-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathExtendedTenant.tsx
More file actions
39 lines (34 loc) · 1.21 KB
/
ExtendedTenant.tsx
File metadata and controls
39 lines (34 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import {useClusterBaseInfo} from '../../../store/reducers/cluster/cluster';
import type {ETenantType} from '../../../types/api/tenant';
import {useAdditionalNodesProps} from '../../../utils/hooks/useAdditionalNodesProps';
import type {GetMonitoringLink} from '../../../utils/monitoring';
import type {Tenant} from '../../Tenant/Tenant';
export interface ExtendedTenantProps {
component: typeof Tenant;
getMonitoringLink?: GetMonitoringLink;
}
export function ExtendedTenant({
component: TenantComponent,
getMonitoringLink,
}: ExtendedTenantProps) {
const {monitoring} = useClusterBaseInfo();
const additionalNodesProps = useAdditionalNodesProps();
const additionalTenantProps = {
getMonitoringLink: (dbName?: string, dbType?: ETenantType) => {
if (monitoring && dbName && dbType && getMonitoringLink) {
return getMonitoringLink({
monitoring,
dbName,
dbType,
});
}
return null;
},
};
return (
<TenantComponent
additionalTenantProps={additionalTenantProps}
additionalNodesProps={additionalNodesProps}
/>
);
}