@backstage/plugin-kubernetes 0.12.4-next.1 → 0.12.4-next.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.12.4-next.2
4
+
5
+ ### Patch Changes
6
+
7
+ - ca3da29: The `/clusters` endpoint is now protected by the `kubernetes.clusters.read` permission.
8
+ The `/services/:serviceId` endpoint is now protected by the `kubernetes.resources.read` permission.
9
+ The `/resources` endpoints are now protected by the `kubernetes.resources.read` permission.
10
+ - Updated dependencies
11
+ - @backstage/core-components@0.16.4-next.1
12
+ - @backstage/plugin-kubernetes-common@0.9.3-next.1
13
+ - @backstage/plugin-catalog-react@1.15.2-next.2
14
+ - @backstage/catalog-model@1.7.3
15
+ - @backstage/core-compat-api@0.3.6-next.2
16
+ - @backstage/core-plugin-api@1.10.4-next.0
17
+ - @backstage/frontend-plugin-api@0.9.5-next.2
18
+ - @backstage/plugin-kubernetes-react@0.5.4-next.2
19
+ - @backstage/plugin-permission-react@0.4.31-next.0
20
+
3
21
  ## 0.12.4-next.1
4
22
 
5
23
  ### Patch Changes
@@ -4,6 +4,7 @@ import Typography from '@material-ui/core/Typography';
4
4
  import { useKubernetesObjects, DetectedErrorsContext, ErrorPanel, ErrorReporting, Cluster } from '@backstage/plugin-kubernetes-react';
5
5
  import { detectErrors } from '@backstage/plugin-kubernetes-common';
6
6
  import { Page, Content, Progress, EmptyState } from '@backstage/core-components';
7
+ import { RequireKubernetesPermissions } from './RequireKubernetesPermissions.esm.js';
7
8
 
8
9
  const KubernetesContent = ({
9
10
  entity,
@@ -16,53 +17,62 @@ const KubernetesContent = ({
16
17
  const clusters = kubernetesObjects?.items.map((item) => item.cluster) ?? [];
17
18
  const clustersWithErrors = kubernetesObjects?.items.filter((r) => r.errors.length > 0) ?? [];
18
19
  const detectedErrors = kubernetesObjects !== void 0 ? detectErrors(kubernetesObjects) : /* @__PURE__ */ new Map();
19
- return /* @__PURE__ */ React.createElement(DetectedErrorsContext.Provider, { value: [...detectedErrors.values()].flat() }, /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, kubernetesObjects === void 0 && error === void 0 && /* @__PURE__ */ React.createElement(Progress, null), clustersWithErrors.length > 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
20
- ErrorPanel,
20
+ return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(RequireKubernetesPermissions, null, /* @__PURE__ */ React.createElement(
21
+ DetectedErrorsContext.Provider,
21
22
  {
22
- entityName: entity.metadata.name,
23
- clustersWithErrors
24
- }
25
- ))), error !== void 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
26
- ErrorPanel,
27
- {
28
- entityName: entity.metadata.name,
29
- errorMessage: error
30
- }
31
- ))), kubernetesObjects && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
32
- ErrorReporting,
33
- {
34
- detectedErrors,
35
- clusters
36
- }
37
- )), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3" }, "Your Clusters")), /* @__PURE__ */ React.createElement(Grid, { item: true, container: true }, kubernetesObjects?.items.length <= 0 && /* @__PURE__ */ React.createElement(
38
- Grid,
39
- {
40
- container: true,
41
- justifyContent: "space-around",
42
- direction: "row",
43
- alignItems: "center",
44
- spacing: 2
23
+ value: [...detectedErrors.values()].flat()
45
24
  },
