@dovetail-v2/refine 0.0.7 → 0.0.8

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.
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntime } from "./index.b720212a.js";
1
+ import { j as jsxRuntime } from "./index.5cb49249.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "@refinedev/core";
@@ -8514,6 +8514,55 @@ class PodModel extends WorkloadModel {
8514
8514
  return `${(_b = (_a = this.rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length}/${(_c = this.rawYaml.spec) == null ? void 0 : _c.containers.length}`;
8515
8515
  }
8516
8516
  }
8517
+ class PodMetricsModel extends ResourceModel {
8518
+ constructor(data2) {
8519
+ super(data2);
8520
+ __publicField(this, "usage");
8521
+ this.data = data2;
8522
+ let cpuUsageNum = 0;
8523
+ let memoryUsageNum = 0;
8524
+ for (const container2 of data2.containers) {
8525
+ cpuUsageNum += parseSi(container2.usage.cpu || "0");
8526
+ memoryUsageNum += parseSi(container2.usage.memory || "0");
8527
+ }
8528
+ this.usage = {
8529
+ cpu: {
8530
+ value: cpuUsageNum,
8531
+ si: formatSi(1e3 * cpuUsageNum, {
8532
+ suffix: "m",
8533
+ maxPrecision: 0
8534
+ })
8535
+ },
8536
+ memory: {
8537
+ value: memoryUsageNum,
8538
+ si: formatSi(memoryUsageNum, {
8539
+ suffix: "i",
8540
+ maxPrecision: 0
8541
+ })
8542
+ }
8543
+ };
8544
+ }
8545
+ }
8546
+ class CronJobModel extends WorkloadModel {
8547
+ constructor(data2) {
8548
+ super(data2);
8549
+ this.data = data2;
8550
+ }
8551
+ suspend() {
8552
+ const newOne = cloneDeep(this.data);
8553
+ if (this.data.kind === "CronJob") {
8554
+ set(newOne, "spec.suspend", true);
8555
+ }
8556
+ return newOne;
8557
+ }
8558
+ resume() {
8559
+ const newOne = cloneDeep(this.data);
8560
+ if (this.data.kind === "CronJob") {
8561
+ set(newOne, "spec.suspend", false);
8562
+ }
8563
+ return newOne;
8564
+ }
8565
+ }
8517
8566
  const ErrorContent_1t51xnx = "";
8518
8567
  const ErrorWrapper = "eckm4od";
8519
8568
  const ErrorContent = "e1hl982n";
@@ -9565,7 +9614,7 @@ const Separator = () => {
9565
9614
  });
9566
9615
  };
9567
9616
  const MonacoYamlEditor = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
