@dovetail-v2/refine 0.3.20-alpha.2 → 0.3.21-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.
@@ -5,7 +5,7 @@ import { Unstructured } from 'k8s-api-provider';
5
5
  import { ConfigMap, Secret } from 'kubernetes-types/core/v1';
6
6
  import { NetworkPolicy } from 'kubernetes-types/networking/v1';
7
7
  import React from 'react';
8
- import { JobModel, ResourceModel, WorkloadModel, WorkloadBaseModel, CronJobModel, IngressModel, ServiceModel, StorageClassModel, PersistentVolumeModel, PersistentVolumeClaimModel } from '../../models';
8
+ import { JobModel, ResourceModel, WorkloadModel, WorkloadBaseModel, CronJobModel, IngressModel, ServiceModel, StorageClassModel, PersistentVolumeModel, PersistentVolumeClaimModel, PodModel } from '../../models';
9
9
  export type ShowField<Model extends ResourceModel> = {
10
10
  key: string;
11
11
  title?: React.ReactNode;
@@ -94,3 +94,4 @@ export declare const SCReclaimPolicyField: <Model extends StorageClassModel>(i18
94
94
  export declare const IsSCAllowVolumeExpansionField: <Model extends StorageClassModel>(i18n: I18nType) => ShowField<Model>;
95
95
  export declare const ResourceTableField: <Model extends ResourceModel<Unstructured>>(resource: string, useTableParams?: import("@refinedev/core").useTableProps<Model, import("@refinedev/core").HttpError, Model> | undefined) => ShowField<Model>;
96
96
  export declare const PodCountOfJobField: <Model extends JobModel>(i18n: I18nType) => ShowField<Model>;
97
+ export declare const PodWorkloadField: <Model extends PodModel>(i18n: I18nType) => ShowField<Model>;
package/dist/refine.cjs CHANGED
@@ -7973,7 +7973,7 @@ var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
7973
7973
  return o(prop);
7974
7974
  }
7975
7975
  }) : styled;
7976
- const index_l4xyq7 = "";
7976
+ const index_o09auy = "";
7977
7977
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
7978
7978
  name: "ErrorWrapper",
7979
7979
  class: "egn3dbn",
@@ -8031,6 +8031,9 @@ const WidgetErrorContent = (props) => {
8031
8031
  className: "error-content",
8032
8032
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("p", {
8033
8033
  className: common.cx_default(fontMap[type2], "title", `${type2}-title`),
8034
+ style: {
8035
+ marginBottom: !!refetch ? "8px" : "0"
8036
+ },
8034
8037
  children: errorText || t2("dovetail.obtain_data_error")
8035
8038
  }), props.children, !refetch ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(kit.button, {
8036
8039
  size: type2 === "list" ? "middle" : "small",
@@ -10986,7 +10989,7 @@ const useEagleTable = (params) => {
10986
10989
  const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
10987
10990
  const [selectedKeys, setSelectedKeys] = React.useState([]);
10988
10991
  const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10989
- const [currentFilters, setCurrentFilters] = React.useState([]);
10992
+ const prevFiltersRef = React.useRef([]);
10990
10993
  const { resource } = core.useResource();
10991
10994
  const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10992
10995
  const useTableParams = React.useMemo(() => {
@@ -11060,11 +11063,11 @@ const useEagleTable = (params) => {
11060
11063
  ]);
11061
11064
  }, []);
11062
11065
  React.useEffect(() => {
11063
- if (lodashEs.isEqual(params.filters, currentFilters)) {
11066
+ if (lodashEs.isEqual(params.filters, prevFiltersRef.current)) {
11064
11067
  return;
11065
11068
  }
11066
11069
  table.setFilters(params.filters || [], "replace");
11067
- setCurrentFilters(params.filters || []);
11070
+ prevFiltersRef.current = params.filters || [];
11068
11071
  }, [params.filters]);
11069
11072
  return {
11070
11073
  tableProps: finalProps,
@@ -12239,6 +12242,56 @@ const NodeTaintsTable = ({
12239
12242
  showMenuColumn: false
12240
12243
  });
12241
12244
  };
12245
+ const ReferenceLink = (props) => {
12246
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
12247
+ const configs = React.useContext(ConfigsContext);
12248
+ const { data: deploymentsData } = core.useList({
12249
+ resource: "deployments",
12250
+ meta: {
12251
+ kind: "Deployment",
12252
+ resourceBasePath: "/apis/apps/v1"
12253
+ },
12254
+ pagination: {
12255
+ mode: "off"
12256
+ }
12257
+ });
12258
+ const { data: replicaSetsData } = core.useList({
12259
+ resource: "replicasets",
12260
+ meta: {
12261
+ kind: "ReplicaSet",
12262
+ resourceBasePath: "/apis/apps/v1"
12263
+ },
12264
+ pagination: {
12265
+ mode: "off"
12266
+ }
12267
+ });
12268
+ if (ownerReference.kind === "ReplicaSet") {
12269
+ const deployment = pod2.getBelongToDeployment(
12270
+ (deploymentsData == null ? void 0 : deploymentsData.data) || [],
12271
+ (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
12272
+ );
12273
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12274
+ ResourceLink,
12275
+ {
12276
+ name: (deployment == null ? void 0 : deployment.name) || "",
12277
+ resourceName: "deployments",
12278
+ namespace: namespace2
12279
+ }
12280
+ );
12281
+ }
12282
+ const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
12283
+ if (!resource) {
12284
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12285
+ }
12286
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12287
+ ResourceLink,
12288
+ {
12289
+ name: ownerReference.name,
12290
+ resourceName: resource.name || "",
12291
+ namespace: namespace2
12292
+ }
12293
+ );
12294
+ };
12242
12295
  function PVVolumeModeDisplay(props) {
12243
12296
  const { value: value2 } = props;
12244
12297
  const i18n2 = common.useTranslation();
@@ -13165,6 +13218,27 @@ const PodCountOfJobField = (i18n2) => {
13165
13218
  }
13166
13219
  };
13167
13220
  };
13221
+ const PodWorkloadField = (i18n2) => {
13222
+ return {
13223
+ key: "podWorkload",
13224
+ title: i18n2.t("dovetail.workload"),
13225
+ path: ["metadata", "ownerReferences"],
13226
+ col: 12,
13227
+ renderContent(value2, record) {
13228
+ const ownerReferences = value2;
13229
+ if (!(ownerReferences == null ? void 0 : ownerReferences.length)) {
13230
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
13231
+ value: ""
13232
+ });
13233
+ }
13234
+ return ownerReferences.map((o) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ReferenceLink, {
13235
+ pod: record,
13236
+ ownerReference: o,
13237
+ namespace: record.metadata.namespace || "default"
13238
+ }, o.name));
13239
+ }
13240
+ };
13241
+ };
13168
13242
  const index_15s69c5 = "";