46
- /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, /* @__PURE__ */ React.createElement(
47
- EmptyState,
25
+ kubernetesObjects === void 0 && error === void 0 && /* @__PURE__ */ React.createElement(Progress, null),
26
+ clustersWithErrors.length > 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
27
+ ErrorPanel,
48
28
  {
49
- missing: "data",
50
- title: "No Kubernetes resources",
51
- description: `No resources on any known clusters for ${entity.metadata.name}`
29
+ entityName: entity.metadata.name,
30
+ clustersWithErrors
52
31
  }
53
- ))
54
- ), kubernetesObjects?.items.length > 0 && kubernetesObjects?.items.map((item, i) => {
55
- const podsWithErrors = new Set(
56
- detectedErrors.get(item.cluster.name)?.filter((de) => de.sourceRef.kind === "Pod").map((de) => de.sourceRef.name)
57
- );
58
- return /* @__PURE__ */ React.createElement(Grid, { item: true, key: i, xs: 12 }, /* @__PURE__ */ React.createElement(
59
- Cluster,
32
+ ))),
33
+ error !== void 0 && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
34
+ ErrorPanel,
60
35
  {
61
- clusterObjects: item,
62
- podsWithErrors
36
+ entityName: entity.metadata.name,
37
+ errorMessage: error
63
38
  }
64
- ));
65
- }))))));
39
+ ))),
40
+ kubernetesObjects && /* @__PURE__ */ React.createElement(Grid, { container: true, spacing: 3, direction: "column" }, /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(
41
+ ErrorReporting,
42
+ {
43
+ detectedErrors,
44
+ clusters
45
+ }
46
+ )), /* @__PURE__ */ React.createElement(Grid, { item: true }, /* @__PURE__ */ React.createElement(Typography, { variant: "h3" }, "Your Clusters")), /* @__PURE__ */ React.createElement(Grid, { item: true, container: true }, kubernetesObjects?.items.length <= 0 && /* @__PURE__ */ React.createElement(
47
+ Grid,
48
+ {
49
+ container: true,
50
+ justifyContent: "space-around",
51
+ direction: "row",
52
+ alignItems: "center",
53
+ spacing: 2
54
+ },
55
+ /* @__PURE__ */ React.createElement(Grid, { item: true, xs: 8 }, /* @__PURE__ */ React.createElement(
56
+ EmptyState,
57
+ {
58
+ missing: "data",
59
+ title: "No Kubernetes resources",
60
+ description: `No resources on any known clusters for ${entity.metadata.name}`
61
+ }
62
+ ))
63
+ ), kubernetesObjects?.items.length > 0 && kubernetesObjects?.items.map((item, i) => {
64
+ const podsWithErrors = new Set(
65
+ detectedErrors.get(item.cluster.name)?.filter((de) => de.sourceRef.kind === "Pod").map((de) => de.sourceRef.name)
66
+ );
67
+ return /* @__PURE__ */ React.createElement(Grid, { item: true, key: i, xs: 12 }, /* @__PURE__ */ React.createElement(
68
+ Cluster,
69
+ {
70
+ clusterObjects: item,
71
+ podsWithErrors
72
+ }
73
+ ));
74
+ })))
75
+ ))));
66
76
  };
67
77
 
68
78
  export { KubernetesContent };
