@dovetail-v2/refine 0.3.19-alpha.3 → 0.3.20-alpha.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.
@@ -24,7 +24,7 @@ export type RefineFormFieldRenderProps = {
24
24
  export type RefineFormField = {
25
25
  path: string[];
26
26
  key: string;
27
- label: string;
27
+ label: React.ReactNode | ((formValue: FieldValues) => React.ReactNode);
28
28
  placeholder?: string;
29
29
  helperText?: React.ReactNode;
30
30
  type?: 'number';
@@ -6,11 +6,15 @@ interface DistributeStorageFormHandler {
6
6
  interface DistributeStorageFormProps {
7
7
  pvc: PersistentVolumeClaimModel;
8
8
  defaultValue: number;
9
+ label?: React.ReactNode;
10
+ onBlur?: (value: number, setValue: (value: number) => void) => void;
9
11
  }
10
12
  export declare const DistributeStorageForm: React.ForwardRefExoticComponent<DistributeStorageFormProps & React.RefAttributes<DistributeStorageFormHandler>>;
11
13
  interface PVCDistributeStorageProps {
12
14
  pvc: PersistentVolumeClaimModel;
13
15
  editable: boolean;
16
+ label?: React.ReactNode;
17
+ onBlur?: (value: number, setValue: (value: number) => void) => void;
14
18
  }
15
- declare function PVCDistributeStorage({ pvc, editable }: PVCDistributeStorageProps): JSX.Element;
19
+ declare function PVCDistributeStorage({ pvc, editable, label, onBlur, }: PVCDistributeStorageProps): JSX.Element;
16
20
  export default PVCDistributeStorage;
@@ -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 {};
@@ -74,7 +74,13 @@ export declare const DurationField: <Model extends JobModel | CronJobModel>(i18n
74
74
  export declare const StorageClassProvisionerField: <Model extends StorageClassModel>(i18n: I18nType) => ShowField<Model>;
75
75
  export declare const StorageClassPvField: <Model extends StorageClassModel>() => ShowField<Model>;
76
76
  export declare const PVCapacityField: <Model extends PersistentVolumeModel>(i18n: I18nType) => ShowField<Model>;
77
- export declare const PVCStorageField: <Model extends PersistentVolumeClaimModel>(i18n: I18nType) => ShowField<Model>;
77
+ export declare const PVCStorageField: <Model extends PersistentVolumeClaimModel>({ i18n, editProps, }: {
78
+ i18n: I18nType;
79
+ editProps?: {
80
+ label?: React.ReactNode;
81
+ onBlur?: ((value: number, setValue: (value: number) => void) => void) | undefined;
82
+ } | undefined;
83
+ }) => ShowField<Model>;
78
84
  export declare const PVRefField: <Model extends PersistentVolumeClaimModel>(i18n: I18nType) => ShowField<Model>;
79
85
  export declare const PVStorageClassField: <Model extends PersistentVolumeModel | PersistentVolumeClaimModel>(i18n: I18nType) => ShowField<Model>;
80
86
  export declare const PVPhaseField: <Model extends PersistentVolumeModel | PersistentVolumeClaimModel>(i18n: I18nType) => ShowField<Model>;
@@ -1,5 +1,5 @@
1
1
  import { RequiredColumnProps } from '@cloudtower/eagle';
2
- import { useTable } from '@refinedev/core';
2
+ import { useTable, CrudFilters, CrudSorting } from '@refinedev/core';
3
3
  import React from 'react';
4
4
  import { Column, InternalTableProps } from '../../components/InternalBaseTable';
5
5
  import { ResourceModel } from '../../models';
@@ -8,6 +8,7 @@ type Params<Model extends ResourceModel> = {
8
8
  columns: Column<Model>[];
9
9
  tableProps?: Partial<InternalTableProps<Model>>;
10
10
  formatter?: (d: Model) => Model;
11
+ filters?: CrudFilters;
11
12
  Dropdown?: React.FC<{
12
13
  record: Model;
13
14
  }>;
@@ -27,20 +28,20 @@ export declare function addDefaultRenderToColumns<Data, Col extends RequiredColu
27
28
  export declare const useEagleTable: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(params: Params<Model>) => {
28
29
  setCurrent: (current: number) => void;
29
30
  tableQueryResult: import("@tanstack/query-core").QueryObserverResult<import("@refinedev/core").GetListResponse<Model>, import("@refinedev/core").HttpError>;
30
- sorter: import("@refinedev/core").CrudSorting;
31
- sorters: import("@refinedev/core").CrudSorting;
32
- setSorter: (sorter: import("@refinedev/core").CrudSorting) => void;
33
- setSorters: (sorter: import("@refinedev/core").CrudSorting) => void;
34
- filters: import("@refinedev/core").CrudFilters;
35
- setFilters: ((filters: import("@refinedev/core").CrudFilters, behavior?: ("replace" | "merge") | undefined) => void) & ((setter: (prevFilters: import("@refinedev/core").CrudFilters) => import("@refinedev/core").CrudFilters) => void);
31
+ sorter: CrudSorting;
32
+ sorters: CrudSorting;
33
+ setSorter: (sorter: CrudSorting) => void;
34
+ setSorters: (sorter: CrudSorting) => void;
35
+ filters: CrudFilters;
36
+ setFilters: ((filters: CrudFilters, behavior?: ("replace" | "merge") | undefined) => void) & ((setter: (prevFilters: CrudFilters) => CrudFilters) => void);
36
37
  createLinkForSyncWithLocation: (params: {
37
38
  pagination: {
38
39
  current?: number | undefined;
39
40
  pageSize?: number | undefined;
40
41
  };
41
- sorter?: import("@refinedev/core").CrudSorting | undefined;
42
- sorters: import("@refinedev/core").CrudSorting;
43
- filters: import("@refinedev/core").CrudFilters;
42
+ sorter?: CrudSorting | undefined;
43
+ sorters: CrudSorting;
44
+ filters: CrudFilters;
44
45
  }) => string;
45
46
  current: number;
46
47
  pageSize: number;
@@ -3,7 +3,5 @@ interface UseRefineFiltersOptions {
3
3
  disableNamespaceFilter?: boolean;
4
4
  disableNameKeywordFilter?: boolean;
5
5
  }
6
- export declare function useRefineFilters(options?: UseRefineFiltersOptions): {
7
- permanent: import("@refinedev/core").CrudFilter[];
8
- };
6
+ export declare function useRefineFilters(options?: UseRefineFiltersOptions): import("@refinedev/core").CrudFilter[];
9
7
  export {};
package/dist/refine.cjs CHANGED
@@ -7423,7 +7423,7 @@ const tag_18x9v7m = "";
7423
7423
  const StateTagStyle = "s82411";
7424
7424
  const NameTagStyle = "n9ja9cs";
7425
7425
  function shortenedImage(image2) {
7426
- return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
7426
+ return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
7427
7427
  }
7428
7428
  function isFirstLetterEnglish(str) {
7429
7429
  return /^[a-zA-Z]/.test(str);
@@ -8555,7 +8555,7 @@ function parseSi(inValue, increment = null, allowFractional = true) {
8555
8555
  return val;
8556
8556
  }
8557
8557
  const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(props, ref) {
8558
- const { defaultValue, pvc: pvc2 } = props;
8558
+ const { defaultValue, pvc: pvc2, label: label2, onBlur } = props;
8559
8559
  const { resource } = core.useResource();
8560
8560
  const { mutateAsync } = core.useUpdate();
8561
8561
  const { t: t2 } = common.useTranslation();
@@ -8604,13 +8604,17 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8604
8604
  errorNotification: false
8605
8605
  });
8606
8606
  }, [pvc2, distributeStorage, resource == null ? void 0 : resource.name, validators, mutateAsync, t2]);
8607
- React.useImperativeHandle(ref, () => ({
8608
- submit
8609
- }), [submit]);
8607
+ React.useImperativeHandle(
8608
+ ref,
8609
+ () => ({
8610
+ submit
8611
+ }),
8612
+ [submit]
8613
+ );
8610
8614
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
8611
8615
  eagle.Form.Item,
8612
8616
  {
8613
- label: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { style: { width: "134px" }, children: t2("dovetail.distributed") }),
8617
+ label: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { style: { width: "134px" }, children: label2 || t2("dovetail.distributed") }),
8614
8618
  colon: false,
8615
8619
  help: validateResult.distributeStorage,
8616
8620
  validateStatus: validateResult.distributeStorage ? "error" : "",
@@ -8628,7 +8632,14 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8628
8632
  distributeStorage: validators.distributeStorage(v)
8629
8633
  });
8630
8634
  },
