Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/containers/Tenant/Diagnostics/Diagnostics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {TENANT_DIAGNOSTICS_TABS_IDS} from '../../../store/reducers/tenant/constants';
import {setDiagnosticsTab} from '../../../store/reducers/tenant/tenant';
import type {AdditionalNodesProps, AdditionalTenantsProps} from '../../../types/additionalProps';
import {uiFactory} from '../../../uiFactory/uiFactory';
import {cn} from '../../../utils/cn';
import {useTypedDispatch, useTypedSelector} from '../../../utils/hooks';
import {Heatmap} from '../../Heatmap';
Expand Down Expand Up @@ -65,6 +66,7 @@ function Diagnostics(props: DiagnosticsProps) {
hasFeatureFlags,
hasTopicData,
isTopLevel: path === database,
hasBackups: typeof uiFactory.renderBackups === 'function',
});
let activeTab = pages.find((el) => el.id === diagnosticsTab);
if (!activeTab) {
Expand All @@ -77,6 +79,7 @@ function Diagnostics(props: DiagnosticsProps) {
}
}, [activeTab, diagnosticsTab, dispatch]);

// eslint-disable-next-line complexity
const renderTabContent = () => {
switch (activeTab?.id) {
case TENANT_DIAGNOSTICS_TABS_IDS.overview: {
Expand Down Expand Up @@ -161,6 +164,9 @@ function Diagnostics(props: DiagnosticsProps) {
case TENANT_DIAGNOSTICS_TABS_IDS.operations: {
return <Operations database={tenantName} />;
}
case TENANT_DIAGNOSTICS_TABS_IDS.backups: {
return uiFactory.renderBackups?.();
}
default: {
return <div>No data...</div>;
}
Expand Down
15 changes: 14 additions & 1 deletion src/containers/Tenant/Diagnostics/DiagnosticsPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ const access = {
id: TENANT_DIAGNOSTICS_TABS_IDS.access,
title: 'Access',
};
const backups = {
id: TENANT_DIAGNOSTICS_TABS_IDS.backups,
title: 'Backups',
};

const nodes = {
id: TENANT_DIAGNOSTICS_TABS_IDS.nodes,
Expand Down Expand Up @@ -111,6 +115,7 @@ const DATABASE_PAGES = [
configs,
access,
operations,
backups,
];

const TABLE_PAGES = [overview, schema, topShards, nodes, graph, tablets, hotKeys, describe, access];
Expand Down Expand Up @@ -166,7 +171,12 @@ const pathSubTypeToPages: Record<EPathSubType, Page[] | undefined> = {
export const getPagesByType = (
type?: EPathType,
subType?: EPathSubType,
options?: {hasFeatureFlags?: boolean; hasTopicData?: boolean; isTopLevel?: boolean},
options?: {
hasFeatureFlags?: boolean;
hasTopicData?: boolean;
isTopLevel?: boolean;
hasBackups?: boolean;
},
) => {
const subTypePages = subType ? pathSubTypeToPages[subType] : undefined;
const typePages = type ? pathTypeToPages[type] : undefined;
Expand All @@ -181,6 +191,9 @@ export const getPagesByType = (
return pages.filter((item) => item.id !== TENANT_DIAGNOSTICS_TABS_IDS.configs);
}
}
if (!options?.hasBackups) {
return pages.filter((item) => item.id !== TENANT_DIAGNOSTICS_TABS_IDS.backups);
}
return pages;
};

Expand Down
1 change: 1 addition & 0 deletions src/store/reducers/tenant/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const TENANT_DIAGNOSTICS_TABS_IDS = {
configs: 'configs',
operations: 'operations',
access: 'access',
backups: 'backups',
} as const;

export const TENANT_SUMMARY_TABS_IDS = {
Expand Down
4 changes: 4 additions & 0 deletions src/uiFactory/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type React from 'react';

import type {
CommonIssueType,
GetHealthcheckViewTitles,
Expand Down Expand Up @@ -28,6 +30,8 @@ export interface UIFactory<H extends string = CommonIssueType> {
getDatabaseLinks?: GetDatabaseLinks;
getClusterLinks?: GetClusterLinks;

renderBackups?: () => React.ReactNode;

healthcheck: {
getHealthckechViewTitles: GetHealthcheckViewTitles<H>;
getHealthcheckViewsOrder: GetHealthcheckViewsOrder<H>;
Expand Down
Loading