-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathObjectGeneral.tsx
57 lines (48 loc) · 1.81 KB
/
ObjectGeneral.tsx
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import {useThemeValue} from '@gravity-ui/uikit';
import {TENANT_PAGES_IDS} from '../../../store/reducers/tenant/constants';
import type {AdditionalNodesProps, AdditionalTenantsProps} from '../../../types/additionalProps';
import type {EPathType} from '../../../types/api/schema';
import {cn} from '../../../utils/cn';
import {useTypedSelector} from '../../../utils/hooks';
import Diagnostics from '../Diagnostics/Diagnostics';
import {Query} from '../Query/Query';
import {TenantNavigation} from '../TenantNavigation/TenantNavigation';
import './ObjectGeneral.scss';
const b = cn('object-general');
interface ObjectGeneralProps {
type?: EPathType;
tenantName: string;
path: string;
additionalTenantProps?: AdditionalTenantsProps;
additionalNodesProps?: AdditionalNodesProps;
}
function ObjectGeneral(props: ObjectGeneralProps) {
const theme = useThemeValue();
const {tenantPage} = useTypedSelector((state) => state.tenant);
const renderPageContent = () => {
const {type, additionalTenantProps, additionalNodesProps, tenantName, path} = props;
switch (tenantPage) {
case TENANT_PAGES_IDS.query: {
return <Query tenantName={tenantName} path={path} theme={theme} type={type} />;
}
default: {
return (
<Diagnostics
type={type}
tenantName={tenantName}
path={path}
additionalTenantProps={additionalTenantProps}
additionalNodesProps={additionalNodesProps}
/>
);
}
}
};
return (
<div className={b()}>
<TenantNavigation />
{renderPageContent()}
</div>
);
}
export default ObjectGeneral;