UNPKG

@kinvolk/headlamp-plugin

Version:

The needed infrastructure for building Headlamp plugins.

83 lines (82 loc) 4.35 kB
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } 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 Box from '@mui/material/Box'; import { useTranslation } from 'react-i18next'; import { useParams } from 'react-router-dom'; import EndpointSlice from '../../lib/k8s/endpointSlices'; import { SectionBox, SimpleTable, StatusLabel } from '../common'; import { DetailsGrid } from '../common/Resource'; export default function EndpointSliceDetails(props) { const params = useParams(); const { name = params.name, namespace = params.namespace, cluster } = props; const { t } = useTranslation(['glossary', 'translation']); return (_jsx(DetailsGrid, { resourceType: EndpointSlice, name: name, namespace: namespace, cluster: cluster, withEvents: true, extraInfo: item => item && [ { name: t('translation|Address Type'), value: item.spec.addressType, }, ], extraSections: (item) => item && [ { id: 'headlamp.endpoint-slice-endpoints', section: (_jsx(SectionBox, { title: t('Endpoints'), children: _jsx(SimpleTable, { data: item?.spec.endpoints || [], columns: [ { label: t('translation|Hostname'), datum: 'hostname', sort: true, }, { label: t('translation|Node Name'), datum: 'nodeName', sort: true, }, { label: t('translation|Zone'), datum: 'zone', sort: true, }, { label: t('Addresses'), getter: endpoint => endpoint.addresses?.join(','), }, { label: t('Conditions'), getter: endpoint => (_jsxs(_Fragment, { children: [_jsx(Box, { display: "inline-block", children: _jsx(StatusLabel, { status: endpoint.conditions.ready ? 'success' : 'error', children: t('Ready') }) }), _jsx(Box, { display: "inline-block", children: _jsx(StatusLabel, { status: endpoint.conditions.serving ? 'success' : 'error', children: t('Serving') }) }), _jsx(Box, { display: "inline-block", children: _jsx(StatusLabel, { status: endpoint.conditions.terminating ? 'success' : 'error', children: t('Terminating') }) })] })), }, ], defaultSortingColumn: 1, reflectInURL: "endpoints" }) })), }, { id: 'headlamp.endpoint-slice-ports', section: (_jsx(SectionBox, { title: t('Ports'), children: _jsx(SimpleTable, { data: item?.spec.ports || [], columns: [ { label: t('translation|Name'), datum: 'name', sort: true, }, { label: t('Port'), datum: 'port', sort: true, }, { label: t('Protocol'), datum: 'protocol', sort: true, }, ], defaultSortingColumn: 1, reflectInURL: "ports" }) })), }, ] })); }