13169
13243
  const ItemWrapperStyle = "i1hk9uwu";
13170
13244
  const LabelsAndAnnotationsShow = ({
@@ -17800,56 +17874,6 @@ const EditButton = () => {
17800
17874
  }
17801
17875
  );
17802
17876
  };
17803
- const ReferenceLink = (props) => {
17804
- const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17805
- const configs = React.useContext(ConfigsContext);
17806
- const { data: deploymentsData } = core.useList({
17807
- resource: "deployments",
17808
- meta: {
17809
- kind: "Deployment",
17810
- resourceBasePath: "/apis/apps/v1"
17811
- },
17812
- pagination: {
17813
- mode: "off"
17814
- }
17815
- });
17816
- const { data: replicaSetsData } = core.useList({
17817
- resource: "replicasets",
17818
- meta: {
17819
- kind: "ReplicaSet",
17820
- resourceBasePath: "/apis/apps/v1"
17821
- },
17822
- pagination: {
17823
- mode: "off"
17824
- }
17825
- });
17826
- if (ownerReference.kind === "ReplicaSet") {
17827
- const deployment = pod2.getBelongToDeployment(
17828
- (deploymentsData == null ? void 0 : deploymentsData.data) || [],
17829
- (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
17830
- );
17831
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17832
- ResourceLink,
17833
- {
17834
- name: (deployment == null ? void 0 : deployment.name) || "",
17835
- resourceName: "deployments",
17836
- namespace: namespace2
17837
- }
17838
- );
17839
- }
17840
- const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17841
- if (!resource) {
17842
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
17843
- }
17844
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17845
- ResourceLink,
17846
- {
17847
- name: ownerReference.name,
17848
- resourceName: resource.name || "",
17849
- namespace: namespace2
17850
- }
17851
- );
17852
- };
17853
17877
  const TextTags = (props) => {
17854
17878
  const { value: value2 } = props;
17855
17879
  if (!value2) {
@@ -20350,6 +20374,7 @@ exports.PodSelectorGroup = PodSelectorGroup;
20350
20374
  exports.PodShell = PodShell;
20351
20375
  exports.PodShellModal = PodShellModal;
20352
20376
  exports.PodWorkloadColumnRenderer = PodWorkloadColumnRenderer;
20377
+ exports.PodWorkloadField = PodWorkloadField;
20353
20378
  exports.PodsField = PodsField;
20354
20379
  exports.PodsGroup = PodsGroup;
20355
20380
  exports.PortMappingColumnRenderer = PortMappingColumnRenderer;
package/dist/refine.js CHANGED
@@ -7954,7 +7954,7 @@ var styled_default = process.env.NODE_ENV !== "production" ? new Proxy(styled, {
7954
7954
  return o(prop);
7955
7955
  }
7956
7956
  }) : styled;
7957
- const index_l4xyq7 = "";
7957
+ const index_o09auy = "";
7958
7958
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
7959
7959
  name: "ErrorWrapper",
7960
7960
  class: "egn3dbn",
@@ -8012,6 +8012,9 @@ const WidgetErrorContent = (props) => {
8012
8012
  className: "error-content",
8013
8013
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("p", {
8014
8014
  className: cx_default(fontMap[type2], "title", `${type2}-title`),
8015
+ style: {
8016
+ marginBottom: !!refetch ? "8px" : "0"
8017
+ },
8015
8018
  children: errorText || t2("dovetail.obtain_data_error")
8016
8019
  }), props.children, !refetch ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
8017
8020
  size: type2 === "list" ? "middle" : "small",
@@ -10967,7 +10970,7 @@ const useEagleTable = (params) => {
10967
10970
  const { columns, tableProps, formatter, Dropdown: Dropdown2 = K8sDropdown } = params;
10968
10971
  const [selectedKeys, setSelectedKeys] = useState([]);
10969
10972
  const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10970
- const [currentFilters, setCurrentFilters] = useState([]);
10973
+ const prevFiltersRef = useRef([]);
10971
10974
  const { resource } = useResource();
10972
10975
  const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10973
10976
  const useTableParams = useMemo(() => {
@@ -11041,11 +11044,11 @@ const useEagleTable = (params) => {
11041
11044
  ]);
11042
11045
  }, []);
11043
11046
  useEffect(() => {
11044
- if (isEqual$1(params.filters, currentFilters)) {
11047
+ if (isEqual$1(params.filters, prevFiltersRef.current)) {
11045
11048
  return;
11046
11049
  }
11047
11050
  table.setFilters(params.filters || [], "replace");
11048
- setCurrentFilters(params.filters || []);
11051
+ prevFiltersRef.current = params.filters || [];
11049
11052
  }, [params.filters]);
11050
11053
  return {
11051
11054
  tableProps: finalProps,
@@ -12220,6 +12223,56 @@ const NodeTaintsTable = ({
12220
12223
  showMenuColumn: false
12221
12224
  });
12222
12225
  };
12226
+ const ReferenceLink = (props) => {
12227
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
12228
+ const configs = useContext(ConfigsContext);
12229
+ const { data: deploymentsData } = useList({
12230
+ resource: "deployments",
12231
+ meta: {
12232
+ kind: "Deployment",
12233
+ resourceBasePath: "/apis/apps/v1"
12234
+ },
12235
+ pagination: {
12236
+ mode: "off"
12237
+ }
12238
+ });
12239
+ const { data: replicaSetsData } = useList({
12240
+ resource: "replicasets",
12241
+ meta: {
12242
+ kind: "ReplicaSet",
12243
+ resourceBasePath: "/apis/apps/v1"
12244
+ },
12245
+ pagination: {
12246
+ mode: "off"
12247
+ }
12248
+ });
12249
+ if (ownerReference.kind === "ReplicaSet") {
12250
+ const deployment = pod2.getBelongToDeployment(
12251
+ (deploymentsData == null ? void 0 : deploymentsData.data) || [],
12252
+ (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
12253
+ );
12254
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12255
+ ResourceLink,
12256
+ {
12257
+ name: (deployment == null ? void 0 : deployment.name) || "",
12258
+ resourceName: "deployments",
12259
+ namespace: namespace2
12260
+ }
12261
+ );
12262
+ }
12263
+ const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
12264
+ if (!resource) {
12265
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12266
+ }
12267
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
12268
+ ResourceLink,
12269
+ {
12270
+ name: ownerReference.name,
12271
+ resourceName: resource.name || "",
12272
+ namespace: namespace2
12273
+ }
12274
+ );
12275
+ };
12223
12276
  function PVVolumeModeDisplay(props) {
12224
12277
  const { value: value2 } = props;
12225
12278
  const i18n2 = useTranslation();
@@ -13146,6 +13199,27 @@ const PodCountOfJobField = (i18n2) => {
13146
13199
  }
13147
13200
  };
13148
13201
  };
13202
+ const PodWorkloadField = (i18n2) => {
13203
+ return {
13204
+ key: "podWorkload",
13205
+ title: i18n2.t("dovetail.workload"),
13206
+ path: ["metadata", "ownerReferences"],
13207
+ col: 12,
13208
+ renderContent(value2, record) {
13209
+ const ownerReferences = value2;
13210
+ if (!(ownerReferences == null ? void 0 : ownerReferences.length)) {
13211
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
13212
+ value: ""
13213
+ });
13214
+ }
13215
+ return ownerReferences.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsx(ReferenceLink, {
13216
+ pod: record,
13217
+ ownerReference: o,
13218
+ namespace: record.metadata.namespace || "default"
13219
+ }, o.name));
13220
+ }
13221
+ };
13222
+ };
13149
13223
  const index_15s69c5 = "";