@@ -1 +1 @@
1
- {"version":3,"file":"KubernetesContent.esm.js","sources":["../src/KubernetesContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ErrorPanel,\n ErrorReporting,\n Cluster,\n useKubernetesObjects,\n DetectedErrorsContext,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n DetectedError,\n detectErrors,\n} from '@backstage/plugin-kubernetes-common';\nimport {\n Content,\n EmptyState,\n Page,\n Progress,\n} from '@backstage/core-components';\n\ntype KubernetesContentProps = {\n entity: Entity;\n refreshIntervalMs?: number;\n children?: React.ReactNode;\n};\n\nexport const KubernetesContent = ({\n entity,\n refreshIntervalMs,\n}: KubernetesContentProps) => {\n const { kubernetesObjects, error } = useKubernetesObjects(\n entity,\n refreshIntervalMs,\n );\n\n const clusters = kubernetesObjects?.items.map(item => item.cluster) ?? [];\n\n const clustersWithErrors =\n kubernetesObjects?.items.filter(r => r.errors.length > 0) ?? [];\n\n const detectedErrors =\n kubernetesObjects !== undefined\n ? detectErrors(kubernetesObjects)\n : new Map<string, DetectedError[]>();\n\n return (\n <DetectedErrorsContext.Provider value={[...detectedErrors.values()].flat()}>\n <Page themeId=\"tool\">\n <Content>\n {kubernetesObjects === undefined && error === undefined && (\n <Progress />\n )}\n\n {/* errors retrieved from the kubernetes clusters */}\n {clustersWithErrors.length > 0 && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n clustersWithErrors={clustersWithErrors}\n />\n </Grid>\n </Grid>\n )}\n\n {/* other errors */}\n {error !== undefined && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n errorMessage={error}\n />\n </Grid>\n </Grid>\n )}\n\n {kubernetesObjects && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorReporting\n detectedErrors={detectedErrors}\n clusters={clusters}\n />\n </Grid>\n <Grid item>\n <Typography variant=\"h3\">Your Clusters</Typography>\n </Grid>\n <Grid item container>\n {kubernetesObjects?.items.length <= 0 && (\n <Grid\n container\n justifyContent=\"space-around\"\n direction=\"row\"\n alignItems=\"center\"\n spacing={2}\n >\n <Grid item xs={8}>\n <EmptyState\n missing=\"data\"\n title=\"No Kubernetes resources\"\n description={`No resources on any known clusters for ${entity.metadata.name}`}\n />\n </Grid>\n </Grid>\n )}\n {kubernetesObjects?.items.length > 0 &&\n kubernetesObjects?.items.map((item, i) => {\n const podsWithErrors = new Set<string>(\n detectedErrors\n .get(item.cluster.name)\n ?.filter(de => de.sourceRef.kind === 'Pod')\n .map(de => de.sourceRef.name),\n );\n\n return (\n <Grid item key={i} xs={12}>\n <Cluster\n clusterObjects={item}\n podsWithErrors={podsWithErrors}\n />\n </Grid>\n );\n })}\n </Grid>\n </Grid>\n )}\n </Content>\n </Page>\n </DetectedErrorsContext.Provider>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4CO,MAAM,oBAAoB,CAAC;AAAA,EAChC,MAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAM,MAAA,EAAE,iBAAmB,EAAA,KAAA,EAAU,GAAA,oBAAA;AAAA,IACnC,MAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,QAAA,GAAW,mBAAmB,KAAM,CAAA,GAAA,CAAI,UAAQ,IAAK,CAAA,OAAO,KAAK,EAAC;AAExE,EAAM,MAAA,kBAAA,GACJ,iBAAmB,EAAA,KAAA,CAAM,MAAO,CAAA,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,MAAA,GAAS,CAAC,CAAA,IAAK,EAAC;AAEhE,EAAA,MAAM,iBACJ,iBAAsB,KAAA,KAAA,CAAA,GAClB,aAAa,iBAAiB,CAAA,uBAC1B,GAA6B,EAAA;AAEvC,EAAA,2CACG,qBAAsB,CAAA,QAAA,EAAtB,EAA+B,KAAO,EAAA,CAAC,GAAG,cAAe,CAAA,MAAA,EAAQ,CAAA,CAAE,MAClE,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,OACE,EAAA,IAAA,EAAA,iBAAA,KAAsB,KAAa,CAAA,IAAA,KAAA,KAAU,0BAC3C,KAAA,CAAA,aAAA,CAAA,QAAA,EAAA,IAAS,GAIX,kBAAmB,CAAA,MAAA,GAAS,qBAC1B,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,SAAS,EAAA,IAAA,EAAC,SAAS,CAAG,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AAe,EAAA,cAAA;AAAA,MACf,SAAU,EAAA,KAAA;AAAA,MACV,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA;AAAA,KAAA;AAAA,oBAER,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAC,IAAI,CACb,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,UAAA;AAAA,MAAA;AAAA,QACC,OAAQ,EAAA,MAAA;AAAA,QACR,KAAM,EAAA,yBAAA;AAAA,QACN,WAAa,EAAA,CAAA,uCAAA,EAA0C,MAAO,CAAA,QAAA,CAAS,IAAI,CAAA;AAAA;AAAA,KAE/E;AAAA,GACF,EAED,iBAAmB,EAAA,KAAA,CAAM,MAAS,GAAA,CAAA,IACjC,mBAAmB,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,CAAM,KAAA;AACxC,IAAA,MAAM,iBAAiB,IAAI,GAAA;AAAA,MACzB,eACG,GAAI,CAAA,IAAA,CAAK,OAAQ,CAAA,IAAI,GACpB,MAAO,CAAA,CAAA,EAAA,KAAM,EAAG,CAAA,SAAA,CAAU,SAAS,KAAK,CAAA,CACzC,IAAI,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,IAAI;AAAA,KAChC;AAEA,IAAA,2CACG,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,GAAK,EAAA,CAAA,EAAG,IAAI,EACrB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,cAAgB,EAAA,IAAA;AAAA,QAChB;AAAA;AAAA,KAEJ,CAAA;AAAA,GAEH,CACL,CACF,CAEJ,CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"KubernetesContent.esm.js","sources":["../src/KubernetesContent.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n ErrorPanel,\n ErrorReporting,\n Cluster,\n useKubernetesObjects,\n DetectedErrorsContext,\n} from '@backstage/plugin-kubernetes-react';\nimport {\n DetectedError,\n detectErrors,\n} from '@backstage/plugin-kubernetes-common';\nimport {\n Content,\n EmptyState,\n Page,\n Progress,\n} from '@backstage/core-components';\nimport { RequireKubernetesPermissions } from './RequireKubernetesPermissions';\n\ntype KubernetesContentProps = {\n entity: Entity;\n refreshIntervalMs?: number;\n children?: React.ReactNode;\n};\n\nexport const KubernetesContent = ({\n entity,\n refreshIntervalMs,\n}: KubernetesContentProps) => {\n const { kubernetesObjects, error } = useKubernetesObjects(\n entity,\n refreshIntervalMs,\n );\n\n const clusters = kubernetesObjects?.items.map(item => item.cluster) ?? [];\n\n const clustersWithErrors =\n kubernetesObjects?.items.filter(r => r.errors.length > 0) ?? [];\n\n const detectedErrors =\n kubernetesObjects !== undefined\n ? detectErrors(kubernetesObjects)\n : new Map<string, DetectedError[]>();\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <RequireKubernetesPermissions>\n <DetectedErrorsContext.Provider\n value={[...detectedErrors.values()].flat()}\n >\n {kubernetesObjects === undefined && error === undefined && (\n <Progress />\n )}\n\n {/* errors retrieved from the kubernetes clusters */}\n {clustersWithErrors.length > 0 && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n clustersWithErrors={clustersWithErrors}\n />\n </Grid>\n </Grid>\n )}\n\n {/* other errors */}\n {error !== undefined && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorPanel\n entityName={entity.metadata.name}\n errorMessage={error}\n />\n </Grid>\n </Grid>\n )}\n\n {kubernetesObjects && (\n <Grid container spacing={3} direction=\"column\">\n <Grid item>\n <ErrorReporting\n detectedErrors={detectedErrors}\n clusters={clusters}\n />\n </Grid>\n <Grid item>\n <Typography variant=\"h3\">Your Clusters</Typography>\n </Grid>\n <Grid item container>\n {kubernetesObjects?.items.length <= 0 && (\n <Grid\n container\n justifyContent=\"space-around\"\n direction=\"row\"\n alignItems=\"center\"\n spacing={2}\n >\n <Grid item xs={8}>\n <EmptyState\n missing=\"data\"\n title=\"No Kubernetes resources\"\n description={`No resources on any known clusters for ${entity.metadata.name}`}\n />\n </Grid>\n </Grid>\n )}\n {kubernetesObjects?.items.length > 0 &&\n kubernetesObjects?.items.map((item, i) => {\n const podsWithErrors = new Set<string>(\n detectedErrors\n .get(item.cluster.name)\n ?.filter(de => de.sourceRef.kind === 'Pod')\n .map(de => de.sourceRef.name),\n );\n\n return (\n <Grid item key={i} xs={12}>\n <Cluster\n clusterObjects={item}\n podsWithErrors={podsWithErrors}\n />\n </Grid>\n );\n })}\n </Grid>\n </Grid>\n )}\n </DetectedErrorsContext.Provider>\n </RequireKubernetesPermissions>\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;AA6CO,MAAM,oBAAoB,CAAC;AAAA,EAChC,MAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAM,MAAA,EAAE,iBAAmB,EAAA,KAAA,EAAU,GAAA,oBAAA;AAAA,IACnC,MAAA;AAAA,IACA;AAAA,GACF;AAEA,EAAM,MAAA,QAAA,GAAW,mBAAmB,KAAM,CAAA,GAAA,CAAI,UAAQ,IAAK,CAAA,OAAO,KAAK,EAAC;AAExE,EAAM,MAAA,kBAAA,GACJ,iBAAmB,EAAA,KAAA,CAAM,MAAO,CAAA,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,MAAA,GAAS,CAAC,CAA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CAAM,KAAA;AACxC,MAAA,MAAM,iBAAiB,IAAI,GAAA;AAAA,QACzB,eACG,GAAI,CAAA,IAAA,CAAK,OAAQ,CAAA,IAAI,GACpB,MAAO,CAAA,CAAA,EAAA,KAAM,EAAG,CAAA,SAAA,CAAU,SAAS,KAAK,CAAA,CACzC,IAAI,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,IAAI;AAAA,OAChC;AAEA,MAAA,2CACG,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,GAAK,EAAA,CAAA,EAAG,IAAI,EACrB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,OAAA;AAAA,QAAA;AAAA,UACC,cAAgB,EAAA,IAAA;AAAA,UAChB;AAAA;AAAA,OAEJ,CAAA;AAAA,KAEH,CACL,CACF;AAAA,GAGN,CACF,CACF,CAAA;AAEJ;;;;"}
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { kubernetesClustersReadPermission, kubernetesResourcesReadPermission } from '@backstage/plugin-kubernetes-common';
3
+ import { usePermission } from '@backstage/plugin-permission-react';
4
+ import { WarningPanel } from '@backstage/core-components';
5
+ import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
6
+ import { kubernetesTranslationRef } from './alpha/translation.esm.js';
7
+
8
+ function RequireKubernetesPermissions(props) {
9
+ const kubernetesClustersPermissionResult = usePermission({
10
+ permission: kubernetesClustersReadPermission
11
+ });
12
+ const kubernetesResourcesPermissionResult = usePermission({
13
+ permission: kubernetesResourcesReadPermission
14
+ });
15
+ const { t } = useTranslationRef(kubernetesTranslationRef);
16
+ if (kubernetesClustersPermissionResult.loading || kubernetesResourcesPermissionResult.loading) {
17
+ return null;
18
+ }
19
+ if (kubernetesClustersPermissionResult.allowed && kubernetesResourcesPermissionResult.allowed) {
20
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, props.children);
21
+ }
22
+ return /* @__PURE__ */ React.createElement(
23
+ WarningPanel,
24
+ {
25
+ title: t("kubernetesContentPage.permissionAlert.title"),
26
+ message: t("kubernetesContentPage.permissionAlert.message")
27
+ }
28
+ );
29
+ }
30
+
31
+ export { RequireKubernetesPermissions };
32
+ //# sourceMappingURL=RequireKubernetesPermissions.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RequireKubernetesPermissions.esm.js","sources":["../src/RequireKubernetesPermissions.tsx"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { ReactNode } from 'react';\nimport {\n kubernetesClustersReadPermission,\n kubernetesResourcesReadPermission,\n} from '@backstage/plugin-kubernetes-common';\nimport { usePermission } from '@backstage/plugin-permission-react';\nimport { WarningPanel } from '@backstage/core-components';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesTranslationRef } from './alpha/translation';\n\nexport type RequireKubernetesPermissionProps = {\n children: ReactNode;\n};\n\nexport function RequireKubernetesPermissions(\n props: RequireKubernetesPermissionProps,\n): JSX.Element | null {\n const kubernetesClustersPermissionResult = usePermission({\n permission: kubernetesClustersReadPermission,\n });\n const kubernetesResourcesPermissionResult = usePermission({\n permission: kubernetesResourcesReadPermission,\n });\n const { t } = useTranslationRef(kubernetesTranslationRef);\n\n if (\n kubernetesClustersPermissionResult.loading ||\n kubernetesResourcesPermissionResult.loading\n ) {\n return null;\n }\n\n if (\n kubernetesClustersPermissionResult.allowed &&\n kubernetesResourcesPermissionResult.allowed\n ) {\n return <>{props.children}</>;\n }\n\n return (\n <WarningPanel\n title={t('kubernetesContentPage.permissionAlert.title')}\n message={t('kubernetesContentPage.permissionAlert.message')}\n />\n );\n}\n"],"names":[],"mappings":";;;;;;;AA6BO,SAAS,6BACd,KACoB,EAAA;AACpB,EAAA,MAAM,qCAAqC,aAAc,CAAA;AAAA,IACvD,UAAY,EAAA;AAAA,GACb,CAAA;AACD,EAAA,MAAM,sCAAsC,aAAc,CAAA;AAAA,IACxD,UAAY,EAAA;AAAA,GACb,CAAA;AACD,EAAA,MAAM,EAAE,CAAA,EAAM,GAAA,iBAAA,CAAkB,wBAAwB,CAAA;AAExD,EACE,IAAA,kCAAA,CAAmC,OACnC,IAAA,mCAAA,CAAoC,OACpC,EAAA;AACA,IAAO,OAAA,IAAA;AAAA;AAGT,EACE,IAAA,kCAAA,CAAmC,OACnC,IAAA,mCAAA,CAAoC,OACpC,EAAA;AACA,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,EAAG,MAAM,QAAS,CAAA;AAAA;AAG3B,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,6CAA6C,CAAA;AAAA,MACtD,OAAA,EAAS,EAAE,+CAA+C;AAAA;AAAA,GAC5D;AAEJ;;;;"}
@@ -0,0 +1,16 @@
1
+ import { createTranslationRef } from '@backstage/core-plugin-api/alpha';
2
+
3
+ const kubernetesTranslationRef = createTranslationRef({
4
+ id: "kubernetes",
5
+ messages: {
6
+ kubernetesContentPage: {
7
+ permissionAlert: {
8
+ title: "Permission required",
9
+ message: "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission."
10
+ }
11
+ }
12
+ }
13
+ });
14
+
15
+ export { kubernetesTranslationRef };
16
+ //# sourceMappingURL=translation.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"translation.esm.js","sources":["../../src/alpha/translation.ts"],"sourcesContent":["/*\n * Copyright 2025 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createTranslationRef } from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport const kubernetesTranslationRef = createTranslationRef({\n id: 'kubernetes',\n messages: {\n kubernetesContentPage: {\n permissionAlert: {\n title: 'Permission required',\n message:\n \"To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission.\",\n },\n },\n },\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,2BAA2B,oBAAqB,CAAA;AAAA,EAC3D,EAAI,EAAA,YAAA;AAAA,EACJ,QAAU,EAAA;AAAA,IACR,qBAAuB,EAAA;AAAA,MACrB,eAAiB,EAAA;AAAA,QACf,KAAO,EAAA,qBAAA;AAAA,QACP,OACE,EAAA;AAAA;AACJ;AACF;AAEJ,CAAC;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,8 +1,15 @@
1
1
  /// <reference types="react" />
