Make GitOps mode indicator link to change management settings for global admins (#44334)
## Summary - Updates the "GitOps mode" indicator in the top navigation bar to become a clickable link that navigates to `/settings/integrations/change-management` when the current user is a global admin. - For non-global-admin users, the indicator remains as a non-clickable text badge (unchanged behavior). ## Changes - **`frontend/components/top_nav/SiteTopNav/SiteTopNav.tsx`**: Added `isGlobalAdmin` prop to `GitOpsModeIndicator` component. When true, wraps the indicator content in a `<Link>` to `PATHS.ADMIN_INTEGRATIONS_CHANGE_MANAGEMENT`. Otherwise, renders the content as-is. - **`frontend/components/top_nav/SiteTopNav/_styles.scss`**: Added `.gitops-mode-indicator__link` styles to ensure the link has no default link styling (no underline, inherited color) and shows a pointer cursor. Built for [Rachael Shaw](https://fleetdm.slack.com/archives/D0AFC5BRFHD/p1777410934139609?thread_ts=1777406096.224979&cid=D0AFC5BRFHD) by [Kilo for Slack](https://kilo.ai/features/slack-integration) Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
kiloconnect[bot]
parent
64a50d0c16
commit
7791e5be7f
@@ -8,6 +8,7 @@ import { isDarkMode } from "utilities/theme";
|
||||
|
||||
import { AppContext } from "context/app";
|
||||
|
||||
import PATHS from "router/paths";
|
||||
import { IConfig } from "interfaces/config";
|
||||
import { API_ALL_TEAMS_ID, APP_CONTEXT_ALL_TEAMS_ID } from "interfaces/team";
|
||||
import { IUser } from "interfaces/user";
|
||||
@@ -77,7 +78,11 @@ const isGlobalPage = (path: string) => {
|
||||
return Object.values(REGEX_GLOBAL_PAGES).some((re) => path.match(re));
|
||||
};
|
||||
|
||||
const GitOpsModeIndicator = () => {
|
||||
const GitOpsModeIndicator = ({
|
||||
isGlobalAdmin,
|
||||
}: {
|
||||
isGlobalAdmin?: boolean;
|
||||
}) => {
|
||||
const baseClass = "gitops-mode-indicator";
|
||||
const tipContent = (
|
||||
<>
|
||||
@@ -91,6 +96,12 @@ const GitOpsModeIndicator = () => {
|
||||
/>
|
||||
</>
|
||||
);
|
||||
const content = (
|
||||
<div className={`${baseClass}__content`}>
|
||||
<Icon name="gitops-mode" />
|
||||
GitOps mode
|
||||
</div>
|
||||
);
|
||||
return (
|
||||
<TooltipWrapper
|
||||
position="bottom"
|
||||
@@ -99,10 +110,16 @@ const GitOpsModeIndicator = () => {
|
||||
tipContent={tipContent}
|
||||
tipOffset={2}
|
||||
>
|
||||
<div className={`${baseClass}__content`}>
|
||||
<Icon name="gitops-mode" />
|
||||
GitOps mode
|
||||
</div>
|
||||
{isGlobalAdmin ? (
|
||||
<Link
|
||||
className={`${baseClass}__link`}
|
||||
to={PATHS.ADMIN_INTEGRATIONS_CHANGE_MANAGEMENT}
|
||||
>
|
||||
{content}
|
||||
</Link>
|
||||
) : (
|
||||
content
|
||||
)}
|
||||
</TooltipWrapper>
|
||||
);
|
||||
};
|
||||
@@ -264,7 +281,9 @@ const SiteTopNav = ({
|
||||
})}
|
||||
</ul>
|
||||
<div className="site-nav-right">
|
||||
{config.gitops.gitops_mode_enabled && <GitOpsModeIndicator />}
|
||||
{config.gitops.gitops_mode_enabled && (
|
||||
<GitOpsModeIndicator isGlobalAdmin={isGlobalAdmin} />
|
||||
)}
|
||||
<UserMenu
|
||||
onLogout={onLogoutUser}
|
||||
onUserMenuItemClick={onUserMenuItemClick}
|
||||
|
||||
@@ -22,6 +22,16 @@
|
||||
gap: $pad-large;
|
||||
}
|
||||
|
||||
.gitops-mode-indicator__link {
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
border-bottom: none;
|
||||
|
||||
.gitops-mode-indicator__content {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
.gitops-mode-indicator__content {
|
||||
min-height: 38px;
|
||||
display: flex;
|
||||
|
||||
Reference in New Issue
Block a user