From c65ca709b486b21c0b4abc43bb4a598a9038d099 Mon Sep 17 00:00:00 2001 From: Oliwia Gowor Date: Mon, 16 Sep 2024 11:02:48 +0200 Subject: [PATCH] add api version to cr --- public/i18n/en.yaml | 2 ++ .../CustomResourceDefinitions/CustomResources.details.js | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/public/i18n/en.yaml b/public/i18n/en.yaml index a499b9802e..9a5aa51aff 100644 --- a/public/i18n/en.yaml +++ b/public/i18n/en.yaml @@ -516,6 +516,8 @@ custom-resource-definitions: custom-resources: description: <0>Custom resource extends the Kubernetes API. You can define your own custom resource by creating a <1>CustomResourceDefinition first. title: Custom Resources + headers: + api-version: API Version daemon-sets: description: <0>DaemonSet ensures that replicated Pods are running across a set of available nodes. name_singular: DaemonSet diff --git a/src/resources/CustomResourceDefinitions/CustomResources.details.js b/src/resources/CustomResourceDefinitions/CustomResources.details.js index df88a06606..c79cc35b2c 100644 --- a/src/resources/CustomResourceDefinitions/CustomResources.details.js +++ b/src/resources/CustomResourceDefinitions/CustomResources.details.js @@ -8,8 +8,10 @@ import { ReadonlyEditorPanel } from 'shared/components/ReadonlyEditorPanel'; import { activeNamespaceIdState } from 'state/activeNamespaceIdAtom'; import CRCreate from 'resources/CustomResourceDefinitions/CRCreate'; import { useCallback } from 'react'; +import { useTranslation } from 'react-i18next'; export default function CustomResource({ params }) { + const { t } = useTranslation(); const namespace = useRecoilValue(activeNamespaceIdState); const { customResourceDefinitionName, @@ -52,6 +54,12 @@ export default function CustomResource({ params }) { }${crdName}/${resourceName}` : ''; + const customColumns = [ + { + header: t('custom-resources.headers.api-version'), + value: resource => resource.apiVersion, + }, + ]; const yamlPreview = resource => { return Object.keys(resource || {}) ?.map(key => { @@ -76,6 +84,7 @@ export default function CustomResource({ params }) { resourceType={crdName} resourceName={resourceName} namespace={namespace} + customColumns={customColumns} createResourceForm={CRCreateWrapper} customComponents={[yamlPreview]} layoutCloseCreateUrl={params.layoutCloseCreateUrl}