9568
- const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.e4468695.js"));
9617
+ const MonacoYamlDiffEditor = React.lazy(() => import("./MonacoYamlDiffEditor.aa479096.js"));
9569
9618
  const YamlEditorComponent = forwardRef(
9570
9619
  function YamlEditorComponent2(props, ref) {
9571
9620
  const {
@@ -11732,8 +11781,14 @@ export {
11732
11781
  STATEFULSET_INIT_VALUE as af,
11733
11782
  POD_INIT_VALUE as ag,
11734
11783
  TIMESTAMP_LABEL as ah,
11735
- Dovetail as ai,
11736
- RESOURCE_GROUP as aj,
11784
+ JobModel as ai,
11785
+ PodModel as aj,
11786
+ PodMetricsModel as ak,
11787
+ ResourceModel as al,
11788
+ WorkloadModel as am,
11789
+ CronJobModel as an,
11790
+ Dovetail as ao,
11791
+ RESOURCE_GROUP as ap,
11737
11792
  NameSpaceColumnRenderer as b,
11738
11793
  NodeNameColumnRenderer as c,
11739
11794
  RestartCountColumnRenderer as d,
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a6, A, aa, B, ac, f, C, e, T, s, w, z, G, ad, ab, X, J, a0, ai, a2, D, a4, O, I, ae, V, H, K, L, a3, M, a5, N, k, b, o, a8, c, ag, q, P, t, U, aj, Q, R, x, E, d, af, Z, S, $, _, a1, ah, a9, v, W, y, F, Y, l, p, n, m, r, a, h, g, i, a7, u } from "./index.b720212a.js";
1
+ import { a6, A, aa, B, ac, f, C, e, T, s, w, z, an, G, ad, ab, X, J, a0, ao, a2, D, a4, O, I, ae, ai, V, H, K, L, a3, M, a5, N, k, b, o, a8, c, ag, q, P, t, ak, aj, U, ap, Q, R, x, al, E, d, af, Z, S, $, _, a1, ah, a9, v, W, am, y, F, Y, l, p, n, m, r, a, h, g, i, a7, u } from "./index.5cb49249.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "js-yaml";
@@ -28,19 +28,21 @@ export {
28
28
  s as ConditionsTable,
29
29
  w as CreateButton,
30
30
  z as CronJobDropdown,
31
+ an as CronJobModel,
31
32
  G as CronjobJobsTable,
32
33
  ad as DAEMONSET_INIT_VALUE,
33
34
  ab as DEPLOYMENT_INIT_VALUE,
34
35
  X as DataField,
35
36
  J as DeleteButton,
36
37
  a0 as DeleteManyButton,
37
- ai as Dovetail,
38
+ ao as Dovetail,
38
39
  a2 as DrawerShow,
39
40
  D as DurationColumnRenderer,
40
41
  a4 as EditButton,
41
42
  O as ImageField,
42
43
  I as ImageNames,
43
44
  ae as JOB_INIT_VALUE,
45
+ ai as JobModel,
44
46
  V as JobsField,
45
47
  H as KeyValue,
46
48
  K as KeyValueListWidget,
@@ -58,11 +60,14 @@ export {
58
60
  q as PageShow,
59
61
  P as PhaseColumnRenderer,
60
62
  t as PodContainersTable,
63
+ ak as PodMetricsModel,
64
+ aj as PodModel,
61
65
  U as PodsField,
62
- aj as RESOURCE_GROUP,
66
+ ap as RESOURCE_GROUP,
63
67
  Q as ReplicaField,
64
68
  R as ReplicasColumnRenderer,
65
69
  x as ResourceCRUD,
70
+ al as ResourceModel,
66
71
  E as ResourceUsageBar,
67
72
  d as RestartCountColumnRenderer,
68
73
  af as STATEFULSET_INIT_VALUE,
@@ -75,6 +80,7 @@ export {
75
80
  a9 as Tags,
76
81
  v as WorkloadDropdown,
77
82
  W as WorkloadImageColumnRenderer,
83
+ am as WorkloadModel,
78
84
  y as WorkloadPodsTable,
79
85
  F as WorkloadReplicas,
80
86
  Y as YamlEditorComponent,
@@ -8528,6 +8528,55 @@ var __publicField = (obj, key, value) => {
8528
8528
  return `${(_b = (_a = this.rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c) => c.ready).length}/${(_c = this.rawYaml.spec) == null ? void 0 : _c.containers.length}`;
8529
8529
  }
8530
8530
  }
8531
+ class PodMetricsModel extends ResourceModel {
8532
+ constructor(data2) {
8533
+ super(data2);
8534
+ __publicField(this, "usage");
8535
+ this.data = data2;
8536
+ let cpuUsageNum = 0;
8537
+ let memoryUsageNum = 0;
8538
+ for (const container2 of data2.containers) {
8539
+ cpuUsageNum += parseSi(container2.usage.cpu || "0");
8540
+ memoryUsageNum += parseSi(container2.usage.memory || "0");
8541
+ }
8542
+ this.usage = {
8543
+ cpu: {
8544
+ value: cpuUsageNum,
8545
+ si: formatSi(1e3 * cpuUsageNum, {
8546
+ suffix: "m",
8547
+ maxPrecision: 0
8548
+ })
8549
+ },
8550
+ memory: {
8551
+ value: memoryUsageNum,
8552
+ si: formatSi(memoryUsageNum, {
8553
+ suffix: "i",
8554
+ maxPrecision: 0
8555
+ })
8556
+ }
8557
+ };
8558
+ }
8559
+ }
8560
+ class CronJobModel extends WorkloadModel {
8561
+ constructor(data2) {
8562
+ super(data2);
8563
+ this.data = data2;
8564
+ }
8565
+ suspend() {
8566
+ const newOne = lodashEs.cloneDeep(this.data);
8567
+ if (this.data.kind === "CronJob") {
8568
+ lodashEs.set(newOne, "spec.suspend", true);
8569
+ }
8570
+ return newOne;
8571
+ }
8572
+ resume() {
8573
+ const newOne = lodashEs.cloneDeep(this.data);
8574
+ if (this.data.kind === "CronJob") {
8575
+ lodashEs.set(newOne, "spec.suspend", false);
8576
+ }
8577
+ return newOne;
8578
+ }
8579
+ }
8531
8580
  const ErrorContent_1t51xnx = "";
8532
8581
  const ErrorWrapper = "eckm4od";
8533
8582
  const ErrorContent = "e1hl982n";
@@ -11750,6 +11799,7 @@ var __publicField = (obj, key, value) => {
11750
11799
  exports2.ConditionsTable = ConditionsTable;
11751
11800
  exports2.CreateButton = CreateButton;
11752
11801
  exports2.CronJobDropdown = CronJobDropdown;
11802
+ exports2.CronJobModel = CronJobModel;
11753
11803
  exports2.CronjobJobsTable = CronjobJobsTable;
11754
11804
  exports2.DAEMONSET_INIT_VALUE = DAEMONSET_INIT_VALUE;
11755
11805
  exports2.DEPLOYMENT_INIT_VALUE = DEPLOYMENT_INIT_VALUE;
@@ -11763,6 +11813,7 @@ var __publicField = (obj, key, value) => {
11763
11813
  exports2.ImageField = ImageField;
11764
11814
  exports2.ImageNames = ImageNames;
11765
11815
  exports2.JOB_INIT_VALUE = JOB_INIT_VALUE;
11816
+ exports2.JobModel = JobModel;
11766
11817
  exports2.JobsField = JobsField;
11767
11818
  exports2.KeyValue = KeyValue;
11768
11819
  exports2.KeyValueListWidget = KeyValueListWidget;
@@ -11780,11 +11831,14 @@ var __publicField = (obj, key, value) => {
11780
11831
  exports2.PageShow = PageShow;
11781
11832
  exports2.PhaseColumnRenderer = PhaseColumnRenderer;
11782
11833
  exports2.PodContainersTable = PodContainersTable;
11834
+ exports2.PodMetricsModel = PodMetricsModel;
11835
+ exports2.PodModel = PodModel;
11783
11836
  exports2.PodsField = PodsField;
11784
11837
  exports2.RESOURCE_GROUP = RESOURCE_GROUP;
11785
11838
  exports2.ReplicaField = ReplicaField;
11786
11839
  exports2.ReplicasColumnRenderer = ReplicasColumnRenderer;
11787
11840
  exports2.ResourceCRUD = ResourceCRUD;
11841
+ exports2.ResourceModel = ResourceModel;
11788
11842
  exports2.ResourceUsageBar = ResourceUsageBar;
11789
11843
  exports2.RestartCountColumnRenderer = RestartCountColumnRenderer;
11790
11844
  exports2.STATEFULSET_INIT_VALUE = STATEFULSET_INIT_VALUE;
@@ -11797,6 +11851,7 @@ var __publicField = (obj, key, value) => {
11797
11851
  exports2.Tags = Tags;
11798
11852
  exports2.WorkloadDropdown = WorkloadDropdown;
11799
11853
  exports2.WorkloadImageColumnRenderer = WorkloadImageColumnRenderer;
11854
+ exports2.WorkloadModel = WorkloadModel;
11800
11855
  exports2.WorkloadPodsTable = WorkloadPodsTable;
11801
11856
  exports2.WorkloadReplicas = WorkloadReplicas;
11802
11857
  exports2.YamlEditorComponent = YamlEditorComponent;
@@ -3,5 +3,6 @@ export * from './hooks';
3
3
  export * from './components';
4
4
  export * from './constants';
5
5
  export * from './hooks';
6
+ export * from './model';
6
7
  export * from './Dovetail';
7
8
  export * from './types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",