UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

62 lines (61 loc) 2.75 kB
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime"; /* * Copyright 2025 The Kubernetes Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import HPA from '../../lib/k8s/hpa'; import Link from '../common/Link'; import { ConditionsSection } from '../common/Resource'; import { DetailsGrid } from '../common/Resource'; import SimpleTable from '../common/SimpleTable'; export default function HpaDetails(props) { const params = useParams(); const { name = params.name, namespace = params.namespace, cluster } = props; const { t } = useTranslation(); return (_jsx(DetailsGrid, { resourceType: HPA, name: name, namespace: namespace, cluster: cluster, withEvents: true, extraInfo: item => item && [ { name: t('translation|Reference'), value: (_jsxs(Link, { kubeObject: item.referenceObject, children: [item.referenceObject?.kind, "/", item.referenceObject?.metadata.name] })), }, { name: t('translation|Metrics'), value: (_jsx(SimpleTable, { data: item.metrics(t), columns: [ { label: t('translation|Name'), getter: item => item.definition }, { label: t('translation|(Current/Target)'), getter: item => item.value }, ] })), }, { name: t('translation|MinReplicas'), value: item.spec.minReplicas, }, { name: t('translation|MaxReplicas'), value: item.spec.maxReplicas, }, { name: t('translation|Deployment pods'), value: t(`translation|{{ currentReplicas }} current / {{ desiredReplicas }} desired`, { currentReplicas: item.status.currentReplicas, desiredReplicas: item.status.desiredReplicas, }), }, ], extraSections: item => item && [ { id: 'headlamp.hpa-conditions', section: _jsx(ConditionsSection, { resource: item?.jsonData }), }, ] })); }