8631
- onBlur: () => void 0,
8635
+ onBlur: () => {
8636
+ onBlur == null ? void 0 : onBlur(distributeStorage, (newValue) => {
8637
+ setDistributeStorage(newValue);
8638
+ setValidateResult({
8639
+ distributeStorage: validators.distributeStorage(newValue)
8640
+ });
8641
+ });
8642
+ },
8632
8643
  onFocus: () => void 0
8633
8644
  },
8634
8645
  min: 1,
@@ -8639,7 +8650,12 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8639
8650
  }
8640
8651
  );
8641
8652
  });
8642
- function PVCDistributeStorage({ pvc: pvc2, editable }) {
8653
+ function PVCDistributeStorage({
8654
+ pvc: pvc2,
8655
+ editable,
8656
+ label: label2,
8657
+ onBlur
8658
+ }) {
8643
8659
  var _a, _b;
8644
8660
  const { t: t2 } = common.useTranslation();
8645
8661
  const formRef = React.useRef(null);
@@ -8659,7 +8675,9 @@ function PVCDistributeStorage({ pvc: pvc2, editable }) {
8659
8675
  {
8660
8676
  ref: formRef,
8661
8677
  defaultValue: value2 ? transformStorageUnit(value2, StorageUnit.Gi) : 0,
8662
- pvc: pvc2
8678
+ pvc: pvc2,
8679
+ label: label2,
8680
+ onBlur
8663
8681
  }
8664
8682
  );
8665
8683
  }
@@ -10247,7 +10265,12 @@ const ServiceOutClusterAccessComponent = ({
10247
10265
  });
10248
10266
  break;
10249
10267
  case ServiceTypeEnum.ClusterIP:
10250
- content = i18n2.t("dovetail.not_support");
10268
+ content = /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
10269
+ style: {
10270
+ color: "#00122e"
10271
+ },
10272
+ children: i18n2.t("dovetail.not_support")
10273
+ });
10251
10274
  break;
