fleet/frontend/components/GitOpsModeTooltipWrapper/GitOpsModeTooltipWrapper.tsx
Gabriel Hernandez 9484ac30bc
add UI for certificate authority list (#26955)
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**


![image](https://github.com/user-attachments/assets/4159bd6d-632e-4adc-ae45-d83f824380ae)

**empty CA list state**


![image](https://github.com/user-attachments/assets/8f27cd8b-53b2-4cf3-ac64-8fa6ec0a2ae2)

**gitops mode on add CA card and CA list**


![image](https://github.com/user-attachments/assets/981a353c-f515-44ed-90d5-f55e412053ba)


![image](https://github.com/user-attachments/assets/286dc503-f2cd-4329-aa46-6301df75b826)


- [ ] Added/updated automated tests
- [x] Manual QA for all new/changed functionality
2025-03-11 14:31:02 +00:00

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;