2
+ import * as _backstage_core_plugin_api_alpha from '@backstage/core-plugin-api/alpha';
2
3
  import * as _backstage_catalog_model from '@backstage/catalog-model';
3
4
  import * as react from 'react';
4
5
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
5
6
 
7
+ /** @alpha */
8
+ declare const kubernetesTranslationRef: _backstage_core_plugin_api_alpha.TranslationRef<"kubernetes", {
9
+ readonly "kubernetesContentPage.permissionAlert.message": "To view Kubernetes objects, contact your portal administrator to give you the 'kubernetes.clusters.read' and 'kubernetes.resources.read' permission.";
10
+ readonly "kubernetesContentPage.permissionAlert.title": "Permission required";
11
+ }>;
12
+
6
13
  declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
7
14
  kubernetes: _backstage_frontend_plugin_api.RouteRef<undefined>;
8
15
  }, {}, {
@@ -100,4 +107,4 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
100
107
  }>;
101
108
  }>;
102
109
 
103
- export { _default as default };
110
+ export { _default as default, kubernetesTranslationRef };
package/dist/alpha.esm.js CHANGED
@@ -1,2 +1,3 @@
1
+ export { kubernetesTranslationRef } from './alpha/translation.esm.js';
1
2
  export { default } from './alpha/plugin.esm.js';
