mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
## For #28221, frontend portion - In desired places, read new config option and render desired UI accordingly - Code refactors to more elegantly support this functionality - Backend branch [here](https://github.com/fleetdm/fleet/pull/28893) for testing    <img width="1012" alt="Screenshot 2025-05-07 at 12 00 04 PM" src="https://github.com/user-attachments/assets/81519388-7696-4a7e-a55a-0d0874c17aad" /> **Teams dropdowns:**  - [x] Changes file added for user-visible changes in `changes/ - [x] A detailed QA plan exists on the associated ticket (if it isn't there, work with the product group's QA engineer to add it) - [x] Manual QA for all new/changed functionality --------- Co-authored-by: Jacob Shandling <jacob@fleetdm.com>
52 lines
1.4 KiB
TypeScript
52 lines
1.4 KiB
TypeScript
import TooltipWrapper, {
|
|
ITooltipWrapper,
|
|
} from "components/TooltipWrapper/TooltipWrapper";
|
|
import { AppContext } from "context/app";
|
|
import React, { useContext } from "react";
|
|
import { getGitOpsModeTipContent } from "utilities/helpers";
|
|
|
|
interface IGitOpsModeTooltipWrapper {
|
|
renderChildren: (disableChildren?: boolean) => React.ReactNode;
|
|
position?: ITooltipWrapper["position"];
|
|
tipOffset?: ITooltipWrapper["tipOffset"];
|
|
fixedPositionStrategy?: ITooltipWrapper["fixedPositionStrategy"];
|
|
}
|
|
|
|
const baseClass = "gitops-mode-tooltip-wrapper";
|
|
|
|
const GitOpsModeTooltipWrapper = ({
|
|
position = "top",
|
|
tipOffset,
|
|
renderChildren,
|
|
fixedPositionStrategy,
|
|
}: IGitOpsModeTooltipWrapper) => {
|
|
const { config } = useContext(AppContext);
|
|
const gitOpsModeEnabled = config?.gitops.gitops_mode_enabled;
|
|
const repoURL = config?.gitops.repository_url;
|
|
|
|
if (!gitOpsModeEnabled) {
|
|
return <>{renderChildren()}</>;
|
|
}
|
|
|
|
const tipContent = (
|
|
<div className={`${baseClass}__tooltip-content`}>
|
|
{repoURL && getGitOpsModeTipContent(repoURL)}
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<TooltipWrapper
|
|
className={baseClass}
|
|
position={position}
|
|
tipOffset={tipOffset}
|
|
tipContent={tipContent}
|
|
underline={false}
|
|
showArrow
|
|
fixedPositionStrategy={fixedPositionStrategy}
|
|
>
|
|
{renderChildren(true)}
|
|
</TooltipWrapper>
|
|
);
|
|
};
|
|
|
|
export default GitOpsModeTooltipWrapper;
|