UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

36 lines (35 loc) 2.08 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime"; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import PDB from '../../lib/k8s/podDisruptionBudget'; import { DetailsGrid, StatusLabel } from '../common'; export default function PDBDetails(props) { const params = useParams(); const { name = params.name, namespace = params.namespace, cluster } = props; function selectorsToJSX(selectors) { const values = []; selectors.forEach((selector) => { values.push(_jsx(StatusLabel, { status: "", children: selector }, selector)); }); return values; } const { t } = useTranslation(['translation', 'glossary']); return (_jsx(DetailsGrid, { resourceType: PDB, name: name, namespace: namespace, cluster: cluster, withEvents: true, extraInfo: item => item && [ { name: t('translation|Max Unavailable'), value: _jsx(_Fragment, { children: item.spec.maxUnavailable }), }, { name: t('translation|Min Available'), value: _jsx(_Fragment, { children: item.spec.minAvailable }), }, { name: t('glossary|Selector'), value: _jsx(_Fragment, { children: selectorsToJSX(item.selectors) }), }, { name: t('translation|Status'), value: (_jsxs(_Fragment, { children: [_jsxs(StatusLabel, { status: "", children: [t('translation|Allowed disruptions'), ":", item.status.disruptionsAllowed] }), _jsx("br", {}), _jsxs(StatusLabel, { status: "", children: [t('translation|Current', { context: 'pods' }), ":", item.status.currentHealthy] }), _jsx("br", {}), _jsxs(StatusLabel, { status: "", children: [t('translation|Desired', { context: 'pods' }), ":", item.status.desiredHealthy] }), _jsx("br", {}), _jsxs(StatusLabel, { status: "", children: [t('translation|Total'), ":", item.status.expectedPods] }), _jsx("br", {})] })), }, ] })); }