@backstage/plugin-kubernetes-react 0.5.24-next.1 → 0.6.0
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 +30 -0
- package/dist/api/formatters/GkeClusterLinksFormatter.esm.js +1 -1
- package/dist/api/formatters/GkeClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/HeadlampClusterLinksFormatter.esm.js +1 -1
- package/dist/api/formatters/HeadlampClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/OpenshiftClusterLinksFormatter.esm.js +1 -1
- package/dist/api/formatters/OpenshiftClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/RancherClusterLinksFormatter.esm.js +1 -1
- package/dist/api/formatters/RancherClusterLinksFormatter.esm.js.map +1 -1
- package/dist/api/formatters/StandardClusterLinksFormatter.esm.js +1 -1
- package/dist/api/formatters/StandardClusterLinksFormatter.esm.js.map +1 -1
- package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js +1 -1
- package/dist/components/CustomResources/DefaultCustomResourceDrawer.esm.js.map +1 -1
- package/dist/components/Pods/FixDialog/FixDialog.esm.js +2 -7
- package/dist/components/Pods/FixDialog/FixDialog.esm.js.map +1 -1
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js +3 -3
- package/dist/components/Pods/PodDrawer/ContainerCard.esm.js.map +1 -1
- package/dist/components/Pods/PodLogs/PodLogs.esm.js +2 -5
- package/dist/components/Pods/PodLogs/PodLogs.esm.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/utils/owner.esm.js +1 -1
- package/dist/utils/owner.esm.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes-react
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- cfba1bc: **BREAKING PRODUCERS:** The `FixDialog`, `ContainerCard`, and `PodLogs` components no longer accept an implicit `children` prop. This aligns them with ADR006. If you were passing children to these components, remove them as they were never rendered.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 736d84e: Use locale-insensitive Unicode casing for consistent string handling across environments.
|
|
12
|
+
- c0ebaa7: chore(deps): bump `js-yaml` from 4.3.1 to 4.3.2
|
|
13
|
+
- 83f34f2: The pod exec terminal now loads `@xterm/xterm` and its stylesheet when a terminal is opened, instead of including them in the initial bundle.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
- @backstage/core-components@0.18.14
|
|
16
|
+
- @backstage/catalog-model@1.10.1
|
|
17
|
+
- @backstage/plugin-kubernetes-common@0.9.13
|
|
18
|
+
- @backstage/core-plugin-api@1.12.10
|
|
19
|
+
|
|
20
|
+
## 0.6.0-next.2
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- cfba1bc: **BREAKING PRODUCERS:** The `FixDialog`, `ContainerCard`, and `PodLogs` components no longer accept an implicit `children` prop. This aligns them with ADR006. If you were passing children to these components, remove them as they were never rendered.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies
|
|
29
|
+
- @backstage/core-components@0.18.14-next.2
|
|
30
|
+
- @backstage/core-plugin-api@1.12.10-next.1
|
|
31
|
+
- @backstage/plugin-kubernetes-common@0.9.13-next.1
|
|
32
|
+
|
|
3
33
|
## 0.5.24-next.1
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -37,7 +37,7 @@ class GkeClusterLinksFormatter {
|
|
|
37
37
|
const namespace = encodeURIComponent(
|
|
38
38
|
options.object.metadata?.namespace ?? ""
|
|
39
39
|
);
|
|
40
|
-
const validKind = kindMappings[options.kind.
|
|
40
|
+
const validKind = kindMappings[options.kind.toLowerCase()];
|
|
41
41
|
let path;
|
|
42
42
|
if (namespace && name && validKind) {
|
|
43
43
|
const kindsWithDetails = ["ingress", "pod"];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GkeClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/GkeClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\nimport { ProfileInfoApi } from '@backstage/core-plugin-api';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployment',\n pod: 'pod',\n ingress: 'ingress',\n service: 'service',\n horizontalpodautoscaler: 'deployment',\n};\n\n/** @public */\nexport class GkeClusterLinksFormatter implements ClusterLinksFormatter {\n private readonly googleAuthApi: ProfileInfoApi | undefined;\n\n constructor(googleAuthApi: ProfileInfoApi | undefined) {\n this.googleAuthApi = googleAuthApi;\n }\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardParameters) {\n throw new Error('GKE dashboard requires a dashboardParameters option');\n }\n const args = options.dashboardParameters;\n if (typeof args.projectId !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"projectId\" of type string in the dashboardParameters option',\n );\n }\n if (typeof args.region !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"region\" of type string in the dashboardParameters option',\n );\n }\n if (typeof args.clusterName !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"clusterName\" of type string in the dashboardParameters option',\n );\n }\n const basePath = new URL('https://console.cloud.google.com/');\n const region = encodeURIComponent(args.region);\n const clusterName = encodeURIComponent(args.clusterName);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.
|
|
1
|
+
{"version":3,"file":"GkeClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/GkeClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\nimport { ProfileInfoApi } from '@backstage/core-plugin-api';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployment',\n pod: 'pod',\n ingress: 'ingress',\n service: 'service',\n horizontalpodautoscaler: 'deployment',\n};\n\n/** @public */\nexport class GkeClusterLinksFormatter implements ClusterLinksFormatter {\n private readonly googleAuthApi: ProfileInfoApi | undefined;\n\n constructor(googleAuthApi: ProfileInfoApi | undefined) {\n this.googleAuthApi = googleAuthApi;\n }\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardParameters) {\n throw new Error('GKE dashboard requires a dashboardParameters option');\n }\n const args = options.dashboardParameters;\n if (typeof args.projectId !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"projectId\" of type string in the dashboardParameters option',\n );\n }\n if (typeof args.region !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"region\" of type string in the dashboardParameters option',\n );\n }\n if (typeof args.clusterName !== 'string') {\n throw new Error(\n 'GKE dashboard requires a \"clusterName\" of type string in the dashboardParameters option',\n );\n }\n const basePath = new URL('https://console.cloud.google.com/');\n const region = encodeURIComponent(args.region);\n const clusterName = encodeURIComponent(args.clusterName);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.toLowerCase()];\n let path: string;\n if (namespace && name && validKind) {\n const kindsWithDetails = ['ingress', 'pod'];\n const landingPage = kindsWithDetails.includes(validKind)\n ? 'details'\n : 'overview';\n path = `kubernetes/${validKind}/${region}/${clusterName}/${namespace}/${name}/${landingPage}`;\n } else {\n path = `kubernetes/clusters/details/${region}/${clusterName}/details`;\n }\n const result = new URL(path, basePath);\n result.searchParams.set('project', args.projectId);\n if (this.googleAuthApi) {\n const profile = await this.googleAuthApi.getProfile({ optional: true });\n if (profile?.email) {\n result.searchParams.set('authuser', profile.email);\n }\n }\n return result;\n }\n}\n"],"names":[],"mappings":"AAqBA,MAAM,YAAA,GAAuC;AAAA,EAC3C,UAAA,EAAY,YAAA;AAAA,EACZ,GAAA,EAAK,KAAA;AAAA,EACL,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,uBAAA,EAAyB;AAC3B,CAAA;AAGO,MAAM,wBAAA,CAA0D;AAAA,EACpD,aAAA;AAAA,EAEjB,YAAY,aAAA,EAA2C;AACrD,IAAA,IAAA,CAAK,aAAA,GAAgB,aAAA;AAAA,EACvB;AAAA,EACA,MAAM,kBAAkB,OAAA,EAAqD;AAC3E,IAAA,IAAI,CAAC,QAAQ,mBAAA,EAAqB;AAChC,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,IACvE;AACA,IAAA,MAAM,OAAO,OAAA,CAAQ,mBAAA;AACrB,IAAA,IAAI,OAAO,IAAA,CAAK,SAAA,KAAc,QAAA,EAAU;AACtC,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA,IACF;AACA,IAAA,IAAI,OAAO,IAAA,CAAK,MAAA,KAAW,QAAA,EAAU;AACnC,MAAA,MAAM,IAAI,KAAA;AAAA,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,CAAA;AACrC,IAAA,MAAA,CAAO,YAAA,CAAa,GAAA,CAAI,SAAA,EAAW,IAAA,CAAK,SAAS,CAAA;AACjD,IAAA,IAAI,KAAK,aAAA,EAAe;AACtB,MAAA,MAAM,OAAA,GAAU,MAAM,IAAA,CAAK,aAAA,CAAc,WAAW,EAAE,QAAA,EAAU,MAAM,CAAA;AACtE,MAAA,IAAI,SAAS,KAAA,EAAO;AAClB,QAAA,MAAA,CAAO,YAAA,CAAa,GAAA,CAAI,UAAA,EAAY,OAAA,CAAQ,KAAK,CAAA;AAAA,MACnD;AAAA,IACF;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -47,7 +47,7 @@ class HeadlampClusterLinksFormatter {
|
|
|
47
47
|
"persistentvolumeclaim"
|
|
48
48
|
]);
|
|
49
49
|
getHeadlampPath(kind, object, clusterName) {
|
|
50
|
-
const lowercaseKind = kind.
|
|
50
|
+
const lowercaseKind = kind.toLowerCase();
|
|
51
51
|
const { name } = object.metadata ?? {};
|
|
52
52
|
let { namespace } = object.metadata ?? {};
|
|
53
53
|
if (!name) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadlampClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/HeadlampClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\n/** @public */\nexport class HeadlampClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n const { dashboardUrl, dashboardParameters, object, kind } = options;\n\n if (!dashboardUrl && !dashboardParameters?.internal) {\n throw new Error(\n 'Dashboard URL is required or dashboardInternal must be true',\n );\n }\n\n const clusterName =\n (dashboardParameters?.clusterName as string) ?? 'default';\n const path = this.getHeadlampPath(kind, object, clusterName);\n if (!path) {\n throw new Error(`Could not find path for kind: ${kind}`);\n }\n\n let baseUrl: URL;\n\n if (dashboardParameters?.internal) {\n baseUrl = new URL(window.location.origin);\n baseUrl.pathname =\n (dashboardParameters.headlampRoute as string) || '/headlamp';\n } else {\n if (!dashboardUrl?.href) {\n throw new Error(\n 'Dashboard URL is required when not using internal dashboard',\n );\n }\n baseUrl = new URL(dashboardUrl.href);\n }\n\n baseUrl.searchParams.set('to', path);\n return baseUrl;\n }\n\n private readonly NAMESPACED_RESOURCES = new Set([\n 'pod',\n 'deployment',\n 'replicaset',\n 'statefulset',\n 'daemonset',\n 'job',\n 'cronjob',\n 'service',\n 'ingress',\n 'configmap',\n 'secret',\n 'serviceaccount',\n 'role',\n 'rolebinding',\n 'networkpolicy',\n 'horizontalpodautoscaler',\n 'poddisruptionbudget',\n 'persistentvolumeclaim',\n ]);\n\n private getHeadlampPath(\n kind: string,\n object: {\n metadata?: {\n name?: string;\n namespace?: string;\n };\n },\n clusterName: string,\n ): string {\n const lowercaseKind = kind.
|
|
1
|
+
{"version":3,"file":"HeadlampClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/HeadlampClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\n/** @public */\nexport class HeadlampClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n const { dashboardUrl, dashboardParameters, object, kind } = options;\n\n if (!dashboardUrl && !dashboardParameters?.internal) {\n throw new Error(\n 'Dashboard URL is required or dashboardInternal must be true',\n );\n }\n\n const clusterName =\n (dashboardParameters?.clusterName as string) ?? 'default';\n const path = this.getHeadlampPath(kind, object, clusterName);\n if (!path) {\n throw new Error(`Could not find path for kind: ${kind}`);\n }\n\n let baseUrl: URL;\n\n if (dashboardParameters?.internal) {\n baseUrl = new URL(window.location.origin);\n baseUrl.pathname =\n (dashboardParameters.headlampRoute as string) || '/headlamp';\n } else {\n if (!dashboardUrl?.href) {\n throw new Error(\n 'Dashboard URL is required when not using internal dashboard',\n );\n }\n baseUrl = new URL(dashboardUrl.href);\n }\n\n baseUrl.searchParams.set('to', path);\n return baseUrl;\n }\n\n private readonly NAMESPACED_RESOURCES = new Set([\n 'pod',\n 'deployment',\n 'replicaset',\n 'statefulset',\n 'daemonset',\n 'job',\n 'cronjob',\n 'service',\n 'ingress',\n 'configmap',\n 'secret',\n 'serviceaccount',\n 'role',\n 'rolebinding',\n 'networkpolicy',\n 'horizontalpodautoscaler',\n 'poddisruptionbudget',\n 'persistentvolumeclaim',\n ]);\n\n private getHeadlampPath(\n kind: string,\n object: {\n metadata?: {\n name?: string;\n namespace?: string;\n };\n },\n clusterName: string,\n ): string {\n const lowercaseKind = kind.toLowerCase();\n const { name } = object.metadata ?? {};\n let { namespace } = object.metadata ?? {};\n\n if (!name) {\n throw new Error(`Resource name is required for kind: ${kind}`);\n }\n\n // Add namespace validation\n if (this.NAMESPACED_RESOURCES.has(lowercaseKind) && !namespace) {\n throw new Error(`Namespace is required for namespaced resource: ${kind}`);\n }\n if (!namespace) {\n namespace = 'default';\n }\n\n const pathMap: Record<string, string> = {\n namespace: `/c/${clusterName}/namespaces/${name}`,\n node: `/c/${clusterName}/nodes/${name}`,\n persistentvolume: `/c/${clusterName}/storage/persistentvolumes/${name}`,\n persistentvolumeclaim: `/c/${clusterName}/storage/persistentvolumeclaims/${namespace}/${name}`,\n pod: `/c/${clusterName}/pods/${namespace}/${name}`,\n deployment: `/c/${clusterName}/deployments/${namespace}/${name}`,\n replicaset: `/c/${clusterName}/replicasets/${namespace}/${name}`,\n statefulset: `/c/${clusterName}/statefulsets/${namespace}/${name}`,\n daemonset: `/c/${clusterName}/daemonsets/${namespace}/${name}`,\n job: `/c/${clusterName}/jobs/${namespace}/${name}`,\n cronjob: `/c/${clusterName}/cronjobs/${namespace}/${name}`,\n service: `/c/${clusterName}/services/${namespace}/${name}`,\n ingress: `/c/${clusterName}/ingresses/${namespace}/${name}`,\n configmap: `/c/${clusterName}/configmaps/${namespace}/${name}`,\n secret: `/c/${clusterName}/secrets/${namespace}/${name}`,\n serviceaccount: `/c/${clusterName}/serviceaccounts/${namespace}/${name}`,\n role: `/c/${clusterName}/roles/${namespace}/${name}`,\n rolebinding: `/c/${clusterName}/rolebindings/${namespace}/${name}`,\n clusterrole: `/c/${clusterName}/clusterroles/${name}`,\n clusterrolebinding: `/c/${clusterName}/clusterrolebindings/${name}`,\n storageclass: `/c/${clusterName}/storage/storageclasses/${name}`,\n networkpolicy: `/c/${clusterName}/networkpolicies/${namespace}/${name}`,\n horizontalpodautoscaler: `/c/${clusterName}/horizontalpodautoscalers/${namespace}/${name}`,\n poddisruptionbudget: `/c/${clusterName}/poddisruptionbudgets/${namespace}/${name}`,\n customresourcedefinition: `/c/${clusterName}/customresourcedefinitions/${name}`,\n };\n\n return pathMap[lowercaseKind] ?? '';\n }\n}\n"],"names":[],"mappings":"AAsBO,MAAM,6BAAA,CAA+D;AAAA,EAC1E,MAAM,kBAAkB,OAAA,EAAqD;AAC3E,IAAA,MAAM,EAAE,YAAA,EAAc,mBAAA,EAAqB,MAAA,EAAQ,MAA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oB,CAAA,GAAA,EAAM,WAAW,CAAA,qBAAA,EAAwB,IAAI,CAAA,CAAA;AAAA,MACjE,YAAA,EAAc,CAAA,GAAA,EAAM,WAAW,CAAA,wBAAA,EAA2B,IAAI,CAAA,CAAA;AAAA,MAC9D,eAAe,CAAA,GAAA,EAAM,WAAW,CAAA,iBAAA,EAAoB,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MACrE,yBAAyB,CAAA,GAAA,EAAM,WAAW,CAAA,0BAAA,EAA6B,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MACxF,qBAAqB,CAAA,GAAA,EAAM,WAAW,CAAA,sBAAA,EAAyB,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MAChF,wBAAA,EAA0B,CAAA,GAAA,EAAM,WAAW,CAAA,2BAAA,EAA8B,IAAI,CAAA;AAAA,KAC/E;AAEA,IAAA,OAAO,OAAA,CAAQ,aAAa,CAAA,IAAK,EAAA;AAAA,EACnC;AACF;;;;"}
|
|
@@ -15,7 +15,7 @@ class OpenshiftClusterLinksFormatter {
|
|
|
15
15
|
const namespace = encodeURIComponent(
|
|
16
16
|
options.object.metadata?.namespace ?? ""
|
|
17
17
|
);
|
|
18
|
-
const validKind = kindMappings[options.kind.
|
|
18
|
+
const validKind = kindMappings[options.kind.toLowerCase()];
|
|
19
19
|
if (!basePath.pathname.endsWith("/")) {
|
|
20
20
|
basePath.pathname += "/";
|
|
21
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenshiftClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/OpenshiftClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { ClusterLinksFormatterOptions } from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployments',\n ingress: 'ingresses',\n service: 'services',\n horizontalpodautoscaler: 'horizontalpodautoscalers',\n persistentvolume: 'persistentvolumes',\n};\n\n/** @public */\nexport class OpenshiftClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('OpenShift dashboard requires a dashboardUrl option');\n }\n const basePath = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.
|
|
1
|
+
{"version":3,"file":"OpenshiftClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/OpenshiftClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 { ClusterLinksFormatterOptions } from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployments',\n ingress: 'ingresses',\n service: 'services',\n horizontalpodautoscaler: 'horizontalpodautoscalers',\n persistentvolume: 'persistentvolumes',\n};\n\n/** @public */\nexport class OpenshiftClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('OpenShift dashboard requires a dashboardUrl option');\n }\n const basePath = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.toLowerCase()];\n if (!basePath.pathname.endsWith('/')) {\n // a dashboard url with a path should end with a slash otherwise\n // the new combined URL will replace the last segment with the appended path!\n // https://foobar.com/abc/def + k8s/cluster/projects/test --> https://foobar.com/abc/k8s/cluster/projects/test\n // https://foobar.com/abc/def/ + k8s/cluster/projects/test --> https://foobar.com/abc/def/k8s/cluster/projects/test\n basePath.pathname += '/';\n }\n let path = '';\n if (namespace) {\n if (name && validKind) {\n path = `k8s/ns/${namespace}/${validKind}/${name}`;\n } else {\n path = `k8s/cluster/projects/${namespace}`;\n }\n } else if (validKind) {\n path = `k8s/cluster/${validKind}`;\n if (name) {\n path += `/${name}`;\n }\n }\n return new URL(path, basePath);\n }\n}\n"],"names":[],"mappings":"AAiBA,MAAM,YAAA,GAAuC;AAAA,EAC3C,UAAA,EAAY,aAAA;AAAA,EACZ,OAAA,EAAS,WAAA;AAAA,EACT,OAAA,EAAS,UAAA;AAAA,EACT,uBAAA,EAAyB,0BAAA;AAAA,EACzB,gBAAA,EAAkB;AACpB,CAAA;AAGO,MAAM,8BAAA,CAA+B;AAAA,EAC1C,MAAM,kBAAkB,OAAA,EAAqD;AAC3E,IAAA,IAAI,CAAC,QAAQ,YAAA,EAAc;AACzB,MAAA,MAAM,IAAI,MAAM,oDAAoD,CAAA;AAAA,IACtE;AACA,IAAA,MAAM,QAAA,GAAW,IAAI,GAAA,CAAI,OAAA,CAAQ,aAAa,IAAI,CAAA;AAClD,IAAA,MAAM,OAAO,kBAAA,CAAmB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,EAAE,CAAA;AACnE,IAAA,MAAM,SAAA,GAAY,kBAAA;AAAA,MAChB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,SAAA,IAAa;AAAA,KACxC;AACA,IAAA,MAAM,SAAA,GAAY,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,aAAa,CAAA;AACzD,IAAA,IAAI,CAAC,QAAA,CAAS,QAAA,CAAS,QAAA,CAAS,GAAG,CAAA,EAAG;AAKpC,MAAA,QAAA,CAAS,QAAA,IAAY,GAAA;AAAA,IACvB;AACA,IAAA,IAAI,IAAA,GAAO,EAAA;AACX,IAAA,IAAI,SAAA,EAAW;AACb,MAAA,IAAI,QAAQ,SAAA,EAAW;AACrB,QAAA,IAAA,GAAO,CAAA,OAAA,EAAU,SAAS,CAAA,CAAA,EAAI,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MACjD,CAAA,MAAO;AACL,QAAA,IAAA,GAAO,wBAAwB,SAAS,CAAA,CAAA;AAAA,MAC1C;AAAA,IACF,WAAW,SAAA,EAAW;AACpB,MAAA,IAAA,GAAO,eAAe,SAAS,CAAA,CAAA;AAC/B,MAAA,IAAI,IAAA,EAAM;AACR,QAAA,IAAA,IAAQ,IAAI,IAAI,CAAA,CAAA;AAAA,MAClB;AAAA,IACF;AACA,IAAA,OAAO,IAAI,GAAA,CAAI,IAAA,EAAM,QAAQ,CAAA;AAAA,EAC/B;AACF;;;;"}
|
|
@@ -14,7 +14,7 @@ class RancherClusterLinksFormatter {
|
|
|
14
14
|
const namespace = encodeURIComponent(
|
|
15
15
|
options.object.metadata?.namespace ?? ""
|
|
16
16
|
);
|
|
17
|
-
const validKind = kindMappings[options.kind.
|
|
17
|
+
const validKind = kindMappings[options.kind.toLowerCase()];
|
|
18
18
|
if (!basePath.pathname.endsWith("/")) {
|
|
19
19
|
basePath.pathname += "/";
|
|
20
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RancherClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/RancherClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'apps.deployment',\n ingress: 'networking.k8s.io.ingress',\n service: 'service',\n horizontalpodautoscaler: 'autoscaling.horizontalpodautoscaler',\n};\n\n/** @public */\nexport class RancherClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('Rancher dashboard requires a dashboardUrl option');\n }\n const basePath = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.
|
|
1
|
+
{"version":3,"file":"RancherClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/RancherClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'apps.deployment',\n ingress: 'networking.k8s.io.ingress',\n service: 'service',\n horizontalpodautoscaler: 'autoscaling.horizontalpodautoscaler',\n};\n\n/** @public */\nexport class RancherClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('Rancher dashboard requires a dashboardUrl option');\n }\n const basePath = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.toLowerCase()];\n if (!basePath.pathname.endsWith('/')) {\n // a dashboard url with a path should end with a slash otherwise\n // the new combined URL will replace the last segment with the appended path!\n // https://foobar.com/abc/def + explorer/service/test --> https://foobar.com/abc/explorer/service/test\n // https://foobar.com/abc/def/ + explorer/service/test --> https://foobar.com/abc/def/explorer/service/test\n basePath.pathname += '/';\n }\n let path = '';\n if (validKind && name && namespace) {\n path = `explorer/${validKind}/${namespace}/${name}`;\n } else if (namespace) {\n path = 'explorer/workload';\n }\n return new URL(path, basePath);\n }\n}\n"],"names":[],"mappings":"AAoBA,MAAM,YAAA,GAAuC;AAAA,EAC3C,UAAA,EAAY,iBAAA;AAAA,EACZ,OAAA,EAAS,2BAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,uBAAA,EAAyB;AAC3B,CAAA;AAGO,MAAM,4BAAA,CAA8D;AAAA,EACzE,MAAM,kBAAkB,OAAA,EAAqD;AAC3E,IAAA,IAAI,CAAC,QAAQ,YAAA,EAAc;AACzB,MAAA,MAAM,IAAI,MAAM,kDAAkD,CAAA;AAAA,IACpE;AACA,IAAA,MAAM,QAAA,GAAW,IAAI,GAAA,CAAI,OAAA,CAAQ,aAAa,IAAI,CAAA;AAClD,IAAA,MAAM,OAAO,kBAAA,CAAmB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,EAAE,CAAA;AACnE,IAAA,MAAM,SAAA,GAAY,kBAAA;AAAA,MAChB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,SAAA,IAAa;AAAA,KACxC;AACA,IAAA,MAAM,SAAA,GAAY,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,aAAa,CAAA;AACzD,IAAA,IAAI,CAAC,QAAA,CAAS,QAAA,CAAS,QAAA,CAAS,GAAG,CAAA,EAAG;AAKpC,MAAA,QAAA,CAAS,QAAA,IAAY,GAAA;AAAA,IACvB;AACA,IAAA,IAAI,IAAA,GAAO,EAAA;AACX,IAAA,IAAI,SAAA,IAAa,QAAQ,SAAA,EAAW;AAClC,MAAA,IAAA,GAAO,CAAA,SAAA,EAAY,SAAS,CAAA,CAAA,EAAI,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,IACnD,WAAW,SAAA,EAAW;AACpB,MAAA,IAAA,GAAO,mBAAA;AAAA,IACT;AACA,IAAA,OAAO,IAAI,GAAA,CAAI,IAAA,EAAM,QAAQ,CAAA;AAAA,EAC/B;AACF;;;;"}
|
|
@@ -16,7 +16,7 @@ class StandardClusterLinksFormatter {
|
|
|
16
16
|
const namespace = encodeURIComponent(
|
|
17
17
|
options.object.metadata?.namespace ?? ""
|
|
18
18
|
);
|
|
19
|
-
const validKind = kindMappings[options.kind.
|
|
19
|
+
const validKind = kindMappings[options.kind.toLowerCase()];
|
|
20
20
|
if (!result.pathname.endsWith("/")) {
|
|
21
21
|
result.pathname += "/";
|
|
22
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/StandardClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployment',\n pod: 'pod',\n ingress: 'ingress',\n service: 'service',\n horizontalpodautoscaler: 'deployment',\n statefulset: 'statefulset',\n};\n\n/** @public */\nexport class StandardClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('standard dashboard requires a dashboardUrl option');\n }\n const result = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.
|
|
1
|
+
{"version":3,"file":"StandardClusterLinksFormatter.esm.js","sources":["../../../src/api/formatters/StandardClusterLinksFormatter.ts"],"sourcesContent":["/*\n * Copyright 2020 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 {\n ClusterLinksFormatter,\n ClusterLinksFormatterOptions,\n} from '../../types';\n\nconst kindMappings: Record<string, string> = {\n deployment: 'deployment',\n pod: 'pod',\n ingress: 'ingress',\n service: 'service',\n horizontalpodautoscaler: 'deployment',\n statefulset: 'statefulset',\n};\n\n/** @public */\nexport class StandardClusterLinksFormatter implements ClusterLinksFormatter {\n async formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL> {\n if (!options.dashboardUrl) {\n throw new Error('standard dashboard requires a dashboardUrl option');\n }\n const result = new URL(options.dashboardUrl.href);\n const name = encodeURIComponent(options.object.metadata?.name ?? '');\n const namespace = encodeURIComponent(\n options.object.metadata?.namespace ?? '',\n );\n const validKind = kindMappings[options.kind.toLowerCase()];\n if (!result.pathname.endsWith('/')) {\n result.pathname += '/';\n }\n if (validKind && name && namespace) {\n result.hash = `/${validKind}/${namespace}/${name}`;\n } else if (namespace) {\n result.hash = '/workloads';\n }\n if (namespace) {\n // Note that Angular SPA requires a hash and the query parameter should be part of it\n result.hash += `?namespace=${namespace}`;\n }\n return result;\n }\n}\n"],"names":[],"mappings":"AAoBA,MAAM,YAAA,GAAuC;AAAA,EAC3C,UAAA,EAAY,YAAA;AAAA,EACZ,GAAA,EAAK,KAAA;AAAA,EACL,OAAA,EAAS,SAAA;AAAA,EACT,OAAA,EAAS,SAAA;AAAA,EACT,uBAAA,EAAyB,YAAA;AAAA,EACzB,WAAA,EAAa;AACf,CAAA;AAGO,MAAM,6BAAA,CAA+D;AAAA,EAC1E,MAAM,kBAAkB,OAAA,EAAqD;AAC3E,IAAA,IAAI,CAAC,QAAQ,YAAA,EAAc;AACzB,MAAA,MAAM,IAAI,MAAM,mDAAmD,CAAA;AAAA,IACrE;AACA,IAAA,MAAM,MAAA,GAAS,IAAI,GAAA,CAAI,OAAA,CAAQ,aAAa,IAAI,CAAA;AAChD,IAAA,MAAM,OAAO,kBAAA,CAAmB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,QAAQ,EAAE,CAAA;AACnE,IAAA,MAAM,SAAA,GAAY,kBAAA;AAAA,MAChB,OAAA,CAAQ,MAAA,CAAO,QAAA,EAAU,SAAA,IAAa;AAAA,KACxC;AACA,IAAA,MAAM,SAAA,GAAY,YAAA,CAAa,OAAA,CAAQ,IAAA,CAAK,aAAa,CAAA;AACzD,IAAA,IAAI,CAAC,MAAA,CAAO,QAAA,CAAS,QAAA,CAAS,GAAG,CAAA,EAAG;AAClC,MAAA,MAAA,CAAO,QAAA,IAAY,GAAA;AAAA,IACrB;AACA,IAAA,IAAI,SAAA,IAAa,QAAQ,SAAA,EAAW;AAClC,MAAA,MAAA,CAAO,OAAO,CAAA,CAAA,EAAI,SAAS,CAAA,CAAA,EAAI,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,IAClD,WAAW,SAAA,EAAW;AACpB,MAAA,MAAA,CAAO,IAAA,GAAO,YAAA;AAAA,IAChB;AACA,IAAA,IAAI,SAAA,EAAW;AAEb,MAAA,MAAA,CAAO,IAAA,IAAQ,cAAc,SAAS,CAAA,CAAA;AAAA,IACxC;AACA,IAAA,OAAO,MAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -11,7 +11,7 @@ import '../../translation.esm.js';
|
|
|
11
11
|
import Typography from '@material-ui/core/Typography';
|
|
12
12
|
import Grid from '@material-ui/core/Grid';
|
|
13
13
|
|
|
14
|
-
const capitalize = (str) => str.charAt(0).
|
|
14
|
+
const capitalize = (str) => str.charAt(0).toUpperCase() + str.slice(1);
|
|
15
15
|
const DefaultCustomResourceDrawer = ({
|
|
16
16
|
customResource,
|
|
17
17
|
customResourceName,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultCustomResourceDrawer.esm.js","sources":["../../../src/components/CustomResources/DefaultCustomResourceDrawer.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 { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\n\nconst capitalize = (str: string)
|
|
1
|
+
{"version":3,"file":"DefaultCustomResourceDrawer.esm.js","sources":["../../../src/components/CustomResources/DefaultCustomResourceDrawer.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 { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\n\nconst capitalize = (str: string) => str.charAt(0).toUpperCase() + str.slice(1);\n\nexport const DefaultCustomResourceDrawer = ({\n customResource,\n customResourceName,\n expanded,\n}: {\n customResource: any;\n customResourceName: string;\n expanded?: boolean;\n}) => {\n const capitalizedName = capitalize(customResourceName);\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={customResource}\n expanded={expanded}\n kind={capitalizedName}\n renderObject={cr => cr}\n >\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"body1\">\n {customResource.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n {capitalizedName}\n </Typography>\n </Grid>\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAoBA,MAAM,UAAA,GAAa,CAAC,GAAA,KAAgB,GAAA,CAAI,MAAA,CAAO,CAAC,CAAA,CAAE,WAAA,EAAY,GAAI,GAAA,CAAI,KAAA,CAAM,CAAC,CAAA;AAEtE,MAAM,8BAA8B,CAAC;AAAA,EAC1C,cAAA;AAAA,EACA,kBAAA;AAAA,EACA;AACF,CAAA,KAIM;AACJ,EAAA,MAAM,eAAA,GAAkB,WAAW,kBAAkB,CAAA;AAErD,EAAA,uBACE,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAA,EAAQ,cAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAA,EAAM,eAAA;AAAA,MACN,cAAc,CAAA,EAAA,KAAM,EAAA;AAAA,MAEpB,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAS,IAAA;AAAA,UACT,SAAA,EAAU,QAAA;AAAA,UACV,cAAA,EAAe,YAAA;AAAA,UACf,UAAA,EAAW,YAAA;AAAA,UACX,OAAA,EAAS,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EACjB,QAAA,EAAA,cAAA,CAAe,QAAA,EAAU,IAAA,IAAQ,gBAAA,EACpC,CAAA,EACF,CAAA;AAAA,4BACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EACR,QAAA,kBAAA,GAAA,CAAC,UAAA,EAAA,EAAW,KAAA,EAAM,eAAA,EAAgB,OAAA,EAAQ,WAAA,EACvC,QAAA,EAAA,eAAA,EACH,CAAA,EACF;AAAA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -35,12 +35,7 @@ const useStyles = makeStyles(
|
|
|
35
35
|
}
|
|
36
36
|
})
|
|
37
37
|
);
|
|
38
|
-
|
|
39
|
-
open,
|
|
40
|
-
pod,
|
|
41
|
-
error,
|
|
42
|
-
clusterName
|
|
43
|
-
}) => {
|
|
38
|
+
function FixDialog({ open, pod, error, clusterName }) {
|
|
44
39
|
const [isOpen, setOpen] = useState(!!open);
|
|
45
40
|
const classes = useStyles();
|
|
46
41
|
const { t } = useTranslationRef(kubernetesReactTranslationRef);
|
|
@@ -144,7 +139,7 @@ const FixDialog = ({
|
|
|
144
139
|
) })
|
|
145
140
|
] })
|
|
146
141
|
] });
|
|
147
|
-
}
|
|
142
|
+
}
|
|
148
143
|
|
|
149
144
|
export { FixDialog };
|
|
150
145
|
//# sourceMappingURL=FixDialog.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FixDialog.esm.js","sources":["../../../../src/components/Pods/FixDialog/FixDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { FC, useState } from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport CloseIcon from '@material-ui/icons/Close';\nimport HelpIcon from '@material-ui/icons/Help';\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew';\n\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { DetectedError } from '@backstage/plugin-kubernetes-common';\nimport { PodLogs } from '../PodLogs';\nimport { Events } from '../Events';\nimport { LinkButton } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n }),\n);\n\n/**\n * Props for FixDialog\n *\n * @public\n */\nexport interface FixDialogProps {\n open?: boolean;\n clusterName: string;\n pod: Pod;\n error: DetectedError;\n}\n\n/**\n * A dialog for fixing detected Kubernetes errors\n *\n * @public\n */\nexport const FixDialog: FC<FixDialogProps> = ({\n open,\n pod,\n error,\n clusterName,\n}: FixDialogProps) => {\n const [isOpen, setOpen] = useState(!!open);\n const classes = useStyles();\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n\n const openDialog = () => {\n setOpen(true);\n };\n\n const closeDialog = () => {\n setOpen(false);\n };\n\n const pf = error.proposedFix;\n\n const dialogContent = () => {\n return (\n <Grid container>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.detectedError')}</Typography>\n <Typography>{error.message}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">\n {t('fixDialog.causeExplanation')}\n </Typography>\n <Typography>\n {error.proposedFix?.rootCauseExplanation ?? t('podsTable.unknown')}\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.fix')}</Typography>\n <List>\n {(error.proposedFix?.actions ?? []).map((fix, i) => {\n return (\n <ListItem\n key={`${\n pod.metadata?.name ?? t('podsTable.unknown')\n }-pf-${i}`}\n >\n {fix}\n </ListItem>\n );\n })}\n </List>\n </Grid>\n\n {pf && pf.type === 'logs' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.crashLogs')}</Typography>\n </Grid>\n <Grid item xs={9}>\n <PodLogs\n previous\n containerScope={{\n podName: pod.metadata?.name ?? t('podsTable.unknown'),\n podNamespace:\n pod.metadata?.namespace ?? t('podsTable.unknown'),\n cluster: { name: clusterName },\n containerName: pf.container,\n }}\n />\n </Grid>\n </>\n )}\n {pf && pf.type === 'events' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.events')}</Typography>\n </Grid>\n <Grid item xs={9}>\n <Events\n warningEventsOnly\n involvedObjectName={pod.metadata?.name ?? ''}\n namespace={pod.metadata?.namespace ?? ''}\n clusterName={clusterName}\n />\n </Grid>\n </>\n )}\n </Grid>\n );\n };\n\n return (\n <>\n <Button\n variant=\"outlined\"\n aria-label={t('fixDialog.ariaLabels.fixIssue')}\n component=\"label\"\n onClick={openDialog}\n startIcon={<HelpIcon />}\n >\n {t('fixDialog.helpButton')}\n </Button>\n <Dialog maxWidth=\"xl\" fullWidth open={isOpen} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n {t('fixDialog.title', {\n podName: pod.metadata?.name ?? '',\n errorType: error.type,\n })}\n <IconButton\n aria-label={t('fixDialog.ariaLabels.close')}\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent>{dialogContent()}</DialogContent>\n <DialogActions>\n {pf && pf.type === 'docs' && (\n <LinkButton\n to={pf.docsLink}\n variant=\"outlined\"\n startIcon={<OpenInNewIcon />}\n target=\"_blank\"\n rel=\"noopener\"\n >\n {t('fixDialog.openDocs')}\n </LinkButton>\n )}\n </DialogActions>\n </Dialog>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAA,CAAa;AAAA,IACX,WAAA,EAAa;AAAA,MACX,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG;AAAA;AAC/B,GACD;AACH,CAAA;AAmBO,MAAM,YAAgC,CAAC;AAAA,EAC5C,IAAA;AAAA,EACA,GAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,KAAsB;AACpB,EAAA,MAAM,CAAC,MAAA,EAAQ,OAAO,IAAI,QAAA,CAAS,CA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AQ,OAAA,EAAS,WAAA,EACrD,QAAA,EAAA;AAAA,sBAAA,IAAA,CAAC,WAAA,EAAA,EAAY,IAAG,cAAA,EACb,QAAA,EAAA;AAAA,QAAA,CAAA,CAAE,iBAAA,EAAmB;AAAA,UACpB,OAAA,EAAS,GAAA,CAAI,QAAA,EAAU,IAAA,IAAQ,EAAA;AAAA,UAC/B,WAAW,KAAA,CAAM;AAAA,SAClB,CAAA;AAAA,wBACD,GAAA;AAAA,UAAC,UAAA;AAAA,UAAA;AAAA,YACC,YAAA,EAAY,EAAE,4BAA4B,CAAA;AAAA,YAC1C,WAAW,OAAA,CAAQ,WAAA;AAAA,YACnB,OAAA,EAAS,WAAA;AAAA,YAET,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA;AACb,OAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,aAAA,EAAc,EAAE,CAAA;AAAA,sBAChC,GAAA,CAAC,aAAA,EAAA,EACE,QAAA,EAAA,EAAA,IAAM,EAAA,CAAG,SAAS,MAAA,oBACjB,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAI,EAAA,CAAG,QAAA;AAAA,UACP,OAAA,EAAQ,UAAA;AAAA,UACR,SAAA,sBAAY,aAAA,EAAA,EAAc,CAAA;AAAA,UAC1B,MAAA,EAAO,QAAA;AAAA,UACP,GAAA,EAAI,UAAA;AAAA,UAEH,YAAE,oBAAoB;AAAA;AAAA,OACzB,EAEJ;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"FixDialog.esm.js","sources":["../../../../src/components/Pods/FixDialog/FixDialog.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { useState } from 'react';\n\nimport Button from '@material-ui/core/Button';\nimport Grid from '@material-ui/core/Grid';\nimport Dialog from '@material-ui/core/Dialog';\nimport DialogActions from '@material-ui/core/DialogActions';\nimport DialogContent from '@material-ui/core/DialogContent';\nimport DialogTitle from '@material-ui/core/DialogTitle';\nimport IconButton from '@material-ui/core/IconButton';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport CloseIcon from '@material-ui/icons/Close';\nimport HelpIcon from '@material-ui/icons/Help';\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew';\n\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { DetectedError } from '@backstage/plugin-kubernetes-common';\nimport { PodLogs } from '../PodLogs';\nimport { Events } from '../Events';\nimport { LinkButton } from '@backstage/core-components';\nimport List from '@material-ui/core/List';\nimport ListItem from '@material-ui/core/ListItem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles((theme: Theme) =>\n createStyles({\n closeButton: {\n position: 'absolute',\n right: theme.spacing(1),\n top: theme.spacing(1),\n color: theme.palette.grey[500],\n },\n }),\n);\n\n/**\n * Props for FixDialog\n *\n * @public\n */\nexport interface FixDialogProps {\n open?: boolean;\n clusterName: string;\n pod: Pod;\n error: DetectedError;\n}\n\n/**\n * A dialog for fixing detected Kubernetes errors\n *\n * @public\n */\nexport function FixDialog({ open, pod, error, clusterName }: FixDialogProps) {\n const [isOpen, setOpen] = useState(!!open);\n const classes = useStyles();\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n\n const openDialog = () => {\n setOpen(true);\n };\n\n const closeDialog = () => {\n setOpen(false);\n };\n\n const pf = error.proposedFix;\n\n const dialogContent = () => {\n return (\n <Grid container>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.detectedError')}</Typography>\n <Typography>{error.message}</Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">\n {t('fixDialog.causeExplanation')}\n </Typography>\n <Typography>\n {error.proposedFix?.rootCauseExplanation ?? t('podsTable.unknown')}\n </Typography>\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.fix')}</Typography>\n <List>\n {(error.proposedFix?.actions ?? []).map((fix, i) => {\n return (\n <ListItem\n key={`${\n pod.metadata?.name ?? t('podsTable.unknown')\n }-pf-${i}`}\n >\n {fix}\n </ListItem>\n );\n })}\n </List>\n </Grid>\n\n {pf && pf.type === 'logs' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.crashLogs')}</Typography>\n </Grid>\n <Grid item xs={9}>\n <PodLogs\n previous\n containerScope={{\n podName: pod.metadata?.name ?? t('podsTable.unknown'),\n podNamespace:\n pod.metadata?.namespace ?? t('podsTable.unknown'),\n cluster: { name: clusterName },\n containerName: pf.container,\n }}\n />\n </Grid>\n </>\n )}\n {pf && pf.type === 'events' && (\n <>\n <Grid item xs={12}>\n <Typography variant=\"h6\">{t('fixDialog.events')}</Typography>\n </Grid>\n <Grid item xs={9}>\n <Events\n warningEventsOnly\n involvedObjectName={pod.metadata?.name ?? ''}\n namespace={pod.metadata?.namespace ?? ''}\n clusterName={clusterName}\n />\n </Grid>\n </>\n )}\n </Grid>\n );\n };\n\n return (\n <>\n <Button\n variant=\"outlined\"\n aria-label={t('fixDialog.ariaLabels.fixIssue')}\n component=\"label\"\n onClick={openDialog}\n startIcon={<HelpIcon />}\n >\n {t('fixDialog.helpButton')}\n </Button>\n <Dialog maxWidth=\"xl\" fullWidth open={isOpen} onClose={closeDialog}>\n <DialogTitle id=\"dialog-title\">\n {t('fixDialog.title', {\n podName: pod.metadata?.name ?? '',\n errorType: error.type,\n })}\n <IconButton\n aria-label={t('fixDialog.ariaLabels.close')}\n className={classes.closeButton}\n onClick={closeDialog}\n >\n <CloseIcon />\n </IconButton>\n </DialogTitle>\n <DialogContent>{dialogContent()}</DialogContent>\n <DialogActions>\n {pf && pf.type === 'docs' && (\n <LinkButton\n to={pf.docsLink}\n variant=\"outlined\"\n startIcon={<OpenInNewIcon />}\n target=\"_blank\"\n rel=\"noopener\"\n >\n {t('fixDialog.openDocs')}\n </LinkButton>\n )}\n </DialogActions>\n </Dialog>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAM,SAAA,GAAY,UAAA;AAAA,EAAW,CAAC,UAC5B,YAAA,CAAa;AAAA,IACX,WAAA,EAAa;AAAA,MACX,QAAA,EAAU,UAAA;AAAA,MACV,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACtB,GAAA,EAAK,KAAA,CAAM,OAAA,CAAQ,CAAC,CAAA;AAAA,MACpB,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK,GAAG;AAAA;AAC/B,GACD;AACH,CAAA;AAmBO,SAAS,UAAU,EAAE,IAAA,EAAM,GAAA,EAAK,KAAA,EAAO,aAAY,EAAmB;AAC3E,EAAA,MAAM,CAAC,MAAA,EAAQ,OAAO,IAAI,QAAA,CAAS,CAAC,CAAC,IAAI,CAAA;AACzC,EAAA,MAAM,UAAU,SAAA,EAAU;AAC1B,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAE7D,EAAA,MAAM,aAAa,MAAM;AACvB,IAAA,OAAA,CAAQ,IAAI,CAAA;AAAA,EACd,CAAA;AAEA,EAAA,MAAM,cAAc,MAAM;AACxB,IAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,EACf,CAAA;AAEA,EAAA,MAAM,KAAK,KAAA,CAAM,WAAA;AAEjB,EAAA,MAAM,gBAAgB,MAAM;AAC1B,IAAA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AQ,WAAA;AAAA,YACnB,OAAA,EAAS,WAAA;AAAA,YAET,8BAAC,SAAA,EAAA,EAAU;AAAA;AAAA;AACb,OAAA,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,aAAA,EAAA,EAAe,QAAA,EAAA,aAAA,EAAc,EAAE,CAAA;AAAA,sBAChC,GAAA,CAAC,aAAA,EAAA,EACE,QAAA,EAAA,EAAA,IAAM,EAAA,CAAG,SAAS,MAAA,oBACjB,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,IAAI,EAAA,CAAG,QAAA;AAAA,UACP,OAAA,EAAQ,UAAA;AAAA,UACR,SAAA,sBAAY,aAAA,EAAA,EAAc,CAAA;AAAA,UAC1B,MAAA,EAAO,QAAA;AAAA,UACP,GAAA,EAAI,UAAA;AAAA,UAEH,YAAE,oBAAoB;AAAA;AAAA,OACzB,EAEJ;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -67,12 +67,12 @@ const ContainerDatetime = ({ prefix, dateTime }) => {
|
|
|
67
67
|
})
|
|
68
68
|
] });
|
|
69
69
|
};
|
|
70
|
-
|
|
70
|
+
function ContainerCard({
|
|
71
71
|
podScope,
|
|
72
72
|
containerSpec,
|
|
73
73
|
containerStatus,
|
|
74
74
|
containerMetrics
|
|
75
|
-
})
|
|
75
|
+
}) {
|
|
76
76
|
const { t } = useTranslationRef(kubernetesReactTranslationRef);
|
|
77
77
|
const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();
|
|
78
78
|
if (containerSpec === void 0) {
|
|
@@ -208,7 +208,7 @@ const ContainerCard = ({
|
|
|
208
208
|
)
|
|
209
209
|
] })
|
|
210
210
|
] });
|
|
211
|
-
}
|
|
211
|
+
}
|
|
212
212
|
|
|
213
213
|
export { ContainerCard };
|
|
214
214
|
//# sourceMappingURL=ContainerCard.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContainerCard.esm.js","sources":["../../../../src/components/Pods/PodDrawer/ContainerCard.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { ClientContainerStatus } from '@backstage/plugin-kubernetes-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { IContainer, IContainerStatus } from 'kubernetes-models/v1';\nimport { DateTime } from 'luxon';\nimport { FC } from 'react';\n\nimport { useIsPodExecTerminalEnabled } from '../../../hooks';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { PodExecTerminalDialog } from '../../PodExecTerminal/PodExecTerminalDialog';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { PodLogsDialog, PodScope } from '../PodLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst getContainerHealthChecks = (\n containerSpec: IContainer,\n containerStatus: IContainerStatus,\n): { [key: string]: boolean } => {\n const healthCheck = {\n 'not waiting to start': containerStatus.state?.waiting === undefined,\n 'no restarts': containerStatus.restartCount === 0,\n };\n if (containerStatus.state?.terminated?.reason === 'Completed') {\n return healthCheck;\n }\n Object.assign(\n healthCheck,\n { started: !!containerStatus.started },\n { ready: containerStatus.ready },\n { 'readiness probe set': containerSpec?.readinessProbe !== undefined },\n );\n if (containerSpec && containerSpec?.livenessProbe !== undefined) {\n Object.assign(healthCheck, {\n 'liveness probe set': containerSpec.livenessProbe,\n });\n }\n return healthCheck;\n};\n\nconst getCurrentState = (containerStatus: IContainerStatus): string => {\n return (\n containerStatus.state?.waiting?.reason ||\n containerStatus.state?.terminated?.reason ||\n (containerStatus.state?.running !== undefined ? 'Running' : 'Unknown')\n );\n};\n\nconst getStartedAtTime = (\n containerStatus: IContainerStatus,\n): string | undefined => {\n return (\n containerStatus.state?.running?.startedAt ||\n containerStatus.state?.terminated?.startedAt\n );\n};\n\ninterface ContainerDatetimeProps {\n prefix: string;\n dateTime: string;\n}\n\nconst ContainerDatetime = ({ prefix, dateTime }: ContainerDatetimeProps) => {\n return (\n <Typography variant=\"subtitle2\">\n {prefix}:{' '}\n {DateTime.fromISO(dateTime).toRelative({\n locale: 'en',\n })}\n </Typography>\n );\n};\n\n/**\n * Props for ContainerCard\n *\n * @public\n */\nexport interface ContainerCardProps {\n podScope: PodScope;\n containerSpec?: IContainer;\n containerStatus: IContainerStatus;\n containerMetrics?: ClientContainerStatus;\n}\n\n/**\n * Shows details about a container within a pod\n *\n * @public\n */\nexport const ContainerCard: FC<ContainerCardProps> = ({\n podScope,\n containerSpec,\n containerStatus,\n containerMetrics,\n}: ContainerCardProps) => {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();\n\n // This should never be undefined\n if (containerSpec === undefined) {\n return <Typography>error reading pod from cluster</Typography>;\n }\n const containerStartedTime = getStartedAtTime(containerStatus);\n const containerFinishedTime = containerStatus.state?.terminated?.finishedAt;\n\n return (\n <Card>\n <CardHeader\n title={containerStatus.name}\n subheader={containerStatus.image}\n />\n <CardContent>\n <Grid container>\n <Grid item xs={12}>\n {containerStartedTime && (\n <ContainerDatetime\n prefix=\"Started\"\n dateTime={containerStartedTime}\n />\n )}\n {containerFinishedTime && (\n <ContainerDatetime\n prefix=\"Completed\"\n dateTime={containerFinishedTime}\n />\n )}\n {containerStartedTime && containerFinishedTime && (\n <Typography variant=\"subtitle2\">\n Execution time:{' '}\n {DateTime.fromISO(containerFinishedTime)\n .diff(DateTime.fromISO(containerStartedTime), [\n 'hours',\n 'minutes',\n 'seconds',\n ])\n .toHuman()}\n </Typography>\n )}\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Status: {getCurrentState(containerStatus)}\n </Typography>\n </Grid>\n {containerStatus.restartCount > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Restarts: {containerStatus.restartCount}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">Container health</Typography>\n </Grid>\n <Grid item xs={12}>\n <StructuredMetadataTable\n metadata={getContainerHealthChecks(\n containerSpec,\n containerStatus,\n )}\n options={{ nestedValuesAsYaml: true }}\n />\n </Grid>\n {containerMetrics && (\n <Grid container item xs={12} spacing={0}>\n <Grid item xs={12}>\n <Typography variant=\"subtitle1\">\n {t('podDrawer.resourceUtilization')}\n </Typography>\n </Grid>\n <Grid item xs={12} style={{ minHeight: '5rem' }}>\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuRequests')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.requestTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuLimits')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.limitTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.limitTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryRequests')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.requestTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryLimits')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.limitTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.limitTotal,\n )}\n />\n </Grid>\n </Grid>\n )}\n </Grid>\n </CardContent>\n <CardActions>\n <PodLogsDialog\n containerScope={{\n containerName: containerStatus.name,\n ...podScope,\n }}\n />\n {isPodExecTerminalEnabled && (\n <PodExecTerminalDialog\n cluster={podScope.cluster}\n containerName={containerStatus.name}\n podName={podScope.podName}\n podNamespace={podScope.podNamespace}\n />\n )}\n </CardActions>\n </Card>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,MAAM,wBAAA,GAA2B,CAC/B,aAAA,EACA,eAAA,KAC+B;AAC/B,EAAA,MAAM,WAAA,GAAc;AAAA,IAClB,sBAAA,EAAwB,eAAA,CAAgB,KAAA,EAAO,OAAA,KAAY,MAAA;AAAA,IAC3D,aAAA,EAAe,gBAAgB,YAAA,KAAiB;AAAA,GAClD;AACA,EAAA,IAAI,eAAA,CAAgB,KAAA,EAAO,UAAA,EAAY,MAAA,KAAW,WAAA,EAAa;AAC7D,IAAA,OAAO,WAAA;AAAA,EACT;AACA,EAAA,MAAA,CAAO,MAAA;AAAA,IACL,WAAA;AAAA,IACA,EAAE,OAAA,EAAS,CAAC,CAAC,gBAAgB,OAAA,EAAQ;AAAA,IACrC,EAAE,KAAA,EAAO,eAAA,CAAgB,KAAA,EAAM;AAAA,IAC/B,EAAE,qBAAA,EAAuB,aAAA,EAAe,cAAA,KAAmB,MAAA;AAAU,GACvE;AACA,EAAA,IAAI,aAAA,IAAiB,aAAA,EAAe,aAAA,KAAkB,MAAA,EAAW;AAC/D,IAAA,MAAA,CAAO,OAAO,WAAA,EAAa;AAAA,MACzB,sBAAsB,aAAA,CAAc;AAAA,KACrC,CAAA;AAAA,EACH;AACA,EAAA,OAAO,WAAA;AACT,CAAA;AAEA,MAAM,eAAA,GAAkB,CAAC,eAAA,KAA8C;AACrE,EAAA,OACE,eAAA,CAAgB,KAAA,EAAO,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EACF;AAAA,OAAA,EACF;AAAA,KAAA,EAEJ,CAAA,EACF,CAAA;AAAA,yBACC,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACC,cAAA,EAAgB;AAAA,YACd,eAAe,eAAA,CAAgB,IAAA;AAAA,YAC/B,GAAG;AAAA;AACL;AAAA,OACF;AAAA,MACC,wBAAA,oBACC,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,eAAe,eAAA,CAAgB,IAAA;AAAA,UAC/B,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,cAAc,QAAA,CAAS;AAAA;AAAA;AACzB,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ContainerCard.esm.js","sources":["../../../../src/components/Pods/PodDrawer/ContainerCard.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { StructuredMetadataTable } from '@backstage/core-components';\nimport { ClientContainerStatus } from '@backstage/plugin-kubernetes-common';\nimport Card from '@material-ui/core/Card';\nimport CardActions from '@material-ui/core/CardActions';\nimport CardContent from '@material-ui/core/CardContent';\nimport CardHeader from '@material-ui/core/CardHeader';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport { IContainer, IContainerStatus } from 'kubernetes-models/v1';\nimport { DateTime } from 'luxon';\n\nimport { useIsPodExecTerminalEnabled } from '../../../hooks';\nimport { bytesToMiB, formatMillicores } from '../../../utils/resources';\nimport { PodExecTerminalDialog } from '../../PodExecTerminal/PodExecTerminalDialog';\nimport { ResourceUtilization } from '../../ResourceUtilization';\nimport { PodLogsDialog, PodScope } from '../PodLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\nconst getContainerHealthChecks = (\n containerSpec: IContainer,\n containerStatus: IContainerStatus,\n): { [key: string]: boolean } => {\n const healthCheck = {\n 'not waiting to start': containerStatus.state?.waiting === undefined,\n 'no restarts': containerStatus.restartCount === 0,\n };\n if (containerStatus.state?.terminated?.reason === 'Completed') {\n return healthCheck;\n }\n Object.assign(\n healthCheck,\n { started: !!containerStatus.started },\n { ready: containerStatus.ready },\n { 'readiness probe set': containerSpec?.readinessProbe !== undefined },\n );\n if (containerSpec && containerSpec?.livenessProbe !== undefined) {\n Object.assign(healthCheck, {\n 'liveness probe set': containerSpec.livenessProbe,\n });\n }\n return healthCheck;\n};\n\nconst getCurrentState = (containerStatus: IContainerStatus): string => {\n return (\n containerStatus.state?.waiting?.reason ||\n containerStatus.state?.terminated?.reason ||\n (containerStatus.state?.running !== undefined ? 'Running' : 'Unknown')\n );\n};\n\nconst getStartedAtTime = (\n containerStatus: IContainerStatus,\n): string | undefined => {\n return (\n containerStatus.state?.running?.startedAt ||\n containerStatus.state?.terminated?.startedAt\n );\n};\n\ninterface ContainerDatetimeProps {\n prefix: string;\n dateTime: string;\n}\n\nconst ContainerDatetime = ({ prefix, dateTime }: ContainerDatetimeProps) => {\n return (\n <Typography variant=\"subtitle2\">\n {prefix}:{' '}\n {DateTime.fromISO(dateTime).toRelative({\n locale: 'en',\n })}\n </Typography>\n );\n};\n\n/**\n * Props for ContainerCard\n *\n * @public\n */\nexport interface ContainerCardProps {\n podScope: PodScope;\n containerSpec?: IContainer;\n containerStatus: IContainerStatus;\n containerMetrics?: ClientContainerStatus;\n}\n\n/**\n * Shows details about a container within a pod\n *\n * @public\n */\nexport function ContainerCard({\n podScope,\n containerSpec,\n containerStatus,\n containerMetrics,\n}: ContainerCardProps) {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const isPodExecTerminalEnabled = useIsPodExecTerminalEnabled();\n\n // This should never be undefined\n if (containerSpec === undefined) {\n return <Typography>error reading pod from cluster</Typography>;\n }\n const containerStartedTime = getStartedAtTime(containerStatus);\n const containerFinishedTime = containerStatus.state?.terminated?.finishedAt;\n\n return (\n <Card>\n <CardHeader\n title={containerStatus.name}\n subheader={containerStatus.image}\n />\n <CardContent>\n <Grid container>\n <Grid item xs={12}>\n {containerStartedTime && (\n <ContainerDatetime\n prefix=\"Started\"\n dateTime={containerStartedTime}\n />\n )}\n {containerFinishedTime && (\n <ContainerDatetime\n prefix=\"Completed\"\n dateTime={containerFinishedTime}\n />\n )}\n {containerStartedTime && containerFinishedTime && (\n <Typography variant=\"subtitle2\">\n Execution time:{' '}\n {DateTime.fromISO(containerFinishedTime)\n .diff(DateTime.fromISO(containerStartedTime), [\n 'hours',\n 'minutes',\n 'seconds',\n ])\n .toHuman()}\n </Typography>\n )}\n </Grid>\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Status: {getCurrentState(containerStatus)}\n </Typography>\n </Grid>\n {containerStatus.restartCount > 0 && (\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">\n Restarts: {containerStatus.restartCount}\n </Typography>\n </Grid>\n )}\n <Grid item xs={12}>\n <Typography variant=\"subtitle2\">Container health</Typography>\n </Grid>\n <Grid item xs={12}>\n <StructuredMetadataTable\n metadata={getContainerHealthChecks(\n containerSpec,\n containerStatus,\n )}\n options={{ nestedValuesAsYaml: true }}\n />\n </Grid>\n {containerMetrics && (\n <Grid container item xs={12} spacing={0}>\n <Grid item xs={12}>\n <Typography variant=\"subtitle1\">\n {t('podDrawer.resourceUtilization')}\n </Typography>\n </Grid>\n <Grid item xs={12} style={{ minHeight: '5rem' }}>\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuRequests')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.requestTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.cpuLimits')}\n usage={containerMetrics.cpuUsage.currentUsage}\n total={containerMetrics.cpuUsage.limitTotal}\n totalFormatted={formatMillicores(\n containerMetrics.cpuUsage.limitTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryRequests')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.requestTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.requestTotal,\n )}\n />\n <ResourceUtilization\n compressed\n title={t('podDrawer.memoryLimits')}\n usage={containerMetrics.memoryUsage.currentUsage}\n total={containerMetrics.memoryUsage.limitTotal}\n totalFormatted={bytesToMiB(\n containerMetrics.memoryUsage.limitTotal,\n )}\n />\n </Grid>\n </Grid>\n )}\n </Grid>\n </CardContent>\n <CardActions>\n <PodLogsDialog\n containerScope={{\n containerName: containerStatus.name,\n ...podScope,\n }}\n />\n {isPodExecTerminalEnabled && (\n <PodExecTerminalDialog\n cluster={podScope.cluster}\n containerName={containerStatus.name}\n podName={podScope.podName}\n podNamespace={podScope.podNamespace}\n />\n )}\n </CardActions>\n </Card>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCA,MAAM,wBAAA,GAA2B,CAC/B,aAAA,EACA,eAAA,KAC+B;AAC/B,EAAA,MAAM,WAAA,GAAc;AAAA,IAClB,sBAAA,EAAwB,eAAA,CAAgB,KAAA,EAAO,OAAA,KAAY,MAAA;AAAA,IAC3D,aAAA,EAAe,gBAAgB,YAAA,KAAiB;AAAA,GAClD;AACA,EAAA,IAAI,eAAA,CAAgB,KAAA,EAAO,UAAA,EAAY,MAAA,KAAW,WAAA,EAAa;AAC7D,IAAA,OAAO,WAAA;AAAA,EACT;AACA,E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EAAE,0BAA0B,CAAA;AAAA,cACnC,KAAA,EAAO,iBAAiB,WAAA,CAAY,YAAA;AAAA,cACpC,KAAA,EAAO,iBAAiB,WAAA,CAAY,YAAA;AAAA,cACpC,cAAA,EAAgB,UAAA;AAAA,gBACd,iBAAiB,WAAA,CAAY;AAAA;AAC/B;AAAA,WACF;AAAA,0BACA,GAAA;AAAA,YAAC,mBAAA;AAAA,YAAA;AAAA,cACC,UAAA,EAAU,IAAA;AAAA,cACV,KAAA,EAAO,EAAE,wBAAwB,CAAA;AAAA,cACjC,KAAA,EAAO,iBAAiB,WAAA,CAAY,YAAA;AAAA,cACpC,KAAA,EAAO,iBAAiB,WAAA,CAAY,UAAA;AAAA,cACpC,cAAA,EAAgB,UAAA;AAAA,gBACd,iBAAiB,WAAA,CAAY;AAAA;AAC/B;AAAA;AACF,SAAA,EACF;AAAA,OAAA,EACF;AAAA,KAAA,EAEJ,CAAA,EACF,CAAA;AAAA,yBACC,WAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,aAAA;AAAA,QAAA;AAAA,UACC,cAAA,EAAgB;AAAA,YACd,eAAe,eAAA,CAAgB,IAAA;AAAA,YAC/B,GAAG;AAAA;AACL;AAAA,OACF;AAAA,MACC,wBAAA,oBACC,GAAA;AAAA,QAAC,qBAAA;AAAA,QAAA;AAAA,UACC,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,eAAe,eAAA,CAAgB,IAAA;AAAA,UAC/B,SAAS,QAAA,CAAS,OAAA;AAAA,UAClB,cAAc,QAAA,CAAS;AAAA;AAAA;AACzB,KAAA,EAEJ;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -6,10 +6,7 @@ import { usePodLogs } from './usePodLogs.esm.js';
|
|
|
6
6
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
7
7
|
import { kubernetesReactTranslationRef } from '../../../translation.esm.js';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
containerScope,
|
|
11
|
-
previous
|
|
12
|
-
}) => {
|
|
9
|
+
function PodLogs({ containerScope, previous }) {
|
|
13
10
|
const { t } = useTranslationRef(kubernetesReactTranslationRef);
|
|
14
11
|
const { value, error, loading } = usePodLogs({
|
|
15
12
|
containerScope,
|
|
@@ -46,7 +43,7 @@ const PodLogs = ({
|
|
|
46
43
|
}
|
|
47
44
|
)
|
|
48
45
|
] });
|
|
49
|
-
}
|
|
46
|
+
}
|
|
50
47
|
|
|
51
48
|
export { PodLogs };
|
|
52
49
|
//# sourceMappingURL=PodLogs.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 */\
|
|
1
|
+
{"version":3,"file":"PodLogs.esm.js","sources":["../../../../src/components/Pods/PodLogs/PodLogs.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 {\n DismissableBanner,\n EmptyState,\n LogViewer,\n} from '@backstage/core-components';\nimport Paper from '@material-ui/core/Paper';\nimport Skeleton from '@material-ui/lab/Skeleton';\n\nimport { ContainerScope } from './types';\nimport { usePodLogs } from './usePodLogs';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { kubernetesReactTranslationRef } from '../../../translation';\n\n/**\n * Props for PodLogs\n *\n * @public\n */\nexport interface PodLogsProps {\n containerScope: ContainerScope;\n previous?: boolean;\n}\n\n/**\n * Shows the logs for the given pod\n *\n * @public\n */\nexport function PodLogs({ containerScope, previous }: PodLogsProps) {\n const { t } = useTranslationRef(kubernetesReactTranslationRef);\n const { value, error, loading } = usePodLogs({\n containerScope,\n previous,\n });\n\n return (\n <>\n {error && (\n <DismissableBanner\n {...{\n message: error.message,\n variant: 'error',\n fixed: false,\n }}\n id=\"pod-logs\"\n />\n )}\n <Paper\n elevation={1}\n style={{ height: '100%', width: '100%', minHeight: '55rem' }}\n >\n {loading && <Skeleton variant=\"rect\" width=\"100%\" height=\"100%\" />}\n {!loading &&\n value !== undefined &&\n (value.text === '' ? (\n <EmptyState\n missing=\"data\"\n title={t('podLogs.title')}\n description={t('podLogs.description')}\n />\n ) : (\n <LogViewer text={value.text} />\n ))}\n </Paper>\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA4CO,SAAS,OAAA,CAAQ,EAAE,cAAA,EAAgB,QAAA,EAAS,EAAiB;AAClE,EAAA,MAAM,EAAE,CAAA,EAAE,GAAI,iBAAA,CAAkB,6BAA6B,CAAA;AAC7D,EAAA,MAAM,EAAE,KAAA,EAAO,KAAA,EAAO,OAAA,KAAY,UAAA,CAAW;AAAA,IAC3C,cAAA;AAAA,IACA;AAAA,GACD,CAAA;AAED,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACG,QAAA,EAAA;AAAA,IAAA,KAAA,oBACC,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACE,GAAG;AAAA,UACF,SAAS,KAAA,CAAM,OAAA;AAAA,UACf,OAAA,EAAS,OAAA;AAAA,UACT,KAAA,EAAO;AAAA,SACT;AAAA,QACA,EAAA,EAAG;AAAA;AAAA,KACL;AAAA,oBAEF,IAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAW,CAAA;AAAA,QACX,OAAO,EAAE,MAAA,EAAQ,QAAQ,KAAA,EAAO,MAAA,EAAQ,WAAW,OAAA,EAAQ;AAAA,QAE1D,QAAA,EAAA;AAAA,UAAA,OAAA,wBAAY,QAAA,EAAA,EAAS,OAAA,EAAQ,QAAO,KAAA,EAAM,MAAA,EAAO,QAAO,MAAA,EAAO,CAAA;AAAA,UAC/D,CAAC,OAAA,IACA,KAAA,KAAU,MAAA,KACT,KAAA,CAAM,SAAS,EAAA,mBACd,GAAA;AAAA,YAAC,UAAA;AAAA,YAAA;AAAA,cACC,OAAA,EAAQ,MAAA;AAAA,cACR,KAAA,EAAO,EAAE,eAAe,CAAA;AAAA,cACxB,WAAA,EAAa,EAAE,qBAAqB;AAAA;AAAA,WACtC,mBAEA,GAAA,CAAC,SAAA,EAAA,EAAU,IAAA,EAAM,MAAM,IAAA,EAAM,CAAA;AAAA;AAAA;AAAA;AAEnC,GAAA,EACF,CAAA;AAEJ;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Entity } from '@backstage/catalog-model';
|
|
2
2
|
import { ObjectsByEntityResponse, CustomResourceMatcher, ClientPodStatus, GroupedResponses, ClusterAttributes, DetectedError, KubernetesRequestBody, WorkloadsByEntityRequest, CustomObjectsByEntityRequest, ClusterObjects, DetectedErrorsByCluster, ClientContainerStatus } from '@backstage/plugin-kubernetes-common';
|
|
3
3
|
import * as react from 'react';
|
|
4
|
-
import { ReactNode
|
|
4
|
+
import { ReactNode } from 'react';
|
|
5
5
|
import { IObjectMeta, IIoK8sApimachineryPkgApisMetaV1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';
|
|
6
6
|
import { TypeMeta } from '@kubernetes-models/base';
|
|
7
7
|
import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
|
|
@@ -651,7 +651,7 @@ interface PodLogsProps {
|
|
|
651
651
|
*
|
|
652
652
|
* @public
|
|
653
653
|
*/
|
|
654
|
-
declare
|
|
654
|
+
declare function PodLogs({ containerScope, previous }: PodLogsProps): react_jsx_runtime.JSX.Element;
|
|
655
655
|
|
|
656
656
|
/**
|
|
657
657
|
* Props for PodLogsDialog
|
|
@@ -702,7 +702,7 @@ interface ContainerCardProps {
|
|
|
702
702
|
*
|
|
703
703
|
* @public
|
|
704
704
|
*/
|
|
705
|
-
declare
|
|
705
|
+
declare function ContainerCard({ podScope, containerSpec, containerStatus, containerMetrics, }: ContainerCardProps): react_jsx_runtime.JSX.Element;
|
|
706
706
|
|
|
707
707
|
/**
|
|
708
708
|
* Props for PendingPodContent
|
|
@@ -735,7 +735,7 @@ interface FixDialogProps {
|
|
|
735
735
|
*
|
|
736
736
|
* @public
|
|
737
737
|
*/
|
|
738
|
-
declare
|
|
738
|
+
declare function FixDialog({ open, pod, error, clusterName }: FixDialogProps): react_jsx_runtime.JSX.Element;
|
|
739
739
|
|
|
740
740
|
/**
|
|
741
741
|
* Props for Events
|
package/dist/utils/owner.esm.js
CHANGED
|
@@ -15,7 +15,7 @@ const getOwnedPodsThroughReplicaSets = (potentialOwner, replicaSets, pods) => {
|
|
|
15
15
|
};
|
|
16
16
|
const getMatchingHpa = (owner, hpas) => {
|
|
17
17
|
return hpas.find((hpa) => {
|
|
18
|
-
return (hpa.spec?.scaleTargetRef?.kind ?? "").
|
|
18
|
+
return (hpa.spec?.scaleTargetRef?.kind ?? "").toLowerCase() === owner.kind.toLowerCase() && (hpa.metadata?.namespace ?? "") === (owner.namespace ?? "unknown-namespace") && (hpa.spec?.scaleTargetRef?.name ?? "") === (owner.name ?? "unknown-deployment");
|
|
19
19
|
});
|
|
20
20
|
};
|
|
21
21
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"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 type {\n V1ObjectMeta,\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').
|
|
1
|
+
{"version":3,"file":"owner.esm.js","sources":["../../src/utils/owner.ts"],"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 type {\n V1ObjectMeta,\n V2HorizontalPodAutoscaler,\n V1Pod,\n V1ReplicaSet,\n} from '@kubernetes/client-node';\n\ninterface CanOwn {\n metadata?: V1ObjectMeta;\n}\n\ninterface CanBeOwned {\n metadata?: V1ObjectMeta;\n}\n\nexport function getOwnedResources<R extends CanBeOwned>(\n potentialOwner: CanOwn,\n possiblyOwned: R[],\n): R[] {\n return possiblyOwned.filter(\n p =>\n p.metadata?.ownerReferences?.some(\n o => o.uid === potentialOwner.metadata?.uid,\n ) ?? false,\n );\n}\n\nexport const getOwnedPodsThroughReplicaSets = (\n potentialOwner: CanOwn,\n replicaSets: V1ReplicaSet[],\n pods: V1Pod[],\n) => {\n return getOwnedResources(\n potentialOwner,\n replicaSets.filter(rs => rs.status && rs.status.replicas > 0),\n ).reduce((accum, rs) => {\n return accum.concat(getOwnedResources(rs, pods));\n }, [] as V1Pod[]);\n};\n\ninterface ResourceRef {\n kind: string;\n namespace?: string;\n name?: string;\n}\n\nexport const getMatchingHpa = (\n owner: ResourceRef,\n hpas: V2HorizontalPodAutoscaler[],\n): V2HorizontalPodAutoscaler | undefined => {\n return hpas.find(hpa => {\n return (\n (hpa.spec?.scaleTargetRef?.kind ?? '').toLowerCase() ===\n owner.kind.toLowerCase() &&\n (hpa.metadata?.namespace ?? '') ===\n (owner.namespace ?? 'unknown-namespace') &&\n (hpa.spec?.scaleTargetRef?.name ?? '') ===\n (owner.name ?? 'unknown-deployment')\n );\n });\n};\n"],"names":[],"mappings":"AA+BO,SAAS,iBAAA,CACd,gBACA,aAAA,EACK;AACL,EAAA,OAAO,aAAA,CAAc,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAA,CAAE,QAAA,EAAU,eAAA,EAAiB,IAAA;AAAA,MAC3B,CAAA,CAAA,KAAK,CAAA,CAAE,GAAA,KAAQ,cAAA,CAAe,QAAA,EAAU;AAAA,KAC1C,IAAK;AAAA,GACT;AACF;AAEO,MAAM,8BAAA,GAAiC,CAC5C,cAAA,EACA,WAAA,EACA,IAAA,KACG;AACH,EAAA,OAAO,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAA,EAAA,KAAM,EAAA,CAAG,UAAU,EAAA,CAAG,MAAA,CAAO,WAAW,CAAC;AAAA,GAC9D,CAAE,MAAA,CAAO,CAAC,KAAA,EAAO,EAAA,KAAO;AACtB,IAAA,OAAO,KAAA,CAAM,MAAA,CAAO,iBAAA,CAAkB,EAAA,EAAI,IAAI,CAAC,CAAA;AAAA,EACjD,CAAA,EAAG,EAAa,CAAA;AAClB;AAQO,MAAM,cAAA,GAAiB,CAC5B,KAAA,EACA,IAAA,KAC0C;AAC1C,EAAA,OAAO,IAAA,CAAK,KAAK,CAAA,GAAA,KAAO;AACtB,IAAA,OAAA,CACG,GAAA,CAAI,IAAA,EAAM,cAAA,EAAgB,IAAA,IAAQ,EAAA,EAAI,aAAY,KACjD,KAAA,CAAM,IAAA,CAAK,WAAA,EAAY,IAAA,CACxB,GAAA,CAAI,UAAU,SAAA,IAAa,EAAA,OACzB,KAAA,CAAM,SAAA,IAAa,mBAAA,CAAA,IAAA,CACrB,GAAA,CAAI,MAAM,cAAA,EAAgB,IAAA,IAAQ,EAAA,OAChC,KAAA,CAAM,IAAA,IAAQ,oBAAA,CAAA;AAAA,EAErB,CAAC,CAAA;AACH;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-kubernetes-react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Web library for the kubernetes-react plugin",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -62,12 +62,12 @@
|
|
|
62
62
|
"test": "backstage-cli package test"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@backstage/catalog-model": "1.10.
|
|
66
|
-
"@backstage/core-components": "0.18.14
|
|
67
|
-
"@backstage/core-plugin-api": "1.12.10
|
|
68
|
-
"@backstage/errors": "1.3.1",
|
|
69
|
-
"@backstage/plugin-kubernetes-common": "0.9.13
|
|
70
|
-
"@backstage/types": "1.2.2",
|
|
65
|
+
"@backstage/catalog-model": "^1.10.1",
|
|
66
|
+
"@backstage/core-components": "^0.18.14",
|
|
67
|
+
"@backstage/core-plugin-api": "^1.12.10",
|
|
68
|
+
"@backstage/errors": "^1.3.1",
|
|
69
|
+
"@backstage/plugin-kubernetes-common": "^0.9.13",
|
|
70
|
+
"@backstage/types": "^1.2.2",
|
|
71
71
|
"@kubernetes-models/apimachinery": "^2.0.0",
|
|
72
72
|
"@kubernetes-models/base": "^5.0.0",
|
|
73
73
|
"@kubernetes/client-node": "1.4.0",
|
|
@@ -78,16 +78,16 @@
|
|
|
78
78
|
"@xterm/addon-fit": "^0.11.0",
|
|
79
79
|
"@xterm/xterm": "^5.5.0",
|
|
80
80
|
"cronstrue": "^2.32.0",
|
|
81
|
-
"js-yaml": "^4.3.
|
|
81
|
+
"js-yaml": "^4.3.2",
|
|
82
82
|
"kubernetes-models": "^4.3.1",
|
|
83
83
|
"lodash": "^4.17.21",
|
|
84
84
|
"luxon": "^3.0.0",
|
|
85
85
|
"react-use": "^17.4.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@backstage/cli": "0.36.6
|
|
89
|
-
"@backstage/core-app-api": "1.20.5
|
|
90
|
-
"@backstage/test-utils": "1.7.22
|
|
88
|
+
"@backstage/cli": "^0.36.6",
|
|
89
|
+
"@backstage/core-app-api": "^1.20.5",
|
|
90
|
+
"@backstage/test-utils": "^1.7.22",
|
|
91
91
|
"@testing-library/dom": "^10.0.0",
|
|
92
92
|
"@testing-library/jest-dom": "^6.0.0",
|
|
93
93
|
"@testing-library/react": "^16.0.0",
|