@backstage/plugin-kubernetes 0.6.6-next.0 → 0.6.6-next.1

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,18 @@
1
1
  # @backstage/plugin-kubernetes
2
2
 
3
+ ## 0.6.6-next.1
4
+
5
+ ### Patch Changes
6
+
7
+ - b9b8bbc7d9: show request/limit CPU and Memory on the UI
8
+ - 8f7b1835df: Updated dependency `msw` to `^0.41.0`.
9
+ - Updated dependencies
10
+ - @backstage/core-components@0.9.5-next.1
11
+ - @backstage/core-plugin-api@1.0.3-next.0
12
+ - @backstage/catalog-model@1.0.3-next.0
13
+ - @backstage/plugin-catalog-react@1.1.1-next.1
14
+ - @backstage/plugin-kubernetes-common@0.3.0-next.1
15
+
3
16
  ## 0.6.6-next.0
4
17
 
5
18
  ### Patch Changes
package/dist/index.esm.js CHANGED
@@ -440,6 +440,9 @@ const currentToDeclaredResourceToPerc = (current, resource) => {
440
440
  const denominator = BigInt(resource);
441
441
  return `${numerator * BigInt(100) / denominator}%`;
442
442
  };
443
+ const formatMilicores = (value) => {
444
+ return `${parseFloat(value.toString()) * 1e3}m`;
445
+ };
443
446
  const podStatusToCpuUtil = (podStatus) => {
444
447
  const cpuUtil = podStatus.cpu;
445
448
  let currentUsage = cpuUtil.currentUsage;
@@ -447,15 +450,18 @@ const podStatusToCpuUtil = (podStatus) => {
447
450
  currentUsage = cpuUtil.currentUsage / 10;
448
451
  }
449
452
  return /* @__PURE__ */ React__default.createElement(SubvalueCell, {
450
- value: `requests: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.requestTotal)}`,
451
- subvalue: `limits: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.limitTotal)}`
453
+ value: `requests: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.requestTotal)} of ${formatMilicores(cpuUtil.requestTotal)}`,
454
+ subvalue: `limits: ${currentToDeclaredResourceToPerc(currentUsage, cpuUtil.limitTotal)} of ${formatMilicores(cpuUtil.limitTotal)}`
452
455
  });
453
456
  };
457
+ const bytesToMiB = (value) => {
458
+ return `${parseFloat(value.toString()) / 1024 / 1024}MiB`;
459
+ };
454
460
  const podStatusToMemoryUtil = (podStatus) => {
455
461
  const memUtil = podStatus.memory;
456
462
  return /* @__PURE__ */ React__default.createElement(SubvalueCell, {
457
- value: `requests: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.requestTotal)}`,
458
- subvalue: `limits: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.limitTotal)}`
463
+ value: `requests: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.requestTotal)} of ${bytesToMiB(memUtil.requestTotal)}`,
464
+ subvalue: `limits: ${currentToDeclaredResourceToPerc(memUtil.currentUsage, memUtil.limitTotal)} of ${bytesToMiB(memUtil.limitTotal)}`
459
465
  });
460
466
  };
461
467