@dovetail-v2/refine 0.3.13-alpha.1 → 0.3.14-alpha.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.
@@ -0,0 +1,10 @@
1
+ import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
+ import { ControllerRevision } from 'kubernetes-types/apps/v1';
3
+ import { ResourceModel } from './resource-model';
4
+ type RequiredControllerRevision = Required<ControllerRevision> & Unstructured;
5
+ export declare class ControllerRevisionModel extends ResourceModel<RequiredControllerRevision> {
6
+ _rawYaml: RequiredControllerRevision;
7
+ constructor(_rawYaml: RequiredControllerRevision, _globalStore: GlobalStore);
8
+ get revision(): number;
9
+ }
10
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import { DaemonSet } from 'kubernetes-types/apps/v1';
3
3
  import { ResourceState } from '../constants';
4
+ import { ControllerRevisionModel } from './controller-revison-model';
4
5
  import { WorkloadModel } from './workload-model';
5
6
  type RequiredDaemonSet = Required<DaemonSet> & Unstructured;
6
7
  export declare class DaemonSetModel extends WorkloadModel {
@@ -8,6 +9,8 @@ export declare class DaemonSetModel extends WorkloadModel {
8
9
  spec?: RequiredDaemonSet['spec'];
9
10
  status?: RequiredDaemonSet['status'];
10
11
  constructor(_rawYaml: RequiredDaemonSet, _globalStore: GlobalStore);
12
+ getControllerRevisions(controllerVisions: ControllerRevisionModel[]): ControllerRevisionModel[];
13
+ getRevision(controllerVisions: ControllerRevisionModel[]): number;
11
14
  get stateDisplay(): ResourceState.UPDATING | ResourceState.READY;
12
15
  get replicas(): number;
13
16
  get readyReplicas(): number;
@@ -8,12 +8,11 @@ export declare class DeploymentModel extends WorkloadModel {
8
8
  _rawYaml: RequiredDeployment;
9
9
  spec?: RequiredDeployment['spec'];
10
10
  status?: RequiredDeployment['status'];
11
- replicaSets: ReplicaSetModel[];
12
11
  constructor(_rawYaml: RequiredDeployment, _globalStore: GlobalStore);
13
12
  init(): Promise<void>;
14
- private getReplicaSets;
13
+ getReplicaSets(replicaSets: ReplicaSetModel[]): ReplicaSetModel[];
15
14
  get stateDisplay(): ResourceState.UPDATING | ResourceState.READY | ResourceState.STOPPED;
16
15
  get revision(): string | undefined;
17
- get currentReplicaSet(): ReplicaSetModel | undefined;
16
+ getCurrentReplicaSet(replicaSets: ReplicaSetModel[]): ReplicaSetModel | undefined;
18
17
  }
19
18
  export {};
@@ -17,3 +17,5 @@ export * from './node-model';
17
17
  export * from './storage-class';
18
18
  export * from './persistent-volume';
19
19
  export * from './persistent-volume-claim';
20
+ export * from './controller-revison-model';
21
+ export * from './ingress-class-model';
@@ -0,0 +1,12 @@
1
+ import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
+ import { IngressClass } from 'kubernetes-types/networking/v1';
3
+ import { ResourceModel } from './resource-model';
4
+ type RequiredIngressClass = Required<IngressClass> & Unstructured;
5
+ export declare class IngressClassModel extends ResourceModel<RequiredIngressClass> {
6
+ _rawYaml: RequiredIngressClass;
7
+ spec?: RequiredIngressClass['spec'];
8
+ constructor(_rawYaml: RequiredIngressClass, _globalStore: GlobalStore);
9
+ get isDefault(): boolean;
10
+ get controller(): string | undefined;
11
+ }
12
+ export {};
@@ -1,6 +1,7 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import type { Pod } from 'kubernetes-types/core/v1';
3
3
  import { DeploymentModel } from './deployment-model';
4
+ import { ReplicaSetModel } from './replicaset-model';
4
5
  import { ResourceQuantity } from './types/metric';
5
6
  import { WorkloadBaseModel } from './workload-base-model';
6
7
  type RequiredPod = Required<Pod> & Unstructured;
@@ -11,7 +12,7 @@ export declare class PodModel extends WorkloadBaseModel {
11
12
  spec?: RequiredPod['spec'];
12
13
  status?: RequiredPod['status'];
13
14
  constructor(_rawYaml: RequiredPod, _globalStore: GlobalStore);
14
- getBelongToDeployment(deployments: DeploymentModel[]): DeploymentModel | undefined;
15
+ getBelongToDeployment(deployments: DeploymentModel[], replicaSets: ReplicaSetModel[]): DeploymentModel | undefined;
15
16
  get imageNames(): string[];
16
17
  get restarts(): number;
17
18
  get readyDisplay(): string;
@@ -1,6 +1,7 @@
1
1
  import { GlobalStore, Unstructured } from 'k8s-api-provider';
2
2
  import { StatefulSet } from 'kubernetes-types/apps/v1';
3
3
  import { ResourceState } from '../constants';
4
+ import { ControllerRevisionModel } from './controller-revison-model';
4
5
  import { WorkloadModel } from './workload-model';
5
6
  type RequiredStatefulSet = Required<StatefulSet> & Unstructured;
6
7
  export declare class StatefulSetModel extends WorkloadModel {
@@ -8,6 +9,8 @@ export declare class StatefulSetModel extends WorkloadModel {
8
9
  spec?: RequiredStatefulSet['spec'];
9
10
  status?: RequiredStatefulSet['status'];
10
11
  constructor(_rawYaml: RequiredStatefulSet, _globalStore: GlobalStore);
12
+ getControllerRevisions(controllerVisions: ControllerRevisionModel[]): ControllerRevisionModel[];
13
+ getRevision(controllerVisions: ControllerRevisionModel[]): number;
11
14
  get stateDisplay(): ResourceState.UPDATING | ResourceState.READY | ResourceState.STOPPED;
12
15
  }
13
16
  export {};
package/dist/refine.cjs CHANGED
@@ -9624,9 +9624,9 @@ class PodModel extends WorkloadBaseModel {
9624
9624
  }
9625
9625
  };
9626
9626
  }
9627
- getBelongToDeployment(deployments) {
9627
+ getBelongToDeployment(deployments, replicaSets) {
9628
9628
  return deployments.find((deployment) => {
9629
- return deployment.replicaSets.find((replicaSet) => {
9629
+ return deployment.getReplicaSets(replicaSets).find((replicaSet) => {
9630
9630
  return replicaSet.pods.find((pod2) => pod2.metadata.uid === this.metadata.uid);
9631
9631
  });
9632
9632
  });
@@ -9812,26 +9812,19 @@ class EventModel extends ResourceModel {
9812
9812
  class DeploymentModel extends WorkloadModel {
9813
9813
  constructor(_rawYaml, _globalStore) {
9814
9814
  super(_rawYaml, _globalStore);
9815
- __publicField(this, "replicaSets", []);
9816
9815
  this._rawYaml = _rawYaml;
9817
9816
  }
9818
9817
  async init() {
9819
9818
  await super.init();
9820
- await this.getReplicaSets();
9821
9819
  }
9822
- async getReplicaSets() {
9823
- const replicaSets = await this._globalStore.get("replicasets", {
9824
- resourceBasePath: "/apis/apps/v1",
9825
- kind: "ReplicaSet"
9826
- });
9827
- const myReplicaSets = replicaSets.items.filter((rs) => {
9820
+ getReplicaSets(replicaSets) {
9821
+ return replicaSets.filter((rs) => {
9828
9822
  var _a, _b, _c;
9829
9823
  const ownerRef = (_b = (_a = rs.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.find(
9830
9824
  (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1" && ref.name === this.name && ref.uid === this.metadata.uid
9831
9825
  );
9832
9826
  return !!ownerRef && ((_c = rs.metadata) == null ? void 0 : _c.namespace) === this.metadata.namespace;
9833
9827
  });
9834
- this.replicaSets = myReplicaSets;
9835
9828
  }
9836
9829
  get stateDisplay() {
9837
9830
  var _a, _b, _c;
@@ -9846,8 +9839,9 @@ class DeploymentModel extends WorkloadModel {
9846
9839
  var _a, _b;
9847
9840
  return (_b = (_a = this.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b["deployment.kubernetes.io/revision"];
9848
9841
  }
9849
- get currentReplicaSet() {
9850
- return this.replicaSets.find((rs) => rs.revision === this.revision);
9842
+ getCurrentReplicaSet(replicaSets) {
9843
+ const myReplicaSets = this.getReplicaSets(replicaSets);
9844
+ return myReplicaSets.find((rs) => rs.revision === this.revision);
9851
9845
  }
9852
9846
  }
9853
9847
  class DaemonSetModel extends WorkloadModel {
@@ -9855,6 +9849,22 @@ class DaemonSetModel extends WorkloadModel {
9855
9849
  super(_rawYaml, _globalStore);
9856
9850
  this._rawYaml = _rawYaml;
9857
9851
  }
9852
+ getControllerRevisions(controllerVisions) {
9853
+ return controllerVisions.filter(
9854
+ (controllerRevision) => {
9855
+ var _a, _b;
9856
+ return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9857
+ (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
9858
+ );
9859
+ }
9860
+ );
9861
+ }
9862
+ getRevision(controllerVisions) {
9863
+ const myControllerVisions = this.getControllerRevisions(controllerVisions);
9864
+ return myControllerVisions.reduce((result, controllerRevision) => {
9865
+ return Math.max(result, Number(controllerRevision.revision || 0));
9866
+ }, 0);
9867
+ }
9858
9868
  get stateDisplay() {
9859
9869
  var _a, _b;
9860
9870
  if (((_a = this.status) == null ? void 0 : _a.desiredNumberScheduled) !== ((_b = this.status) == null ? void 0 : _b.numberReady)) {
@@ -9874,6 +9884,22 @@ class StatefulSetModel extends WorkloadModel {
9874
9884
  super(_rawYaml, _globalStore);
9875
9885
  this._rawYaml = _rawYaml;
9876
9886
  }
9887
+ getControllerRevisions(controllerVisions) {
9888
+ return controllerVisions.filter(
9889
+ (controllerRevision) => {
9890
+ var _a, _b;
9891
+ return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9892
+ (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
9893
+ );
9894
+ }
9895
+ );
9896
+ }
9897
+ getRevision(controllerVisions) {
9898
+ const myControllerVisions = this.getControllerRevisions(controllerVisions);
9899
+ return myControllerVisions.reduce((result, controllerRevision) => {
9900
+ return Math.max(result, Number(controllerRevision.revision || 0));
9901
+ }, 0);
9902
+ }
9877
9903
  get stateDisplay() {
9878
9904
  var _a, _b, _c;
9879
9905
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -10076,6 +10102,29 @@ class PersistentVolumeClaimModel extends ResourceModel {
10076
10102
  return lodashEs.set(yaml2, "spec.resources.requests.storage", `${distributeStorage}Gi`);
10077
10103
  }
10078
10104
  }
10105
+ class ControllerRevisionModel extends ResourceModel {
10106
+ constructor(_rawYaml, _globalStore) {
10107
+ super(_rawYaml, _globalStore);
10108
+ this._rawYaml = _rawYaml;
10109
+ }
10110
+ get revision() {
10111
+ return this._rawYaml.revision;
10112
+ }
10113
+ }
10114
+ class IngressClassModel extends ResourceModel {
10115
+ constructor(_rawYaml, _globalStore) {
10116
+ super(_rawYaml, _globalStore);
10117
+ this._rawYaml = _rawYaml;
10118
+ }
10119
+ get isDefault() {
10120
+ var _a, _b;
10121
+ return ((_b = (_a = this._rawYaml.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b["ingressclass.kubernetes.io/is-default-class"]) === "true";
10122
+ }
10123
+ get controller() {
10124
+ var _a;
10125
+ return (_a = this.spec) == null ? void 0 : _a.controller;
10126
+ }
10127
+ }
10079
10128
  const index_1r58r8x = "";
10080
10129
  const ServiceInClusterAccessComponent = ({
10081
10130
  service
@@ -18978,7 +19027,7 @@ const AgeColumnRenderer = (i18n2, config, {
18978
19027
  dataIndex,
18979
19028
  title: i18n2.t("dovetail.created_time"),
18980
19029
  width: 120,
18981
- sorter: true,
19030
+ sorter: CommonSorter(dataIndex),
18982
19031
  render: (value2) => {
18983
19032
  return isRelativeTime ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(Time, {
18984
19033
  date: new Date(value2)
@@ -19711,7 +19760,9 @@ class ModelPlugin {
19711
19760
  StorageClass: StorageClassModel,
19712
19761
  PersistentVolume: PersistentVolumeModel,
19713
19762
  PersistentVolumeClaim: PersistentVolumeClaimModel,
19714
- ReplicaSet: ReplicaSetModel
19763
+ ReplicaSet: ReplicaSetModel,
19764
+ ControllerRevision: ControllerRevisionModel,
19765
+ IngressClass: IngressClassModel
19715
19766
  })
19716
19767
  ));
19717
19768
  }
@@ -19858,6 +19909,7 @@ exports.ConditionsGroup = ConditionsGroup;
19858
19909
  exports.ConditionsTab = ConditionsTab;
19859
19910
  exports.ConditionsTable = ConditionsTable;
19860
19911
  exports.ConfigsContext = ConfigsContext;
19912
+ exports.ControllerRevisionModel = ControllerRevisionModel;
19861
19913
  exports.CreateButton = CreateButton;
19862
19914
  exports.CronJobDropdown = CronJobDropdown;
19863
19915
  exports.CronJobModel = CronJobModel;
@@ -19901,6 +19953,7 @@ exports.INGRESS_INIT_VALUE = INGRESS_INIT_VALUE;
19901
19953
  exports.ImageField = ImageField;
19902
19954
  exports.ImageNames = ImageNames;
19903
19955
  exports.IngressClassColumnRenderer = IngressClassColumnRenderer;
19956
+ exports.IngressClassModel = IngressClassModel;
19904
19957
  exports.IngressDefaultBackendColumnRenderer = IngressDefaultBackendColumnRenderer;
19905
19958
  exports.IngressModel = IngressModel;
19906
19959
  exports.IngressRulesColumnRenderer = IngressRulesColumnRenderer;
package/dist/refine.js CHANGED
@@ -9605,9 +9605,9 @@ class PodModel extends WorkloadBaseModel {
9605
9605
  }
9606
9606
  };
9607
9607
  }
9608
- getBelongToDeployment(deployments) {
9608
+ getBelongToDeployment(deployments, replicaSets) {
9609
9609
  return deployments.find((deployment) => {
9610
- return deployment.replicaSets.find((replicaSet) => {
9610
+ return deployment.getReplicaSets(replicaSets).find((replicaSet) => {
9611
9611
  return replicaSet.pods.find((pod2) => pod2.metadata.uid === this.metadata.uid);
9612
9612
  });
9613
9613
  });
@@ -9793,26 +9793,19 @@ class EventModel extends ResourceModel {
9793
9793
  class DeploymentModel extends WorkloadModel {
9794
9794
  constructor(_rawYaml, _globalStore) {
9795
9795
  super(_rawYaml, _globalStore);
9796
- __publicField(this, "replicaSets", []);
9797
9796
  this._rawYaml = _rawYaml;
9798
9797
  }
9799
9798
  async init() {
9800
9799
  await super.init();
9801
- await this.getReplicaSets();
9802
9800
  }
9803
- async getReplicaSets() {
9804
- const replicaSets = await this._globalStore.get("replicasets", {
9805
- resourceBasePath: "/apis/apps/v1",
9806
- kind: "ReplicaSet"
9807
- });
9808
- const myReplicaSets = replicaSets.items.filter((rs) => {
9801
+ getReplicaSets(replicaSets) {
9802
+ return replicaSets.filter((rs) => {
9809
9803
  var _a, _b, _c;
9810
9804
  const ownerRef = (_b = (_a = rs.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.find(
9811
9805
  (ref) => ref.kind === "Deployment" && ref.apiVersion === "apps/v1" && ref.name === this.name && ref.uid === this.metadata.uid
9812
9806
  );
9813
9807
  return !!ownerRef && ((_c = rs.metadata) == null ? void 0 : _c.namespace) === this.metadata.namespace;
9814
9808
  });
9815
- this.replicaSets = myReplicaSets;
9816
9809
  }
9817
9810
  get stateDisplay() {
9818
9811
  var _a, _b, _c;
@@ -9827,8 +9820,9 @@ class DeploymentModel extends WorkloadModel {
9827
9820
  var _a, _b;
9828
9821
  return (_b = (_a = this.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b["deployment.kubernetes.io/revision"];
9829
9822
  }
9830
- get currentReplicaSet() {
9831
- return this.replicaSets.find((rs) => rs.revision === this.revision);
9823
+ getCurrentReplicaSet(replicaSets) {
9824
+ const myReplicaSets = this.getReplicaSets(replicaSets);
9825
+ return myReplicaSets.find((rs) => rs.revision === this.revision);
9832
9826
  }
9833
9827
  }
9834
9828
  class DaemonSetModel extends WorkloadModel {
@@ -9836,6 +9830,22 @@ class DaemonSetModel extends WorkloadModel {
9836
9830
  super(_rawYaml, _globalStore);
9837
9831
  this._rawYaml = _rawYaml;
9838
9832
  }
9833
+ getControllerRevisions(controllerVisions) {
9834
+ return controllerVisions.filter(
9835
+ (controllerRevision) => {
9836
+ var _a, _b;
9837
+ return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9838
+ (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
9839
+ );
9840
+ }
9841
+ );
9842
+ }
9843
+ getRevision(controllerVisions) {
9844
+ const myControllerVisions = this.getControllerRevisions(controllerVisions);
9845
+ return myControllerVisions.reduce((result, controllerRevision) => {
9846
+ return Math.max(result, Number(controllerRevision.revision || 0));
9847
+ }, 0);
9848
+ }
9839
9849
  get stateDisplay() {
9840
9850
  var _a, _b;
9841
9851
  if (((_a = this.status) == null ? void 0 : _a.desiredNumberScheduled) !== ((_b = this.status) == null ? void 0 : _b.numberReady)) {
@@ -9855,6 +9865,22 @@ class StatefulSetModel extends WorkloadModel {
9855
9865
  super(_rawYaml, _globalStore);
9856
9866
  this._rawYaml = _rawYaml;
9857
9867
  }
9868
+ getControllerRevisions(controllerVisions) {
9869
+ return controllerVisions.filter(
9870
+ (controllerRevision) => {
9871
+ var _a, _b;
9872
+ return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9873
+ (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
9874
+ );
9875
+ }
9876
+ );
9877
+ }
9878
+ getRevision(controllerVisions) {
9879
+ const myControllerVisions = this.getControllerRevisions(controllerVisions);
9880
+ return myControllerVisions.reduce((result, controllerRevision) => {
9881
+ return Math.max(result, Number(controllerRevision.revision || 0));
9882
+ }, 0);
9883
+ }
9858
9884
  get stateDisplay() {
9859
9885
  var _a, _b, _c;
9860
9886
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -10057,6 +10083,29 @@ class PersistentVolumeClaimModel extends ResourceModel {
10057
10083
  return set(yaml2, "spec.resources.requests.storage", `${distributeStorage}Gi`);
10058
10084
  }
10059
10085
  }
10086
+ class ControllerRevisionModel extends ResourceModel {
10087
+ constructor(_rawYaml, _globalStore) {
10088
+ super(_rawYaml, _globalStore);
10089
+ this._rawYaml = _rawYaml;
10090
+ }
10091
+ get revision() {
10092
+ return this._rawYaml.revision;
10093
+ }
10094
+ }
10095
+ class IngressClassModel extends ResourceModel {
10096
+ constructor(_rawYaml, _globalStore) {
10097
+ super(_rawYaml, _globalStore);
10098
+ this._rawYaml = _rawYaml;
10099
+ }
10100
+ get isDefault() {
10101
+ var _a, _b;
10102
+ return ((_b = (_a = this._rawYaml.metadata) == null ? void 0 : _a.annotations) == null ? void 0 : _b["ingressclass.kubernetes.io/is-default-class"]) === "true";
10103
+ }
10104
+ get controller() {
10105
+ var _a;
10106
+ return (_a = this.spec) == null ? void 0 : _a.controller;
10107
+ }
10108
+ }
10060
10109
  const index_1r58r8x = "";
10061
10110
  const ServiceInClusterAccessComponent = ({
10062
10111
  service
@@ -18959,7 +19008,7 @@ const AgeColumnRenderer = (i18n2, config, {
18959
19008
  dataIndex,
18960
19009
  title: i18n2.t("dovetail.created_time"),
18961
19010
  width: 120,
18962
- sorter: true,
19011
+ sorter: CommonSorter(dataIndex),
18963
19012
  render: (value2) => {
18964
19013
  return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
18965
19014
  date: new Date(value2)
@@ -19692,7 +19741,9 @@ class ModelPlugin {
19692
19741
  StorageClass: StorageClassModel,
19693
19742
  PersistentVolume: PersistentVolumeModel,
19694
19743
  PersistentVolumeClaim: PersistentVolumeClaimModel,
19695
- ReplicaSet: ReplicaSetModel
19744
+ ReplicaSet: ReplicaSetModel,
19745
+ ControllerRevision: ControllerRevisionModel,
19746
+ IngressClass: IngressClassModel
19696
19747
  })
19697
19748
  ));
19698
19749
  }
@@ -19840,6 +19891,7 @@ export {
19840
19891
  ConditionsTab,
19841
19892
  ConditionsTable,
19842
19893
  ConfigsContext,
19894
+ ControllerRevisionModel,
19843
19895
  CreateButton,
19844
19896
  CronJobDropdown,
19845
19897
  CronJobModel,
@@ -19883,6 +19935,7 @@ export {
19883
19935
  ImageField,
19884
19936
  ImageNames,
19885
19937
  IngressClassColumnRenderer,
19938
+ IngressClassModel,
19886
19939
  IngressDefaultBackendColumnRenderer,
19887
19940
  IngressModel,
19888
19941
  IngressRulesColumnRenderer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.13-alpha.1",
3
+ "version": "0.3.14-alpha.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",