UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

78 lines (77 loc) 4.09 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import CRD from '../../lib/k8s/crd'; import { Link, ObjectEventList } from '../common'; import Loader from '../common/Loader'; import { ConditionsTable, MainInfoSection, PageGrid } from '../common/Resource'; import { SectionBox } from '../common/SectionBox'; import SimpleTable from '../common/SimpleTable'; import DetailsViewSection from '../DetailsViewSection'; import { CustomResourceListTable } from './CustomResourceList'; export default function CustomResourceDefinitionDetails(props) { const params = useParams(); const { name = params.name } = props; const [item, error] = CRD.useGet(name); const { t } = useTranslation(['glossary', 'translation']); return !item ? (_jsx(Loader, { title: t('translation|Loading resource definition details') })) : (_jsxs(PageGrid, { children: [_jsx(MainInfoSection, { resource: item, error: error, extraInfo: item && [ { name: t('translation|Group'), value: item.spec.group, }, { name: t('translation|Version'), value: item.spec.version, }, { name: t('Scope'), value: item.spec.scope, }, { name: t('Subresources'), value: item.spec.subresources && Object.keys(item.spec.subresources).join(' & '), hide: !item.spec.subresources, }, { name: t('Resource'), value: (_jsx(Link, { routeName: "customresources", params: { crd: item.metadata.name, }, activeCluster: item.cluster, children: item.spec.names.kind })), }, { name: t('translation|Categories'), value: item.getCategories().join(', '), hide: item.getCategories().length === 0, }, ] }), _jsx(SectionBox, { title: t('translation|Accepted Names'), children: _jsx(SimpleTable, { data: [item.spec.names], columns: [ { label: t('Plural'), datum: 'plural', }, { label: t('Singular'), datum: 'singular', }, { label: t('glossary|Kind'), datum: 'kind', }, { label: t('List Kind'), datum: 'listKind', }, ], reflectInURL: "acceptedNames" }) }), _jsx(SectionBox, { title: t('translation|Versions'), children: _jsx(SimpleTable, { data: item.spec.versions, columns: [ { label: t('translation|Name'), datum: 'name', }, { label: t('Served'), getter: version => version.storage.toString(), }, { label: t('Storage'), getter: version => version.storage.toString(), }, ], reflectInURL: "versions" }) }), _jsx(SectionBox, { title: t('translation|Conditions'), children: _jsx(ConditionsTable, { resource: item.jsonData, showLastUpdate: false }) }), _jsx(CustomResourceListTable, { title: t('Objects'), crd: item }), _jsx(DetailsViewSection, { resource: item }), item && _jsx(ObjectEventList, { object: item })] })); }