13150
13224
  const ItemWrapperStyle = "i1hk9uwu";
13151
13225
  const LabelsAndAnnotationsShow = ({
@@ -17781,56 +17855,6 @@ const EditButton = () => {
17781
17855
  }
17782
17856
  );
17783
17857
  };
17784
- const ReferenceLink = (props) => {
17785
- const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17786
- const configs = useContext(ConfigsContext);
17787
- const { data: deploymentsData } = useList({
17788
- resource: "deployments",
17789
- meta: {
17790
- kind: "Deployment",
17791
- resourceBasePath: "/apis/apps/v1"
17792
- },
17793
- pagination: {
17794
- mode: "off"
17795
- }
17796
- });
17797
- const { data: replicaSetsData } = useList({
17798
- resource: "replicasets",
17799
- meta: {
17800
- kind: "ReplicaSet",
17801
- resourceBasePath: "/apis/apps/v1"
17802
- },
17803
- pagination: {
17804
- mode: "off"
17805
- }
17806
- });
17807
- if (ownerReference.kind === "ReplicaSet") {
17808
- const deployment = pod2.getBelongToDeployment(
17809
- (deploymentsData == null ? void 0 : deploymentsData.data) || [],
17810
- (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
17811
- );
17812
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17813
- ResourceLink,
17814
- {
17815
- name: (deployment == null ? void 0 : deployment.name) || "",
17816
- resourceName: "deployments",
17817
- namespace: namespace2
17818
- }
17819
- );
17820
- }
17821
- const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17822
- if (!resource) {
17823
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
17824
- }
17825
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
17826
- ResourceLink,
17827
- {
17828
- name: ownerReference.name,
17829
- resourceName: resource.name || "",
17830
- namespace: namespace2
17831
- }
17832
- );
17833
- };
17834
17858
  const TextTags = (props) => {
17835
17859
  const { value: value2 } = props;
17836
17860
  if (!value2) {
@@ -20332,6 +20356,7 @@ export {
20332
20356
  PodShell,
20333
20357
  PodShellModal,
20334
20358
  PodWorkloadColumnRenderer,
20359
+ PodWorkloadField,
20335
20360
  PodsField,
20336
20361
  PodsGroup,
20337
20362
  PortMappingColumnRenderer,
package/dist/style.css CHANGED
@@ -730,9 +730,6 @@
730
730
  align-items: center;
731
731
  justify-content: center;
732
732
  }
733
- .e136jgy8 .title {
734
- margin-bottom: 8px;
735
- }
736
733
  .e136jgy8 .title.list-title {
737
734
  margin-bottom: 16px;
738
735
  }/* // basic */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.20-alpha.2",
3
+ "version": "0.3.21-alpha.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -10,8 +10,8 @@
10
10
  "module": "./dist/refine.js",
11
11
  "types": "./dist/index.d.ts",
12
12
  "dependencies": {
13
- "@cloudtower/eagle": "^0.34.24",
14
- "@cloudtower/icons-react": "^0.34.24",
13
+ "@cloudtower/eagle": "^490.0.1",
14
+ "@cloudtower/icons-react": "^490.0.1",
15
15
  "@patternfly/react-core": "^5.1.1",
16
16
  "@patternfly/react-log-viewer": "^5.0.0",
17
17
  "@refinedev/core": "^4.47.2",
@@ -86,8 +86,8 @@
86
86
  "vite-plugin-commonjs": "^0.10.0"
87
87
  },
88
88
  "peerDependencies": {
89
- "@cloudtower/eagle": "^0.34.24",
90
- "@cloudtower/icons-react": "^0.34.24",
89
+ "@cloudtower/eagle": "^490.0.1",
90
+ "@cloudtower/icons-react": "^490.0.1",
91
91
  "@refinedev/core": "^4.47.2",
92
92
  "antd": "4.5.0",
93
93
  "i18next": "^23.2.3",