Skip to content

Commit 76275c4

Browse files
authored
feat(Diagnostics): hide AccessRights is not configured (#2691)
1 parent 91c3844 commit 76275c4

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

src/containers/Tenant/Diagnostics/Diagnostics.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ function Diagnostics(props: DiagnosticsProps) {
7070
isTopLevel: path === database,
7171
hasBackups: typeof uiFactory.renderBackups === 'function' && Boolean(controlPlane),
7272
hasConfigs: isViewerUser,
73+
hasAccess: uiFactory.hasAccess,
7374
});
7475
let activeTab = pages.find((el) => el.id === diagnosticsTab);
7576
if (!activeTab) {

src/containers/Tenant/Diagnostics/DiagnosticsPages.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export const getPagesByType = (
177177
isTopLevel?: boolean;
178178
hasBackups?: boolean;
179179
hasConfigs?: boolean;
180+
hasAccess?: boolean;
180181
},
181182
) => {
182183
const subTypePages = subType ? pathSubTypeToPages[subType] : undefined;
@@ -198,6 +199,9 @@ export const getPagesByType = (
198199
if (!options?.hasConfigs) {
199200
pages = pages.filter((item) => item.id !== TENANT_DIAGNOSTICS_TABS_IDS.configs);
200201
}
202+
if (!options?.hasAccess) {
203+
pages = pages.filter((item) => item.id !== TENANT_DIAGNOSTICS_TABS_IDS.access);
204+
}
201205
return pages;
202206
};
203207

src/uiFactory/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export interface UIFactory<H extends string = CommonIssueType> {
4242
getHealthcheckViewsOrder: GetHealthcheckViewsOrder<H>;
4343
countHealthcheckIssuesByType: (issueTrees: IssuesTree[]) => Record<H, number>;
4444
};
45+
hasAccess?: boolean;
4546
}
4647

4748
export type HandleCreateDB = (params: {clusterName: string}) => Promise<boolean>;

src/uiFactory/uiFactory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const uiFactoryBase: UIFactory = {
1818
getHealthcheckViewsOrder,
1919
countHealthcheckIssuesByType,
2020
},
21+
hasAccess: true,
2122
};
2223

2324
export function configureUIFactory<H extends string>(overrides: Partial<UIFactory<H>>) {

0 commit comments

Comments
 (0)