@dovetail-v2/refine 0.3.20-alpha.0 → 0.3.20-alpha.2

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,8 +1,10 @@
1
1
  import type { OwnerReference } from 'kubernetes-types/meta/v1';
2
2
  import React from 'react';
3
+ import { PodModel } from '../../models';
3
4
  type Props = {
4
5
  ownerReference: OwnerReference;
5
6
  namespace: string;
7
+ pod: PodModel;
6
8
  };
7
9
  export declare const ReferenceLink: React.FC<Props>;
8
10
  export {};
package/dist/refine.cjs CHANGED
@@ -10986,6 +10986,7 @@ const useEagleTable = (params) => {
10986
10986
  const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
10987
10987
  const [selectedKeys, setSelectedKeys] = React.useState([]);
10988
10988
  const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10989
+ const [currentFilters, setCurrentFilters] = React.useState([]);
10989
10990
  const { resource } = core.useResource();
10990
10991
  const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10991
10992
  const useTableParams = React.useMemo(() => {
@@ -11059,10 +11060,11 @@ const useEagleTable = (params) => {
11059
11060
  ]);
11060
11061
  }, []);
11061
11062
  React.useEffect(() => {
11062
- if (lodashEs.isEqual(params.filters, table.filters)) {
11063
+ if (lodashEs.isEqual(params.filters, currentFilters)) {
11063
11064
  return;
11064
11065
  }
11065
11066
  table.setFilters(params.filters || [], "replace");
11067
+ setCurrentFilters(params.filters || []);
11066
11068
  }, [params.filters]);
11067
11069
  return {
11068
11070
  tableProps: finalProps,
@@ -17799,10 +17801,41 @@ const EditButton = () => {
17799
17801
  );
17800
17802
  };
17801
17803
  const ReferenceLink = (props) => {
17802
- const { ownerReference, namespace: namespace2 } = props;
17804
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17803
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
+ });
17804
17826
  if (ownerReference.kind === "ReplicaSet") {
17805
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { children: ownerReference.name });
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
+ );
17806
17839
  }
17807
17840
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17808
17841
  if (!resource) {
@@ -19502,6 +19535,7 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19502
19535
  });
19503
19536
  }
19504
19537
  return value2.map((o) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ReferenceLink, {
19538
+ pod: record,
19505
19539
  ownerReference: o,
19506
19540
  namespace: record.metadata.namespace || "default"
19507
19541
  }, o.name));
package/dist/refine.js CHANGED
@@ -10967,6 +10967,7 @@ const useEagleTable = (params) => {
10967
10967
  const { columns, tableProps, formatter, Dropdown: Dropdown2 = K8sDropdown } = params;
10968
10968
  const [selectedKeys, setSelectedKeys] = useState([]);
10969
10969
  const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10970
+ const [currentFilters, setCurrentFilters] = useState([]);
10970
10971
  const { resource } = useResource();
10971
10972
  const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10972
10973
  const useTableParams = useMemo(() => {
@@ -11040,10 +11041,11 @@ const useEagleTable = (params) => {
11040
11041
  ]);
11041
11042
  }, []);
11042
11043
  useEffect(() => {
11043
- if (isEqual$1(params.filters, table.filters)) {
11044
+ if (isEqual$1(params.filters, currentFilters)) {
11044
11045
  return;
11045
11046
  }
11046
11047
  table.setFilters(params.filters || [], "replace");
11048
+ setCurrentFilters(params.filters || []);
11047
11049
  }, [params.filters]);
11048
11050
  return {
11049
11051
  tableProps: finalProps,
@@ -17780,10 +17782,41 @@ const EditButton = () => {
17780
17782
  );
17781
17783
  };
17782
17784
  const ReferenceLink = (props) => {
17783
- const { ownerReference, namespace: namespace2 } = props;
17785
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17784
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
+ });
17785
17807
  if (ownerReference.kind === "ReplicaSet") {
17786
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: ownerReference.name });
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
+ );
17787
17820
  }
17788
17821
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17789
17822
  if (!resource) {
@@ -19483,6 +19516,7 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19483
19516
  });
19484
19517
  }
19485
19518
  return value2.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsx(ReferenceLink, {
19519
+ pod: record,
19486
19520
  ownerReference: o,
19487
19521
  namespace: record.metadata.namespace || "default"
19488
19522
  }, o.name));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.20-alpha.0",
3
+ "version": "0.3.20-alpha.2",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",