2022-10-14 16:45:57 +00:00
|
|
|
import classnames from "classnames";
|
2022-02-28 21:25:06 +00:00
|
|
|
import React from "react";
|
2023-11-07 21:15:49 +00:00
|
|
|
import { Tooltip as ReactTooltip5, PlacesType } from "react-tooltip-5";
|
2022-02-28 21:25:06 +00:00
|
|
|
|
2023-11-07 21:15:49 +00:00
|
|
|
import { uniqueId } from "lodash";
|
2023-06-08 17:13:27 +00:00
|
|
|
|
UI - GitOps Mode: Core abstractions, first batch of applications (#26401)
## 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](feedbb2d4c25ec2e304e1f18d409cee62f6752ed) 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>
2025-02-20 16:41:07 +00:00
|
|
|
export interface ITooltipWrapper {
|
2023-11-07 21:15:49 +00:00
|
|
|
children: React.ReactNode;
|
|
|
|
|
// default is bottom-start
|
|
|
|
|
position?: PlacesType;
|
2025-09-18 16:42:30 +00:00
|
|
|
/** A boolean or number defining how long to delay showing the tooltip content on hover over the
|
|
|
|
|
* element. If a boolean, sets delay to the default below. If a number, sets to that
|
|
|
|
|
* many milliseconds. Defaults to `true`, overridden by `delayShowHide` */
|
|
|
|
|
delayShow?: boolean | number;
|
|
|
|
|
/** A boolean or number defining how long to delay hiding the tooltip content on mouseout from the element. If a boolean, sets delay to the default below. If a number, sets to that
|
|
|
|
|
* many milliseconds. Overridden by `delayShowHide` */
|
|
|
|
|
delayHide?: boolean | number;
|
|
|
|
|
/** A boolean or number defining how long to delay showing and hiding the tooltip content on hover
|
|
|
|
|
and mouseout from the element. If a boolean, sets delay to the default below. If a number, sets to that
|
|
|
|
|
* many milliseconds. Overrides `delayShow` and `delayHide` */
|
|
|
|
|
delayShowHide?: boolean | number;
|
2025-09-29 17:10:41 +00:00
|
|
|
delayInMs?: number;
|
2023-11-07 21:15:49 +00:00
|
|
|
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.
|
2022-10-14 16:45:57 +00:00
|
|
|
className?: string;
|
2023-08-29 10:47:37 +00:00
|
|
|
tooltipClass?: string;
|
2023-11-07 21:15:49 +00:00
|
|
|
// wrapperCustomClass?: string;
|
|
|
|
|
// elementCustomClass?: string;
|
|
|
|
|
// tipCustomClass?: string;
|
|
|
|
|
clickable?: boolean;
|
|
|
|
|
tipContent: React.ReactNode;
|
2024-06-17 17:47:24 +00:00
|
|
|
tipOffset?: number;
|
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
|
|
|
/** 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;
|
2024-06-11 11:56:50 +00:00
|
|
|
/** 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;
|
2024-07-03 16:35:59 +00:00
|
|
|
/** 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;
|
2025-11-11 15:38:09 +00:00
|
|
|
isMobileView?: boolean;
|
2022-02-28 21:25:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const baseClass = "component__tooltip-wrapper";
|
|
|
|
|
|
2025-09-18 16:42:30 +00:00
|
|
|
const DEFAULT_DELAY_MS = 250;
|
|
|
|
|
|
2022-02-28 21:25:06 +00:00
|
|
|
const TooltipWrapper = ({
|
2023-11-07 21:15:49 +00:00
|
|
|
// wrapperCustomClass,
|
|
|
|
|
// elementCustomClass,
|
|
|
|
|
// tipCustomClass,
|
2022-02-28 21:25:06 +00:00
|
|
|
children,
|
|
|
|
|
tipContent,
|
2024-06-17 17:47:24 +00:00
|
|
|
tipOffset = 5,
|
2023-11-07 21:15:49 +00:00
|
|
|
position = "bottom-start",
|
2025-09-18 16:42:30 +00:00
|
|
|
delayShow = true,
|
|
|
|
|
delayHide,
|
|
|
|
|
delayShowHide,
|
2025-09-29 17:10:41 +00:00
|
|
|
delayInMs, // TODO: Apply pattern of delay tooltip for repeated table tooltips
|
2023-11-07 21:15:49 +00:00
|
|
|
underline = true,
|
2022-10-14 16:45:57 +00:00
|
|
|
className,
|
2023-08-29 10:47:37 +00:00
|
|
|
tooltipClass,
|
2023-11-07 21:15:49 +00:00
|
|
|
clickable = true,
|
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
|
|
|
disableTooltip = false,
|
2024-06-11 11:56:50 +00:00
|
|
|
showArrow = false,
|
2024-07-03 16:35:59 +00:00
|
|
|
fixedPositionStrategy = false,
|
2025-11-11 15:38:09 +00:00
|
|
|
isMobileView = false,
|
2023-11-07 21:15:49 +00:00
|
|
|
}: ITooltipWrapper) => {
|
|
|
|
|
const wrapperClassNames = classnames(baseClass, className, {
|
2024-06-11 11:56:50 +00:00
|
|
|
"show-arrow": showArrow,
|
2023-11-07 21:15:49 +00:00
|
|
|
// [`${baseClass}__${wrapperCustomClass}`]: !!wrapperCustomClass,
|
2023-08-29 10:47:37 +00:00
|
|
|
});
|
2022-10-04 14:03:51 +00:00
|
|
|
|
2023-11-07 21:15:49 +00:00
|
|
|
const elementClassNames = classnames(`${baseClass}__element`, {
|
|
|
|
|
// [`${baseClass}__${elementCustomClass}`]: !!elementCustomClass,
|
|
|
|
|
[`${baseClass}__underline`]: underline,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const tipClassNames = classnames(`${baseClass}__tip-text`, tooltipClass, {
|
|
|
|
|
// [`${baseClass}__${tipCustomClass}`]: !!tipCustomClass,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const tipId = uniqueId();
|
2023-06-08 17:13:27 +00:00
|
|
|
|
2025-09-18 16:42:30 +00:00
|
|
|
let delayShowVal;
|
|
|
|
|
if (typeof delayShow === "boolean" && delayShow) {
|
|
|
|
|
delayShowVal = DEFAULT_DELAY_MS;
|
|
|
|
|
} else if (typeof delayShow === "number") {
|
|
|
|
|
delayShowVal = delayShow;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
let delayHideVal;
|
2025-11-13 17:06:14 +00:00
|
|
|
if ((typeof delayHide === "boolean" && delayHide) || clickable) {
|
2025-09-18 16:42:30 +00:00
|
|
|
delayHideVal = DEFAULT_DELAY_MS;
|
|
|
|
|
} else if (typeof delayHide === "number") {
|
|
|
|
|
delayHideVal = delayHide;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (typeof delayShowHide === "boolean" && delayShowHide) {
|
|
|
|
|
[delayShowVal, delayHideVal] = [DEFAULT_DELAY_MS, DEFAULT_DELAY_MS];
|
|
|
|
|
} else if (typeof delayShowHide === "number") {
|
|
|
|
|
[delayShowVal, delayHideVal] = [delayShowHide, delayShowHide];
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-28 21:25:06 +00:00
|
|
|
return (
|
2023-11-07 21:15:49 +00:00
|
|
|
<span className={wrapperClassNames}>
|
2025-11-11 15:38:09 +00:00
|
|
|
<div
|
|
|
|
|
className={elementClassNames}
|
|
|
|
|
data-tip
|
|
|
|
|
data-tooltip-id={tipId}
|
|
|
|
|
style={
|
|
|
|
|
isMobileView && !disableTooltip ? { cursor: "pointer" } : undefined
|
|
|
|
|
} // With mobile width, show pointer cursor on hover since tooltip won't show on hover
|
|
|
|
|
>
|
2022-02-28 21:25:06 +00:00
|
|
|
{children}
|
|
|
|
|
</div>
|
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
|
|
|
{!disableTooltip && (
|
|
|
|
|
<ReactTooltip5
|
|
|
|
|
className={tipClassNames}
|
|
|
|
|
id={tipId}
|
2025-09-29 17:10:41 +00:00
|
|
|
delayShow={delayShowVal || delayInMs}
|
2025-09-18 16:42:30 +00:00
|
|
|
delayHide={delayHideVal}
|
2024-06-11 11:56:50 +00:00
|
|
|
noArrow={!showArrow}
|
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
|
|
|
place={position}
|
|
|
|
|
opacity={1}
|
|
|
|
|
disableStyleInjection
|
|
|
|
|
clickable={clickable}
|
2024-06-17 17:47:24 +00:00
|
|
|
offset={tipOffset}
|
2024-07-03 16:35:59 +00:00
|
|
|
positionStrategy={fixedPositionStrategy ? "fixed" : "absolute"}
|
2025-11-11 15:38:09 +00:00
|
|
|
globalCloseEvents={
|
|
|
|
|
isMobileView ? { clickOutsideAnchor: true } : undefined
|
|
|
|
|
}
|
|
|
|
|
openEvents={isMobileView ? { click: true } : { mouseenter: true }}
|
|
|
|
|
closeEvents={isMobileView ? { click: true } : { mouseleave: true }}
|
Update UI for software self-service features (#19244)
Issues https://github.com/fleetdm/fleet/issues/17587,
https://github.com/fleetdm/fleet/issues/18836,
https://github.com/fleetdm/fleet/issues/18837,
https://github.com/fleetdm/fleet/pull/18339, and
https://github.com/fleetdm/fleet/pull/18340
# TODOS
- Integrate backend
- Unit/integration tests
- Various todos noted in comments
- Cleanup styles and organization of components (de-duplicating and
consolidating where possible)
- Activity feed updates (if any)
# Checklist for submitter
If some of the following don't apply, delete the relevant line.
<!-- Note that API documentation changes are now addressed by the
product design team. -->
- [ ] Changes file added for user-visible changes in `changes/`,
`orbit/changes/` or `ee/fleetd-chrome/changes`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [ ] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [ ] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [ ] Added/updated tests
- [ ] If database migrations are included, checked table schema to
confirm autoupdate
- For database migrations:
- [ ] Checked schema for all modified table for columns that will
auto-update timestamps during migration.
- [ ] Confirmed that updating the timestamps is acceptable, and will not
cause unwanted side effects.
- [ ] Ensured the correct collation is explicitly set for character
columns (`COLLATE utf8mb4_unicode_ci`).
- [ ] Manual QA for all new/changed functionality
- For Orbit and Fleet Desktop changes:
- [ ] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [ ] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
---------
Co-authored-by: Gabriel Hernandez <ghernandez345@gmail.com>
2024-05-31 10:09:53 +00:00
|
|
|
>
|
|
|
|
|
{tipContent}
|
|
|
|
|
</ReactTooltip5>
|
|
|
|
|
)}
|
2023-11-07 21:15:49 +00:00
|
|
|
</span>
|
2022-02-28 21:25:06 +00:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default TooltipWrapper;
|