@backstage/plugin-kubernetes-react 0.5.6-next.1 → 0.5.7-next.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 +31 -0
- package/dist/api/formatters/HeadlampClusterLinksFormatter.esm.js +94 -0
- package/dist/api/formatters/HeadlampClusterLinksFormatter.esm.js.map +1 -0
- package/dist/api/formatters/index.esm.js +4 -2
- package/dist/api/formatters/index.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsAccordions.esm.js.map +1 -1
- package/dist/components/CronJobsAccordions/CronJobsDrawer.esm.js.map +1 -1
- package/dist/components/CustomResources/ArgoRollouts/Rollout.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsAccordions.esm.js.map +1 -1
- package/dist/components/DaemonSetsAccordions/DaemonSetsDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentDrawer.esm.js.map +1 -1
- package/dist/components/DeploymentsAccordions/DeploymentsAccordions.esm.js.map +1 -1
- package/dist/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressDrawer.esm.js.map +1 -1
- package/dist/components/IngressesAccordions/IngressesAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsAccordions.esm.js.map +1 -1
- package/dist/components/JobsAccordions/JobsDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesDrawer.esm.js.map +1 -1
- package/dist/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.esm.js.map +1 -1
- package/dist/components/Pods/PodsTable.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServiceDrawer.esm.js.map +1 -1
- package/dist/components/ServicesAccordions/ServicesAccordions.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetDrawer.esm.js.map +1 -1
- package/dist/components/StatefulSetsAccordions/StatefulSetsAccordions.esm.js.map +1 -1
- package/dist/hooks/useMatchingErrors.esm.js.map +1 -1
- package/dist/hooks/usePodMetrics.esm.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.esm.js +1 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/utils/owner.esm.js.map +1 -1
- package/dist/utils/pod.esm.js.map +1 -1
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# @backstage/plugin-kubernetes-react
|
|
2
2
|
|
|
3
|
+
## 0.5.7-next.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 599c89e: Add headlamp formatter
|
|
8
|
+
- 216c6b2: Updated dependency `@kubernetes/client-node` to `1.1.2`.
|
|
9
|
+
- 72d019d: Removed various typos
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
- @backstage/core-components@0.17.2-next.0
|
|
12
|
+
- @backstage/plugin-kubernetes-common@0.9.5-next.0
|
|
13
|
+
- @backstage/catalog-model@1.7.3
|
|
14
|
+
- @backstage/core-plugin-api@1.10.6
|
|
15
|
+
- @backstage/errors@1.2.7
|
|
16
|
+
- @backstage/types@1.2.1
|
|
17
|
+
|
|
18
|
+
## 0.5.6
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
23
|
+
|
|
24
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
25
|
+
|
|
26
|
+
- Updated dependencies
|
|
27
|
+
- @backstage/core-components@0.17.1
|
|
28
|
+
- @backstage/core-plugin-api@1.10.6
|
|
29
|
+
- @backstage/catalog-model@1.7.3
|
|
30
|
+
- @backstage/errors@1.2.7
|
|
31
|
+
- @backstage/types@1.2.1
|
|
32
|
+
- @backstage/plugin-kubernetes-common@0.9.4
|
|
33
|
+
|
|
3
34
|
## 0.5.6-next.1
|
|
4
35
|
|
|
5
36
|
### Patch Changes
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
class HeadlampClusterLinksFormatter {
|
|
2
|
+
async formatClusterLink(options) {
|
|
3
|
+
const { dashboardUrl, dashboardParameters, object, kind } = options;
|
|
4
|
+
if (!dashboardUrl && !dashboardParameters?.internal) {
|
|
5
|
+
throw new Error(
|
|
6
|
+
"Dashboard URL is required or dashboardInternal must be true"
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
const clusterName = dashboardParameters?.clusterName ?? "default";
|
|
10
|
+
const path = this.getHeadlampPath(kind, object, clusterName);
|
|
11
|
+
if (!path) {
|
|
12
|
+
throw new Error(`Could not find path for kind: ${kind}`);
|
|
13
|
+
}
|
|
14
|
+
let baseUrl;
|
|
15
|
+
if (dashboardParameters?.internal) {
|
|
16
|
+
baseUrl = new URL(window.location.origin);
|
|
17
|
+
baseUrl.pathname = dashboardParameters.headlampRoute || "/headlamp";
|
|
18
|
+
} else {
|
|
19
|
+
if (!dashboardUrl?.href) {
|
|
20
|
+
throw new Error(
|
|
21
|
+
"Dashboard URL is required when not using internal dashboard"
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
baseUrl = new URL(dashboardUrl.href);
|
|
25
|
+
}
|
|
26
|
+
baseUrl.searchParams.set("to", path);
|
|
27
|
+
return baseUrl;
|
|
28
|
+
}
|
|
29
|
+
NAMESPACED_RESOURCES = /* @__PURE__ */ new Set([
|
|
30
|
+
"pod",
|
|
31
|
+
"deployment",
|
|
32
|
+
"replicaset",
|
|
33
|
+
"statefulset",
|
|
34
|
+
"daemonset",
|
|
35
|
+
"job",
|
|
36
|
+
"cronjob",
|
|
37
|
+
"service",
|
|
38
|
+
"ingress",
|
|
39
|
+
"configmap",
|
|
40
|
+
"secret",
|
|
41
|
+
"serviceaccount",
|
|
42
|
+
"role",
|
|
43
|
+
"rolebinding",
|
|
44
|
+
"networkpolicy",
|
|
45
|
+
"horizontalpodautoscaler",
|
|
46
|
+
"poddisruptionbudget",
|
|
47
|
+
"persistentvolumeclaim"
|
|
48
|
+
]);
|
|
49
|
+
getHeadlampPath(kind, object, clusterName) {
|
|
50
|
+
const lowercaseKind = kind.toLocaleLowerCase("en-US");
|
|
51
|
+
const { name } = object.metadata ?? {};
|
|
52
|
+
let { namespace } = object.metadata ?? {};
|
|
53
|
+
if (!name) {
|
|
54
|
+
throw new Error(`Resource name is required for kind: ${kind}`);
|
|
55
|
+
}
|
|
56
|
+
if (this.NAMESPACED_RESOURCES.has(lowercaseKind) && !namespace) {
|
|
57
|
+
throw new Error(`Namespace is required for namespaced resource: ${kind}`);
|
|
58
|
+
}
|
|
59
|
+
if (!namespace) {
|
|
60
|
+
namespace = "default";
|
|
61
|
+
}
|
|
62
|
+
const pathMap = {
|
|
63
|
+
namespace: `/c/${clusterName}/namespaces/${name}`,
|
|
64
|
+
node: `/c/${clusterName}/nodes/${name}`,
|
|
65
|
+
persistentvolume: `/c/${clusterName}/storage/persistentvolumes/${name}`,
|
|
66
|
+
persistentvolumeclaim: `/c/${clusterName}/storage/persistentvolumeclaims/${namespace}/${name}`,
|
|
67
|
+
pod: `/c/${clusterName}/pods/${namespace}/${name}`,
|
|
68
|
+
deployment: `/c/${clusterName}/deployments/${namespace}/${name}`,
|
|
69
|
+
replicaset: `/c/${clusterName}/replicasets/${namespace}/${name}`,
|
|
70
|
+
statefulset: `/c/${clusterName}/statefulsets/${namespace}/${name}`,
|
|
71
|
+
daemonset: `/c/${clusterName}/daemonsets/${namespace}/${name}`,
|
|
72
|
+
job: `/c/${clusterName}/jobs/${namespace}/${name}`,
|
|
73
|
+
cronjob: `/c/${clusterName}/cronjobs/${namespace}/${name}`,
|
|
74
|
+
service: `/c/${clusterName}/services/${namespace}/${name}`,
|
|
75
|
+
ingress: `/c/${clusterName}/ingresses/${namespace}/${name}`,
|
|
76
|
+
configmap: `/c/${clusterName}/configmaps/${namespace}/${name}`,
|
|
77
|
+
secret: `/c/${clusterName}/secrets/${namespace}/${name}`,
|
|
78
|
+
serviceaccount: `/c/${clusterName}/serviceaccounts/${namespace}/${name}`,
|
|
79
|
+
role: `/c/${clusterName}/roles/${namespace}/${name}`,
|
|
80
|
+
rolebinding: `/c/${clusterName}/rolebindings/${namespace}/${name}`,
|
|
81
|
+
clusterrole: `/c/${clusterName}/clusterroles/${name}`,
|
|
82
|
+
clusterrolebinding: `/c/${clusterName}/clusterrolebindings/${name}`,
|
|
83
|
+
storageclass: `/c/${clusterName}/storage/storageclasses/${name}`,
|
|
84
|
+
networkpolicy: `/c/${clusterName}/networkpolicies/${namespace}/${name}`,
|
|
85
|
+
horizontalpodautoscaler: `/c/${clusterName}/horizontalpodautoscalers/${namespace}/${name}`,
|
|
86
|
+
poddisruptionbudget: `/c/${clusterName}/poddisruptionbudgets/${namespace}/${name}`,
|
|
87
|
+
customresourcedefinition: `/c/${clusterName}/customresourcedefinitions/${name}`
|
|
88
|
+
};
|
|
89
|
+
return pathMap[lowercaseKind] ?? "";
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export { HeadlampClusterLinksFormatter };
|
|
94
|
+
//# sourceMappingURL=HeadlampClusterLinksFormatter.esm.js.map
|
|
@@ -0,0 +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.toLocaleLowerCase('en-US');\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,6BAA+D,CAAA;AAAA,EAC1E,MAAM,kBAAkB,OAAqD,EAAA;AAC3E,IAAA,MAAM,EAAE,YAAA,EAAc,mBAAqB,EAAA,MAAA,EAAQ,MAAS,GAAA,OAAA;AAE5D,IAAA,IAAI,CAAC,YAAA,IAAgB,CAAC,mBAAA,EAAqB,QAAU,EAAA;AACnD,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AAA,wBAAA,EAA2B,IAAI,CAAA,CAAA;AAAA,MAC9D,eAAe,CAAM,GAAA,EAAA,WAAW,CAAoB,iBAAA,EAAA,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MACrE,yBAAyB,CAAM,GAAA,EAAA,WAAW,CAA6B,0BAAA,EAAA,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MACxF,qBAAqB,CAAM,GAAA,EAAA,WAAW,CAAyB,sBAAA,EAAA,SAAS,IAAI,IAAI,CAAA,CAAA;AAAA,MAChF,wBAA0B,EAAA,CAAA,GAAA,EAAM,WAAW,CAAA,2BAAA,EAA8B,IAAI,CAAA;AAAA,KAC/E;AAEA,IAAO,OAAA,OAAA,CAAQ,aAAa,CAAK,IAAA,EAAA;AAAA;AAErC;;;;"}
|
|
@@ -4,6 +4,7 @@ import { GkeClusterLinksFormatter } from './GkeClusterLinksFormatter.esm.js';
|
|
|
4
4
|
import { StandardClusterLinksFormatter } from './StandardClusterLinksFormatter.esm.js';
|
|
5
5
|
import { OpenshiftClusterLinksFormatter } from './OpenshiftClusterLinksFormatter.esm.js';
|
|
6
6
|
import { RancherClusterLinksFormatter } from './RancherClusterLinksFormatter.esm.js';
|
|
7
|
+
import { HeadlampClusterLinksFormatter } from './HeadlampClusterLinksFormatter.esm.js';
|
|
7
8
|
|
|
8
9
|
const DEFAULT_FORMATTER_NAME = "standard";
|
|
9
10
|
function getDefaultFormatters(deps) {
|
|
@@ -13,9 +14,10 @@ function getDefaultFormatters(deps) {
|
|
|
13
14
|
eks: new EksClusterLinksFormatter(),
|
|
14
15
|
gke: new GkeClusterLinksFormatter(deps.googleAuthApi),
|
|
15
16
|
openshift: new OpenshiftClusterLinksFormatter(),
|
|
16
|
-
rancher: new RancherClusterLinksFormatter()
|
|
17
|
+
rancher: new RancherClusterLinksFormatter(),
|
|
18
|
+
headlamp: new HeadlampClusterLinksFormatter()
|
|
17
19
|
};
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
export { AksClusterLinksFormatter, DEFAULT_FORMATTER_NAME, EksClusterLinksFormatter, GkeClusterLinksFormatter, OpenshiftClusterLinksFormatter, RancherClusterLinksFormatter, StandardClusterLinksFormatter, getDefaultFormatters };
|
|
22
|
+
export { AksClusterLinksFormatter, DEFAULT_FORMATTER_NAME, EksClusterLinksFormatter, GkeClusterLinksFormatter, HeadlampClusterLinksFormatter, OpenshiftClusterLinksFormatter, RancherClusterLinksFormatter, StandardClusterLinksFormatter, getDefaultFormatters };
|
|
21
23
|
//# sourceMappingURL=index.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/api/formatters/index.ts"],"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 { AksClusterLinksFormatter } from './AksClusterLinksFormatter';\nimport { ClusterLinksFormatter } from '../../types';\nimport { EksClusterLinksFormatter } from './EksClusterLinksFormatter';\nimport { GkeClusterLinksFormatter } from './GkeClusterLinksFormatter';\nimport { StandardClusterLinksFormatter } from './StandardClusterLinksFormatter';\nimport { OpenshiftClusterLinksFormatter } from './OpenshiftClusterLinksFormatter';\nimport { RancherClusterLinksFormatter } from './RancherClusterLinksFormatter';\nimport { ProfileInfoApi } from '@backstage/core-plugin-api';\n\nexport {\n StandardClusterLinksFormatter,\n AksClusterLinksFormatter,\n EksClusterLinksFormatter,\n GkeClusterLinksFormatter,\n OpenshiftClusterLinksFormatter,\n RancherClusterLinksFormatter,\n};\n\n/** @public */\nexport const DEFAULT_FORMATTER_NAME = 'standard';\n\n/** @public */\nexport function getDefaultFormatters(deps: {\n googleAuthApi: ProfileInfoApi;\n}): Record<string, ClusterLinksFormatter> {\n return {\n standard: new StandardClusterLinksFormatter(),\n aks: new AksClusterLinksFormatter(),\n eks: new EksClusterLinksFormatter(),\n gke: new GkeClusterLinksFormatter(deps.googleAuthApi),\n openshift: new OpenshiftClusterLinksFormatter(),\n rancher: new RancherClusterLinksFormatter(),\n };\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/api/formatters/index.ts"],"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 { AksClusterLinksFormatter } from './AksClusterLinksFormatter';\nimport { ClusterLinksFormatter } from '../../types';\nimport { EksClusterLinksFormatter } from './EksClusterLinksFormatter';\nimport { GkeClusterLinksFormatter } from './GkeClusterLinksFormatter';\nimport { StandardClusterLinksFormatter } from './StandardClusterLinksFormatter';\nimport { OpenshiftClusterLinksFormatter } from './OpenshiftClusterLinksFormatter';\nimport { RancherClusterLinksFormatter } from './RancherClusterLinksFormatter';\nimport { HeadlampClusterLinksFormatter } from './HeadlampClusterLinksFormatter';\nimport { ProfileInfoApi } from '@backstage/core-plugin-api';\n\nexport {\n StandardClusterLinksFormatter,\n AksClusterLinksFormatter,\n EksClusterLinksFormatter,\n GkeClusterLinksFormatter,\n OpenshiftClusterLinksFormatter,\n RancherClusterLinksFormatter,\n HeadlampClusterLinksFormatter,\n};\n\n/** @public */\nexport const DEFAULT_FORMATTER_NAME = 'standard';\n\n/** @public */\nexport function getDefaultFormatters(deps: {\n googleAuthApi: ProfileInfoApi;\n}): Record<string, ClusterLinksFormatter> {\n return {\n standard: new StandardClusterLinksFormatter(),\n aks: new AksClusterLinksFormatter(),\n eks: new EksClusterLinksFormatter(),\n gke: new GkeClusterLinksFormatter(deps.googleAuthApi),\n openshift: new OpenshiftClusterLinksFormatter(),\n rancher: new RancherClusterLinksFormatter(),\n headlamp: new HeadlampClusterLinksFormatter(),\n };\n}\n"],"names":[],"mappings":";;;;;;;;AAqCO,MAAM,sBAAyB,GAAA;AAG/B,SAAS,qBAAqB,IAEK,EAAA;AACxC,EAAO,OAAA;AAAA,IACL,QAAA,EAAU,IAAI,6BAA8B,EAAA;AAAA,IAC5C,GAAA,EAAK,IAAI,wBAAyB,EAAA;AAAA,IAClC,GAAA,EAAK,IAAI,wBAAyB,EAAA;AAAA,IAClC,GAAK,EAAA,IAAI,wBAAyB,CAAA,IAAA,CAAK,aAAa,CAAA;AAAA,IACpD,SAAA,EAAW,IAAI,8BAA+B,EAAA;AAAA,IAC9C,OAAA,EAAS,IAAI,4BAA6B,EAAA;AAAA,IAC1C,QAAA,EAAU,IAAI,6BAA8B;AAAA,GAC9C;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJobsAccordions.esm.js","sources":["../../../src/components/CronJobsAccordions/CronJobsAccordions.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 */\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1CronJob, V1Job } from '@kubernetes/client-node';\nimport { JobsAccordions } from '../JobsAccordions';\nimport { CronJobDrawer } from './CronJobsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { humanizeCron } from '../../utils/crons';\n\n/**\n *\n *\n * @public\n */\nexport type CronJobsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype CronJobAccordionProps = {\n cronJob: V1CronJob;\n ownedJobs: V1Job[];\n children?: ReactNode;\n};\n\ntype CronJobSummaryProps = {\n cronJob: V1CronJob;\n children?: ReactNode;\n};\n\nconst CronJobSummary = ({ cronJob }: CronJobSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <CronJobDrawer cronJob={cronJob} />\n </Grid>\n <Grid\n item\n container\n xs={6}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n {cronJob.spec?.suspend ? (\n <StatusError>Suspended</StatusError>\n ) : (\n <StatusOK>Active</StatusOK>\n )}\n </Grid>\n <Grid item>\n <Typography variant=\"body1\">\n Schedule:{' '}\n {cronJob.spec?.schedule\n ? `${cronJob.spec.schedule} (${humanizeCron(\n cronJob.spec.schedule,\n )})`\n : 'N/A'}\n </Typography>\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst CronJobAccordion = ({ cronJob, ownedJobs }: CronJobAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <CronJobSummary cronJob={cronJob} />\n </AccordionSummary>\n <AccordionDetails>\n <JobsAccordions jobs={ownedJobs.reverse()} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const CronJobsAccordions = ({}: CronJobsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.cronJobs.map((cronJob, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <CronJobAccordion\n ownedJobs={getOwnedResources(cronJob, groupedResponses.jobs)}\n cronJob={cronJob}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,SAAkB,CACnC,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EAAA,IAAA;AAAA,YACT,EAAI,EAAA,CAAA;AAAA,YACJ,SAAU,EAAA,QAAA;AAAA,YACV,cAAe,EAAA,YAAA;AAAA,YACf,UAAW,EAAA,UAAA;AAAA,YACX,OAAS,EAAA,CAAA;AAAA,YAET,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACP,EAAA,QAAA,EAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,mBACZ,GAA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AA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,QAAS,CAAA,GAAA,CAAI,CAAC,OAAS,EAAA,CAAA,yBACtC,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,iBAAA,CAAkB,OAAS,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC3D;AAAA;AAAA,OACF,EACF,CANwB,EAAA,EAAA,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CronJobsAccordions.esm.js","sources":["../../../src/components/CronJobsAccordions/CronJobsAccordions.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 */\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1CronJob, V1Job } from '@kubernetes/client-node';\nimport { JobsAccordions } from '../JobsAccordions';\nimport { CronJobDrawer } from './CronJobsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { humanizeCron } from '../../utils/crons';\n\n/**\n *\n *\n * @public\n */\nexport type CronJobsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype CronJobAccordionProps = {\n cronJob: V1CronJob;\n ownedJobs: V1Job[];\n children?: ReactNode;\n};\n\ntype CronJobSummaryProps = {\n cronJob: V1CronJob;\n children?: ReactNode;\n};\n\nconst CronJobSummary = ({ cronJob }: CronJobSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <CronJobDrawer cronJob={cronJob} />\n </Grid>\n <Grid\n item\n container\n xs={6}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n {cronJob.spec?.suspend ? (\n <StatusError>Suspended</StatusError>\n ) : (\n <StatusOK>Active</StatusOK>\n )}\n </Grid>\n <Grid item>\n <Typography variant=\"body1\">\n Schedule:{' '}\n {cronJob.spec?.schedule\n ? `${cronJob.spec.schedule} (${humanizeCron(\n cronJob.spec.schedule,\n )})`\n : 'N/A'}\n </Typography>\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst CronJobAccordion = ({ cronJob, ownedJobs }: CronJobAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <CronJobSummary cronJob={cronJob} />\n </AccordionSummary>\n <AccordionDetails>\n <JobsAccordions jobs={ownedJobs.reverse()} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const CronJobsAccordions = ({}: CronJobsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.cronJobs.map((cronJob, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <CronJobAccordion\n ownedJobs={getOwnedResources(cronJob, groupedResponses.jobs)}\n cronJob={cronJob}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,SAAkB,CACnC,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EAAA,IAAA;AAAA,YACT,EAAI,EAAA,CAAA;AAAA,YACJ,SAAU,EAAA,QAAA;AAAA,YACV,cAAe,EAAA,YAAA;AAAA,YACf,UAAW,EAAA,UAAA;AAAA,YACX,OAAS,EAAA,CAAA;AAAA,YAET,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACP,EAAA,QAAA,EAAA,OAAA,CAAQ,IAAM,EAAA,OAAA,mBACZ,GAAA,CAAA,WAAA,EAAA,EAAY,QAAS,EAAA,WAAA,EAAA,CAAA,mBAErB,GAAA,CAAA,QAAA,EAAA,EAAS,oBAAM,CAEpB,EAAA,CAAA;AAAA,kCACC,IAAK,EAAA,EAAA,IAAA,EAAI,MACR,QAAC,kBAAA,IAAA,CAAA,UAAA,EAAA,EAAW,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EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,iBAAA,CAAkB,OAAS,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC3D;AAAA;AAAA,OACF,EACF,CANwB,EAAA,EAAA,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CronJobsDrawer.esm.js","sources":["../../../src/components/CronJobsAccordions/CronJobsDrawer.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 */\nimport { V1CronJob } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const CronJobDrawer = ({\n cronJob,\n expanded,\n}: {\n cronJob: V1CronJob;\n expanded?: boolean;\n}) => {\n const namespace = cronJob.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={cronJob}\n expanded={expanded}\n kind=\"CronJob\"\n renderObject={(cronJobObj: V1CronJob) => ({\n schedule: cronJobObj.spec?.schedule ?? '???',\n startingDeadlineSeconds:\n cronJobObj.spec?.startingDeadlineSeconds ?? '???',\n concurrencyPolicy: cronJobObj.spec?.concurrencyPolicy ?? '???',\n lastScheduleTime: cronJobObj.status?.lastScheduleTime ?? '???',\n })}\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 {cronJob.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n CronJob\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,UAA2B,MAAA;AAAA,QACxC,QAAA,EAAU,UAAW,CAAA,IAAA,EAAM,QAAY,IAAA,KAAA;AAAA,QACvC,uBAAA,EACE,UAAW,CAAA,IAAA,EAAM,uBAA2B,IAAA,KAAA;AAAA,QAC9C,iBAAA,EAAmB,UAAW,CAAA,IAAA,EAAM,iBAAqB,IAAA,KAAA;AAAA,QACzD,gBAAA,EAAkB,UAAW,CAAA,MAAA,EAAQ,gBAAoB,IAAA;AAAA,OAC3D,CAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"CronJobsDrawer.esm.js","sources":["../../../src/components/CronJobsAccordions/CronJobsDrawer.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 */\nimport type { V1CronJob } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const CronJobDrawer = ({\n cronJob,\n expanded,\n}: {\n cronJob: V1CronJob;\n expanded?: boolean;\n}) => {\n const namespace = cronJob.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={cronJob}\n expanded={expanded}\n kind=\"CronJob\"\n renderObject={(cronJobObj: V1CronJob) => ({\n schedule: cronJobObj.spec?.schedule ?? '???',\n startingDeadlineSeconds:\n cronJobObj.spec?.startingDeadlineSeconds ?? '???',\n concurrencyPolicy: cronJobObj.spec?.concurrencyPolicy ?? '???',\n lastScheduleTime: cronJobObj.status?.lastScheduleTime ?? '???',\n })}\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 {cronJob.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n CronJob\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAqBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,UAA2B,MAAA;AAAA,QACxC,QAAA,EAAU,UAAW,CAAA,IAAA,EAAM,QAAY,IAAA,KAAA;AAAA,QACvC,uBAAA,EACE,UAAW,CAAA,IAAA,EAAM,uBAA2B,IAAA,KAAA;AAAA,QAC9C,iBAAA,EAAmB,UAAW,CAAA,IAAA,EAAM,iBAAqB,IAAA,KAAA;AAAA,QACzD,gBAAA,EAAkB,UAAW,CAAA,MAAA,EAAQ,gBAAoB,IAAA;AAAA,OAC3D,CAAA;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAA,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA;AAAA,KACZ;AAAA,IAEA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,CAAA;AAAA,sBACjB,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAY,QAAO,EAAA,SAAA,EAAA;AAAA;AAAA;AACzC,CAAA;AAGF,MAAM,kBAAqB,GAAA,CAAC,OAC1B,KAAA,OAAA,CAAQ,QAAQ,UAAY,EAAA,IAAA;AAAA,EAC1B,CAAC,MACC,CAAE,CAAA,IAAA,KAAS,iBACX,CAAE,CAAA,MAAA,KAAW,OACb,IAAA,CAAA,CAAE,MAAW,KAAA;AACjB,CAAG,EAAA,OAAA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S,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,eAAA;AAAA,UACA,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,QAAQ,QAAU,EAAA,IAAA;AAAA,cACxB,SAAA,EAAW,QAAQ,QAAU,EAAA,SAAA;AAAA,cAC7B,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,8BAAA;AAAA,YACT,OAAA;AAAA,YACA,gBAAiB,CAAA,WAAA;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAnBwB,EAAA,EAAA,CAoB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"Rollout.esm.js","sources":["../../../../src/components/CustomResources/ArgoRollouts/Rollout.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Pod, V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { PodsTable } from '../../Pods';\nimport { HorizontalPodAutoscalerDrawer } from '../../HorizontalPodAutoscalers';\nimport { RolloutDrawer } from './RolloutDrawer';\nimport PauseIcon from '@material-ui/icons/Pause';\nimport ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';\nimport { DateTime } from 'luxon';\nimport { StepsProgress } from './StepsProgress';\nimport {\n PodNamesWithErrorsContext,\n GroupedResponsesContext,\n} from '../../../hooks';\nimport {\n getMatchingHpa,\n getOwnedPodsThroughReplicaSets,\n} from '../../../utils/owner';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../../Pods/PodsTable';\n\ntype RolloutAccordionsProps = {\n rollouts: any[];\n defaultExpanded?: boolean;\n children?: ReactNode;\n};\n\ntype RolloutAccordionProps = {\n rollout: any;\n ownedPods: V1Pod[];\n defaultExpanded?: boolean;\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype RolloutSummaryProps = {\n rollout: any;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst AbortedTitle = (\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <ErrorOutlineIcon />\n <Typography variant=\"subtitle1\">Aborted</Typography>\n </div>\n);\n\nconst findAbortedMessage = (rollout: any): string | undefined =>\n rollout.status?.conditions?.find(\n (c: any) =>\n c.type === 'Progressing' &&\n c.status === 'False' &&\n c.reason === 'RolloutAborted',\n )?.message;\n\nconst RolloutSummary = ({\n rollout,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: RolloutSummaryProps) => {\n const pauseTime: string | undefined = rollout.status?.pauseConditions?.find(\n (p: any) => p.reason === 'CanaryPauseStep',\n )?.startTime;\n const abortedMessage = findAbortedMessage(rollout);\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <RolloutDrawer rollout={rollout} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n {pauseTime && (\n <Grid item xs={3}>\n <div\n style={{\n display: 'flex',\n alignItems: 'center',\n flexWrap: 'wrap',\n }}\n >\n <PauseIcon />\n <Typography variant=\"subtitle1\">\n Paused ({DateTime.fromISO(pauseTime).toRelative({ locale: 'en' })}\n )\n </Typography>\n </div>\n </Grid>\n )}\n {abortedMessage && (\n <Grid item xs={3}>\n {AbortedTitle}\n </Grid>\n )}\n </Grid>\n );\n};\n\nconst RolloutAccordion = ({\n rollout,\n ownedPods,\n matchingHpa,\n defaultExpanded,\n}: RolloutAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n const currentStepIndex = rollout.status?.currentStepIndex ?? 0;\n const abortedMessage = findAbortedMessage(rollout);\n\n return (\n <Accordion\n defaultExpanded={defaultExpanded}\n TransitionProps={{ unmountOnExit: true }}\n variant=\"outlined\"\n >\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <RolloutSummary\n rollout={rollout}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <div style={{ width: '100%' }}>\n <div>\n <Typography variant=\"h6\">Rollout status</Typography>\n </div>\n <div style={{ margin: '1rem' }}>\n {abortedMessage && (\n <>\n {AbortedTitle}\n <Typography variant=\"subtitle2\">{abortedMessage}</Typography>\n </>\n )}\n <StepsProgress\n aborted={abortedMessage !== undefined}\n steps={rollout.spec?.strategy?.canary?.steps ?? []}\n currentStepIndex={currentStepIndex}\n />\n </div>\n <div>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </div>\n </div>\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const RolloutAccordions = ({\n rollouts,\n defaultExpanded = false,\n}: RolloutAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {rollouts.map((rollout, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <RolloutAccordion\n defaultExpanded={defaultExpanded}\n matchingHpa={getMatchingHpa(\n {\n name: rollout.metadata?.name,\n namespace: rollout.metadata?.namespace,\n kind: 'rollout',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n rollout,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n rollout={rollout}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgEA,MAAM,YACJ,mBAAA,IAAA;AAAA,EAAC,KAAA;AAAA,EAAA;AAAA,IACC,KAAO,EAAA;AAAA,MACL,OAAS,EAAA,MAAA;AAAA,MACT,UAAY,EAAA,QAAA;AAAA,MACZ,QAAU,EAAA;AAAA,KACZ;AAAA,IAEA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,gBAAiB,EAAA,EAAA,CAAA;AAAA,sBACjB,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,WAAA,EAAY,QAAO,EAAA,SAAA,EAAA;AAAA;AAAA;AACzC,CAAA;AAGF,MAAM,kBAAqB,GAAA,CAAC,OAC1B,KAAA,OAAA,CAAQ,QAAQ,UAAY,EAAA,IAAA;AAAA,EAC1B,CAAC,MACC,CAAE,CAAA,IAAA,KAAS,iBACX,CAAE,CAAA,MAAA,KAAW,OACb,IAAA,CAAA,CAAE,MAAW,KAAA;AACjB,CAAG,EAAA,OAAA;AAEL,MAAM,iBAAiB,CAAC;AAAA,EACtB,OAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA2B,KAAA;AACzB,EAAM,MAAA,SAAA,GAAgC,OAAQ,CAAA,MAAA,EAAQ,eAAiB,EAAA,IAAA;AAAA,IACrE,CAAC,CAAW,KAAA,CAAA,CAAE,MAAW,KAAA;AAAA,GACxB,EAAA,SAAA;AACH,EAAM,MAAA,cAAA,GAAiB,mBAAmB,OAAO,CAAA;AACjD,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,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,WACnB;AAAA,UACA,SAAW,EAAA,8BAAA;AAAA,YACT,OAAA;AAAA,YACA,gBAAiB,CAAA,WAAA;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAnBwB,EAAA,EAAA,CAoB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaemonSetsAccordions.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Pod, V1DaemonSet } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DaemonSetDrawer } from './DaemonSetsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DaemonSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DaemonSetAccordionProps = {\n daemonset: V1DaemonSet;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype DaemonSetSummaryProps = {\n daemonset: V1DaemonSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n children?: ReactNode;\n};\n\nconst DaemonSetSummary = ({\n daemonset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n}: DaemonSetSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DaemonSetDrawer daemonset={daemonset} />\n </Grid>\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DaemonSetAccordion = ({\n daemonset,\n ownedPods,\n}: DaemonSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DaemonSetSummary\n daemonset={daemonset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DaemonSetsAccordions = ({}: DaemonSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.daemonSets.map((daemonset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DaemonSetAccordion\n ownedPods={getOwnedResources(daemonset, groupedResponses.pods)}\n daemonset={daemonset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,mBAAmB,CAAC;AAAA,EACxB,SAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,WAAsB,CACzC,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EAAA,IAAA;AAAA,YACT,EAAI,EAAA,CAAA;AAAA,YACJ,SAAU,EAAA,QAAA;AAAA,YACV,cAAe,EAAA,YAAA;AAAA,YACf,UAAW,EAAA,UAAA;AAAA,YACX,OAAS,EAAA,CAAA;AAAA,YAET,QAAA,EAAA;AAAA,8BAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,IAAA,CAAC,QAAU,EAAA,EAAA,QAAA,EAAA;AAAA,gBAAA,mBAAA;AAAA,gBAAoB;AAAA,eAAA,EAAK,CACtC,EAAA,CAAA;AAAA,kCACC,IAAK,EAAA,EAAA,IAAA,EAAI,MACP,QAAyB,EAAA,s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ACrE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,UAAW,CAAA,GAAA,CAAI,CAAC,SAAW,EAAA,CAAA,yBAC1C,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,iBAAA,CAAkB,SAAW,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC7D;AAAA;AAAA,OACF,EACF,CANwB,EAAA,EAAA,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DaemonSetsAccordions.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Pod, V1DaemonSet } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DaemonSetDrawer } from './DaemonSetsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DaemonSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DaemonSetAccordionProps = {\n daemonset: V1DaemonSet;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype DaemonSetSummaryProps = {\n daemonset: V1DaemonSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n children?: ReactNode;\n};\n\nconst DaemonSetSummary = ({\n daemonset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n}: DaemonSetSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DaemonSetDrawer daemonset={daemonset} />\n </Grid>\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DaemonSetAccordion = ({\n daemonset,\n ownedPods,\n}: DaemonSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DaemonSetSummary\n daemonset={daemonset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DaemonSetsAccordions = ({}: DaemonSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.daemonSets.map((daemonset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DaemonSetAccordion\n ownedPods={getOwnedResources(daemonset, groupedResponses.pods)}\n daemonset={daemonset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDA,MAAM,mBAAmB,CAAC;AAAA,EACxB,SAAA;AAAA,EACA,mBAAA;AAAA,EACA;AACF,CAA6B,KAAA;AAC3B,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,eAAA,EAAA,EAAgB,WAAsB,CACzC,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EA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*\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 { V1DaemonSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DaemonSetDrawer = ({\n daemonset,\n expanded,\n}: {\n daemonset: V1DaemonSet;\n expanded?: boolean;\n}) => {\n const namespace = daemonset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={daemonset}\n expanded={expanded}\n kind=\"DaemonSet\"\n renderObject={(daemonsetObj: V1DaemonSet) => {\n return {\n updateStrategyType: daemonsetObj.spec?.updateStrategy?.type ?? '???',\n minReadySeconds: daemonsetObj.spec?.minReadySeconds ?? '???',\n revisionHistoryLimit:\n daemonsetObj.spec?.revisionHistoryLimit ?? '???',\n currentNumberScheduled:\n daemonsetObj.status?.currentNumberScheduled ?? '???',\n desiredNumberScheduled:\n daemonsetObj.status?.desiredNumberScheduled ?? '???',\n numberAvailable: daemonsetObj.status?.numberAvailable ?? '???',\n numberMisscheduled: daemonsetObj.status?.numberMisscheduled ?? '???',\n numberReady: daemonsetObj.status?.numberReady ?? '???',\n };\n }}\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 {daemonset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n DaemonSet\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,UAAU,QAAU,EAAA,SAAA;AACtC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,SAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,WAAA;AAAA,MACL,YAAA,EAAc,CAAC,YAA8B,KAAA;AAC3C,QAAO,OAAA;AAAA,UACL,kBAAoB,EAAA,YAAA,CAAa,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,KAAA;AAAA,UAC/D,eAAA,EAAiB,YAAa,CAAA,IAAA,EAAM,eAAmB,IAAA,KAAA;AAAA,UACvD,oBAAA,EACE,YAAa,CAAA,IAAA,EAAM,oBAAwB,IAAA,KAAA;AAAA,UAC7C,sBAAA,EACE,YAAa,CAAA,MAAA,EAAQ,sBAA0B,IAAA,KAAA;AAAA,UACjD,sBAAA,EACE,YAAa,CAAA,MAAA,EAAQ,sBAA0B,IAAA,KAAA;AAAA,UACjD,eAAA,EAAiB,YAAa,CAAA,MAAA,EAAQ,eAAmB,IAAA,KAAA;AAAA,UACzD,kBAAA,EAAoB,YAAa,CAAA,MAAA,EAAQ,kBAAsB,IAAA,KAAA;AAAA,UAC/D,WAAA,EAAa,YAAa,CAAA,MAAA,EAAQ,WAAe,IAAA;AAAA,SACnD;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAU,EAAA,SAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC/B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,WAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DaemonSetsDrawer.esm.js","sources":["../../../src/components/DaemonSetsAccordions/DaemonSetsDrawer.tsx"],"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 type { V1DaemonSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DaemonSetDrawer = ({\n daemonset,\n expanded,\n}: {\n daemonset: V1DaemonSet;\n expanded?: boolean;\n}) => {\n const namespace = daemonset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={daemonset}\n expanded={expanded}\n kind=\"DaemonSet\"\n renderObject={(daemonsetObj: V1DaemonSet) => {\n return {\n updateStrategyType: daemonsetObj.spec?.updateStrategy?.type ?? '???',\n minReadySeconds: daemonsetObj.spec?.minReadySeconds ?? '???',\n revisionHistoryLimit:\n daemonsetObj.spec?.revisionHistoryLimit ?? '???',\n currentNumberScheduled:\n daemonsetObj.status?.currentNumberScheduled ?? '???',\n desiredNumberScheduled:\n daemonsetObj.status?.desiredNumberScheduled ?? '???',\n numberAvailable: daemonsetObj.status?.numberAvailable ?? '???',\n numberMisscheduled: daemonsetObj.status?.numberMisscheduled ?? '???',\n numberReady: daemonsetObj.status?.numberReady ?? '???',\n };\n }}\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 {daemonset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n DaemonSet\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,kBAAkB,CAAC;AAAA,EAC9B,SAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,UAAU,QAAU,EAAA,SAAA;AACtC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,SAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,E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EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,WAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentDrawer.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentDrawer.tsx"],"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 { ReactNode } from 'react';\nimport { V1Deployment } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DeploymentDrawer = ({\n deployment,\n expanded,\n}: {\n deployment: V1Deployment;\n expanded?: boolean;\n}) => {\n const namespace = deployment.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={deployment}\n expanded={expanded}\n kind=\"Deployment\"\n renderObject={(deploymentObj: V1Deployment) => {\n const conditions = (deploymentObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n strategy: deploymentObj.spec?.strategy ?? '???',\n minReadySeconds: deploymentObj.spec?.minReadySeconds ?? '???',\n progressDeadlineSeconds:\n deploymentObj.spec?.progressDeadlineSeconds ?? '???',\n ...conditions,\n };\n }}\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 {deployment.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Deployment\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB,CAAC;AAAA,EAC/B,UAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,WAAW,QAAU,EAAA,SAAA;AACvC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,UAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,YAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAAgC,KAAA;AAC7C,QAAA,MAAM,UAAc,GAAA,CAAA,aAAA,CAAc,MAAQ,EAAA,UAAA,IAAc,EAAC,EACtD,GAAI,CAAA,eAAe,CACnB,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,IAAS,KAAA;AACvB,UAAA,KAAA,CAAM,IAAK,CAAA,CAAC,CAAC,CAAA,GAAI,KAAK,CAAC,CAAA;AACvB,UAAO,OAAA,KAAA;AAAA,SACT,EAAG,EAAkC,CAAA;AAEvC,QAAO,OAAA;AAAA,UACL,QAAA,EAAU,aAAc,CAAA,IAAA,EAAM,QAAY,IAAA,KAAA;AAAA,UAC1C,eAAA,EAAiB,aAAc,CAAA,IAAA,EAAM,eAAmB,IAAA,KAAA;AAAA,UACxD,uBAAA,EACE,aAAc,CAAA,IAAA,EAAM,uBAA2B,IAAA,KAAA;AAAA,UACjD,GAAG;AAAA,SACL;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAW,EAAA,UAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAChC,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,YAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DeploymentDrawer.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentDrawer.tsx"],"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 { ReactNode } from 'react';\nimport type { V1Deployment } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const DeploymentDrawer = ({\n deployment,\n expanded,\n}: {\n deployment: V1Deployment;\n expanded?: boolean;\n}) => {\n const namespace = deployment.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={deployment}\n expanded={expanded}\n kind=\"Deployment\"\n renderObject={(deploymentObj: V1Deployment) => {\n const conditions = (deploymentObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n strategy: deploymentObj.spec?.strategy ?? '???',\n minReadySeconds: deploymentObj.spec?.minReadySeconds ?? '???',\n progressDeadlineSeconds:\n deploymentObj.spec?.progressDeadlineSeconds ?? '???',\n ...conditions,\n };\n }}\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 {deployment.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Deployment\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,mBAAmB,CAAC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Q,IAAA,gBAAA,EAChC,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,YAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA8B,KAAA;AAC5B,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,gBAAA,EAAA,EAAiB,YAAwB,CAC5C,EAAA,CAAA;AAAA,QACC,GAAA,wBACE,IAAK,EAAA,EAAA,IAAA,EAAI,MAAC,EAAI,EAAA,CAAA,EACb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;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAlBwB,EAAA,EAAA,CAmB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"DeploymentsAccordions.esm.js","sources":["../../../src/components/DeploymentsAccordions/DeploymentsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n V1Deployment,\n V1Pod,\n V2HorizontalPodAutoscaler,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { DeploymentDrawer } from './DeploymentDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport {\n getOwnedPodsThroughReplicaSets,\n getMatchingHpa,\n} from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype DeploymentsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype DeploymentAccordionProps = {\n deployment: V1Deployment;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype DeploymentSummaryProps = {\n deployment: V1Deployment;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst DeploymentSummary = ({\n deployment,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: DeploymentSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={4} item>\n <DeploymentDrawer deployment={deployment} />\n </Grid>\n {hpa && (\n <Grid item xs={4}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={4}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst DeploymentAccordion = ({\n deployment,\n ownedPods,\n matchingHpa,\n}: DeploymentAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <DeploymentSummary\n deployment={deployment}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const DeploymentsAccordions = ({}: DeploymentsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.deployments.map((deployment, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <DeploymentAccordion\n matchingHpa={getMatchingHpa(\n {\n name: deployment.metadata?.name,\n namespace: deployment.metadata?.namespace,\n kind: 'deployment',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedPodsThroughReplicaSets(\n deployment,\n groupedResponses.replicaSets,\n groupedResponses.pods,\n )}\n deployment={deployment}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,MAAM,oBAAoB,CAAC;AAAA,EACzB,UAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA8B,KAAA;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EAAA,CAAA;AAEJ,CAAA;AAEa,MAAA,qBAAA,GAAwB,CAAC,EAAmC,KAAA;AACvE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,WAAY,CAAA,GAAA,CAAI,CAAC,UAAY,EAAA,CAAA,yBAC5C,IAAK,EAAA,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,mBAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,WAAW,QAAU,EAAA,IAAA;AAAA,cAC3B,SAAA,EAAW,WAAW,QAAU,EAAA,SAAA;AAAA,cAChC,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,8BAAA;AAAA,YACT,UAAA;AAAA,YACA,gBAAiB,CAAA,WAAA;AAAA,YACjB,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA;AAAA;AAAA,OACF,EACF,CAlBwB,EAAA,EAAA,CAmB1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.tsx"],"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 { ReactNode } from 'react';\nimport { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBa,MAAA,6BAAA,GAAgC,CAAC,KAIxC,KAAA;AACJ,EAAA,MAAM,EAAE,GAAA,EAAK,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAEpC,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,yBAAA;AAAA,MACL,MAAQ,EAAA,GAAA;AAAA,MACR,QAAA;AAAA,MACA,YAAA,EAAc,CAAC,SAAyC,KAAA;AACtD,QAAO,OAAA;AAAA,UACL,8BAAgC,EAAA,WAAA;AAAA,UAChC,+BAAiC,EAAA,OAAA;AAAA,UACjC,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,aAAA,EAAe,KAAK,MAAQ,EAAA;AAAA,SAC9B;AAAA,OACF;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"HorizontalPodAutoscalerDrawer.esm.js","sources":["../../../src/components/HorizontalPodAutoscalers/HorizontalPodAutoscalerDrawer.tsx"],"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 { ReactNode } from 'react';\nimport type { V2HorizontalPodAutoscaler } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\n\n/** @public */\nexport const HorizontalPodAutoscalerDrawer = (props: {\n hpa: V2HorizontalPodAutoscaler;\n expanded?: boolean;\n children?: ReactNode;\n}) => {\n const { hpa, expanded, children } = props;\n\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <KubernetesStructuredMetadataTableDrawer\n kind=\"HorizontalPodAutoscaler\"\n object={hpa}\n expanded={expanded}\n renderObject={(hpaObject: V2HorizontalPodAutoscaler) => {\n return {\n targetCPUUtilizationPercentage: specCpuUtil,\n currentCPUUtilizationPercentage: cpuUtil,\n minReplicas: hpaObject.spec?.minReplicas,\n maxReplicas: hpaObject.spec?.maxReplicas,\n currentReplicas: hpaObject.status?.currentReplicas,\n desiredReplicas: hpaObject.status?.desiredReplicas,\n lastScaleTime: hpa?.status?.lastScaleTime,\n };\n }}\n >\n {children}\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAqBa,MAAA,6BAAA,GAAgC,CAAC,KAIxC,KAAA;AACJ,EAAA,MAAM,EAAE,GAAA,EAAK,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA;AAEpC,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,IAAK,EAAA,yBAAA;AAAA,MACL,MAAQ,EAAA,GAAA;AAAA,MACR,QAAA;AAAA,MACA,YAAA,EAAc,CAAC,SAAyC,KAAA;AACtD,QAAO,OAAA;AAAA,UACL,8BAAgC,EAAA,WAAA;AAAA,UAChC,+BAAiC,EAAA,OAAA;AAAA,UACjC,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,WAAA,EAAa,UAAU,IAAM,EAAA,WAAA;AAAA,UAC7B,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,eAAA,EAAiB,UAAU,MAAQ,EAAA,eAAA;AAAA,UACnC,aAAA,EAAe,KAAK,MAAQ,EAAA;AAAA,SAC9B;AAAA,OACF;AAAA,MAEC;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.tsx"],"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 { V1Ingress } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const IngressDrawer = ({\n ingress,\n expanded,\n}: {\n ingress: V1Ingress;\n expanded?: boolean;\n}) => {\n const namespace = ingress.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={ingress}\n expanded={expanded}\n kind=\"Ingress\"\n renderObject={(ingressObject: V1Ingress) => {\n return ingressObject.spec || {};\n }}\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 {ingress.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Ingress\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAA6B,KAAA;AAC1C,QAAO,OAAA,aAAA,CAAc,QAAQ,EAAC;AAAA,OAChC;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"IngressDrawer.esm.js","sources":["../../../src/components/IngressesAccordions/IngressDrawer.tsx"],"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 type { V1Ingress } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const IngressDrawer = ({\n ingress,\n expanded,\n}: {\n ingress: V1Ingress;\n expanded?: boolean;\n}) => {\n const namespace = ingress.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={ingress}\n expanded={expanded}\n kind=\"Ingress\"\n renderObject={(ingressObject: V1Ingress) => {\n return ingressObject.spec || {};\n }}\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 {ingress.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Ingress\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAA6B,KAAA;AAC1C,QAAO,OAAA,aAAA,CAAc,QAAQ,EAAC;AAAA,OAChC;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IngressesAccordions.esm.js","sources":["../../../src/components/IngressesAccordions/IngressesAccordions.tsx"],"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 { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Ingress } from '@kubernetes/client-node';\nimport { IngressDrawer } from './IngressDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type IngressesAccordionsProps = {};\n\ntype IngressAccordionProps = {\n ingress: V1Ingress;\n};\n\ntype IngressSummaryProps = {\n ingress: V1Ingress;\n};\n\nconst IngressSummary = ({ ingress }: IngressSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid xs={12} item>\n <IngressDrawer ingress={ingress} />\n </Grid>\n </Grid>\n );\n};\n\ntype IngressCardProps = {\n ingress: V1Ingress;\n};\n\nconst IngressCard = ({ ingress }: IngressCardProps) => {\n return (\n <StructuredMetadataTable\n metadata={{\n ...ingress.spec,\n }}\n options={{\n nestedValuesAsYaml: true,\n }}\n />\n );\n};\n\nconst IngressAccordion = ({ ingress }: IngressAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }}>\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <IngressSummary ingress={ingress} />\n </AccordionSummary>\n <AccordionDetails>\n <IngressCard ingress={ingress} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const IngressesAccordions = ({}: IngressesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.ingresses.map((ingress, i) => (\n <Grid item key={i} xs>\n <IngressAccordion ingress={ingress} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAA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,CAAC,OAAA,EAAS,sBACvC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAS,IAAE,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,OAAkB,EAAA,CAAA,EAAA,EADtB,CAEhB,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"IngressesAccordions.esm.js","sources":["../../../src/components/IngressesAccordions/IngressesAccordions.tsx"],"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 { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Ingress } from '@kubernetes/client-node';\nimport { IngressDrawer } from './IngressDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type IngressesAccordionsProps = {};\n\ntype IngressAccordionProps = {\n ingress: V1Ingress;\n};\n\ntype IngressSummaryProps = {\n ingress: V1Ingress;\n};\n\nconst IngressSummary = ({ ingress }: IngressSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"center\"\n >\n <Grid xs={12} item>\n <IngressDrawer ingress={ingress} />\n </Grid>\n </Grid>\n );\n};\n\ntype IngressCardProps = {\n ingress: V1Ingress;\n};\n\nconst IngressCard = ({ ingress }: IngressCardProps) => {\n return (\n <StructuredMetadataTable\n metadata={{\n ...ingress.spec,\n }}\n options={{\n nestedValuesAsYaml: true,\n }}\n />\n );\n};\n\nconst IngressAccordion = ({ ingress }: IngressAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }}>\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <IngressSummary ingress={ingress} />\n </AccordionSummary>\n <AccordionDetails>\n <IngressCard ingress={ingress} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const IngressesAccordions = ({}: IngressesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.ingresses.map((ingress, i) => (\n <Grid item key={i} xs>\n <IngressAccordion ingress={ingress} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MAEX,QAAA,kBAAA,GAAA,CAAC,QAAK,EAAI,EAAA,EAAA,EAAI,MAAI,IAChB,EAAA,QAAA,kBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,OAAA,EAAkB,CACnC,EAAA;AAAA;AAAA,GACF;AAEJ,CAAA;AAMA,MAAM,WAAc,GAAA,CAAC,EAAE,OAAA,EAAgC,KAAA;AACrD,EACE,uBAAA,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA;AAAA,QACR,GAAG,OAAQ,CAAA;AAAA,OACb;AAAA,MACA,OAAS,EAAA;AAAA,QACP,kBAAoB,EAAA;AAAA;AACtB;AAAA,GACF;AAEJ,CAAA;AAEA,MAAM,gBAAmB,GAAA,CAAC,EAAE,OAAA,EAAqC,KAAA;AAC/D,EAAA,4BACG,SAAU,EAAA,EAAA,eAAA,EAAiB,EAAE,aAAA,EAAe,MAC3C,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,gBAAA,EAAA,EAAiB,4BAAa,GAAA,CAAA,cAAA,EAAA,EAAe,GAC5C,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,SAAkB,CACpC,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,gBAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA,EAAY,SAAkB,CACjC,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ,CAAA;AAOa,MAAA,mBAAA,GAAsB,CAAC,EAAiC,KAAA;AACnE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAC3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,SAAU,CAAA,GAAA,CAAI,CAAC,OAAA,EAAS,sBACvC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAS,IAAE,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,OAAkB,EAAA,CAAA,EAAA,EADtB,CAEhB,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobsAccordions.esm.js","sources":["../../../src/components/JobsAccordions/JobsAccordions.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 */\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Job, V1Pod } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { JobDrawer } from './JobsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport { GroupedResponsesContext } from '../../hooks';\nimport {\n StatusError,\n StatusOK,\n StatusPending,\n} from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type JobsAccordionsProps = {\n jobs: V1Job[];\n children?: ReactNode;\n};\n\ntype JobAccordionProps = {\n job: V1Job;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype JobSummaryProps = {\n job: V1Job;\n children?: ReactNode;\n};\n\nconst JobSummary = ({ job }: JobSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <JobDrawer job={job} />\n </Grid>\n <Grid\n item\n container\n xs={6}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n {job.status?.succeeded && <StatusOK>Succeeded</StatusOK>}\n {job.status?.active && <StatusPending>Running</StatusPending>}\n {job.status?.failed && <StatusError>Failed</StatusError>}\n </Grid>\n <Grid item>Start time: {job.status?.startTime?.toString()}</Grid>\n {job.status?.completionTime && (\n <Grid item>\n Completion time: {job.status.completionTime.toString()}\n </Grid>\n )}\n </Grid>\n </Grid>\n );\n};\n\nconst JobAccordion = ({ job, ownedPods }: JobAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <JobSummary job={job} />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable pods={ownedPods} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const JobsAccordions = ({ jobs }: JobsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {jobs.map((job, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <JobAccordion\n ownedPods={getOwnedResources(job, groupedResponses.pods)}\n job={job}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,UAAa,GAAA,CAAC,EAAE,GAAA,EAA2B,KAAA;AAC/C,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,KAAU,CACvB,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EAAA,IAAA;AAAA,YACT,EAAI,EAAA,CAAA;AAAA,YACJ,SAAU,EAAA,QAAA;AAAA,YACV,cAAe,EAA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,KAAU,CACxB,EAAA,CAAA;AAAA,wBACC,gBACC,EAAA,EAAA,QAAA,kBAAA,GAAA,CAAC,SAAU,EAAA,EAAA,IAAA,EAAM,WAAW,CAC9B,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ,CAAA;AAOO,MAAM,cAAiB,GAAA,CAAC,EAAE,IAAA,EAAgC,KAAA;AAC/D,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,eAAK,GAAI,CAAA,CAAC,KAAK,CACd,qBAAA,GAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,iBAAA,CAAkB,GAAK,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UACvD;AAAA;AAAA,OACF,EACF,CANwB,EAAA,EAAA,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"JobsAccordions.esm.js","sources":["../../../src/components/JobsAccordions/JobsAccordions.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 */\nimport { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Job, V1Pod } from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { JobDrawer } from './JobsDrawer';\nimport { getOwnedResources } from '../../utils/owner';\nimport { GroupedResponsesContext } from '../../hooks';\nimport {\n StatusError,\n StatusOK,\n StatusPending,\n} from '@backstage/core-components';\n\n/**\n *\n *\n * @public\n */\nexport type JobsAccordionsProps = {\n jobs: V1Job[];\n children?: ReactNode;\n};\n\ntype JobAccordionProps = {\n job: V1Job;\n ownedPods: V1Pod[];\n children?: ReactNode;\n};\n\ntype JobSummaryProps = {\n job: V1Job;\n children?: ReactNode;\n};\n\nconst JobSummary = ({ job }: JobSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <JobDrawer job={job} />\n </Grid>\n <Grid\n item\n container\n xs={6}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-end\"\n spacing={0}\n >\n <Grid item>\n {job.status?.succeeded && <StatusOK>Succeeded</StatusOK>}\n {job.status?.active && <StatusPending>Running</StatusPending>}\n {job.status?.failed && <StatusError>Failed</StatusError>}\n </Grid>\n <Grid item>Start time: {job.status?.startTime?.toString()}</Grid>\n {job.status?.completionTime && (\n <Grid item>\n Completion time: {job.status.completionTime.toString()}\n </Grid>\n )}\n </Grid>\n </Grid>\n );\n};\n\nconst JobAccordion = ({ job, ownedPods }: JobAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <JobSummary job={job} />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable pods={ownedPods} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const JobsAccordions = ({ jobs }: JobsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {jobs.map((job, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <JobAccordion\n ownedPods={getOwnedResources(job, groupedResponses.pods)}\n job={job}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAM,UAAa,GAAA,CAAC,EAAE,GAAA,EAA2B,KAAA;AAC/C,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,SAAA,EAAA,EAAU,KAAU,CACvB,EAAA,CAAA;AAAA,wBACA,IAAA;AAAA,UAAC,IAAA;AAAA,UAAA;AAAA,YACC,IAAI,EAAA,IAAA;AAAA,YACJ,SAAS,EAAA,IAAA;AAAA,YACT,EAAI,EAAA,CAAA;AAAA,YACJ,SAAU,EAAA,QAAA;AAAA,YACV,cAAe,EAAA,YAAA;AAAA,YACf,UAAW,EAAA,UAAA;AAAA,YACX,OAAS,EAAA,CAAA;AAAA,YAET,QAAA,EAAA;AAAA,8BAAC,IAAA,CAAA,IAAA,EAAA,EAAK,MAAI,IACP,EAAA,QAAA,EAAA;AAAA,gBAAA,GA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,cAAiB,GAAA,CAAC,EAAE,IAAA,EAAgC,KAAA;AAC/D,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAE3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,QAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,eAAK,GAAI,CAAA,CAAC,KAAK,CACd,qBAAA,GAAA,CAAC,QAAK,SAAS,EAAA,IAAA,EAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,YAAA;AAAA,QAAA;AAAA,UACC,SAAW,EAAA,iBAAA,CAAkB,GAAK,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UACvD;AAAA;AAAA,OACF,EACF,CANwB,EAAA,EAAA,CAO1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JobsDrawer.esm.js","sources":["../../../src/components/JobsAccordions/JobsDrawer.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 */\nimport { V1Job } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\n\nexport const JobDrawer = ({\n job,\n expanded,\n}: {\n job: V1Job;\n expanded?: boolean;\n}) => {\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={job}\n expanded={expanded}\n kind=\"Job\"\n renderObject={(jobObj: V1Job) => {\n return {\n parallelism: jobObj.spec?.parallelism ?? '???',\n completions: jobObj.spec?.completions ?? '???',\n backoffLimit: jobObj.spec?.backoffLimit ?? '???',\n startTime: jobObj.status?.startTime ?? '???',\n };\n }}\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 {job.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Job\n </Typography>\n </Grid>\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAoBO,MAAM,YAAY,CAAC;AAAA,EACxB,GAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,GAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,KAAA;AAAA,MACL,YAAA,EAAc,CAAC,MAAkB,KAAA;AAC/B,QAAO,OAAA;AAAA,UACL,WAAA,EAAa,MAAO,CAAA,IAAA,EAAM,WAAe,IAAA,KAAA;AAAA,UACzC,WAAA,EAAa,MAAO,CAAA,IAAA,EAAM,WAAe,IAAA,KAAA;AAAA,UACzC,YAAA,EAAc,MAAO,CAAA,IAAA,EAAM,YAAgB,IAAA,KAAA;AAAA,UAC3C,SAAA,EAAW,MAAO,CAAA,MAAA,EAAQ,SAAa,IAAA;AAAA,SACzC;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAI,EAAA,GAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EACzB,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,KAAA,EAEtD,CACF,EAAA;AAAA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"JobsDrawer.esm.js","sources":["../../../src/components/JobsAccordions/JobsDrawer.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 */\nimport type { V1Job } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\n\nexport const JobDrawer = ({\n job,\n expanded,\n}: {\n job: V1Job;\n expanded?: boolean;\n}) => {\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={job}\n expanded={expanded}\n kind=\"Job\"\n renderObject={(jobObj: V1Job) => {\n return {\n parallelism: jobObj.spec?.parallelism ?? '???',\n completions: jobObj.spec?.completions ?? '???',\n backoffLimit: jobObj.spec?.backoffLimit ?? '???',\n startTime: jobObj.status?.startTime ?? '???',\n };\n }}\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 {job.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Job\n </Typography>\n </Grid>\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAoBO,MAAM,YAAY,CAAC;AAAA,EACxB,GAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,GAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,KAAA;AAAA,MACL,YAAA,EAAc,CAAC,MAAkB,KAAA;AAC/B,QAAO,OAAA;AAAA,UACL,WAAA,EAAa,MAAO,CAAA,IAAA,EAAM,WAAe,IAAA,KAAA;AAAA,UACzC,WAAA,EAAa,MAAO,CAAA,IAAA,EAAM,WAAe,IAAA,KAAA;AAAA,UACzC,YAAA,EAAc,MAAO,CAAA,IAAA,EAAM,YAAgB,IAAA,KAAA;AAAA,UAC3C,SAAA,EAAW,MAAO,CAAA,MAAA,EAAQ,SAAa,IAAA;AAAA,SACzC;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAI,EAAA,GAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EACzB,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,KAAA,EAEtD,CACF,EAAA;AAAA;AAAA;AAAA;AACF;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KubernetesDrawer.esm.js","sources":["../../../src/components/KubernetesDrawer/KubernetesDrawer.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 { ReactNode, ChangeEvent, useState } from 'react';\n\nimport { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport Drawer from '@material-ui/core/Drawer';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport Switch from '@material-ui/core/Switch';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport {\n createStyles,\n makeStyles,\n Theme,\n withStyles,\n} from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { ManifestYaml } from './ManifestYaml';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n }),\n);\n\n/**\n * The type of object that can be represented by the Drawer\n *\n * @public\n */\nexport interface KubernetesObject {\n kind: string;\n metadata?: IObjectMeta;\n}\n\ninterface KubernetesDrawerContentProps {\n close: () => void;\n kubernetesObject: KubernetesObject;\n header?: ReactNode;\n children?: ReactNode;\n}\n\nconst KubernetesDrawerContent = ({\n children,\n header,\n kubernetesObject,\n close,\n}: KubernetesDrawerContentProps) => {\n const classes = useDrawerContentStyles();\n const [isYaml, setIsYaml] = useState<boolean>(false);\n\n return (\n <>\n <div className={classes.header}>\n <Grid container justifyContent=\"flex-start\" alignItems=\"flex-start\">\n <Grid item xs={11}>\n <Typography variant=\"h5\">\n {kubernetesObject.metadata?.name}\n </Typography>\n </Grid>\n <Grid item xs={1}>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={() => close()}\n color=\"inherit\"\n >\n <CloseIcon className={classes.icon} />\n </IconButton>\n </Grid>\n <Grid item xs={12}>\n {header}\n </Grid>\n <Grid item xs={12}>\n <FormControlLabel\n control={\n <Switch\n checked={isYaml}\n onChange={event => {\n setIsYaml(event.target.checked);\n }}\n name=\"YAML\"\n />\n }\n label=\"YAML\"\n />\n </Grid>\n </Grid>\n </div>\n <div className={classes.content}>\n {isYaml && <ManifestYaml object={kubernetesObject} />}\n {!isYaml && children}\n </div>\n </>\n );\n};\n\n/**\n * Props of KubernetesDrawer\n *\n * @public\n */\nexport interface KubernetesDrawerProps {\n open?: boolean;\n kubernetesObject: KubernetesObject;\n label: ReactNode;\n drawerContentsHeader?: ReactNode;\n children?: ReactNode;\n}\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '50%',\n justifyContent: 'space-between',\n padding: theme.spacing(2.5),\n },\n }),\n);\n\nconst DrawerButton = withStyles({\n root: {\n padding: '6px 5px',\n },\n label: {\n textTransform: 'none',\n },\n})(Button);\n\n/**\n * Button/Drawer component for Kubernetes Objects\n *\n * @public\n */\nexport const KubernetesDrawer = ({\n open,\n label,\n drawerContentsHeader,\n kubernetesObject,\n children,\n}: KubernetesDrawerProps) => {\n const classes = useDrawerStyles();\n const [isOpen, setIsOpen] = useState<boolean>(open ?? false);\n\n const toggleDrawer = (e: ChangeEvent<{}>, newValue: boolean) => {\n e.stopPropagation();\n setIsOpen(newValue);\n };\n\n return (\n <>\n <DrawerButton onClick={() => setIsOpen(true)}>{label}</DrawerButton>\n <Drawer\n classes={{\n paper: classes.paper,\n }}\n anchor=\"right\"\n open={isOpen}\n onClose={(e: any) => toggleDrawer(e, false)}\n onClick={event => event.stopPropagation()}\n >\n {isOpen && (\n <KubernetesDrawerContent\n header={drawerContentsHeader}\n kubernetesObject={kubernetesObject}\n children={children}\n close={() => setIsOpen(false)}\n />\n )}\n </Drawer>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA;AACZ,GACD;AACH,CAAA;AAmBA,MAAM,0BAA0B,CAAC;AAAA,EAC/B,QAAA;AAAA,EACA,MAAA;AAAA,EACA,gBAAA;AAAA,EACA;AACF,CAAoC,KAAA;AAClC,EAAA,MAAM,UAAU,sBAAuB,EAAA;AACvC,EAAA,MAAM,CAAC,MAAA,EAAQ,SAAS,CAAA,GAAI,SAAkB,KAAK,CAAA;AAEnD,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EA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EI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,gBAAa,OAAS,EAAA,MAAM,SAAU,CAAA,IAAI,GAAI,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,oBACrD,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA;AAAA,UACP,OAAO,OAAQ,CAAA;AAAA,SACjB;AAAA,QACA,MAAO,EAAA,OAAA;AAAA,QACP,IAAM,EAAA,MAAA;AAAA,QACN,OAAS,EAAA,CAAC,CAAW,KAAA,YAAA,CAAa,GAAG,KAAK,CAAA;AAAA,QAC1C,OAAA,EAAS,CAAS,KAAA,KAAA,KAAA,CAAM,eAAgB,EAAA;AAAA,QAEvC,QACC,EAAA,MAAA,oBAAA,GAAA;AAAA,UAAC,uBAAA;AAAA,UAAA;AAAA,YACC,MAAQ,EAAA,oBAAA;AAAA,YACR,gBAAA;AAAA,YACA,QAAA;AAAA,YACA,KAAA,EAAO,MAAM,SAAA,CAAU,KAAK;AAAA;AAAA;AAC9B;AAAA;AAEJ,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"KubernetesDrawer.esm.js","sources":["../../../src/components/KubernetesDrawer/KubernetesDrawer.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 { ReactNode, ChangeEvent, useState } from 'react';\n\nimport type { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport Drawer from '@material-ui/core/Drawer';\nimport Grid from '@material-ui/core/Grid';\nimport IconButton from '@material-ui/core/IconButton';\nimport Switch from '@material-ui/core/Switch';\nimport Typography from '@material-ui/core/Typography';\nimport Button from '@material-ui/core/Button';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport {\n createStyles,\n makeStyles,\n Theme,\n withStyles,\n} from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport { ManifestYaml } from './ManifestYaml';\n\nconst useDrawerContentStyles = makeStyles((_theme: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n content: {\n height: '80%',\n },\n icon: {\n fontSize: 20,\n },\n }),\n);\n\n/**\n * The type of object that can be represented by the Drawer\n *\n * @public\n */\nexport interface KubernetesObject {\n kind: string;\n metadata?: IObjectMeta;\n}\n\ninterface KubernetesDrawerContentProps {\n close: () => void;\n kubernetesObject: KubernetesObject;\n header?: ReactNode;\n children?: ReactNode;\n}\n\nconst KubernetesDrawerContent = ({\n children,\n header,\n kubernetesObject,\n close,\n}: KubernetesDrawerContentProps) => {\n const classes = useDrawerContentStyles();\n const [isYaml, setIsYaml] = useState<boolean>(false);\n\n return (\n <>\n <div className={classes.header}>\n <Grid container justifyContent=\"flex-start\" alignItems=\"flex-start\">\n <Grid item xs={11}>\n <Typography variant=\"h5\">\n {kubernetesObject.metadata?.name}\n </Typography>\n </Grid>\n <Grid item xs={1}>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={() => close()}\n color=\"inherit\"\n >\n <CloseIcon className={classes.icon} />\n </IconButton>\n </Grid>\n <Grid item xs={12}>\n {header}\n </Grid>\n <Grid item xs={12}>\n <FormControlLabel\n control={\n <Switch\n checked={isYaml}\n onChange={event => {\n setIsYaml(event.target.checked);\n }}\n name=\"YAML\"\n />\n }\n label=\"YAML\"\n />\n </Grid>\n </Grid>\n </div>\n <div className={classes.content}>\n {isYaml && <ManifestYaml object={kubernetesObject} />}\n {!isYaml && children}\n </div>\n </>\n );\n};\n\n/**\n * Props of KubernetesDrawer\n *\n * @public\n */\nexport interface KubernetesDrawerProps {\n open?: boolean;\n kubernetesObject: KubernetesObject;\n label: ReactNode;\n drawerContentsHeader?: ReactNode;\n children?: ReactNode;\n}\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '50%',\n justifyContent: 'space-between',\n padding: theme.spacing(2.5),\n },\n }),\n);\n\nconst DrawerButton = withStyles({\n root: {\n padding: '6px 5px',\n },\n label: {\n textTransform: 'none',\n },\n})(Button);\n\n/**\n * Button/Drawer component for Kubernetes Objects\n *\n * @public\n */\nexport const KubernetesDrawer = ({\n open,\n label,\n drawerContentsHeader,\n kubernetesObject,\n children,\n}: KubernetesDrawerProps) => {\n const classes = useDrawerStyles();\n const [isOpen, setIsOpen] = useState<boolean>(open ?? false);\n\n const toggleDrawer = (e: ChangeEvent<{}>, newValue: boolean) => {\n e.stopPropagation();\n setIsOpen(newValue);\n };\n\n return (\n <>\n <DrawerButton onClick={() => setIsOpen(true)}>{label}</DrawerButton>\n <Drawer\n classes={{\n paper: classes.paper,\n }}\n anchor=\"right\"\n open={isOpen}\n onClose={(e: any) => toggleDrawer(e, false)}\n onClick={event => event.stopPropagation()}\n >\n {isOpen && (\n <KubernetesDrawerContent\n header={drawerContentsHeader}\n kubernetesObject={kubernetesObject}\n children={children}\n close={() => setIsOpen(false)}\n />\n )}\n </Drawer>\n </>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAkCA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,WACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA;AACZ,GACD;AACH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AM,UAAU,eAAgB,EAAA;AAChC,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,QAAA,CAAkB,QAAQ,KAAK,CAAA;AAE3D,EAAM,MAAA,YAAA,GAAe,CAAC,CAAA,EAAoB,QAAsB,KAAA;AAC9D,IAAA,CAAA,CAAE,eAAgB,EAAA;AAClB,IAAA,SAAA,CAAU,QAAQ,CAAA;AAAA,GACpB;AAEA,EAAA,uBAEI,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,gBAAa,OAAS,EAAA,MAAM,SAAU,CAAA,IAAI,GAAI,QAAM,EAAA,KAAA,EAAA,CAAA;AAAA,oBACrD,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA;AAAA,UACP,OAAO,OAAQ,CAAA;AAAA,SACjB;AAAA,QACA,MAAO,EAAA,OAAA;AAAA,QACP,IAAM,EAAA,MAAA;AAAA,QACN,OAAS,EAAA,CAAC,CAAW,KAAA,YAAA,CAAa,GAAG,KAAK,CAAA;AAAA,QAC1C,OAAA,EAAS,CAAS,KAAA,KAAA,KAAA,CAAM,eAAgB,EAAA;AAAA,QAEvC,QACC,EAAA,MAAA,oBAAA,GAAA;AAAA,UAAC,uBAAA;AAAA,UAAA;AAAA,YACC,MAAQ,EAAA,oBAAA;AAAA,YACR,gBAAA;AAAA,YACA,QAAA;AAAA,YACA,KAAA,EAAO,MAAM,SAAA,CAAU,KAAK;AAAA;AAAA;AAC9B;AAAA;AAEJ,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KubernetesStructuredMetadataTableDrawer.esm.js","sources":["../../../src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx"],"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 { ReactNode, ChangeEvent, useContext, useState } from 'react';\nimport Button from '@material-ui/core/Button';\nimport Typography from '@material-ui/core/Typography';\nimport IconButton from '@material-ui/core/IconButton';\nimport Drawer from '@material-ui/core/Drawer';\nimport Switch from '@material-ui/core/Switch';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport Close from '@material-ui/icons/Close';\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew';\nimport { V1ObjectMeta } from '@kubernetes/client-node';\nimport { withStyles } from '@material-ui/core/styles';\nimport {\n LinkButton as BackstageButton,\n StructuredMetadataTable,\n WarningPanel,\n} from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\nimport { ManifestYaml } from './ManifestYaml';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesClusterLinkFormatterApiRef } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '50%',\n justifyContent: 'space-between',\n padding: theme.spacing(2.5),\n },\n }),\n);\n\nconst useDrawerContentStyles = makeStyles((_: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n errorMessage: {\n marginTop: '1em',\n marginBottom: '1em',\n },\n options: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n icon: {\n fontSize: 20,\n },\n content: {\n height: '80%',\n },\n }),\n);\n\nconst PodDrawerButton = withStyles({\n root: {\n padding: '6px 5px',\n },\n label: {\n textTransform: 'none',\n },\n})(Button);\n\n/**\n *\n *\n * @public\n */\nexport type LinkErrorPanelProps = {\n cluster: ClusterAttributes;\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n *\n *\n * @public\n */\nexport const LinkErrorPanel = ({\n cluster,\n errorMessage,\n}: LinkErrorPanelProps) => (\n <WarningPanel\n title=\"There was a problem formatting the link to the Kubernetes dashboard\"\n message={`Could not format the link to the dashboard of your cluster named '${\n cluster.name\n }'. Its dashboardApp property has been set to '${\n cluster.dashboardApp || 'standard'\n }.'`}\n >\n {errorMessage && (\n <Typography variant=\"body2\">Errors: {errorMessage}</Typography>\n )}\n </WarningPanel>\n);\n\n/**\n *\n *\n * @public\n */\nexport interface KubernetesDrawerable {\n metadata?: V1ObjectMeta;\n}\n\ninterface KubernetesStructuredMetadataTableDrawerContentProps<\n T extends KubernetesDrawerable,\n> {\n toggleDrawer: (e: ChangeEvent<{}>, isOpen: boolean) => void;\n object: T;\n renderObject: (obj: T) => object;\n kind: string;\n}\n\nfunction replaceNullsWithUndefined(someObj: any) {\n const replacer = (_: any, value: any) =>\n String(value) === 'null' || String(value) === 'undefined'\n ? undefined\n : value;\n\n return JSON.parse(JSON.stringify(someObj, replacer));\n}\n\nconst KubernetesStructuredMetadataTableDrawerContent = <\n T extends KubernetesDrawerable,\n>({\n toggleDrawer,\n object,\n renderObject,\n kind,\n}: KubernetesStructuredMetadataTableDrawerContentProps<T>) => {\n const [isYaml, setIsYaml] = useState<boolean>(false);\n\n const formatter = useApi(kubernetesClusterLinkFormatterApiRef);\n const classes = useDrawerContentStyles();\n const cluster = useContext(ClusterContext);\n const { value: clusterLink, error } = useAsync(\n async () =>\n formatter.formatClusterLink({\n dashboardUrl: cluster.dashboardUrl,\n dashboardApp: cluster.dashboardApp,\n dashboardParameters: cluster.dashboardParameters,\n object,\n kind,\n }),\n [cluster, object, kind, formatter],\n );\n\n return (\n <>\n <div className={classes.header}>\n <Grid container justifyContent=\"flex-start\" alignItems=\"flex-start\">\n <Grid item xs={11}>\n <Typography variant=\"h5\">\n {object.metadata?.name ?? 'unknown name'}\n </Typography>\n </Grid>\n <Grid item xs={1}>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={e => toggleDrawer(e, false)}\n color=\"inherit\"\n >\n <Close className={classes.icon} />\n </IconButton>\n </Grid>\n <Grid item xs={11}>\n <Typography color=\"textSecondary\" variant=\"body1\">\n {kind}\n </Typography>\n </Grid>\n <Grid item xs={11}>\n <FormControlLabel\n control={\n <Switch\n checked={isYaml}\n onChange={event => {\n setIsYaml(event.target.checked);\n }}\n name=\"YAML\"\n />\n }\n label=\"YAML\"\n />\n </Grid>\n </Grid>\n </div>\n {error && (\n <div className={classes.errorMessage}>\n <LinkErrorPanel\n cluster={cluster}\n errorMessage={error.message || error.toString()}\n />\n </div>\n )}\n <div className={classes.options}>\n <div>\n {clusterLink && (\n <BackstageButton\n variant=\"outlined\"\n color=\"primary\"\n size=\"small\"\n to={clusterLink}\n endIcon={<OpenInNewIcon />}\n >\n Open Kubernetes Dashboard\n </BackstageButton>\n )}\n </div>\n </div>\n <div className={classes.content}>\n {isYaml && <ManifestYaml object={object} />}\n {!isYaml && (\n <StructuredMetadataTable\n metadata={renderObject(replaceNullsWithUndefined(object))}\n options={{ nestedValuesAsYaml: true }}\n />\n )}\n </div>\n </>\n );\n};\n\n/**\n *\n * @public\n */\nexport interface KubernetesStructuredMetadataTableDrawerProps<\n T extends KubernetesDrawerable,\n> {\n object: T;\n renderObject: (obj: T) => object;\n buttonVariant?: 'h5' | 'subtitle2';\n kind: string;\n expanded?: boolean;\n children?: ReactNode;\n}\n\n/**\n *\n * @public\n */\nexport const KubernetesStructuredMetadataTableDrawer = <\n T extends KubernetesDrawerable,\n>({\n object,\n renderObject,\n kind,\n buttonVariant = 'subtitle2',\n expanded = false,\n children,\n}: KubernetesStructuredMetadataTableDrawerProps<T>) => {\n const [isOpen, setIsOpen] = useState(expanded);\n const classes = useDrawerStyles();\n\n const toggleDrawer = (e: ChangeEvent<{}>, newValue: boolean) => {\n e.stopPropagation();\n setIsOpen(newValue);\n };\n\n return (\n <>\n <PodDrawerButton\n onClick={e => toggleDrawer(e, true)}\n onFocus={event => event.stopPropagation()}\n >\n {children === undefined ? (\n <Typography variant={buttonVariant}>\n {object.metadata?.name ?? 'unknown object'}\n </Typography>\n ) : (\n children\n )}\n </PodDrawerButton>\n <Drawer\n classes={{\n paper: classes.paper,\n }}\n anchor=\"right\"\n open={isOpen}\n onClose={(e: any) => toggleDrawer(e, false)}\n onClick={event => event.stopPropagation()}\n >\n <KubernetesStructuredMetadataTableDrawerContent\n kind={kind}\n toggleDrawer={toggleDrawer}\n object={object}\n renderObject={renderObject}\n />\n </Drawer>\n </>\n );\n};\n"],"names":["Close","BackstageButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,eAAkB,GAAA,UAAA;AAAA,EAAW,CAAC,UAClC,YAAa,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,KAAO,EAAA,KAAA;AAAA,MACP,cAAgB,EAAA,eAAA;AAAA,MAChB,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAC5B,GACD;AACH,CAAA;AAEA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,MACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,SAAW,EAAA,KAAA;AAAA,MACX,YAAc,EAAA;AAAA,KAChB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,OA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AA,EAAA,QAAA,KAAa,KACZ,CAAA,mBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAS,eAClB,QAAO,EAAA,MAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC5B,CAEA,GAAA;AAAA;AAAA,KAEJ;AAAA,oBACA,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA;AAAA,UACP,OAAO,OAAQ,CAAA;AAAA,SACjB;AAAA,QACA,MAAO,EAAA,OAAA;AAAA,QACP,IAAM,EAAA,MAAA;AAAA,QACN,OAAS,EAAA,CAAC,CAAW,KAAA,YAAA,CAAa,GAAG,KAAK,CAAA;AAAA,QAC1C,OAAA,EAAS,CAAS,KAAA,KAAA,KAAA,CAAM,eAAgB,EAAA;AAAA,QAExC,QAAA,kBAAA,GAAA;AAAA,UAAC,8CAAA;AAAA,UAAA;AAAA,YACC,IAAA;AAAA,YACA,YAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"KubernetesStructuredMetadataTableDrawer.esm.js","sources":["../../../src/components/KubernetesDrawer/KubernetesStructuredMetadataTableDrawer.tsx"],"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 { ReactNode, ChangeEvent, useContext, useState } from 'react';\nimport Button from '@material-ui/core/Button';\nimport Typography from '@material-ui/core/Typography';\nimport IconButton from '@material-ui/core/IconButton';\nimport Drawer from '@material-ui/core/Drawer';\nimport Switch from '@material-ui/core/Switch';\nimport FormControlLabel from '@material-ui/core/FormControlLabel';\nimport Grid from '@material-ui/core/Grid';\nimport { makeStyles, createStyles, Theme } from '@material-ui/core/styles';\nimport Close from '@material-ui/icons/Close';\nimport OpenInNewIcon from '@material-ui/icons/OpenInNew';\nimport type { V1ObjectMeta } from '@kubernetes/client-node';\nimport { withStyles } from '@material-ui/core/styles';\nimport {\n LinkButton as BackstageButton,\n StructuredMetadataTable,\n WarningPanel,\n} from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks';\nimport { ClusterAttributes } from '@backstage/plugin-kubernetes-common';\nimport { ManifestYaml } from './ManifestYaml';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { kubernetesClusterLinkFormatterApiRef } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\n\nconst useDrawerStyles = makeStyles((theme: Theme) =>\n createStyles({\n paper: {\n width: '50%',\n justifyContent: 'space-between',\n padding: theme.spacing(2.5),\n },\n }),\n);\n\nconst useDrawerContentStyles = makeStyles((_: Theme) =>\n createStyles({\n header: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n errorMessage: {\n marginTop: '1em',\n marginBottom: '1em',\n },\n options: {\n display: 'flex',\n flexDirection: 'row',\n justifyContent: 'space-between',\n },\n icon: {\n fontSize: 20,\n },\n content: {\n height: '80%',\n },\n }),\n);\n\nconst PodDrawerButton = withStyles({\n root: {\n padding: '6px 5px',\n },\n label: {\n textTransform: 'none',\n },\n})(Button);\n\n/**\n *\n *\n * @public\n */\nexport type LinkErrorPanelProps = {\n cluster: ClusterAttributes;\n errorMessage?: string;\n children?: ReactNode;\n};\n\n/**\n *\n *\n * @public\n */\nexport const LinkErrorPanel = ({\n cluster,\n errorMessage,\n}: LinkErrorPanelProps) => (\n <WarningPanel\n title=\"There was a problem formatting the link to the Kubernetes dashboard\"\n message={`Could not format the link to the dashboard of your cluster named '${\n cluster.name\n }'. Its dashboardApp property has been set to '${\n cluster.dashboardApp || 'standard'\n }.'`}\n >\n {errorMessage && (\n <Typography variant=\"body2\">Errors: {errorMessage}</Typography>\n )}\n </WarningPanel>\n);\n\n/**\n *\n *\n * @public\n */\nexport interface KubernetesDrawerable {\n metadata?: V1ObjectMeta;\n}\n\ninterface KubernetesStructuredMetadataTableDrawerContentProps<\n T extends KubernetesDrawerable,\n> {\n toggleDrawer: (e: ChangeEvent<{}>, isOpen: boolean) => void;\n object: T;\n renderObject: (obj: T) => object;\n kind: string;\n}\n\nfunction replaceNullsWithUndefined(someObj: any) {\n const replacer = (_: any, value: any) =>\n String(value) === 'null' || String(value) === 'undefined'\n ? undefined\n : value;\n\n return JSON.parse(JSON.stringify(someObj, replacer));\n}\n\nconst KubernetesStructuredMetadataTableDrawerContent = <\n T extends KubernetesDrawerable,\n>({\n toggleDrawer,\n object,\n renderObject,\n kind,\n}: KubernetesStructuredMetadataTableDrawerContentProps<T>) => {\n const [isYaml, setIsYaml] = useState<boolean>(false);\n\n const formatter = useApi(kubernetesClusterLinkFormatterApiRef);\n const classes = useDrawerContentStyles();\n const cluster = useContext(ClusterContext);\n const { value: clusterLink, error } = useAsync(\n async () =>\n formatter.formatClusterLink({\n dashboardUrl: cluster.dashboardUrl,\n dashboardApp: cluster.dashboardApp,\n dashboardParameters: cluster.dashboardParameters,\n object,\n kind,\n }),\n [cluster, object, kind, formatter],\n );\n\n return (\n <>\n <div className={classes.header}>\n <Grid container justifyContent=\"flex-start\" alignItems=\"flex-start\">\n <Grid item xs={11}>\n <Typography variant=\"h5\">\n {object.metadata?.name ?? 'unknown name'}\n </Typography>\n </Grid>\n <Grid item xs={1}>\n <IconButton\n key=\"dismiss\"\n title=\"Close the drawer\"\n onClick={e => toggleDrawer(e, false)}\n color=\"inherit\"\n >\n <Close className={classes.icon} />\n </IconButton>\n </Grid>\n <Grid item xs={11}>\n <Typography color=\"textSecondary\" variant=\"body1\">\n {kind}\n </Typography>\n </Grid>\n <Grid item xs={11}>\n <FormControlLabel\n control={\n <Switch\n checked={isYaml}\n onChange={event => {\n setIsYaml(event.target.checked);\n }}\n name=\"YAML\"\n />\n }\n label=\"YAML\"\n />\n </Grid>\n </Grid>\n </div>\n {error && (\n <div className={classes.errorMessage}>\n <LinkErrorPanel\n cluster={cluster}\n errorMessage={error.message || error.toString()}\n />\n </div>\n )}\n <div className={classes.options}>\n <div>\n {clusterLink && (\n <BackstageButton\n variant=\"outlined\"\n color=\"primary\"\n size=\"small\"\n to={clusterLink}\n endIcon={<OpenInNewIcon />}\n >\n Open Kubernetes Dashboard\n </BackstageButton>\n )}\n </div>\n </div>\n <div className={classes.content}>\n {isYaml && <ManifestYaml object={object} />}\n {!isYaml && (\n <StructuredMetadataTable\n metadata={renderObject(replaceNullsWithUndefined(object))}\n options={{ nestedValuesAsYaml: true }}\n />\n )}\n </div>\n </>\n );\n};\n\n/**\n *\n * @public\n */\nexport interface KubernetesStructuredMetadataTableDrawerProps<\n T extends KubernetesDrawerable,\n> {\n object: T;\n renderObject: (obj: T) => object;\n buttonVariant?: 'h5' | 'subtitle2';\n kind: string;\n expanded?: boolean;\n children?: ReactNode;\n}\n\n/**\n *\n * @public\n */\nexport const KubernetesStructuredMetadataTableDrawer = <\n T extends KubernetesDrawerable,\n>({\n object,\n renderObject,\n kind,\n buttonVariant = 'subtitle2',\n expanded = false,\n children,\n}: KubernetesStructuredMetadataTableDrawerProps<T>) => {\n const [isOpen, setIsOpen] = useState(expanded);\n const classes = useDrawerStyles();\n\n const toggleDrawer = (e: ChangeEvent<{}>, newValue: boolean) => {\n e.stopPropagation();\n setIsOpen(newValue);\n };\n\n return (\n <>\n <PodDrawerButton\n onClick={e => toggleDrawer(e, true)}\n onFocus={event => event.stopPropagation()}\n >\n {children === undefined ? (\n <Typography variant={buttonVariant}>\n {object.metadata?.name ?? 'unknown object'}\n </Typography>\n ) : (\n children\n )}\n </PodDrawerButton>\n <Drawer\n classes={{\n paper: classes.paper,\n }}\n anchor=\"right\"\n open={isOpen}\n onClose={(e: any) => toggleDrawer(e, false)}\n onClick={event => event.stopPropagation()}\n >\n <KubernetesStructuredMetadataTableDrawerContent\n kind={kind}\n toggleDrawer={toggleDrawer}\n object={object}\n renderObject={renderObject}\n />\n </Drawer>\n </>\n );\n};\n"],"names":["Close","BackstageButton"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,MAAM,eAAkB,GAAA,UAAA;AAAA,EAAW,CAAC,UAClC,YAAa,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,KAAO,EAAA,KAAA;AAAA,MACP,cAAgB,EAAA,eAAA;AAAA,MAChB,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,GAAG;AAAA;AAC5B,GACD;AACH,CAAA;AAEA,MAAM,sBAAyB,GAAA,UAAA;AAAA,EAAW,CAAC,MACzC,YAAa,CAAA;AAAA,IACX,MAAQ,EAAA;AAAA,MACN,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,YAAc,EAAA;AAAA,MACZ,SAAW,EAAA,KAAA;AAAA,MACX,YAAc,EAAA;AAAA,KAChB;AAAA,IACA,OAAS,EAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,aAAe,EAAA,KAAA;AAAA,MACf,cAAgB,EAAA;AAAA,KAClB;AAAA,IACA,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA,KACZ;AAAA,IACA,OAAS,EAAA;AAAA,MACP,MAAQ,EAAA;AAAA;AACV,GACD;AACH,CAAA;AAEA,MAAM,kBAAkB,UAAW,CAAA;AAAA,EACjC,IAAM,EAAA;AAAA,IACJ,OAAS,EAAA;AAAA,GACX;AAAA,EACA,KAAO,EAAA;AAAA,IACL,aAAe,EAAA;AAAA;AAEnB,CAAC,EAAE,MAAM,CAAA;AAkBF,MAAM,iBAAiB,CAAC;AAAA,EAC7B,OAAA;AAAA,EACA;AACF,CACE,qBAAA,GAAA;AAAA,EAAC,YAAA;A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P,IAAM,EAAA,MAAA;AAAA,QACN,OAAS,EAAA,CAAC,CAAW,KAAA,YAAA,CAAa,GAAG,KAAK,CAAA;AAAA,QAC1C,OAAA,EAAS,CAAS,KAAA,KAAA,KAAA,CAAM,eAAgB,EAAA;AAAA,QAExC,QAAA,kBAAA,GAAA;AAAA,UAAC,8CAAA;AAAA,UAAA;AAAA,YACC,IAAA;AAAA,YACA,YAAA;AAAA,YACA,MAAA;AAAA,YACA;AAAA;AAAA;AACF;AAAA;AACF,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PodsTable.esm.js","sources":["../../../src/components/Pods/PodsTable.tsx"],"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 { ReactNode, useContext } from 'react';\nimport { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,aAA4B,GAAA;AAOlC,MAAM,gBAA+B,GAAA;AAoB5C,MAAM,KAA4B,GAAA;AAAA,EAChC;AAAA,IACE,KAAO,EAAA,kBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,eAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,gBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,aAAA;AAAA,IACR,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA;AAAA;AAEX,CAAA;AAEA,MAAM,gBAAmB,GAAA,CAAC,EAAE,GAAA,EAAwB,KAAA;AAClD,EAAA,MAAM,SAAS,iBAAkB,CAAA;AAAA,IAC/B,IAAM,EAAA,KAAA;AAAA,IACN,UAAY,EAAA,IAAA;AAAA,IACZ,UAAU,GAAI,CAAA;AAAA,GACf,CAAA;AACD,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,YAAc,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AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,qBAAqB,KAAM,EAAA;AAAA,MAGnE,IACG,EAAA,IAAA,CAAe,GAAI,CAAA,CAAC,GAAc,MAAA;AAAA,QACjC,GAAG,GAAA;AAAA,QACH,EAAA,EAAI,KAAK,QAAU,EAAA;AAAA,OACnB,CAAA,CAAA;AAAA,MAEJ;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"PodsTable.esm.js","sources":["../../../src/components/Pods/PodsTable.tsx"],"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 { ReactNode, useContext } from 'react';\nimport { PodDrawer } from './PodDrawer';\nimport {\n containersReady,\n containerStatuses,\n podStatusToCpuUtil,\n podStatusToMemoryUtil,\n totalRestarts,\n} from '../../utils/pod';\nimport { Table, TableColumn } from '@backstage/core-components';\nimport { ClusterContext } from '../../hooks/Cluster';\nimport { useMatchingErrors } from '../../hooks/useMatchingErrors';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport type { V1Pod } from '@kubernetes/client-node';\nimport { usePodMetrics } from '../../hooks/usePodMetrics';\nimport Typography from '@material-ui/core/Typography';\n\n/**\n *\n *\n * @public\n */\nexport const READY_COLUMNS: PodColumns = 'READY';\n\n/**\n *\n *\n * @public\n */\nexport const RESOURCE_COLUMNS: PodColumns = 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodColumns = 'READY' | 'RESOURCE';\n\n/**\n *\n *\n * @public\n */\nexport type PodsTablesProps = {\n pods: Pod | V1Pod[];\n extraColumns?: PodColumns[];\n children?: ReactNode;\n};\n\nconst READY: TableColumn<Pod>[] = [\n {\n title: 'containers ready',\n align: 'center',\n render: containersReady,\n width: 'auto',\n },\n {\n title: 'total restarts',\n align: 'center',\n render: totalRestarts,\n type: 'numeric',\n width: 'auto',\n },\n];\n\nconst PodDrawerTrigger = ({ pod }: { pod: Pod }) => {\n const errors = useMatchingErrors({\n kind: 'Pod',\n apiVersion: 'v1',\n metadata: pod.metadata,\n });\n return (\n <PodDrawer\n podAndErrors={{\n pod: pod as any,\n cluster: useContext(ClusterContext),\n errors: errors,\n }}\n />\n );\n};\n\nconst Cpu = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToCpuUtil(metrics)}</>;\n};\n\nconst Memory = ({ clusterName, pod }: { clusterName: string; pod: Pod }) => {\n const metrics = usePodMetrics(clusterName, pod);\n\n if (!metrics) {\n return <Typography>unknown</Typography>;\n }\n\n return <>{podStatusToMemoryUtil(metrics)}</>;\n};\n\n/**\n *\n *\n * @public\n */\nexport const PodsTable = ({ pods, extraColumns = [] }: PodsTablesProps) => {\n const cluster = useContext(ClusterContext);\n const defaultColumns: TableColumn<Pod>[] = [\n {\n title: 'ID',\n field: 'metadata.uid',\n hidden: true,\n },\n {\n title: 'name',\n highlight: true,\n render: (pod: Pod) => {\n return <PodDrawerTrigger pod={pod} />;\n },\n },\n {\n title: 'phase',\n render: (pod: Pod) => pod.status?.phase ?? 'unknown',\n width: 'auto',\n },\n {\n title: 'status',\n render: containerStatuses,\n },\n ];\n const columns: TableColumn<Pod>[] = [...defaultColumns];\n\n if (extraColumns.includes(READY_COLUMNS)) {\n columns.push(...READY);\n }\n if (extraColumns.includes(RESOURCE_COLUMNS)) {\n const resourceColumns: TableColumn<Pod>[] = [\n {\n title: 'CPU usage %',\n render: (pod: Pod) => {\n return <Cpu clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n {\n title: 'Memory usage %',\n render: (pod: Pod) => {\n return <Memory clusterName={cluster.name} pod={pod} />;\n },\n width: 'auto',\n },\n ];\n columns.push(...resourceColumns);\n }\n\n const tableStyle = {\n minWidth: '0',\n width: '100%',\n };\n\n return (\n <div style={tableStyle}>\n <Table\n options={{ paging: true, search: false, emptyRowsWhenPaging: false }}\n // It was observed that in some instances the pod drawer closes when new data (like CPU usage) is available and the table reloads.\n // Mapping the metadata UID to the tables ID fixes this problem.\n data={\n (pods as Pod[]).map((pod: Pod) => ({\n ...pod,\n id: pod?.metadata?.uid,\n })) as any as Pod[]\n }\n columns={columns}\n />\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsCO,MAAM,aAA4B,GAAA;AAOlC,MAAM,gBAA+B,GAAA;AAoB5C,MAAM,KAA4B,GAAA;AAAA,EAChC;AAAA,IACE,KAAO,EAAA,kBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,eAAA;AAAA,IACR,KAAO,EAAA;AAAA,GACT;AAAA,EACA;AAAA,IACE,KAAO,EAAA,gBAAA;AAAA,IACP,KAAO,EAAA,QAAA;AAAA,IACP,MAAQ,EAAA,aAAA;AAAA,IACR,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA;AAAA;AAEX,CAAA;AAEA,MAAM,gBAAmB,GAAA,CAAC,EAAE,GAAA,EAAwB,KAAA;AAClD,EAAA,MAAM,SAAS,iBAAkB,CAAA;AAAA,IAC/B,IAAM,EAAA,KAAA;AAAA,IACN,UAAY,EAAA,IAAA;AAAA,IACZ,UAAU,GAAI,CAAA;AAAA,GACf,CAAA;AACD,EACE,uBAAA,GAAA;AAAA,IAAC,SAAA;AAAA,IAAA;AAAA,MACC,YAAc,EAAA;AAAA,QACZ,GAAA;AAAA,Q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AAA,MACC,SAAS,EAAE,MAAA,EAAQ,MAAM,MAAQ,EAAA,KAAA,EAAO,qBAAqB,KAAM,EAAA;AAAA,MAGnE,IACG,EAAA,IAAA,CAAe,GAAI,CAAA,CAAC,GAAc,MAAA;AAAA,QACjC,GAAG,GAAA;AAAA,QACH,EAAA,EAAI,KAAK,QAAU,EAAA;AAAA,OACnB,CAAA,CAAA;AAAA,MAEJ;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceDrawer.esm.js","sources":["../../../src/components/ServicesAccordions/ServiceDrawer.tsx"],"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 { V1Service } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.spec || {};\n }}\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 {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAsBO,MAAM,gBAAgB,CAAC;AAAA,EAC5B,OAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,QAAQ,QAAU,EAAA,SAAA;AACpC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,OAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,SAAA;AAAA,MACL,YAAA,EAAc,CAAC,aAA6B,KAAA;AAC1C,QAAO,OAAA,aAAA,CAAc,QAAQ,EAAC;AAAA,OAChC;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAQ,EAAA,OAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EAC7B,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,SAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ServiceDrawer.esm.js","sources":["../../../src/components/ServicesAccordions/ServiceDrawer.tsx"],"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 type { V1Service } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const ServiceDrawer = ({\n service,\n expanded,\n}: {\n service: V1Service;\n expanded?: boolean;\n}) => {\n const namespace = service.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={service}\n expanded={expanded}\n kind=\"Service\"\n renderObject={(serviceObject: V1Service) => {\n return serviceObject.spec || {};\n }}\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 {service.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Service\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </Kubernet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EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServicesAccordions.esm.js","sources":["../../../src/components/ServicesAccordions/ServicesAccordions.tsx"],"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 { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,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AAQ,UAC3D,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,gBAAA,EAAA,EAAiB,4BAAa,GAAA,CAAA,cAAA,EAAA,EAAe,GAC5C,QAAC,kBAAA,GAAA,CAAA,cAAA,EAAA,EAAe,SAAkB,CACpC,EAAA,CAAA;AAAA,oBACC,GAAA,CAAA,gBAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,WAAA,EAAA,EAAY,SAAkB,CACjC,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ,CAAA;AAOa,MAAA,kBAAA,GAAqB,CAAC,EAAgC,KAAA;AACjE,EAAM,MAAA,gBAAA,GAAmB,WAAW,uBAAuB,CAAA;AAC3D,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,QAAS,CAAA,GAAA,CAAI,CAAC,OAAA,EAAS,sBACtC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAS,IAAE,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,OAAkB,EAAA,CAAA,EAAA,EADtB,CAEhB,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"ServicesAccordions.esm.js","sources":["../../../src/components/ServicesAccordions/ServicesAccordions.tsx"],"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 { useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type { V1Service } from '@kubernetes/client-node';\nimport { ServiceDrawer } from './ServiceDrawer';\nimport { GroupedResponsesContext } from '../../hooks';\nimport { StructuredMetadataTable } from '@backstage/core-components';\n\ntype ServiceSummaryProps = {\n service: V1Service;\n};\n\nconst ServiceSummary = ({ service }: ServiceSummaryProps) => {\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={8} item>\n <ServiceDrawer service={service} />\n </Grid>\n\n <Grid item>\n <Typography variant=\"subtitle2\">\n Type: {service.spec?.type ?? '?'}\n </Typography>\n </Grid>\n </Grid>\n );\n};\n\ntype ServiceCardProps = {\n service: V1Service;\n};\n\nconst ServiceCard = ({ service }: ServiceCardProps) => {\n const metadata: any = {};\n\n if (service.status?.loadBalancer?.ingress?.length ?? -1 > 0) {\n metadata.loadbalancer = service.status?.loadBalancer;\n }\n\n if (service.spec?.type === 'ClusterIP') {\n metadata.clusterIP = service.spec.clusterIP;\n }\n if (service.spec?.type === 'ExternalName') {\n metadata.externalName = service.spec.externalName;\n }\n\n return (\n <StructuredMetadataTable\n metadata={{\n type: service.spec?.type,\n ports: service.spec?.ports,\n ...metadata,\n }}\n options={{ nestedValuesAsYaml: true }}\n />\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport type ServicesAccordionsProps = {};\n\ntype ServiceAccordionProps = {\n service: V1Service;\n};\n\nconst ServiceAccordion = ({ service }: ServiceAccordionProps) => {\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <ServiceSummary service={service} />\n </AccordionSummary>\n <AccordionDetails>\n <ServiceCard service={service} />\n </AccordionDetails>\n </Accordion>\n );\n};\n\n/**\n *\n *\n * @public\n */\nexport const ServicesAccordions = ({}: ServicesAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.services.map((service, i) => (\n <Grid item key={i} xs>\n <ServiceAccordion service={service} />\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAgCA,MAAM,cAAiB,GAAA,CAAC,EAAE,OAAA,EAAmC,KAAA;AAC3D,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,SAAkB,CACnC,EAAA,CAAA;AAAA,4BAEC,IAAK,EAAA,EAAA,IAAA,EAAI,MACR,QAAC,kBAAA,IAAA,CAAA,UAAA,EAAA,EAAW,SAAQ,WAAY,EAAA,QAAA,EAAA;AAAA,UAAA,QAAA;AAAA,UACvB,OAAA,CAAQ,MAAM,IAAQ,IAAA;AAAA,SAAA,EAC/B,CACF,EAAA;AAAA;AAAA;AAAA,GACF;AAEJ,CAAA;AAMA,MAAM,WAAc,GAAA,CAAC,EAAE,OAAA,EAAgC,KAAA;AACrD,EAAA,MAAM,WAAgB,EAAC;AAEvB,EAAA,IAAI,QAAQ,MAAQ,EAAA,YAAA,EAAc,OAAS,EAAA,MAAA,IAAU,KAAK,CAAG,EAAA;AAC3D,IAAS,QAAA,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A;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,YAAA;AAAA,MACf,UAAW,EAAA,YAAA;AAAA,MAEV,2BAAiB,QAAS,CAAA,GAAA,CAAI,CAAC,OAAA,EAAS,sBACtC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EAAS,IAAE,IACnB,EAAA,QAAA,kBAAA,GAAA,CAAC,oBAAiB,OAAkB,EAAA,CAAA,EAAA,EADtB,CAEhB,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.tsx"],"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 { ReactNode } from 'react';\nimport { V1StatefulSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const StatefulSetDrawer = ({\n statefulset,\n expanded,\n}: {\n statefulset: V1StatefulSet;\n expanded?: boolean;\n}) => {\n const namespace = statefulset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={statefulset}\n expanded={expanded}\n kind=\"StatefulSet\"\n renderObject={(statefulsetObj: V1StatefulSet) => {\n const conditions = (statefulsetObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n updateStrategy: statefulset.spec?.updateStrategy ?? '???',\n podManagementPolicy: statefulset.spec?.podManagementPolicy ?? '???',\n serviceName: statefulset.spec?.serviceName ?? '???',\n selector: statefulset.spec?.selector ?? '???',\n revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? '???',\n ...conditions,\n };\n }}\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 {statefulset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Stateful Set\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,YAAY,QAAU,EAAA,SAAA;AACxC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,WAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,aAAA;AAAA,MACL,YAAA,EAAc,CAAC,cAAkC,KAAA;AAC/C,QAAA,MAAM,UAAc,GAAA,CAAA,cAAA,CAAe,MAAQ,EAAA,UAAA,IAAc,EAAC,EACvD,GAAI,CAAA,eAAe,CACnB,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,IAAS,KAAA;AACvB,UAAA,KAAA,CAAM,IAAK,CAAA,CAAC,CAAC,CAAA,GAAI,KAAK,CAAC,CAAA;AACvB,UAAO,OAAA,KAAA;AAAA,SACT,EAAG,EAAkC,CAA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AI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"StatefulSetDrawer.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetDrawer.tsx"],"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 { ReactNode } from 'react';\nimport type { V1StatefulSet } from '@kubernetes/client-node';\nimport { KubernetesStructuredMetadataTableDrawer } from '../KubernetesDrawer';\nimport { renderCondition } from '../../utils/pod';\nimport Typography from '@material-ui/core/Typography';\nimport Grid from '@material-ui/core/Grid';\nimport Chip from '@material-ui/core/Chip';\n\nexport const StatefulSetDrawer = ({\n statefulset,\n expanded,\n}: {\n statefulset: V1StatefulSet;\n expanded?: boolean;\n}) => {\n const namespace = statefulset.metadata?.namespace;\n return (\n <KubernetesStructuredMetadataTableDrawer\n object={statefulset}\n expanded={expanded}\n kind=\"StatefulSet\"\n renderObject={(statefulsetObj: V1StatefulSet) => {\n const conditions = (statefulsetObj.status?.conditions ?? [])\n .map(renderCondition)\n .reduce((accum, next) => {\n accum[next[0]] = next[1];\n return accum;\n }, {} as { [key: string]: ReactNode });\n\n return {\n updateStrategy: statefulset.spec?.updateStrategy ?? '???',\n podManagementPolicy: statefulset.spec?.podManagementPolicy ?? '???',\n serviceName: statefulset.spec?.serviceName ?? '???',\n selector: statefulset.spec?.selector ?? '???',\n revisionHistoryLimit: statefulset.spec?.revisionHistoryLimit ?? '???',\n ...conditions,\n };\n }}\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 {statefulset.metadata?.name ?? 'unknown object'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography color=\"textSecondary\" variant=\"subtitle1\">\n Stateful Set\n </Typography>\n </Grid>\n {namespace && (\n <Grid item>\n <Chip size=\"small\" label={`namespace: ${namespace}`} />\n </Grid>\n )}\n </Grid>\n </KubernetesStructuredMetadataTableDrawer>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAwBO,MAAM,oBAAoB,CAAC;AAAA,EAChC,WAAA;AAAA,EACA;AACF,CAGM,KAAA;AACJ,EAAM,MAAA,SAAA,GAAY,YAAY,QAAU,EAAA,SAAA;AACxC,EACE,uBAAA,GAAA;AAAA,IAAC,uCAAA;AAAA,IAAA;AAAA,MACC,MAAQ,EAAA,WAAA;AAAA,MACR,QAAA;AAAA,MACA,IAAK,EAAA,aAAA;AAAA,MACL,YAAA,EAAc,CAAC,cAAkC,KAAA;AAC/C,QAAA,MAAM,UAAc,GAAA,CAAA,cAAA,CAAe,MAAQ,EAAA,UAAA,IAAc,EAAC,EACvD,GAAI,CAAA,eAAe,CACnB,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,IAAS,KAAA;AACvB,UAAA,KAAA,CAAM,IAAK,CAAA,CAAC,CAAC,CAAA,GAAI,KAAK,CAAC,CAAA;AACvB,UAAO,OAAA,KAAA;AAAA,SACT,EAAG,EAAkC,CAAA;AAEvC,QAAO,OAAA;AAAA,UACL,cAAA,EAAgB,WAAY,CAAA,IAAA,EAAM,cAAkB,IAAA,KAAA;AAAA,UACpD,mBAAA,EAAqB,WAAY,CAAA,IAAA,EAAM,mBAAuB,IAAA,KAAA;AAAA,UAC9D,WAAA,EAAa,WAAY,CAAA,IAAA,EAAM,WAAe,IAAA,KAAA;AAAA,UAC9C,QAAA,EAAU,WAAY,CAAA,IAAA,EAAM,QAAY,IAAA,KAAA;AAAA,UACxC,oBAAA,EAAsB,WAAY,CAAA,IAAA,EAAM,oBAAwB,IAAA,KAAA;AAAA,UAChE,GAAG;AAAA,SACL;AAAA,OACF;AAAA,MAEA,QAAA,kBAAA,IAAA;AAAA,QAAC,IAAA;AAAA,QAAA;AAAA,UACC,SAAS,EAAA,IAAA;AAAA,UACT,SAAU,EAAA,QAAA;AAAA,UACV,cAAe,EAAA,YAAA;AAAA,UACf,UAAW,EAAA,YAAA;AAAA,UACX,OAAS,EAAA,CAAA;AAAA,UAET,QAAA,EAAA;AAAA,4BAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,EAAA,IAAA,EACR,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,OAAA,EACjB,QAAY,EAAA,WAAA,CAAA,QAAA,EAAU,IAAQ,IAAA,gBAAA,EACjC,CACF,EAAA,CAAA;AAAA,4BACA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,UAAW,EAAA,EAAA,KAAA,EAAM,eAAgB,EAAA,OAAA,EAAQ,WAAY,EAAA,QAAA,EAAA,cAAA,EAEtD,CACF,EAAA,CAAA;AAAA,YACC,SACC,oBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAI,IACR,EAAA,QAAA,kBAAA,GAAA,CAAC,IAAK,EAAA,EAAA,IAAA,EAAK,OAAQ,EAAA,KAAA,EAAO,CAAc,WAAA,EAAA,SAAS,IAAI,CACvD,EAAA;AAAA;AAAA;AAAA;AAEJ;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport {\n V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UA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,EAAA,SAAA,EAAS,MAAC,IAAI,EAAA,IAAA,EAAS,IAAE,IAC7B,EAAA,QAAA,kBAAA,GAAA,CAAC,QAAK,IAAI,EAAA,IAAA,EAAC,IAAE,IACX,EAAA,QAAA,kBAAA,GAAA;AAAA,QAAC,oBAAA;AAAA,QAAA;AAAA,UACC,WAAa,EAAA,cAAA;AAAA,YACX;AAAA,cACE,IAAA,EAAM,YAAY,QAAU,EAAA,IAAA;AAAA,cAC5B,SAAA,EAAW,YAAY,QAAU,EAAA,SAAA;AAAA,cACjC,IAAM,EAAA;AAAA,aACR;AAAA,YACA,gBAAiB,CAAA;AAAA,WACnB;AAAA,UACA,SAAW,EAAA,iBAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC/D;AAAA;AAAA,OACF,EACF,CAdwB,EAAA,EAAA,CAe1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"StatefulSetsAccordions.esm.js","sources":["../../../src/components/StatefulSetsAccordions/StatefulSetsAccordions.tsx"],"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 { ReactNode, useContext } from 'react';\nimport Accordion from '@material-ui/core/Accordion';\nimport AccordionDetails from '@material-ui/core/AccordionDetails';\nimport AccordionSummary from '@material-ui/core/AccordionSummary';\nimport Grid from '@material-ui/core/Grid';\nimport Typography from '@material-ui/core/Typography';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport type {\n V1Pod,\n V2HorizontalPodAutoscaler,\n V1StatefulSet,\n} from '@kubernetes/client-node';\nimport { PodsTable } from '../Pods';\nimport { StatefulSetDrawer } from './StatefulSetDrawer';\nimport { HorizontalPodAutoscalerDrawer } from '../HorizontalPodAutoscalers';\nimport { getMatchingHpa, getOwnedResources } from '../../utils/owner';\nimport {\n GroupedResponsesContext,\n PodNamesWithErrorsContext,\n} from '../../hooks';\nimport { StatusError, StatusOK } from '@backstage/core-components';\nimport { READY_COLUMNS, RESOURCE_COLUMNS } from '../Pods/PodsTable';\n\ntype StatefulSetsAccordionsProps = {\n children?: ReactNode;\n};\n\ntype StatefulSetAccordionProps = {\n statefulset: V1StatefulSet;\n ownedPods: V1Pod[];\n matchingHpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\ntype StatefulSetSummaryProps = {\n statefulset: V1StatefulSet;\n numberOfCurrentPods: number;\n numberOfPodsWithErrors: number;\n hpa?: V2HorizontalPodAutoscaler;\n children?: ReactNode;\n};\n\nconst StatefulSetSummary = ({\n statefulset,\n numberOfCurrentPods,\n numberOfPodsWithErrors,\n hpa,\n}: StatefulSetSummaryProps) => {\n const specCpuUtil = hpa?.spec?.metrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.target.averageUtilization;\n\n const cpuUtil = hpa?.status?.currentMetrics?.find(\n metric => metric.type === 'Resource' && metric.resource?.name === 'cpu',\n )?.resource?.current.averageUtilization;\n\n return (\n <Grid\n container\n direction=\"row\"\n justifyContent=\"space-between\"\n alignItems=\"center\"\n spacing={0}\n >\n <Grid xs={6} item>\n <StatefulSetDrawer statefulset={statefulset} />\n </Grid>\n {hpa && (\n <Grid item xs={3}>\n <HorizontalPodAutoscalerDrawer hpa={hpa}>\n <Grid\n item\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <Typography variant=\"subtitle2\">\n min replicas {hpa.spec?.minReplicas ?? '?'} / max replicas{' '}\n {hpa.spec?.maxReplicas ?? '?'}\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n current CPU usage: {cpuUtil ?? '?'}%\n </Typography>\n </Grid>\n <Grid item>\n <Typography variant=\"subtitle2\">\n target CPU usage: {specCpuUtil ?? '?'}%\n </Typography>\n </Grid>\n </Grid>\n </HorizontalPodAutoscalerDrawer>\n </Grid>\n )}\n <Grid\n item\n container\n xs={3}\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n spacing={0}\n >\n <Grid item>\n <StatusOK>{numberOfCurrentPods} pods</StatusOK>\n </Grid>\n <Grid item>\n {numberOfPodsWithErrors > 0 ? (\n <StatusError>\n {numberOfPodsWithErrors} pod\n {numberOfPodsWithErrors > 1 ? 's' : ''} with errors\n </StatusError>\n ) : (\n <StatusOK>No pods with errors</StatusOK>\n )}\n </Grid>\n </Grid>\n </Grid>\n );\n};\n\nconst StatefulSetAccordion = ({\n statefulset,\n ownedPods,\n matchingHpa,\n}: StatefulSetAccordionProps) => {\n const podNamesWithErrors = useContext(PodNamesWithErrorsContext);\n\n const podsWithErrors = ownedPods.filter(p =>\n podNamesWithErrors.has(p.metadata?.name ?? ''),\n );\n\n return (\n <Accordion TransitionProps={{ unmountOnExit: true }} variant=\"outlined\">\n <AccordionSummary expandIcon={<ExpandMoreIcon />}>\n <StatefulSetSummary\n statefulset={statefulset}\n numberOfCurrentPods={ownedPods.length}\n numberOfPodsWithErrors={podsWithErrors.length}\n hpa={matchingHpa}\n />\n </AccordionSummary>\n <AccordionDetails>\n <PodsTable\n pods={ownedPods}\n extraColumns={[READY_COLUMNS, RESOURCE_COLUMNS]}\n />\n </AccordionDetails>\n </Accordion>\n );\n};\n\nexport const StatefulSetsAccordions = ({}: StatefulSetsAccordionsProps) => {\n const groupedResponses = useContext(GroupedResponsesContext);\n\n return (\n <Grid\n container\n direction=\"column\"\n justifyContent=\"flex-start\"\n alignItems=\"flex-start\"\n >\n {groupedResponses.statefulsets.map((statefulset, i) => (\n <Grid container item key={i} xs>\n <Grid item xs>\n <StatefulSetAccordion\n matchingHpa={getMatchingHpa(\n {\n name: statefulset.metadata?.name,\n namespace: statefulset.metadata?.namespace,\n kind: 'statefulset',\n },\n groupedResponses.horizontalPodAutoscalers,\n )}\n ownedPods={getOwnedResources(statefulset, groupedResponses.pods)}\n statefulset={statefulset}\n />\n </Grid>\n </Grid>\n ))}\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0DA,MAAM,qBAAqB,CAAC;AAAA,EAC1B,WAAA;AAAA,EACA,mBAAA;AAAA,EACA,sBAAA;AAAA,EACA;AACF,CAA+B,KAAA;AAC7B,EAAM,MAAA,WAAA,GAAc,GAAK,EAAA,IAAA,EAAM,OAAS,EAAA,IAAA;AAAA,IACtC,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,MAAO,CAAA,kBAAA;AAEpB,EAAM,MAAA,OAAA,GAAU,GAAK,EAAA,MAAA,EAAQ,cAAgB,EAAA,IAAA;AAAA,IAC3C,YAAU,MAAO,CAAA,IAAA,KAAS,UAAc,IAAA,MAAA,CAAO,UAAU,IAAS,KAAA;AAAA,GACpE,EAAG,UAAU,OAAQ,CAAA,kBAAA;AAErB,EACE,uBAAA,IAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,SAAS,EAAA,IAAA;AAAA,MACT,SAAU,EAAA,KAAA;AAAA,MACV,cAAe,EAAA,eAAA;AAAA,MACf,UAAW,EAAA,QAAA;AAAA,MACX,OAAS,EAAA,CAAA;AAAA,MAET,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,IAAA,EAAA,EAAK,IAAI,CAAG,EAAA,IAAA,EAAI,MACf,QAAC,kBAAA,GAAA,CAAA,iBAAA,EAAA,EAAkB,aAA0B,CAC/C,EAAA,CAAA;AAAA,QACC,GAAA,wBACE,IAAK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BAAA,CAAkB,WAAa,EAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,UAC/D;AAAA;AAAA,OACF,EACF,CAdwB,EAAA,EAAA,CAe1B,CACD;AAAA;AAAA,GACH;AAEJ;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"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 { createContext, useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport { TypeMeta } from '@kubernetes-models/base';\nimport { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\n\n/**\n * Context for detected errors\n *\n * @public\n */\nexport const DetectedErrorsContext = createContext<DetectedError[]>([]);\n\n/**\n *\n * @public\n */\nexport type ErrorMatcher = {\n metadata?: V1ObjectMeta;\n} & TypeMeta;\n\n/**\n * Find errors which match the resource\n *\n * @public\n */\nexport const useMatchingErrors = (matcher: ErrorMatcher): DetectedError[] => {\n const targetRef: ResourceRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n kind: matcher.kind,\n apiGroup: matcher.apiVersion,\n };\n\n const errors = useContext(DetectedErrorsContext);\n\n return errors.filter(e => {\n const r = e.sourceRef;\n return (\n targetRef.apiGroup === r.apiGroup &&\n targetRef.kind === r.kind &&\n targetRef.name === r.name &&\n targetRef.namespace === r.namespace\n );\n });\n};\n"],"names":[],"mappings":";;AA4Ba,MAAA,qBAAA,GAAwB,aAA+B,CAAA,EAAE;AAezD,MAAA,iBAAA,GAAoB,CAAC,OAA2C,KAAA;AAC3E,EAAA,MAAM,SAAyB,GAAA;AAAA,IAC7B,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA;AAAA,IAC1C,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA;AAAA,GACpB;AAEA,EAAM,MAAA,MAAA,GAAS,WAAW,qBAAqB,CAAA;AAE/C,EAAO,OAAA,MAAA,CAAO,OAAO,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,IAAI,CAAE,CAAA,SAAA;AACZ,IAAA,OACE,SAAU,CAAA,QAAA,KAAa,CAAE,CAAA,QAAA,IACzB,UAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,cAAc,CAAE,CAAA,SAAA;AAAA,GAE7B,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"useMatchingErrors.esm.js","sources":["../../src/hooks/useMatchingErrors.ts"],"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 { createContext, useContext } from 'react';\nimport {\n DetectedError,\n ResourceRef,\n} from '@backstage/plugin-kubernetes-common';\nimport type { TypeMeta } from '@kubernetes-models/base';\nimport type { IIoK8sApimachineryPkgApisMetaV1ObjectMeta as V1ObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\n\n/**\n * Context for detected errors\n *\n * @public\n */\nexport const DetectedErrorsContext = createContext<DetectedError[]>([]);\n\n/**\n *\n * @public\n */\nexport type ErrorMatcher = {\n metadata?: V1ObjectMeta;\n} & TypeMeta;\n\n/**\n * Find errors which match the resource\n *\n * @public\n */\nexport const useMatchingErrors = (matcher: ErrorMatcher): DetectedError[] => {\n const targetRef: ResourceRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n kind: matcher.kind,\n apiGroup: matcher.apiVersion,\n };\n\n const errors = useContext(DetectedErrorsContext);\n\n return errors.filter(e => {\n const r = e.sourceRef;\n return (\n targetRef.apiGroup === r.apiGroup &&\n targetRef.kind === r.kind &&\n targetRef.name === r.name &&\n targetRef.namespace === r.namespace\n );\n });\n};\n"],"names":[],"mappings":";;AA4Ba,MAAA,qBAAA,GAAwB,aAA+B,CAAA,EAAE;AAezD,MAAA,iBAAA,GAAoB,CAAC,OAA2C,KAAA;AAC3E,EAAA,MAAM,SAAyB,GAAA;AAAA,IAC7B,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA;AAAA,IAC1C,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,UAAU,OAAQ,CAAA;AAAA,GACpB;AAEA,EAAM,MAAA,MAAA,GAAS,WAAW,qBAAqB,CAAA;AAE/C,EAAO,OAAA,MAAA,CAAO,OAAO,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,IAAI,CAAE,CAAA,SAAA;AACZ,IAAA,OACE,SAAU,CAAA,QAAA,KAAa,CAAE,CAAA,QAAA,IACzB,UAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,IAAS,KAAA,CAAA,CAAE,IACrB,IAAA,SAAA,CAAU,cAAc,CAAE,CAAA,SAAA;AAAA,GAE7B,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"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 { createContext, useContext } from 'react';\nimport { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(\n new Map(),\n);\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,iBAAoB,GAAA,aAAA;AAAA,sBAC3B,GAAI;AACV;AAca,MAAA,aAAA,GAAgB,CAC3B,WAAA,EACA,OACgC,KAAA;AAChC,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA;AAAA,GAC5C;AAEA,EAAM,MAAA,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAM,MAAA,OAAA,GAAU,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAO,OAAA,OAAA,EAAS,KAAK,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,MAAM,CAAE,CAAA,GAAA;AACd,IACE,OAAA,SAAA,CAAU,IAAU,MAAA,GAAA,CAAI,QAAU,EAAA,IAAA,IAAQ,OAC1C,SAAU,CAAA,SAAA,MAAe,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA,CAAA;AAAA,GAEvD,CAAA;AACH;;;;"}
|
|
1
|
+
{"version":3,"file":"usePodMetrics.esm.js","sources":["../../src/hooks/usePodMetrics.ts"],"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 { createContext, useContext } from 'react';\nimport type { IObjectMeta } from '@kubernetes-models/apimachinery/apis/meta/v1/ObjectMeta';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\n\n/**\n * Context for Pod Metrics\n *\n * @public\n */\nexport const PodMetricsContext = createContext<Map<string, ClientPodStatus[]>>(\n new Map(),\n);\n\n/**\n * @public\n */\nexport type PodMetricsMatcher = {\n metadata?: IObjectMeta;\n};\n\n/**\n * Find metrics matching the provided pod\n *\n * @public\n */\nexport const usePodMetrics = (\n clusterName: string,\n matcher: PodMetricsMatcher,\n): ClientPodStatus | undefined => {\n const targetRef = {\n name: matcher.metadata?.name ?? '',\n namespace: matcher.metadata?.namespace ?? '',\n };\n\n const metricsMap = useContext(PodMetricsContext);\n\n const metrics = metricsMap.get(clusterName);\n\n return metrics?.find(m => {\n const pod = m.pod;\n return (\n targetRef.name === (pod.metadata?.name ?? '') &&\n targetRef.namespace === (pod.metadata?.namespace ?? '')\n );\n });\n};\n"],"names":[],"mappings":";;AAwBO,MAAM,iBAAoB,GAAA,aAAA;AAAA,sBAC3B,GAAI;AACV;AAca,MAAA,aAAA,GAAgB,CAC3B,WAAA,EACA,OACgC,KAAA;AAChC,EAAA,MAAM,SAAY,GAAA;AAAA,IAChB,IAAA,EAAM,OAAQ,CAAA,QAAA,EAAU,IAAQ,IAAA,EAAA;AAAA,IAChC,SAAA,EAAW,OAAQ,CAAA,QAAA,EAAU,SAAa,IAAA;AAAA,GAC5C;AAEA,EAAM,MAAA,UAAA,GAAa,WAAW,iBAAiB,CAAA;AAE/C,EAAM,MAAA,OAAA,GAAU,UAAW,CAAA,GAAA,CAAI,WAAW,CAAA;AAE1C,EAAO,OAAA,OAAA,EAAS,KAAK,CAAK,CAAA,KAAA;AACxB,IAAA,MAAM,MAAM,CAAE,CAAA,GAAA;AACd,IACE,OAAA,SAAA,CAAU,IAAU,MAAA,GAAA,CAAI,QAAU,EAAA,IAAA,IAAQ,OAC1C,SAAU,CAAA,SAAA,MAAe,GAAI,CAAA,QAAA,EAAU,SAAa,IAAA,EAAA,CAAA;AAAA,GAEvD,CAAA;AACH;;;;"}
|
package/dist/index.d.ts
CHANGED
|
@@ -366,6 +366,13 @@ declare class RancherClusterLinksFormatter implements ClusterLinksFormatter {
|
|
|
366
366
|
formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL>;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
/** @public */
|
|
370
|
+
declare class HeadlampClusterLinksFormatter implements ClusterLinksFormatter {
|
|
371
|
+
formatClusterLink(options: ClusterLinksFormatterOptions): Promise<URL>;
|
|
372
|
+
private readonly NAMESPACED_RESOURCES;
|
|
373
|
+
private getHeadlampPath;
|
|
374
|
+
}
|
|
375
|
+
|
|
369
376
|
/** @public */
|
|
370
377
|
declare const DEFAULT_FORMATTER_NAME = "standard";
|
|
371
378
|
/** @public */
|
|
@@ -878,4 +885,4 @@ declare const PodExecTerminal: (props: PodExecTerminalProps) => react_jsx_runtim
|
|
|
878
885
|
*/
|
|
879
886
|
declare const PodExecTerminalDialog: (props: PodExecTerminalProps) => false | react_jsx_runtime.JSX.Element | undefined;
|
|
880
887
|
|
|
881
|
-
export { AksClusterLinksFormatter, AksKubernetesAuthProvider, Cluster, ClusterContext, type ClusterLinksFormatter, type ClusterLinksFormatterOptions, type ClusterProps, ContainerCard, type ContainerCardProps, type ContainerScope, CronJobsAccordions, type CronJobsAccordionsProps, CustomResources, type CustomResourcesProps, DEFAULT_FORMATTER_NAME, DetectedErrorsContext, EksClusterLinksFormatter, ErrorList, type ErrorListProps, type ErrorMatcher, ErrorPanel, type ErrorPanelProps, ErrorReporting, type ErrorReportingProps, Events, EventsContent, type EventsContentProps, type EventsOptions, type EventsProps, FixDialog, type FixDialogProps, type FormatClusterLinkOptions, GkeClusterLinksFormatter, GoogleKubernetesAuthProvider, GroupedResponsesContext, HorizontalPodAutoscalerDrawer, IngressesAccordions, type IngressesAccordionsProps, JobsAccordions, type JobsAccordionsProps, type KubernetesApi, type KubernetesAuthProvider, KubernetesAuthProviders, type KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesClusterLinkFormatter, type KubernetesClusterLinkFormatterApi, KubernetesDrawer, type KubernetesDrawerProps, type KubernetesDrawerable, type KubernetesObject, type KubernetesObjects, type KubernetesProxyApi, KubernetesProxyClient, KubernetesStructuredMetadataTableDrawer, type KubernetesStructuredMetadataTableDrawerProps, LinkErrorPanel, type LinkErrorPanelProps, ManifestYaml, type ManifestYamlProps, OidcKubernetesAuthProvider, OpenshiftClusterLinksFormatter, PendingPodContent, type PendingPodContentProps, type PodAndErrors, type PodColumns, PodDrawer, type PodDrawerProps, PodExecTerminal, PodExecTerminalDialog, type PodExecTerminalProps, PodLogs, PodLogsDialog, type PodLogsDialogProps, type PodLogsOptions, type PodLogsProps, PodMetricsContext, type PodMetricsMatcher, PodNamesWithErrorsContext, PodNamesWithMetricsContext, type PodScope, PodsTable, type PodsTablesProps, READY_COLUMNS, RESOURCE_COLUMNS, RancherClusterLinksFormatter, ResourceUtilization, type ResourceUtilizationProps, ServerSideKubernetesAuthProvider, ServicesAccordions, type ServicesAccordionsProps, StandardClusterLinksFormatter, getDefaultFormatters, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesClusterLinkFormatterApiRef, kubernetesProxyApiRef, useCustomResources, useEvents, useKubernetesObjects, useMatchingErrors, usePodLogs, usePodMetrics };
|
|
888
|
+
export { AksClusterLinksFormatter, AksKubernetesAuthProvider, Cluster, ClusterContext, type ClusterLinksFormatter, type ClusterLinksFormatterOptions, type ClusterProps, ContainerCard, type ContainerCardProps, type ContainerScope, CronJobsAccordions, type CronJobsAccordionsProps, CustomResources, type CustomResourcesProps, DEFAULT_FORMATTER_NAME, DetectedErrorsContext, EksClusterLinksFormatter, ErrorList, type ErrorListProps, type ErrorMatcher, ErrorPanel, type ErrorPanelProps, ErrorReporting, type ErrorReportingProps, Events, EventsContent, type EventsContentProps, type EventsOptions, type EventsProps, FixDialog, type FixDialogProps, type FormatClusterLinkOptions, GkeClusterLinksFormatter, GoogleKubernetesAuthProvider, GroupedResponsesContext, HeadlampClusterLinksFormatter, HorizontalPodAutoscalerDrawer, IngressesAccordions, type IngressesAccordionsProps, JobsAccordions, type JobsAccordionsProps, type KubernetesApi, type KubernetesAuthProvider, KubernetesAuthProviders, type KubernetesAuthProvidersApi, KubernetesBackendClient, KubernetesClusterLinkFormatter, type KubernetesClusterLinkFormatterApi, KubernetesDrawer, type KubernetesDrawerProps, type KubernetesDrawerable, type KubernetesObject, type KubernetesObjects, type KubernetesProxyApi, KubernetesProxyClient, KubernetesStructuredMetadataTableDrawer, type KubernetesStructuredMetadataTableDrawerProps, LinkErrorPanel, type LinkErrorPanelProps, ManifestYaml, type ManifestYamlProps, OidcKubernetesAuthProvider, OpenshiftClusterLinksFormatter, PendingPodContent, type PendingPodContentProps, type PodAndErrors, type PodColumns, PodDrawer, type PodDrawerProps, PodExecTerminal, PodExecTerminalDialog, type PodExecTerminalProps, PodLogs, PodLogsDialog, type PodLogsDialogProps, type PodLogsOptions, type PodLogsProps, PodMetricsContext, type PodMetricsMatcher, PodNamesWithErrorsContext, PodNamesWithMetricsContext, type PodScope, PodsTable, type PodsTablesProps, READY_COLUMNS, RESOURCE_COLUMNS, RancherClusterLinksFormatter, ResourceUtilization, type ResourceUtilizationProps, ServerSideKubernetesAuthProvider, ServicesAccordions, type ServicesAccordionsProps, StandardClusterLinksFormatter, getDefaultFormatters, kubernetesApiRef, kubernetesAuthProvidersApiRef, kubernetesClusterLinkFormatterApiRef, kubernetesProxyApiRef, useCustomResources, useEvents, useKubernetesObjects, useMatchingErrors, usePodLogs, usePodMetrics };
|
package/dist/index.esm.js
CHANGED
|
@@ -52,4 +52,5 @@ export { EksClusterLinksFormatter } from './api/formatters/EksClusterLinksFormat
|
|
|
52
52
|
export { GkeClusterLinksFormatter } from './api/formatters/GkeClusterLinksFormatter.esm.js';
|
|
53
53
|
export { OpenshiftClusterLinksFormatter } from './api/formatters/OpenshiftClusterLinksFormatter.esm.js';
|
|
54
54
|
export { RancherClusterLinksFormatter } from './api/formatters/RancherClusterLinksFormatter.esm.js';
|
|
55
|
+
export { HeadlampClusterLinksFormatter } from './api/formatters/HeadlampClusterLinksFormatter.esm.js';
|
|
55
56
|
//# sourceMappingURL=index.esm.js.map
|
package/dist/index.esm.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -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 {\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 ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\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+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OAAO,aAAc,CAAA,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAE,CAAA,QAAA,EAAU,eAAiB,EAAA,IAAA;AAAA,MAC3B,CAAK,CAAA,KAAA,CAAA,CAAE,GAAQ,KAAA,cAAA,CAAe,QAAU,EAAA;AAAA,KACrC,IAAA;AAAA,GACT;AACF;AAEO,MAAM,8BAAiC,GAAA,CAC5C,cACA,EAAA,WAAA,EACA,IACG,KAAA;AACH,EAAO,OAAA,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,EAAG,CAAA,MAAA,CAAO,WAAW,CAAC;AAAA,GAC5D,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,EAAO,KAAA;AACtB,IAAA,OAAO,KAAM,CAAA,MAAA,CAAO,iBAAkB,CAAA,EAAA,EAAI,IAAI,CAAC,CAAA;AAAA,GACjD,EAAG,EAAa,CAAA;AAClB;AAQa,MAAA,cAAA,GAAiB,CAC5B,KAAA,EACA,IAC0C,KAAA;AAC1C,EAAO,OAAA,IAAA,CAAK,KAAK,CAAO,GAAA,KAAA;AACtB,IACG,OAAA,CAAA,GAAA,CAAI,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,EAAA,EAAI,iBAAkB,CAAA,OAAO,CAC9D,KAAA,KAAA,CAAM,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAU,EAAA,SAAA,IAAa,EACzB,OAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAA,IAAA,CACrB,GAAI,CAAA,IAAA,EAAM,cAAgB,EAAA,IAAA,IAAQ,EAChC,OAAA,KAAA,CAAM,IAAQ,IAAA,oBAAA,CAAA;AAAA,GAEpB,CAAA;AACH;;;;"}
|
|
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 ?? '').toLocaleLowerCase('en-US') ===\n owner.kind.toLocaleLowerCase('en-US') &&\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+BgB,SAAA,iBAAA,CACd,gBACA,aACK,EAAA;AACL,EAAA,OAAO,aAAc,CAAA,MAAA;AAAA,IACnB,CAAA,CAAA,KACE,CAAE,CAAA,QAAA,EAAU,eAAiB,EAAA,IAAA;AAAA,MAC3B,CAAK,CAAA,KAAA,CAAA,CAAE,GAAQ,KAAA,cAAA,CAAe,QAAU,EAAA;AAAA,KACrC,IAAA;AAAA,GACT;AACF;AAEO,MAAM,8BAAiC,GAAA,CAC5C,cACA,EAAA,WAAA,EACA,IACG,KAAA;AACH,EAAO,OAAA,iBAAA;AAAA,IACL,cAAA;AAAA,IACA,WAAA,CAAY,OAAO,CAAM,EAAA,KAAA,EAAA,CAAG,UAAU,EAAG,CAAA,MAAA,CAAO,WAAW,CAAC;AAAA,GAC5D,CAAA,MAAA,CAAO,CAAC,KAAA,EAAO,EAAO,KAAA;AACtB,IAAA,OAAO,KAAM,CAAA,MAAA,CAAO,iBAAkB,CAAA,EAAA,EAAI,IAAI,CAAC,CAAA;AAAA,GACjD,EAAG,EAAa,CAAA;AAClB;AAQa,MAAA,cAAA,GAAiB,CAC5B,KAAA,EACA,IAC0C,KAAA;AAC1C,EAAO,OAAA,IAAA,CAAK,KAAK,CAAO,GAAA,KAAA;AACtB,IACG,OAAA,CAAA,GAAA,CAAI,IAAM,EAAA,cAAA,EAAgB,IAAQ,IAAA,EAAA,EAAI,iBAAkB,CAAA,OAAO,CAC9D,KAAA,KAAA,CAAM,IAAK,CAAA,iBAAA,CAAkB,OAAO,CAAA,IAAA,CACrC,IAAI,QAAU,EAAA,SAAA,IAAa,EACzB,OAAA,KAAA,CAAM,SAAa,IAAA,mBAAA,CAAA,IAAA,CACrB,GAAI,CAAA,IAAA,EAAM,cAAgB,EAAA,IAAA,IAAQ,EAChC,OAAA,KAAA,CAAM,IAAQ,IAAA,oBAAA,CAAA;AAAA,GAEpB,CAAA;AACH;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"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 V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses"],"mappings":";;;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA;AAC3D;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI,GAAA,CAAA,CAAE,cAAc,CAAC,CAAA;AAClE;AAEa,MAAA,iBAAA,GAAoB,CAAC,GAAwB,KAAA;AACxD,EAAA,MAAM,qBAAwB,GAAA,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AAAA,QACR,OAAQ,CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAAA,GACxC;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"pod.esm.js","sources":["../../src/utils/pod.tsx"],"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 type {\n V1Pod,\n V1PodCondition,\n V1DeploymentCondition,\n} from '@kubernetes/client-node';\nimport { Fragment, ReactNode } from 'react';\nimport Chip from '@material-ui/core/Chip';\nimport {\n StatusAborted,\n StatusError,\n StatusOK,\n SubvalueCell,\n} from '@backstage/core-components';\nimport { ClientPodStatus } from '@backstage/plugin-kubernetes-common';\nimport { Pod } from 'kubernetes-models/v1/Pod';\nimport { bytesToMiB, formatMillicores } from './resources';\n\nexport const imageChips = (pod: V1Pod): ReactNode => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const images = containerStatuses.map((cs, i) => {\n return <Chip key={i} label={`${cs.name}=${cs.image}`} size=\"small\" />;\n });\n\n return <div>{images}</div>;\n};\n\nexport const containersReady = (pod: Pod): string => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n const containersReadyItem = containerStatuses.filter(cs => cs.ready).length;\n\n return `${containersReadyItem}/${containerStatuses.length}`;\n};\n\nexport const totalRestarts = (pod: Pod): number => {\n const containerStatuses = pod.status?.containerStatuses ?? [];\n return containerStatuses?.reduce((a, b) => a + b.restartCount, 0);\n};\n\nexport const containerStatuses = (pod: Pod): ReactNode => {\n const containerStatusesItem = pod.status?.containerStatuses ?? [];\n const errors = containerStatusesItem.reduce((accum, next) => {\n if (next.state === undefined) {\n return accum;\n }\n\n const waiting = next.state.waiting;\n const terminated = next.state.terminated;\n\n const renderCell = (reason: string | undefined) => (\n <Fragment key={`${pod.metadata?.name}-${next.name}`}>\n <SubvalueCell\n value={\n reason === 'Completed' ? (\n <StatusOK>Container: {next.name}</StatusOK>\n ) : (\n <StatusError>Container: {next.name}</StatusError>\n )\n }\n subvalue={reason}\n />\n <br />\n </Fragment>\n );\n\n if (waiting) {\n accum.push(renderCell(waiting.reason));\n }\n\n if (terminated) {\n accum.push(renderCell(terminated.reason));\n }\n\n return accum;\n }, [] as ReactNode[]);\n\n if (errors.length === 0) {\n return <StatusOK>OK</StatusOK>;\n }\n\n return errors;\n};\n\nexport const renderCondition = (\n condition: V1PodCondition | V1DeploymentCondition,\n): [string, ReactNode] => {\n const status = condition.status;\n\n if (status === 'True') {\n return [condition.type, <StatusOK>True</StatusOK>];\n } else if (status === 'False') {\n return [\n condition.type,\n <SubvalueCell\n value={<StatusError>False</StatusError>}\n subvalue={condition.message ?? ''}\n />,\n ];\n }\n return [condition.type, <StatusAborted />];\n};\n\n// visible for testing\nexport const currentToDeclaredResourceToPerc = (\n current: number | string,\n resource: number | string,\n): string => {\n if (Number(resource) === 0) return `0%`;\n\n if (typeof current === 'number' && typeof resource === 'number') {\n return `${Math.round((current / resource) * 100)}%`;\n }\n\n const numerator: bigint = BigInt(\n typeof current === 'number' ? Math.round(current) : Number(current),\n );\n const denominator: bigint = BigInt(\n typeof resource === 'number' ? Math.round(resource) : Number(resource),\n );\n\n return `${(numerator * BigInt(100)) / denominator}%`;\n};\n\nexport const podStatusToCpuUtil = (podStatus: ClientPodStatus): ReactNode => {\n const cpuUtil = podStatus.cpu;\n\n let currentUsage: number | string = cpuUtil.currentUsage;\n\n // current usage number for CPU is a different unit than request/limit total\n // this might be a bug in the k8s library\n if (typeof cpuUtil.currentUsage === 'number') {\n currentUsage = cpuUtil.currentUsage / 10;\n }\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.requestTotal,\n )} of ${formatMillicores(cpuUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n currentUsage,\n cpuUtil.limitTotal,\n )} of ${formatMillicores(cpuUtil.limitTotal)}`}\n />\n );\n};\n\nexport const podStatusToMemoryUtil = (\n podStatus: ClientPodStatus,\n): ReactNode => {\n const memUtil = podStatus.memory;\n\n return (\n <SubvalueCell\n value={`requests: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.requestTotal,\n )} of ${bytesToMiB(memUtil.requestTotal)}`}\n subvalue={`limits: ${currentToDeclaredResourceToPerc(\n memUtil.currentUsage,\n memUtil.limitTotal,\n )} of ${bytesToMiB(memUtil.limitTotal)}`}\n />\n );\n};\n"],"names":["containerStatuses"],"mappings":";;;;;;AA0Ca,MAAA,eAAA,GAAkB,CAAC,GAAqB,KAAA;AACnD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAA,MAAM,sBAAsBA,kBAAkB,CAAA,MAAA,CAAO,CAAM,EAAA,KAAA,EAAA,CAAG,KAAK,CAAE,CAAA,MAAA;AAErE,EAAA,OAAO,CAAG,EAAA,mBAAmB,CAAIA,CAAAA,EAAAA,kBAAAA,CAAkB,MAAM,CAAA,CAAA;AAC3D;AAEa,MAAA,aAAA,GAAgB,CAAC,GAAqB,KAAA;AACjD,EAAA,MAAMA,kBAAoB,GAAA,GAAA,CAAI,MAAQ,EAAA,iBAAA,IAAqB,EAAC;AAC5D,EAAOA,OAAAA,kBAAAA,EAAmB,OAAO,CAAC,CAAA,EAAG,MAAM,CAAI,GAAA,CAAA,CAAE,cAAc,CAAC,CAAA;AAClE;AAEa,MAAA,iBAAA,GAAoB,CAAC,GAAwB,KAAA;AACxD,EAAA,MAAM,qBAAwB,GAAA,GAAA,CAAI,MAAQ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CAAA;AAAA,OACT,CAAA,IAAA,EAAO,UAAW,CAAA,OAAA,CAAQ,UAAU,CAAC,CAAA;AAAA;AAAA,GACxC;AAEJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage/plugin-kubernetes-react",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.7-next.0",
|
|
4
4
|
"description": "Web library for the kubernetes-react plugin",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "web-library",
|
|
@@ -63,14 +63,14 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@backstage/catalog-model": "1.7.3",
|
|
66
|
-
"@backstage/core-components": "0.17.
|
|
67
|
-
"@backstage/core-plugin-api": "1.10.6
|
|
66
|
+
"@backstage/core-components": "0.17.2-next.0",
|
|
67
|
+
"@backstage/core-plugin-api": "1.10.6",
|
|
68
68
|
"@backstage/errors": "1.2.7",
|
|
69
|
-
"@backstage/plugin-kubernetes-common": "0.9.
|
|
69
|
+
"@backstage/plugin-kubernetes-common": "0.9.5-next.0",
|
|
70
70
|
"@backstage/types": "1.2.1",
|
|
71
71
|
"@kubernetes-models/apimachinery": "^2.0.0",
|
|
72
72
|
"@kubernetes-models/base": "^5.0.0",
|
|
73
|
-
"@kubernetes/client-node": "1.
|
|
73
|
+
"@kubernetes/client-node": "1.1.2",
|
|
74
74
|
"@material-ui/core": "^4.9.13",
|
|
75
75
|
"@material-ui/icons": "^4.11.3",
|
|
76
76
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
@@ -85,9 +85,9 @@
|
|
|
85
85
|
"xterm-addon-fit": "^0.8.0"
|
|
86
86
|
},
|
|
87
87
|
"devDependencies": {
|
|
88
|
-
"@backstage/cli": "0.32.
|
|
89
|
-
"@backstage/core-app-api": "1.16.1
|
|
90
|
-
"@backstage/test-utils": "1.7.
|
|
88
|
+
"@backstage/cli": "0.32.1-next.1",
|
|
89
|
+
"@backstage/core-app-api": "1.16.1",
|
|
90
|
+
"@backstage/test-utils": "1.7.8-next.0",
|
|
91
91
|
"@testing-library/jest-dom": "^6.0.0",
|
|
92
92
|
"@testing-library/react": "^16.0.0",
|
|
93
93
|
"@types/react": "^18.0.0",
|