2
3
  //# sourceMappingURL=alpha.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
1
+ {"version":3,"file":"alpha.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-kubernetes",
3
- "version": "0.12.4-next.1",
3
+ "version": "0.12.4-next.2",
4
4
  "description": "A Backstage plugin that integrates towards Kubernetes",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -11,7 +11,10 @@
11
11
  "@backstage/plugin-kubernetes-common",
12
12
  "@backstage/plugin-kubernetes-node",
13
13
  "@backstage/plugin-kubernetes-react"
14
- ]
14
+ ],
15
+ "features": {
16
+ "./alpha": "@backstage/FrontendPlugin"
17
+ }
15
18
  },
16
19
  "publishConfig": {
17
20
  "access": "public"
@@ -68,13 +71,14 @@
68
71
  },
69
72
  "dependencies": {
70
73
  "@backstage/catalog-model": "1.7.3",
71
- "@backstage/core-compat-api": "0.3.6-next.1",
72
- "@backstage/core-components": "0.16.4-next.0",
74
+ "@backstage/core-compat-api": "0.3.6-next.2",
75
+ "@backstage/core-components": "0.16.4-next.1",
73
76
  "@backstage/core-plugin-api": "1.10.4-next.0",
74
- "@backstage/frontend-plugin-api": "0.9.5-next.1",
75
- "@backstage/plugin-catalog-react": "1.15.2-next.1",
76
- "@backstage/plugin-kubernetes-common": "0.9.3-next.0",
77
- "@backstage/plugin-kubernetes-react": "0.5.4-next.1",
77
+ "@backstage/frontend-plugin-api": "0.9.5-next.2",
78
+ "@backstage/plugin-catalog-react": "1.15.2-next.2",
79
+ "@backstage/plugin-kubernetes-common": "0.9.3-next.1",
80
+ "@backstage/plugin-kubernetes-react": "0.5.4-next.2",
81
+ "@backstage/plugin-permission-react": "0.4.31-next.0",
78
82
  "@kubernetes-models/apimachinery": "^2.0.0",
79
83
  "@kubernetes-models/base": "^5.0.0",
80
84
  "@kubernetes/client-node": "1.0.0-rc7",
@@ -89,8 +93,8 @@
89
93
  "xterm-addon-fit": "^0.8.0"
90
94
  },
91
95
  "devDependencies": {
92
- "@backstage/cli": "0.30.0-next.1",
93
- "@backstage/dev-utils": "1.1.7-next.1",
96
+ "@backstage/cli": "0.30.0-next.2",
97
+ "@backstage/dev-utils": "1.1.7-next.2",
94
98
  "@backstage/test-utils": "1.7.5-next.0",
95
99
  "@testing-library/dom": "^10.0.0",
96
100
  "@testing-library/jest-dom": "^6.0.0",