mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 21:47:20 +00:00
For #26605 This is the UI for the certificate authority list that shows the added CAs. This includes: **new CA section and list on integration page**  **empty CA list state**  **gitops mode on add CA card and CA list**   - [ ] Added/updated automated tests - [x] Manual QA for all new/changed functionality
60 lines
1.6 KiB
TypeScript
60 lines
1.6 KiB
TypeScript
import CustomLink from "components/CustomLink";
|
|
import TooltipWrapper, {
|
|
ITooltipWrapper,
|
|
} from "components/TooltipWrapper/TooltipWrapper";
|
|
import { AppContext } from "context/app";
|
|
import React, { useContext } from "react";
|
|
|
|
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 = (
|
|
// at this point repoURL will always be defined
|
|
<div className={`${baseClass}__tooltip-content`}>
|
|
{repoURL && (
|
|
<span>
|
|
Manage in{" "}
|
|
<CustomLink newTab text="YAML" variant="tooltip-link" url={repoURL} />
|
|
<br />
|
|
</span>
|
|
)}
|
|
<span>(GitOps mode enabled)</span>
|
|
</div>
|
|
);
|
|
|
|
return (
|
|
<TooltipWrapper
|
|
className={baseClass}
|
|
position={position}
|
|
tipOffset={tipOffset}
|
|
tipContent={tipContent}
|
|
underline={false}
|
|
showArrow
|
|
fixedPositionStrategy={fixedPositionStrategy}
|
|
>
|
|
{renderChildren(true)}
|
|
</TooltipWrapper>
|
|
);
|
|
};
|
|
|
|
export default GitOpsModeTooltipWrapper;
|