10252
10275
  default:
10253
10276
  content = /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10259,7 +10282,8 @@ const ServiceOutClusterAccessComponent = ({
10259
10282
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
10260
10283
  style: {
10261
10284
  whiteSpace: "pre-wrap",
10262
- color: "#0080ff"
10285
+ color: "#0080ff",
10286
+ height: "18px"
10263
10287
  },
10264
10288
  children: content || "-"
10265
10289
  });
@@ -11034,6 +11058,12 @@ const useEagleTable = (params) => {
11034
11058
  }
11035
11059
  ]);
11036
11060
  }, []);
11061
+ React.useEffect(() => {
11062
+ if (lodashEs.isEqual(params.filters, table.filters)) {
11063
+ return;
11064
+ }
11065
+ table.setFilters(params.filters || [], "replace");
11066
+ }, [params.filters]);
11037
11067
  return {
11038
11068
  tableProps: finalProps,
11039
11069
  selectedKeys,
@@ -11517,7 +11547,7 @@ const IngressRulesTable = ({ ingress }) => {
11517
11547
  }
11518
11548
  );
11519
11549
  };
11520
- const KeyValue_1cqk7i8 = "";
11550
+ const KeyValue_1qasuz9 = "";
11521
11551
  const ContentBlockStyle = "c8jy7dc";
11522
11552
  const KeyStyle = "k2sddxl";
11523
11553
  const ValueStyle$2 = "v16vicsr";
@@ -12932,7 +12962,10 @@ const PVCapacityField = (i18n2) => {
12932
12962
  }
