@backstage/plugin-kubernetes-react 0.3.0-next.1 → 0.3.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,43 @@
1
1
  # @backstage/plugin-kubernetes-react
2
2
 
3
+ ## 0.3.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - 0dfc185: **BREAKING** The `PodScope`, `PodAndErrors`, and `PodExecTerminalProps` types no
8
+ longer have a `clusterName` field; instead they now have the field `cluster`
9
+ which contains the full `ClusterAttributes`.
10
+
11
+ ### Patch Changes
12
+
13
+ - 5bf0c17: Pod dialogs display cluster title when specified.
14
+ - 74770c8: The `ErrorPanel` component will display the `title` field (when specified) for
15
+ clusters with errors.
16
+ - b01c86c: The `ErrorReporting` component's cluster column now displays cluster titles when
17
+ specified.
18
+ - 8472188: Added or fixed the `repository` field in `package.json`.
19
+ - 2b305eb: The `Cluster` component now renders the cluster's title, if specified.
20
+ - Updated dependencies
21
+ - @backstage/plugin-kubernetes-common@0.7.4-next.2
22
+ - @backstage/core-components@0.14.0-next.2
23
+ - @backstage/catalog-model@1.4.4-next.0
24
+ - @backstage/core-plugin-api@1.9.0-next.1
25
+ - @backstage/errors@1.2.3
26
+ - @backstage/types@1.1.1
27
+
28
+ ## 0.3.0-next.2
29
+
30
+ ### Patch Changes
31
+
32
+ - 8fe56a8: Widen `@types/react` dependency range to include version 18.
33
+ - Updated dependencies
34
+ - @backstage/core-components@0.14.0-next.1
35
+ - @backstage/core-plugin-api@1.9.0-next.1
36
+ - @backstage/catalog-model@1.4.4-next.0
37
+ - @backstage/errors@1.2.3
38
+ - @backstage/types@1.1.1
39
+ - @backstage/plugin-kubernetes-common@0.7.4-next.1
40
+
3
41
  ## 0.3.0-next.1
4
42
 
