From b877e46ca8dce119dfb89bad3ca1eddbe12df790 Mon Sep 17 00:00:00 2001 From: Andre Wanlin Date: Fri, 28 Mar 2025 19:09:37 +0000 Subject: [PATCH] kubernetes - Added New Frontend System filter for tab Signed-off-by: Andre Wanlin --- .changeset/dry-cars-build.md | 5 +++++ plugins/kubernetes/package.json | 1 + plugins/kubernetes/src/alpha/entityContents.tsx | 9 ++++++++- yarn.lock | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 .changeset/dry-cars-build.md diff --git a/.changeset/dry-cars-build.md b/.changeset/dry-cars-build.md new file mode 100644 index 0000000000..60fd3ece49 --- /dev/null +++ b/.changeset/dry-cars-build.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-kubernetes': patch +--- + +Added New Frontend System filter for the Kubernetes tab to use `isKubernetesAvailable` to control its visibility diff --git a/plugins/kubernetes/package.json b/plugins/kubernetes/package.json index 8d621e0d88..76774fa589 100644 --- a/plugins/kubernetes/package.json +++ b/plugins/kubernetes/package.json @@ -63,6 +63,7 @@ "@backstage/core-components": "workspace:^", "@backstage/core-plugin-api": "workspace:^", "@backstage/frontend-plugin-api": "workspace:^", + "@backstage/plugin-catalog": "workspace:^", "@backstage/plugin-catalog-react": "workspace:^", "@backstage/plugin-kubernetes-common": "workspace:^", "@backstage/plugin-kubernetes-react": "workspace:^", diff --git a/plugins/kubernetes/src/alpha/entityContents.tsx b/plugins/kubernetes/src/alpha/entityContents.tsx index 7b6dc78e4b..6720865d3e 100644 --- a/plugins/kubernetes/src/alpha/entityContents.tsx +++ b/plugins/kubernetes/src/alpha/entityContents.tsx @@ -17,6 +17,8 @@ import React from 'react'; import { compatWrapper } from '@backstage/core-compat-api'; import { EntityContentBlueprint } from '@backstage/plugin-catalog-react/alpha'; +import { isKubernetesAvailable } from '../Router'; +import { isKind } from '@backstage/plugin-catalog'; export const entityKubernetesContent = EntityContentBlueprint.make({ name: 'kubernetes', @@ -24,7 +26,12 @@ export const entityKubernetesContent = EntityContentBlueprint.make({ defaultPath: '/kubernetes', defaultTitle: 'Kubernetes', defaultGroup: 'deployment', - filter: 'kind:component,resource', + filter: entity => { + if (!isKind('Component')) return false; + if (!isKind('Resource')) return false; + if (!isKubernetesAvailable(entity)) return false; + return true; + }, loader: () => import('./KubernetesContentPage').then(m => compatWrapper(), diff --git a/yarn.lock b/yarn.lock index 648c69d5cc..2ab79a31ab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6718,6 +6718,7 @@ __metadata: "@backstage/core-plugin-api": "workspace:^" "@backstage/dev-utils": "workspace:^" "@backstage/frontend-plugin-api": "workspace:^" + "@backstage/plugin-catalog": "workspace:^" "@backstage/plugin-catalog-react": "workspace:^" "@backstage/plugin-kubernetes-common": "workspace:^" "@backstage/plugin-kubernetes-react": "workspace:^"