12933
12963
  };
12934
12964
  };
12935
- const PVCStorageField = (i18n2) => {
12965
+ const PVCStorageField = ({
12966
+ i18n: i18n2,
12967
+ editProps
12968
+ }) => {
12936
12969
  return {
12937
12970
  key: "storage",
12938
12971
  col: 12,
@@ -12941,6 +12974,8 @@ const PVCStorageField = (i18n2) => {
12941
12974
  renderContent(value2, pvc2) {
12942
12975
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PVCDistributeStorage, {
12943
12976
  pvc: pvc2,
12977
+ label: editProps == null ? void 0 : editProps.label,
12978
+ onBlur: editProps == null ? void 0 : editProps.onBlur,
12944
12979
  editable: true
12945
12980
  });
12946
12981
  }
@@ -13864,7 +13899,7 @@ function Tabs(props) {
13864
13899
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13865
13900
  }) });
13866
13901
  }
13867
- const ShowContentView_196cma3 = "";
13902
+ const ShowContentView_1xfhkd = "";
13868
13903
  const ShowContentWrapperStyle = "soapvs9";
13869
13904
  const BackButton = "b13d603q";
13870
13905
  const ToolBarWrapper = "tm8eaia";
@@ -14129,9 +14164,6 @@ const ShowContentView = (props) => {
14129
14164
  const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
14130
14165
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
14131
14166
  className: common.cx_default(ShowContentWrapperStyle, className),
14132
- style: {
14133
- background: size === "small" ? "#fff" : void 0
14134
- },
14135
14167
  children: [hideTopBar ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Space, {
14136
14168
  direction: "vertical",
14137
14169
  className: ShowContentHeaderStyle,
@@ -14654,9 +14686,8 @@ function ResourceList(props) {
14654
14686
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
14655
14687
  const filters = useRefineFilters();
14656
14688
  const { tableProps, selectedKeys } = useEagleTable({
14657
- useTableParams: {
14658
- filters
14659
- },
14689
+ useTableParams: {},
14690
+ filters,
14660
14691
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
14661
14692
  tableProps: {
14662
14693
  defaultSize: 50,
@@ -14931,7 +14962,7 @@ const MemoizedFormField = React.memo(function FormField({
14931
14962
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
14932
14963
  eagle.Form.Item,
14933
14964
  {
14934
- label: fieldConfig.label,
14965
+ label: typeof fieldConfig.label === "function" ? fieldConfig.label(currentFormValue) : fieldConfig.label,
14935
14966
  colon: false,
14936
14967
  labelCol: fieldConfig.layout === FormItemLayout.VERTICAL ? {} : { flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}` },
14937
14968
  help: fieldConfig.isHideErrorStatus ? "" : (_a = fieldState.error) == null ? void 0 : _a.message,
@@ -17768,10 +17799,41 @@ const EditButton = () => {
17768
17799
  );
17769
17800
  };
17770
17801
  const ReferenceLink = (props) => {
17771
- const { ownerReference, namespace: namespace2 } = props;
17802
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17772
17803
  const configs = React.useContext(ConfigsContext);
17804
+ const { data: deploymentsData } = core.useList({
17805
+ resource: "deployments",
17806
+ meta: {
17807
+ kind: "Deployment",
17808
+ resourceBasePath: "/apis/apps/v1"
17809
+ },
17810
+ pagination: {
17811
+ mode: "off"
17812
+ }
17813
+ });
17814
+ const { data: replicaSetsData } = core.useList({
17815
+ resource: "replicasets",
17816
+ meta: {
17817
+ kind: "ReplicaSet",
17818
+ resourceBasePath: "/apis/apps/v1"
17819
+ },
17820
+ pagination: {
17821
+ mode: "off"
17822
+ }
17823
+ });
17773
17824
  if (ownerReference.kind === "ReplicaSet") {
17774
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { children: ownerReference.name });
17825
+ const deployment = pod2.getBelongToDeployment(
17826
+ (deploymentsData == null ? void 0 : deploymentsData.data) || [],
17827
+ (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
17828
+ );
17829
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17830
+ ResourceLink,
17831
+ {
17832
+ name: (deployment == null ? void 0 : deployment.name) || "",
17833
+ resourceName: "deployments",
17834
+ namespace: namespace2
17835
+ }
17836
+ );
17775
17837
  }
17776
17838
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17777
17839
  if (!resource) {
@@ -19471,6 +19533,7 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19471
19533
  });
19472
19534
  }
19473
19535
  return value2.map((o) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ReferenceLink, {
19536
+ pod: record,
19474
19537
  ownerReference: o,
19475
19538
  namespace: record.metadata.namespace || "default"
19476
19539
  }, o.name));
@@ -19846,27 +19909,18 @@ function useNamespaceRefineFilter() {
19846
19909
  }
19847
19910
  const NAME_KEYWORD_PARAM = "name_keyword";
19848
19911
  function useRefineFilters(options = {}) {
19849
- const {
19850
- disableNamespaceFilter = false,
19851
- disableNameKeywordFilter = false
19852
- } = options;
19912
+ const { disableNamespaceFilter = false, disableNameKeywordFilter = false } = options;
19853
19913
  const { value: nsFilters = [] } = useNamespacesFilter();
19854
19914
  const namespaceFilters = React.useMemo(() => {
19855
- if (disableNamespaceFilter) {
19856
- return [];
19857
- }
19858
19915
  const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
19859
- if (filters2.length === 0) {
19916
+ if (disableNamespaceFilter || filters2.length === 0) {
19860
19917
  return [];
19861
19918
  }
19862
19919
  return [
19863
19920
  {
19864
- operator: "or",
19865
- value: filters2.map((filter) => ({
19866
- field: "metadata.namespace",
19867
- operator: "eq",
19868
- value: filter
19869
- }))
19921
+ field: "metadata.namespace",
19922
+ operator: "in",
19923
+ value: filters2
19870
19924
  }
19871
19925
  ];
19872
19926
  }, [nsFilters, disableNamespaceFilter]);
@@ -19885,9 +19939,7 @@ function useRefineFilters(options = {}) {
19885
19939
  ];
19886
19940
  }, [nameKeyword, disableNameKeywordFilter]);
19887
19941
  const filters = React.useMemo(
19888
- () => ({
19889
- permanent: [...namespaceFilters, ...nameKeywordFilters]
19890
- }),
19942
+ () => [...namespaceFilters, ...nameKeywordFilters],
19891
19943
  [namespaceFilters, nameKeywordFilters]
19892
19944
  );
19893
19945
  return filters;
package/dist/refine.js CHANGED
@@ -7404,7 +7404,7 @@ const tag_18x9v7m = "";
7404
7404
  const StateTagStyle = "s82411";
7405
7405
  const NameTagStyle = "n9ja9cs";
7406
7406
  function shortenedImage(image2) {
7407
- return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
7407
+ return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
7408
7408
  }
7409
7409
  function isFirstLetterEnglish(str) {
7410
7410
  return /^[a-zA-Z]/.test(str);
@@ -8536,7 +8536,7 @@ function parseSi(inValue, increment = null, allowFractional = true) {
8536
8536
  return val;
8537
8537
  }
8538
8538
  const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(props, ref) {
8539
- const { defaultValue, pvc: pvc2 } = props;
8539
+ const { defaultValue, pvc: pvc2, label: label2, onBlur } = props;
8540
8540
  const { resource } = useResource();
8541
8541
  const { mutateAsync } = useUpdate();
8542
8542
  const { t: t2 } = useTranslation();
@@ -8585,13 +8585,17 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8585
8585
  errorNotification: false
8586
8586
  });
8587
8587
  }, [pvc2, distributeStorage, resource == null ? void 0 : resource.name, validators, mutateAsync, t2]);
8588
- useImperativeHandle(ref, () => ({
8589
- submit
8590
- }), [submit]);
8588
+ useImperativeHandle(
8589
+ ref,
8590
+ () => ({
8591
+ submit
8592
+ }),
8593
+ [submit]
8594
+ );
8591
8595
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8592
8596
  Form.Item,
8593
8597
  {
8594
- label: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { width: "134px" }, children: t2("dovetail.distributed") }),
8598
+ label: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { width: "134px" }, children: label2 || t2("dovetail.distributed") }),
8595
8599
  colon: false,
8596
8600
  help: validateResult.distributeStorage,
8597
8601
  validateStatus: validateResult.distributeStorage ? "error" : "",
@@ -8609,7 +8613,14 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8609
8613
  distributeStorage: validators.distributeStorage(v)
8610
8614
  });
8611
8615
  },
8612
- onBlur: () => void 0,
8616
+ onBlur: () => {
8617
+ onBlur == null ? void 0 : onBlur(distributeStorage, (newValue) => {
8618
+ setDistributeStorage(newValue);
8619
+ setValidateResult({
8620
+ distributeStorage: validators.distributeStorage(newValue)
8621
+ });
8622
+ });
8623
+ },
8613
8624
  onFocus: () => void 0
8614
8625
  },
8615
8626
  min: 1,
@@ -8620,7 +8631,12 @@ const DistributeStorageForm = React.forwardRef(function DistributeStorageForm2(p
8620
8631
  }
8621
8632
  );
8622
8633
  });
8623
- function PVCDistributeStorage({ pvc: pvc2, editable }) {
8634
+ function PVCDistributeStorage({
8635
+ pvc: pvc2,
8636
+ editable,
8637
+ label: label2,
8638
+ onBlur
8639
+ }) {
8624
8640
  var _a, _b;
8625
8641
  const { t: t2 } = useTranslation();
8626
8642
  const formRef = useRef(null);
@@ -8640,7 +8656,9 @@ function PVCDistributeStorage({ pvc: pvc2, editable }) {
8640
8656
  {
8641
8657
  ref: formRef,
8642
8658
  defaultValue: value2 ? transformStorageUnit(value2, StorageUnit.Gi) : 0,
8643
- pvc: pvc2
8659
+ pvc: pvc2,
8660
+ label: label2,
8661
+ onBlur
8644
8662
  }
8645
8663
  );
8646
8664
  }
@@ -10228,7 +10246,12 @@ const ServiceOutClusterAccessComponent = ({
10228
10246
  });
10229
10247
  break;
10230
10248
  case ServiceTypeEnum.ClusterIP:
10231
- content = i18n2.t("dovetail.not_support");
10249
+ content = /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10250
+ style: {
10251
+ color: "#00122e"
10252
+ },
10253
+ children: i18n2.t("dovetail.not_support")
10254
+ });
10232
10255
  break;
10233
10256
  default:
10234
10257
  content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10240,7 +10263,8 @@ const ServiceOutClusterAccessComponent = ({
10240
10263
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10241
10264
  style: {
10242
10265
  whiteSpace: "pre-wrap",
10243
- color: "#0080ff"
10266
+ color: "#0080ff",
10267
+ height: "18px"
10244
10268
  },
10245
10269
  children: content || "-"
10246
10270
  });
@@ -11015,6 +11039,12 @@ const useEagleTable = (params) => {
11015
11039
  }
11016
11040
  ]);
11017
11041
  }, []);
11042
+ useEffect(() => {
11043
+ if (isEqual$1(params.filters, table.filters)) {
11044
+ return;
11045
+ }
11046
+ table.setFilters(params.filters || [], "replace");
11047
+ }, [params.filters]);
11018
11048
  return {
11019
11049
  tableProps: finalProps,
11020
11050
  selectedKeys,
@@ -11498,7 +11528,7 @@ const IngressRulesTable = ({ ingress }) => {
11498
11528
  }
11499
11529
  );
11500
11530
  };
11501
- const KeyValue_1cqk7i8 = "";
11531
+ const KeyValue_1qasuz9 = "";
11502
11532
  const ContentBlockStyle = "c8jy7dc";
11503
11533
  const KeyStyle = "k2sddxl";
11504
11534
  const ValueStyle$2 = "v16vicsr";
@@ -12913,7 +12943,10 @@ const PVCapacityField = (i18n2) => {
12913
12943
  }
12914
12944
  };
12915
12945
  };
12916
- const PVCStorageField = (i18n2) => {
12946
+ const PVCStorageField = ({
12947
+ i18n: i18n2,
12948
+ editProps
12949
+ }) => {
12917
12950
  return {
12918
12951
  key: "storage",
12919
12952
  col: 12,
@@ -12922,6 +12955,8 @@ const PVCStorageField = (i18n2) => {
12922
12955
  renderContent(value2, pvc2) {
12923
12956
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PVCDistributeStorage, {
12924
12957
  pvc: pvc2,
12958
+ label: editProps == null ? void 0 : editProps.label,
12959
+ onBlur: editProps == null ? void 0 : editProps.onBlur,
12925
12960
  editable: true
12926
12961
  });
12927
12962
  }
@@ -13845,7 +13880,7 @@ function Tabs(props) {
13845
13880
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13846
13881
  }) });
13847
13882
  }
13848
- const ShowContentView_196cma3 = "";
13883
+ const ShowContentView_1xfhkd = "";
13849
13884
  const ShowContentWrapperStyle = "soapvs9";
13850
13885
  const BackButton = "b13d603q";
13851
13886
  const ToolBarWrapper = "tm8eaia";
@@ -14110,9 +14145,6 @@ const ShowContentView = (props) => {
14110
14145
  const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
14111
14146
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
14112
14147
  className: cx_default(ShowContentWrapperStyle, className),
14113
- style: {
14114
- background: size === "small" ? "#fff" : void 0
14115
- },
14116
14148
  children: [hideTopBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
14117
14149
  direction: "vertical",
14118
14150
  className: ShowContentHeaderStyle,
@@ -14635,9 +14667,8 @@ function ResourceList(props) {
14635
14667
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
14636
14668
  const filters = useRefineFilters();
14637
14669
  const { tableProps, selectedKeys } = useEagleTable({
14638
- useTableParams: {
14639
- filters
14640
- },
14670
+ useTableParams: {},
14671
+ filters,
14641
14672
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
14642
14673
  tableProps: {
14643
14674
  defaultSize: 50,
@@ -14912,7 +14943,7 @@ const MemoizedFormField = memo(function FormField({
14912
14943
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14913
14944
  Form.Item,
14914
14945
  {
14915
- label: fieldConfig.label,
14946
+ label: typeof fieldConfig.label === "function" ? fieldConfig.label(currentFormValue) : fieldConfig.label,
14916
14947
  colon: false,
14917
14948
  labelCol: fieldConfig.layout === FormItemLayout.VERTICAL ? {} : { flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}` },
14918
14949
  help: fieldConfig.isHideErrorStatus ? "" : (_a = fieldState.error) == null ? void 0 : _a.message,
@@ -17749,10 +17780,41 @@ const EditButton = () => {
17749
17780
  );
17750
17781
  };
17751
17782
  const ReferenceLink = (props) => {
17752
- const { ownerReference, namespace: namespace2 } = props;
17783
+ const { ownerReference, namespace: namespace2, pod: pod2 } = props;
17753
17784
  const configs = useContext(ConfigsContext);
17785
+ const { data: deploymentsData } = useList({
17786
+ resource: "deployments",
17787
+ meta: {
17788
+ kind: "Deployment",
17789
+ resourceBasePath: "/apis/apps/v1"
17790
+ },
17791
+ pagination: {
17792
+ mode: "off"
17793
+ }
17794
+ });
17795
+ const { data: replicaSetsData } = useList({
17796
+ resource: "replicasets",
17797
+ meta: {
17798
+ kind: "ReplicaSet",
17799
+ resourceBasePath: "/apis/apps/v1"
17800
+ },
17801
+ pagination: {
17802
+ mode: "off"
17803
+ }
17804
+ });
17754
17805
  if (ownerReference.kind === "ReplicaSet") {
17755
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: ownerReference.name });
17806
+ const deployment = pod2.getBelongToDeployment(
17807
+ (deploymentsData == null ? void 0 : deploymentsData.data) || [],
17808
+ (replicaSetsData == null ? void 0 : replicaSetsData.data) || []
17809
+ );
17810
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
17811
+ ResourceLink,
17812
+ {
17813
+ name: (deployment == null ? void 0 : deployment.name) || "",
17814
+ resourceName: "deployments",
17815
+ namespace: namespace2
17816
+ }
17817
+ );
17756
17818
  }
17757
17819
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
17758
17820
  if (!resource) {
@@ -19452,6 +19514,7 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19452
19514
  });
19453
19515
  }
19454
19516
  return value2.map((o) => /* @__PURE__ */ jsxRuntimeExports.jsx(ReferenceLink, {
19517
+ pod: record,
19455
19518
  ownerReference: o,
19456
19519
  namespace: record.metadata.namespace || "default"
19457
19520
  }, o.name));
@@ -19827,27 +19890,18 @@ function useNamespaceRefineFilter() {
19827
19890
  }
19828
19891
  const NAME_KEYWORD_PARAM = "name_keyword";
19829
19892
  function useRefineFilters(options = {}) {
19830
- const {
19831
- disableNamespaceFilter = false,
19832
- disableNameKeywordFilter = false
19833
- } = options;
19893
+ const { disableNamespaceFilter = false, disableNameKeywordFilter = false } = options;
19834
19894
  const { value: nsFilters = [] } = useNamespacesFilter();
19835
19895
  const namespaceFilters = useMemo(() => {
19836
- if (disableNamespaceFilter) {
19837
- return [];
19838
- }
19839
19896
  const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
19840
- if (filters2.length === 0) {
19897
+ if (disableNamespaceFilter || filters2.length === 0) {
19841
19898
  return [];
19842
19899
  }
19843
19900
  return [
19844
19901
  {
19845
- operator: "or",
19846
- value: filters2.map((filter) => ({
19847
- field: "metadata.namespace",
19848
- operator: "eq",
19849
- value: filter
19850
- }))
19902
+ field: "metadata.namespace",
19903
+ operator: "in",
19904
+ value: filters2
19851
19905
  }
19852
19906
  ];
19853
19907
  }, [nsFilters, disableNamespaceFilter]);
@@ -19866,9 +19920,7 @@ function useRefineFilters(options = {}) {
19866
19920
  ];
19867
19921
  }, [nameKeyword, disableNameKeywordFilter]);
19868
19922
  const filters = useMemo(
19869
- () => ({
19870
- permanent: [...namespaceFilters, ...nameKeywordFilters]
19871
- }),
19923
+ () => [...namespaceFilters, ...nameKeywordFilters],
19872
19924
  [namespaceFilters, nameKeywordFilters]
19873
19925
  );
19874
19926
  return filters;
package/dist/style.css CHANGED
@@ -1400,9 +1400,6 @@
1400
1400
  border-radius: 4px;
1401
1401
  background: rgba(237, 241, 250, 0.6);
1402
1402
  }
1403
- .c8jy7dc:not(:last-of-type) {
1404
- margin-bottom: 8px;
1405
- }
1406
1403
 
1407
1404
  .k2sddxl {
1408
1405
  color: rgba(44, 56, 82, 0.75);
@@ -3508,7 +3505,7 @@
3508
3505
  height: 100%;
3509
3506
  display: flex;
3510
3507
  flex-direction: column;
3511
- background: linear-gradient(180deg, #fff 0%, #edf0f7 100%);
3508
+ background: white;
3512
3509
  }
3513
3510
 
3514
3511
  .b13d603q {
@@ -3627,7 +3624,10 @@
3627
3624
  margin: auto 0;
3628
3625
  margin-right: 8px;
3629
3626
  border: 1px solid rgba(172, 186, 211, 0.6);
3630
- background-color: white;
3627
+ background-color: white !important;
3628
+ padding: 2px 5px;
3629
+ height: 22px;
3630
+ color: #1D326C !important;
3631
3631
  }
3632
3632
 
3633
3633
  .cxd8k68 {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.3.19-alpha.3",
3
+ "version": "0.3.20-alpha.1",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",