5
43
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -430,13 +430,14 @@ declare const ErrorPanel: ({ entityName, errorMessage, clustersWithErrors, }: Er
430
430
  */
431
431
  type ErrorReportingProps = {
432
432
  detectedErrors: DetectedErrorsByCluster;
433
+ clusters: ClusterAttributes[];
433
434
  };
434
435
  /**
435
436
  *
436
437
  *
437
438
  * @public
438
439
  */
439
- declare const ErrorReporting: ({ detectedErrors }: ErrorReportingProps) => React.JSX.Element;
440
+ declare const ErrorReporting: ({ detectedErrors, clusters, }: ErrorReportingProps) => React.JSX.Element;
440
441
 
441
442
  /** @public */
442
443
  declare const HorizontalPodAutoscalerDrawer: (props: {
@@ -560,12 +561,12 @@ interface ManifestYamlProps {
560
561
  declare const ManifestYaml: ({ object }: ManifestYamlProps) => React__default.JSX.Element;
561
562
 
562
563
  /**
563
- * Wraps a pod with the associated detected errors and cluster name
564
+ * Wraps a pod with the associated detected errors and cluster
564
565
  *
565
566
  * @public
566
567
  */
567
568
  interface PodAndErrors {
568
- clusterName: string;
569
+ cluster: ClusterAttributes;
569
570
  pod: Pod;
570
571
  errors: DetectedError[];
571
572
  }
@@ -594,7 +595,7 @@ declare const PodDrawer: ({ podAndErrors, open }: PodDrawerProps) => React__defa
594
595
  interface PodScope {
595
596
  podName: string;
596
597
  podNamespace: string;
597
- clusterName: string;
598
+ cluster: ClusterAttributes;
598
599
  }
599
600
  /**
600
601
  * Contains the details needed to make a log request to Kubernetes
@@ -843,7 +844,7 @@ declare const ResourceUtilization: ({ compressed, title, usage, total, totalForm
843
844
  * @public
844
845
  */
845
846
  interface PodExecTerminalProps {
846
- clusterName: string;
847
+ cluster: ClusterAttributes;
847
848
  containerName: string;
848
849
  podName: string;
849
850
  podNamespace: string;
package/dist/index.esm.js CHANGED
@@ -1029,7 +1029,7 @@ const PodExecTerminal = (props) => {
1029
1029
  };
1030
1030
 
1031
1031
  const PodExecTerminalDialog = (props) => {
1032
- const { clusterName, containerName, podName } = props;
1032
+ const { cluster, containerName, podName } = props;
1033
1033
  const isPodExecTerminalSupported = useIsPodExecTerminalSupported();
1034
1034
  return !isPodExecTerminalSupported.loading && isPodExecTerminalSupported.value && /* @__PURE__ */ React__default.createElement(
1035
1035
  KubernetesDialog,
@@ -1038,7 +1038,7 @@ const PodExecTerminalDialog = (props) => {
1038
1038
  buttonIcon: /* @__PURE__ */ React__default.createElement(OpenInBrowserIcon, null),
1039
1039
  buttonText: "Terminal",
1040
1040
  disabled: isPodExecTerminalSupported.loading || !isPodExecTerminalSupported.value,
1041
- title: `${podName} - ${containerName} terminal shell on cluster ${clusterName}`
1041
+ title: `${podName} - ${containerName} terminal shell on cluster ${cluster.title || cluster.name}`
1042
1042
  },
1043
1043
  /* @__PURE__ */ React__default.createElement(PodExecTerminal, { ...props })
1044
1044
  );
@@ -1093,7 +1093,7 @@ const usePodLogs = ({ containerScope, previous }) => {
1093
1093
  podName: containerScope.podName,
1094
1094
  namespace: containerScope.podNamespace,
1095
1095
  containerName: containerScope.containerName,
1096
- clusterName: containerScope.clusterName,
1096
+ clusterName: containerScope.cluster.name,
1097
1097
  previous
1098
1098
  });
1099
1099
  }, [JSON.stringify(containerScope)]);
@@ -1143,7 +1143,7 @@ const PodLogsDialog = ({ containerScope }) => {
1143
1143
  buttonIcon: /* @__PURE__ */ React__default.createElement(SubjectIcon, null),
1144
1144
  buttonText: "Logs",
1145
1145
  disabled: false,
1146
- title: `${containerScope.podName} - ${containerScope.containerName} logs on cluster ${containerScope.clusterName}`
1146
+ title: `${containerScope.podName} - ${containerScope.containerName} logs on cluster ${containerScope.cluster.title || containerScope.cluster.name}`
1147
1147
  },
1148
1148
  /* @__PURE__ */ React__default.createElement(PodLogs, { containerScope })
1149
1149
  );
@@ -1276,7 +1276,7 @@ const ContainerCard = ({
1276
1276
  ), isPodExecTerminalEnabled && /* @__PURE__ */ React__default.createElement(
1277
1277
  PodExecTerminalDialog,
1278
1278
  {
1279
- clusterName: podScope.clusterName,
1279
+ cluster: podScope.cluster,
1280
1280
  containerName: containerStatus.name,
1281
1281
  podName: podScope.podName,
1282
1282
  podNamespace: podScope.podNamespace
@@ -1720,7 +1720,7 @@ const FixDialog = ({
1720
1720
  containerScope: {
1721
1721
  podName: (_f = (_e = pod.metadata) == null ? void 0 : _e.name) != null ? _f : "unknown",
1722
1722
  podNamespace: (_h = (_g = pod.metadata) == null ? void 0 : _g.namespace) != null ? _h : "unknown",
1723
- clusterName,
1723
+ cluster: { name: clusterName },
1724
1724
  containerName: pf.container
1725
1725
  }
1726
1726
  }
@@ -1797,7 +1797,7 @@ const ErrorList = ({ podAndErrors }) => {
1797
1797
  {
1798
1798
  pod: onlyPodWithErrors.pod,
1799
1799
  error,
1800
- clusterName: onlyPodWithErrors.clusterName
1800
+ clusterName: onlyPodWithErrors.cluster.name
1801
1801
  }
1802
1802
  ))))
1803
1803
  );
@@ -1832,7 +1832,7 @@ function getContainerSpecByName(pod, containerName) {
1832
1832
  const PodDrawer = ({ podAndErrors, open }) => {
1833
1833
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
1834
1834
  const classes = useDrawerContentStyles();
1835
- const podMetrics = usePodMetrics(podAndErrors.clusterName, podAndErrors.pod);
1835
+ const podMetrics = usePodMetrics(podAndErrors.cluster.name, podAndErrors.pod);
1836
1836
  return /* @__PURE__ */ React__default.createElement(
1837
1837
  KubernetesDrawer,
1838
1838
  {
@@ -1889,7 +1889,7 @@ const PodDrawer = ({ podAndErrors, open }) => {
1889
1889
  podScope: {
1890
1890
  podName: (_d2 = (_c2 = podAndErrors.pod.metadata) == null ? void 0 : _c2.name) != null ? _d2 : "unknown",
1891
1891
  podNamespace: (_f2 = (_e2 = podAndErrors.pod.metadata) == null ? void 0 : _e2.namespace) != null ? _f2 : "unknown",
1892
- clusterName: podAndErrors.clusterName
1892
+ cluster: podAndErrors.cluster
1893
1893
  },
1894
1894
  containerSpec,
1895
1895
  containerStatus
@@ -2031,7 +2031,6 @@ const READY = [
2031
2031
  }
2032
2032
  ];
2033
2033
  const PodDrawerTrigger = ({ pod }) => {
2034
- const cluster = useContext(ClusterContext);
2035
2034
  const errors = useMatchingErrors({
2036
2035
  kind: "Pod",
2037
2036
  apiVersion: "v1",
@@ -2042,7 +2041,7 @@ const PodDrawerTrigger = ({ pod }) => {
2042
2041
  {
2043
2042
  podAndErrors: {
2044
2043
  pod,
2045
- clusterName: cluster.name,
2044
+ cluster: useContext(ClusterContext),
2046
2045
  errors
2047
2046
  }
2048
2047
  }
@@ -3233,7 +3232,7 @@ const Cluster = ({ clusterObjects, podsWithErrors }) => {
3233
3232
  return /* @__PURE__ */ React__default.createElement(ClusterContext.Provider, { value: clusterObjects.cluster }, /* @__PURE__ */ React__default.createElement(GroupedResponsesContext.Provider, { value: groupedResponses }, /* @__PURE__ */ React__default.createElement(PodMetricsContext.Provider, { value: podMetricsMap }, /* @__PURE__ */ React__default.createElement(PodNamesWithErrorsContext.Provider, { value: podsWithErrors }, /* @__PURE__ */ React__default.createElement(Accordion, { TransitionProps: { unmountOnExit: true } }, /* @__PURE__ */ React__default.createElement(AccordionSummary, { expandIcon: /* @__PURE__ */ React__default.createElement(ExpandMoreIcon, null) }, /* @__PURE__ */ React__default.createElement(
3234
3233
  ClusterSummary,
3235
3234
  {
3236
- clusterName: clusterObjects.cluster.name,
3235
+ clusterName: clusterObjects.cluster.title || clusterObjects.cluster.name,
3237
3236
  totalNumberOfPods: groupedResponses.pods.length,
3238
3237
  numberOfPodsWithErrors: podsWithErrors.size
3239
3238
  }
@@ -3242,7 +3241,7 @@ const Cluster = ({ clusterObjects, podsWithErrors }) => {
3242
3241
 
3243
3242
  const clustersWithErrorsToErrorMessage = (clustersWithErrors) => {
3244
3243
  return clustersWithErrors.map((c, i) => {
3245
- return /* @__PURE__ */ React__default.createElement("div", { key: i }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "body2" }, `Cluster: ${c.cluster.name}`), c.errors.map((e, j) => {
3244
+ return /* @__PURE__ */ React__default.createElement("div", { key: i }, /* @__PURE__ */ React__default.createElement(Typography, { variant: "body2" }, `Cluster: ${c.cluster.title || c.cluster.name}`), c.errors.map((e, j) => {
3246
3245
  return /* @__PURE__ */ React__default.createElement(Typography, { variant: "body2", key: j }, e.errorType === "FETCH_ERROR" ? `Error communicating with Kubernetes: ${e.errorType}, message: ${e.message}` : `Error fetching Kubernetes resource: '${e.resourcePath}', error: ${e.errorType}, status code: ${e.statusCode}`);
3247
3246
  }), /* @__PURE__ */ React__default.createElement("br", null));
3248
3247
  });
@@ -3265,7 +3264,7 @@ const columns = [
3265
3264
  {
3266
3265
  title: "cluster",
3267
3266
  width: "10%",
3268
- render: (row) => row.clusterName
3267
+ render: (row) => row.cluster.title || row.cluster.name
3269
3268
  },
3270
3269
  {
3271
3270
  title: "namespace",
@@ -3298,10 +3297,13 @@ const sortBySeverity = (a, b) => {
3298
3297
  }
3299
3298
  return 0;
3300
3299
  };
3301
- const ErrorReporting = ({ detectedErrors }) => {
3300
+ const ErrorReporting = ({
3301
+ detectedErrors,
3302
+ clusters
3303
+ }) => {
3302
3304
  const errors = Array.from(detectedErrors.entries()).flatMap(([clusterName, resourceErrors]) => {
3303
3305
  return resourceErrors.map((e) => ({
3304
- clusterName,
3306
+ cluster: clusters.find((c) => c.name === clusterName),
3305
3307
  error: e
3306
3308
  }));
3307
3309
  }).sort(sortBySeverity);