mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
## For #26229 – Part 1

- This PR contains the core abstractions, routes, API updates, and types
for GitOps mode in the UI. Since this work will touch essentially every
part of the Fleet UI, it is ripe for merge conflicts. To mitigate such
conflicts, I'll be merging this work in a number of iterative PRs. ~To
effectively gate any of this work from showing until it is all merged to
`main`, [this commit](feedbb2d4c) hides
the settings section that allows enabling/disabling this setting,
effectively feature flagging the entire thing. In the last of these
iterative PRs, that commit will be reverted to engage the entire
feature. For testing purposes, reviewers can `git revert
feedbb2d4c25ec2e304e1f18d409cee62f6752ed` locally~ The new settings
section for this feature is feature flagged until all PRs are merged -
to show the setting section while testing, run `ALLOW_GITOPS_MODE=true
NODE_ENV=development yarn run webpack --progress --watch` in place of
`make generate-dev`
- Changes file will be added and feature flag removed in the last PR
- [x] Settings page with routing, form, API integration (hidden until
last PR)
- [x] Activities
- [x] Navbar indicator
- Apply GOM conditional UI to:
- [x] Manage enroll secret modal: .5
- Controls >
- [x] Scripts:
- Setup experience >
- [x] Install software > Select software modal
- [x] OS Settings >
- [x] Custom settings
- [x] Disk encryption
- [x] OS Updates
2/18/25, added to this PR:
- [x] Controls > Setup experience > Run script
- [x] Software >
- [x] Manage automations modal
- [x] Add software >
- [x] App Store (VPP)
- [x] Custom package
- [x] Queries
- [x] Manage
- [x] Automations modal
- [x] New
- [x] Edit
- [x] Policies
- [x] Manage
- [x] New
- [x] Edit
- Manage automations
- [x] Calendar events
- [x] Manual QA for all new/changed functionality
---------
Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
103 lines
3.2 KiB
TypeScript
103 lines
3.2 KiB
TypeScript
import classnames from "classnames";
|
|
import React from "react";
|
|
import { Tooltip as ReactTooltip5, PlacesType } from "react-tooltip-5";
|
|
|
|
import { uniqueId } from "lodash";
|
|
|
|
export interface ITooltipWrapper {
|
|
children: React.ReactNode;
|
|
// default is bottom-start
|
|
position?: PlacesType;
|
|
isDelayed?: boolean;
|
|
underline?: boolean;
|
|
// Below two props used here to maintain the API of the old TooltipWrapper
|
|
// A clearer system would be to use the 3 below commented props, which describe exactly where they
|
|
// will apply, `element` being the element this tooltip will wrap. Associated logic is commented
|
|
// out, but ready to be used.
|
|
className?: string;
|
|
tooltipClass?: string;
|
|
// wrapperCustomClass?: string;
|
|
// elementCustomClass?: string;
|
|
// tipCustomClass?: string;
|
|
clickable?: boolean;
|
|
tipContent: React.ReactNode;
|
|
tipOffset?: number;
|
|
/** If set to `true`, will not show the tooltip. This can be used to dynamically
|
|
* disable the tooltip from the parent component.
|
|
* @default false
|
|
*/
|
|
disableTooltip?: boolean;
|
|
/** If set to `true`, will show the arrow on the tooltip.
|
|
* This can be used to dynamically hide the arrow from the parent component.
|
|
* @default false
|
|
*/
|
|
showArrow?: boolean;
|
|
/** Corresponds to the react tooltip 5 `positionStrategy` option - see https://react-tooltip.com/docs/options.
|
|
* Setting as `true` will set the tooltip's `positionStrategy` to `"fixed"`. The default strategy is "absolute".
|
|
* Do this if you run into issues with `overflow: hidden` on the tooltip parent container
|
|
* */
|
|
fixedPositionStrategy?: boolean;
|
|
}
|
|
|
|
const baseClass = "component__tooltip-wrapper";
|
|
|
|
const TooltipWrapper = ({
|
|
// wrapperCustomClass,
|
|
// elementCustomClass,
|
|
// tipCustomClass,
|
|
children,
|
|
tipContent,
|
|
tipOffset = 5,
|
|
position = "bottom-start",
|
|
isDelayed,
|
|
underline = true,
|
|
className,
|
|
tooltipClass,
|
|
clickable = true,
|
|
disableTooltip = false,
|
|
showArrow = false,
|
|
fixedPositionStrategy = false,
|
|
}: ITooltipWrapper) => {
|
|
const wrapperClassNames = classnames(baseClass, className, {
|
|
"show-arrow": showArrow,
|
|
// [`${baseClass}__${wrapperCustomClass}`]: !!wrapperCustomClass,
|
|
});
|
|
|
|
const elementClassNames = classnames(`${baseClass}__element`, {
|
|
// [`${baseClass}__${elementCustomClass}`]: !!elementCustomClass,
|
|
[`${baseClass}__underline`]: underline,
|
|
});
|
|
|
|
const tipClassNames = classnames(`${baseClass}__tip-text`, tooltipClass, {
|
|
// [`${baseClass}__${tipCustomClass}`]: !!tipCustomClass,
|
|
});
|
|
|
|
const tipId = uniqueId();
|
|
|
|
return (
|
|
<span className={wrapperClassNames}>
|
|
<div className={elementClassNames} data-tooltip-id={tipId}>
|
|
{children}
|
|
</div>
|
|
{!disableTooltip && (
|
|
<ReactTooltip5
|
|
className={tipClassNames}
|
|
id={tipId}
|
|
delayShow={isDelayed ? 500 : undefined}
|
|
delayHide={isDelayed ? 500 : undefined}
|
|
noArrow={!showArrow}
|
|
place={position}
|
|
opacity={1}
|
|
disableStyleInjection
|
|
clickable={clickable}
|
|
offset={tipOffset}
|
|
positionStrategy={fixedPositionStrategy ? "fixed" : "absolute"}
|
|
>
|
|
{tipContent}
|
|
</ReactTooltip5>
|
|
)}
|
|
</span>
|
|
);
|
|
};
|
|
|
|
export default TooltipWrapper;
|