@dovetail-v2/refine 0.3.19-alpha.2 → 0.3.20-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.
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
  });
@@ -10565,22 +10589,22 @@ function useOpenForm() {
10565
10589
  const go = useGo();
10566
10590
  return function openForm(options) {
10567
10591
  var _a, _b;
10568
- const finalResourceName = (options == null ? void 0 : options.resourceName) || ((_a = options == null ? void 0 : options.config) == null ? void 0 : _a.name) || (resource == null ? void 0 : resource.name);
10569
- if (finalResourceName || (options == null ? void 0 : options.config)) {
10570
- const config = (options == null ? void 0 : options.config) || configs[finalResourceName || ""];
10571
- const formType = (_b = config.formConfig) == null ? void 0 : _b.formContainerType;
10592
+ const finalResourceName = (options == null ? void 0 : options.resourceName) || ((_a = options == null ? void 0 : options.resourceConfig) == null ? void 0 : _a.name) || (resource == null ? void 0 : resource.name);
10593
+ if (finalResourceName || (options == null ? void 0 : options.resourceConfig)) {
10594
+ const resourceConfig = (options == null ? void 0 : options.resourceConfig) || configs[finalResourceName || ""];
10595
+ const formType = (_b = resourceConfig.formConfig) == null ? void 0 : _b.formContainerType;
10572
10596
  if (formType === void 0 || formType === FormContainerType.MODAL) {
10573
10597
  pushModal({
10574
10598
  component: () => {
10575
10599
  var _a2;
10576
- const ModalComponent = ((_a2 = config.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
10600
+ const ModalComponent = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
10577
10601
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10578
10602
  ModalComponent,
10579
10603
  {
10580
10604
  id: options == null ? void 0 : options.id,
10581
- config,
10605
+ resourceConfig,
10582
10606
  yamlFormProps: {
10583
- config
10607
+ resourceConfig
10584
10608
  },
10585
10609
  options,
10586
10610
  onSuccess: options == null ? void 0 : options.onSuccess
@@ -10818,23 +10842,20 @@ function K8sDropdown(props) {
10818
10842
  const {
10819
10843
  record,
10820
10844
  size = "normal",
10821
- resourceName: resourceNameFromProps,
10822
- config: configFromProps,
10845
+ resourceConfig,
10823
10846
  customButton,
10824
- deleteDialogProps,
10825
- displayName,
10826
- hideEdit
10847
+ deleteDialogProps
10827
10848
  } = props;
10828
10849
  const globalStore = useGlobalStore();
10829
10850
  const useResourceResult = useResource();
10830
10851
  const configs = useContext(ConfigsContext);
10831
- const resourceName = resourceNameFromProps || getResourceNameByKind(record.kind || "", configs);
10832
- const config = configFromProps || configs[resourceName || ""];
10852
+ const resourceName = (resourceConfig == null ? void 0 : resourceConfig.name) || getResourceNameByKind(record.kind || "", configs);
10853
+ const config = resourceConfig || configs[resourceName || ""];
10833
10854
  const { t: t2, i18n: i18n2 } = useTranslation();
10834
10855
  const { openDeleteConfirmModal } = useDeleteModal({
10835
10856
  resourceName: resourceName || "",
10836
10857
  deleteDialogProps,
10837
- displayName,
10858
+ displayName: config.displayName,
10838
10859
  meta: record.apiVersion ? {
10839
10860
  kind: record.kind || "",
10840
10861
  resourceBasePath: (
@@ -10865,12 +10886,12 @@ function K8sDropdown(props) {
10865
10886
  Dropdown,
10866
10887
  {
10867
10888
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(Menu$1, { children: [
10868
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || hideEdit || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10889
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10869
10890
  Menu$1.Item,
10870
10891
  {
10871
- onClick: () => openForm({ id: record.id, resourceName, config }),
10892
+ onClick: () => openForm({ id: record.id, resourceName, resourceConfig: config }),
10872
10893
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { src: EditPen16PrimaryIcon, children: formType === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(
10873
- displayName || (config == null ? void 0 : config.displayName) || record.kind || "",
10894
+ config.displayName || record.kind || "",
10874
10895
  i18n2.language
10875
10896
  )}` : t2("dovetail.edit_yaml") })
10876
10897
  }
@@ -11018,6 +11039,12 @@ const useEagleTable = (params) => {
11018
11039
  }
11019
11040
  ]);
11020
11041
  }, []);
11042
+ useEffect(() => {
11043
+ if (isEqual$1(params.filters, table.filters)) {
11044
+ return;
11045
+ }
11046
+ table.setFilters(params.filters || [], "replace");
11047
+ }, [params.filters]);
11021
11048
  return {
11022
11049
  tableProps: finalProps,
11023
11050
  selectedKeys,
@@ -11501,7 +11528,7 @@ const IngressRulesTable = ({ ingress }) => {
11501
11528
  }
11502
11529
  );
11503
11530
  };
11504
- const KeyValue_1cqk7i8 = "";
11531
+ const KeyValue_1qasuz9 = "";
11505
11532
  const ContentBlockStyle = "c8jy7dc";
11506
11533
  const KeyStyle = "k2sddxl";
11507
11534
  const ValueStyle$2 = "v16vicsr";
@@ -12916,7 +12943,10 @@ const PVCapacityField = (i18n2) => {
12916
12943
  }
12917
12944
  };
12918
12945
  };
12919
- const PVCStorageField = (i18n2) => {
12946
+ const PVCStorageField = ({
12947
+ i18n: i18n2,
12948
+ editProps
12949
+ }) => {
12920
12950
  return {
12921
12951
  key: "storage",
12922
12952
  col: 12,
@@ -12925,6 +12955,8 @@ const PVCStorageField = (i18n2) => {
12925
12955
  renderContent(value2, pvc2) {
12926
12956
  return /* @__PURE__ */ jsxRuntimeExports.jsx(PVCDistributeStorage, {
12927
12957
  pvc: pvc2,
12958
+ label: editProps == null ? void 0 : editProps.label,
12959
+ onBlur: editProps == null ? void 0 : editProps.onBlur,
12928
12960
  editable: true
12929
12961
  });
12930
12962
  }
@@ -13848,7 +13880,7 @@ function Tabs(props) {
13848
13880
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13849
13881
  }) });
13850
13882
  }
13851
- const ShowContentView_196cma3 = "";
13883
+ const ShowContentView_1xfhkd = "";
13852
13884
  const ShowContentWrapperStyle = "soapvs9";
13853
13885
  const BackButton = "b13d603q";
13854
13886
  const ToolBarWrapper = "tm8eaia";
@@ -14113,9 +14145,6 @@ const ShowContentView = (props) => {
14113
14145
  const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
14114
14146
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
14115
14147
  className: cx_default(ShowContentWrapperStyle, className),
14116
- style: {
14117
- background: size === "small" ? "#fff" : void 0
14118
- },
14119
14148
  children: [hideTopBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(Space, {
14120
14149
  direction: "vertical",
14121
14150
  className: ShowContentHeaderStyle,
@@ -14638,9 +14667,8 @@ function ResourceList(props) {
14638
14667
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
14639
14668
  const filters = useRefineFilters();
14640
14669
  const { tableProps, selectedKeys } = useEagleTable({
14641
- useTableParams: {
14642
- filters
14643
- },
14670
+ useTableParams: {},
14671
+ filters,
14644
14672
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
14645
14673
  tableProps: {
14646
14674
  defaultSize: 50,
@@ -14665,10 +14693,10 @@ function ResourceShow(props) {
14665
14693
  }
14666
14694
  );
14667
14695
  }
14668
- function getInitialValues(config) {
14669
- return config.initValue || {
14670
- apiVersion: config.apiVersion,
14671
- kind: config.kind,
14696
+ function getInitialValues(resourceConfig) {
14697
+ return resourceConfig.initValue || {
14698
+ apiVersion: resourceConfig.apiVersion,
14699
+ kind: resourceConfig.kind,
14672
14700
  ...BASE_INIT_VALUE,
14673
14701
  spec: {}
14674
14702
  };
@@ -14807,19 +14835,19 @@ const SpaceStyle = "sea7f83";
14807
14835
  const VerticalFormItemStyle = "v1jthrhz";
14808
14836
  const IntegerStyle = "i1brpchs";
14809
14837
  const ContentWrapper = "c11mae2d";
14810
- function useFieldsConfig(config, formConfig, resourceId, step, customOptions, transformedInitValues) {
14838
+ function useFieldsConfig(resourceConfig, formConfig, resourceId, step, customOptions, transformedInitValues) {
14811
14839
  var _a, _b, _c;
14812
14840
  const action = resourceId ? "edit" : "create";
14813
14841
  const listQuery = useList({
14814
- resource: config == null ? void 0 : config.name,
14815
- meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
14842
+ resource: resourceConfig == null ? void 0 : resourceConfig.name,
14843
+ meta: { resourceBasePath: resourceConfig == null ? void 0 : resourceConfig.basePath, kind: resourceConfig == null ? void 0 : resourceConfig.kind },
14816
14844
  pagination: {
14817
14845
  mode: "off"
14818
14846
  }
14819
14847
  });
14820
14848
  const showQuery = useShow({
14821
- resource: config == null ? void 0 : config.name,
14822
- meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
14849
+ resource: resourceConfig == null ? void 0 : resourceConfig.name,
14850
+ meta: { resourceBasePath: resourceConfig == null ? void 0 : resourceConfig.basePath, kind: resourceConfig == null ? void 0 : resourceConfig.kind },
14823
14851
  id: resourceId
14824
14852
  });
14825
14853
  return (_c = formConfig == null ? void 0 : formConfig.fields) == null ? void 0 : _c.call(formConfig, {
@@ -14915,7 +14943,7 @@ const MemoizedFormField = memo(function FormField({
14915
14943
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
14916
14944
  Form.Item,
14917
14945
  {
14918
- label: fieldConfig.label,
14946
+ label: typeof fieldConfig.label === "function" ? fieldConfig.label(currentFormValue) : fieldConfig.label,
14919
14947
  colon: false,
14920
14948
  labelCol: fieldConfig.layout === FormItemLayout.VERTICAL ? {} : { flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}` },
14921
14949
  help: fieldConfig.isHideErrorStatus ? "" : (_a = fieldState.error) == null ? void 0 : _a.message,
@@ -14934,7 +14962,7 @@ const MemoizedFormField = memo(function FormField({
14934
14962
  });
14935
14963
  function FieldsContent(props) {
14936
14964
  const {
14937
- config,
14965
+ resourceConfig,
14938
14966
  formConfig,
14939
14967
  resourceId,
14940
14968
  step,
@@ -14946,7 +14974,7 @@ function FieldsContent(props) {
14946
14974
  const { control, getValues, watch, trigger } = formResult;
14947
14975
  const action = resourceId ? "edit" : "create";
14948
14976
  const formFieldsConfig = useFieldsConfig(
14949
- config,
14977
+ resourceConfig,
14950
14978
  { fields },
14951
14979
  resourceId,
14952
14980
  step,
@@ -14964,7 +14992,7 @@ function FieldsContent(props) {
14964
14992
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: ContentWrapper, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
14965
14993
  FieldsContent,
14966
14994
  {
14967
- config,
14995
+ resourceConfig,
14968
14996
  formConfig,
14969
14997
  resourceId,
14970
14998
  step,
@@ -14994,7 +15022,7 @@ function FieldsContent(props) {
14994
15022
  }
14995
15023
  const RefineFormContent = (props) => {
14996
15024
  const {
14997
- config,
15025
+ resourceConfig: config,
14998
15026
  formResult,
14999
15027
  resourceId,
15000
15028
  errorMsgs,
@@ -15008,7 +15036,7 @@ const RefineFormContent = (props) => {
15008
15036
  /* @__PURE__ */ jsxRuntimeExports.jsx(
15009
15037
  FieldsContent,
15010
15038
  {
15011
- config,
15039
+ resourceConfig: config,
15012
15040
  formConfig,
15013
15041
  fields: formConfig == null ? void 0 : formConfig.fields,
15014
15042
  resourceId,
@@ -15719,7 +15747,7 @@ const useForm = ({
15719
15747
  };
15720
15748
  };
15721
15749
  const useRefineForm = (props) => {
15722
- const { formConfig, config, id, refineProps, options } = props;
15750
+ const { formConfig, resourceConfig, id, refineProps, options } = props;
15723
15751
  const { transformInitValues, transformApplyValues } = usePathMap({
15724
15752
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
15725
15753
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
@@ -15738,7 +15766,7 @@ const useRefineForm = (props) => {
15738
15766
  return {
15739
15767
  message: i18n2.t(id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast", {
15740
15768
  kind: transformResourceKindInSentence(
15741
- config.displayName || config.kind,
15769
+ resourceConfig.displayName || resourceConfig.kind,
15742
15770
  i18n2.language
15743
15771
  ),
15744
15772
  name: (_a = formValue.metadata) == null ? void 0 : _a.name,
@@ -15748,13 +15776,13 @@ const useRefineForm = (props) => {
15748
15776
  type: "success"
15749
15777
  };
15750
15778
  },
15751
- resource: config.name,
15779
+ resource: resourceConfig.name,
15752
15780
  action: id ? "edit" : "create",
15753
15781
  id,
15754
15782
  liveMode: "off",
15755
15783
  ...refineProps
15756
15784
  },
15757
- defaultValues: (options == null ? void 0 : options.initialValues) || (config == null ? void 0 : config.initValue),
15785
+ defaultValues: (options == null ? void 0 : options.initialValues) || (resourceConfig == null ? void 0 : resourceConfig.initValue),
15758
15786
  transformApplyValues,
15759
15787
  transformInitValues,
15760
15788
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16452,7 +16480,7 @@ function YamlForm(props) {
16452
16480
  schemaStrategy = "Optional",
16453
16481
  isShowLayout = true,
16454
16482
  useFormProps,
16455
- config,
16483
+ resourceConfig,
16456
16484
  transformInitValues,
16457
16485
  transformApplyValues,
16458
16486
  beforeSubmit,
@@ -16496,7 +16524,7 @@ function YamlForm(props) {
16496
16524
  beforeSubmit,
16497
16525
  successNotification(data2) {
16498
16526
  var _a;
16499
- const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
16527
+ const displayName = resourceConfig.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
16500
16528
  return {
16501
16529
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
16502
16530
  kind: transformResourceKindInSentence(displayName, i18n2.language),
@@ -16513,10 +16541,10 @@ function YamlForm(props) {
16513
16541
  transformApplyValues,
16514
16542
  mutationMeta: {
16515
16543
  updateType: "put",
16516
- dataProviderName: config.dataProviderName,
16517
- resourceBasePath: config.basePath,
16518
- kind: config.kind,
16519
- label: `${config.kind}s`
16544
+ dataProviderName: resourceConfig.dataProviderName,
16545
+ resourceBasePath: resourceConfig.basePath,
16546
+ kind: resourceConfig.kind,
16547
+ label: `${resourceConfig.kind}s`
16520
16548
  },
16521
16549
  ...useFormProps
16522
16550
  });
@@ -16599,7 +16627,7 @@ function YamlForm(props) {
16599
16627
  }
16600
16628
  const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16601
16629
  id,
16602
- config,
16630
+ resourceConfig,
16603
16631
  step,
16604
16632
  customYamlFormProps,
16605
16633
  formConfig,
@@ -16612,7 +16640,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16612
16640
  var _a, _b;
16613
16641
  const action = id ? "edit" : "create";
16614
16642
  const refineFormResult = useRefineForm({
16615
- config,
16643
+ resourceConfig,
16616
16644
  id,
16617
16645
  refineProps: {
16618
16646
  onMutationSuccess: (data2) => {
@@ -16638,7 +16666,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16638
16666
  }
16639
16667
  });
16640
16668
  const fieldsConfig = useFieldsConfig(
16641
- config,
16669
+ resourceConfig,
16642
16670
  { fields: formConfig == null ? void 0 : formConfig.fields },
16643
16671
  id,
16644
16672
  step,
@@ -16654,8 +16682,8 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16654
16682
  if (isYamlMode) {
16655
16683
  return {
16656
16684
  ...customYamlFormProps,
16657
- resource: config.name,
16658
- config,
16685
+ resource: resourceConfig.name,
16686
+ resourceConfig,
16659
16687
  transformInitValues: void 0,
16660
16688
  transformApplyValues: void 0,
16661
16689
  initialValuesForCreate: transformApplyValues(
@@ -16671,10 +16699,10 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16671
16699
  redirect: false
16672
16700
  },
16673
16701
  rules: fieldsConfig == null ? void 0 : fieldsConfig.filter(
16674
- (config2) => "isSkipValidationInYaml" in config2 && !config2.isSkipValidationInYaml
16675
- ).map((config2) => ({
16676
- path: "path" in config2 ? config2.path : [],
16677
- validators: "validators" in config2 ? config2.validators : void 0
16702
+ (config) => "isSkipValidationInYaml" in config && !config.isSkipValidationInYaml
16703
+ ).map((config) => ({
16704
+ path: "path" in config ? config.path : [],
16705
+ validators: "validators" in config ? config.validators : void 0
16678
16706
  })),
16679
16707
  onSaveButtonPropsChange,
16680
16708
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16687,14 +16715,14 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16687
16715
  };
16688
16716
  }
16689
16717
  return {
16690
- config
16718
+ resourceConfig
16691
16719
  };
16692
16720
  }, [
16693
16721
  action,
16694
16722
  isYamlMode,
16695
16723
  customYamlFormProps,
16696
16724
  fieldsConfig,
16697
- config,
16725
+ resourceConfig,
16698
16726
  id,
16699
16727
  refineFormResult,
16700
16728
  formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16736,7 +16764,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16736
16764
  RefineFormContent,
16737
16765
  {
16738
16766
  formResult: refineFormResult.formResult,
16739
- config,
16767
+ resourceConfig,
16740
16768
  step,
16741
16769
  formConfig,
16742
16770
  errorMsgs: [
@@ -16753,7 +16781,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16753
16781
  function YamlFormContainer({
16754
16782
  id,
16755
16783
  customYamlFormProps,
16756
- config,
16784
+ resourceConfig,
16757
16785
  formConfig,
16758
16786
  onSuccess,
16759
16787
  onError,
@@ -16768,12 +16796,12 @@ function YamlFormContainer({
16768
16796
  const yamlFormProps = useMemo(() => {
16769
16797
  return {
16770
16798
  ...customYamlFormProps,
16771
- resource: config.name,
16772
- config,
16799
+ resource: resourceConfig.name,
16800
+ resourceConfig,
16773
16801
  transformInitValues,
16774
16802
  transformApplyValues,
16775
16803
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
16776
- initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || getInitialValues(config),
16804
+ initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || getInitialValues(resourceConfig),
16777
16805
  initialValuesForEdit: void 0,
16778
16806
  id,
16779
16807
  action,
@@ -16794,7 +16822,7 @@ function YamlFormContainer({
16794
16822
  id,
16795
16823
  action,
16796
16824
  customYamlFormProps,
16797
- config,
16825
+ resourceConfig,
16798
16826
  formConfig == null ? void 0 : formConfig.beforeSubmit,
16799
16827
  transformInitValues,
16800
16828
  transformApplyValues,
@@ -16842,7 +16870,7 @@ function FormModal(props) {
16842
16870
  yamlFormProps: customYamlFormProps,
16843
16871
  modalProps,
16844
16872
  options,
16845
- config,
16873
+ resourceConfig,
16846
16874
  onSuccess
16847
16875
  } = props;
16848
16876
  const {
@@ -16856,10 +16884,10 @@ function FormModal(props) {
16856
16884
  const refineFormContainerRef = useRef(null);
16857
16885
  const popModal = usePopModal();
16858
16886
  const pushModal = usePushModal();
16859
- const isDisabledChangeMode = config.formConfig && "isDisabledChangeMode" in config.formConfig && config.formConfig.isDisabledChangeMode;
16887
+ const isDisabledChangeMode = resourceConfig.formConfig && "isDisabledChangeMode" in resourceConfig.formConfig && resourceConfig.formConfig.isDisabledChangeMode;
16860
16888
  const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
16861
16889
  const action = id ? "edit" : "create";
16862
- const isYamlForm = ((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.YAML;
16890
+ const isYamlForm = ((_a = resourceConfig.formConfig) == null ? void 0 : _a.formType) === FormType.YAML;
16863
16891
  const onOk = useCallback((e2) => {
16864
16892
  var _a2;
16865
16893
  setIsError(false);
@@ -16887,30 +16915,30 @@ function FormModal(props) {
16887
16915
  }, [isError, id, i18n2]);
16888
16916
  const title = useMemo(() => {
16889
16917
  var _a2, _b2, _c2, _d2;
16890
- if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formTitle) === "string")
16891
- return (_b2 = config.formConfig) == null ? void 0 : _b2.formTitle;
16892
- if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
16893
- return (_d2 = config.formConfig) == null ? void 0 : _d2.formTitle(action);
16918
+ if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
16919
+ return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formTitle;
16920
+ if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
16921
+ return (_d2 = resourceConfig.formConfig) == null ? void 0 : _d2.formTitle(action);
16894
16922
  }
16895
- const label2 = config.displayName || (config == null ? void 0 : config.kind);
16923
+ const label2 = resourceConfig.displayName || (resourceConfig == null ? void 0 : resourceConfig.kind);
16896
16924
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
16897
16925
  resource: transformResourceKindInSentence(label2, i18n2.language)
16898
16926
  });
16899
- }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
16927
+ }, [action, resourceConfig.formConfig, resourceConfig.displayName, resourceConfig == null ? void 0 : resourceConfig.kind, i18n2, id]);
16900
16928
  const desc = useMemo(() => {
16901
16929
  var _a2, _b2, _c2, _d2;
16902
- if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formDesc) === "string")
16903
- return (_b2 = config.formConfig) == null ? void 0 : _b2.formDesc;
16904
- if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
16905
- return (_d2 = config.formConfig) == null ? void 0 : _d2.formDesc(action);
16930
+ if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formDesc) === "string")
16931
+ return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formDesc;
16932
+ if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
16933
+ return (_d2 = resourceConfig.formConfig) == null ? void 0 : _d2.formDesc(action);
16906
16934
  }
16907
16935
  return "";
16908
- }, [action, config.formConfig]);
16936
+ }, [action, resourceConfig.formConfig]);
16909
16937
  const formEle = useMemo(() => {
16910
16938
  var _a2;
16911
16939
  const commonFormProps = {
16912
16940
  id,
16913
- config,
16941
+ resourceConfig,
16914
16942
  customYamlFormProps,
16915
16943
  onSaveButtonPropsChange: setSaveButtonProps,
16916
16944
  onError: () => {
@@ -16922,28 +16950,28 @@ function FormModal(props) {
16922
16950
  onSuccess == null ? void 0 : onSuccess(data2);
16923
16951
  }
16924
16952
  };
16925
- if (config.formConfig && (((_a2 = config.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in config.formConfig)) {
16953
+ if (resourceConfig.formConfig && (((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in resourceConfig.formConfig)) {
16926
16954
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContainer, {
16927
16955
  ...commonFormProps,
16928
16956
  ref: refineFormContainerRef,
16929
16957
  step,
16930
16958
  options,
16931
16959
  isYamlMode,
16932
- formConfig: config.formConfig
16960
+ formConfig: resourceConfig.formConfig
16933
16961
  });
16934
16962
  }
16935
16963
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlFormContainer, {
16936
16964
  ...commonFormProps,
16937
- formConfig: config.formConfig
16965
+ formConfig: resourceConfig.formConfig
16938
16966
  });
16939
- }, [id, customYamlFormProps, config, isYamlMode, step, options, popModal, setSaveButtonProps, onSuccess]);
16967
+ }, [id, customYamlFormProps, resourceConfig, isYamlMode, step, options, popModal, setSaveButtonProps, onSuccess]);
16940
16968
  const steps = useMemo(() => {
16941
16969
  var _a2, _b2;
16942
16970
  if (isYamlMode) {
16943
16971
  return void 0;
16944
16972
  }
16945
- if (config.formConfig && "steps" in config.formConfig) {
16946
- return (_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.steps) == null ? void 0 : _b2.map((step2, index2) => ({
16973
+ if (resourceConfig.formConfig && "steps" in resourceConfig.formConfig) {
16974
+ return (_b2 = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.steps) == null ? void 0 : _b2.map((step2, index2) => ({
16947
16975
  title: step2.title,
16948
16976
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
16949
16977
  children: [desc && index2 === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -16954,7 +16982,7 @@ function FormModal(props) {
16954
16982
  }));
16955
16983
  }
16956
16984
  return void 0;
16957
- }, [config.formConfig, desc, formEle, isYamlMode]);
16985
+ }, [resourceConfig.formConfig, desc, formEle, isYamlMode]);
16958
16986
  const handleStepChange = useCallback(async (nextStep) => {
16959
16987
  var _a2, _b2;
16960
16988
  const isNextStep = nextStep > step;
@@ -16976,8 +17004,8 @@ function FormModal(props) {
16976
17004
  className: TitleWrapperStyle,
16977
17005
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
16978
17006
  children: title
16979
- }), ((_b = config.formConfig) == null ? void 0 : _b.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
16980
- formConfig: config.formConfig,
17007
+ }), ((_b = resourceConfig.formConfig) == null ? void 0 : _b.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
17008
+ formConfig: resourceConfig.formConfig,
16981
17009
  mode,
16982
17010
  onChangeMode
16983
17011
  }) : null]
@@ -16989,9 +17017,9 @@ function FormModal(props) {
16989
17017
  onOk,
16990
17018
  okButtonProps: {
16991
17019
  ...omit$1(saveButtonProps, "onClick"),
16992
- children: (_c = config.formConfig) == null ? void 0 : _c.saveButtonText
17020
+ children: (_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText
16993
17021
  },
16994
- okText: ((_d = config.formConfig) == null ? void 0 : _d.saveButtonText) || okText,
17022
+ okText: ((_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText) || okText,
16995
17023
  destroyOnClose: true,
16996
17024
  destroyOtherStep: true,
16997
17025
  ...modalProps,
@@ -17015,7 +17043,7 @@ const RefineFormPage = (props) => {
17015
17043
  const {
17016
17044
  formResult
17017
17045
  } = useRefineForm({
17018
- config,
17046
+ resourceConfig: config,
17019
17047
  id
17020
17048
  });
17021
17049
  const action = id ? "edit" : "create";
@@ -17034,7 +17062,7 @@ const RefineFormPage = (props) => {
17034
17062
  direction: "vertical",
17035
17063
  className: "c1pvtlkp",
17036
17064
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
17037
- config,
17065
+ resourceConfig: config,
17038
17066
  formResult,
17039
17067
  resourceId: id,
17040
17068
  transformedInitValues: formResult.transformedInitValues
@@ -17047,18 +17075,18 @@ const RefineFormPage = (props) => {
17047
17075
  };
17048
17076
  function ResourceForm(props) {
17049
17077
  var _a;
17050
- const { config } = props;
17078
+ const { resourceConfig } = props;
17051
17079
  const formProps = useMemo(() => {
17052
17080
  var _a2, _b;
17053
17081
  return {
17054
- initialValues: getInitialValues(config),
17055
- transformInitValues: (_a2 = config.formConfig) == null ? void 0 : _a2.transformInitValues,
17056
- transformApplyValues: (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues,
17057
- config
17082
+ initialValues: getInitialValues(resourceConfig),
17083
+ transformInitValues: (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.transformInitValues,
17084
+ transformApplyValues: (_b = resourceConfig.formConfig) == null ? void 0 : _b.transformApplyValues,
17085
+ resourceConfig
17058
17086
  };
17059
- }, [config]);
17060
- if (((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.FORM) {
17061
- return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormPage, { config });
17087
+ }, [resourceConfig]);
17088
+ if (((_a = resourceConfig.formConfig) == null ? void 0 : _a.formType) === FormType.FORM) {
17089
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormPage, { config: resourceConfig });
17062
17090
  }
17063
17091
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...formProps });
17064
17092
  }
@@ -17071,8 +17099,8 @@ function ResourceCRUD(props) {
17071
17099
  !config.noShow ? /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: `${urlPrefix}/${config.name}/show`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceShow, { config }) }) : null,
17072
17100
  // the modals would render in ModalStack
17073
17101
  ((_a = config.formConfig) == null ? void 0 : _a.formContainerType) === FormContainerType.PAGE ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17074
- /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: `${urlPrefix}/${config.name}/create`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { config }) }),
17075
- /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: `${urlPrefix}/${config.name}/edit`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { config }) })
17102
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: `${urlPrefix}/${config.name}/create`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { resourceConfig: config }) }),
17103
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Route, { path: `${urlPrefix}/${config.name}/edit`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceForm, { resourceConfig: config }) })
17076
17104
  ] }) : null
17077
17105
  ] }, config.name);
17078
17106
  }) });
@@ -19830,27 +19858,18 @@ function useNamespaceRefineFilter() {
19830
19858
  }
19831
19859
  const NAME_KEYWORD_PARAM = "name_keyword";
19832
19860
  function useRefineFilters(options = {}) {
19833
- const {
19834
- disableNamespaceFilter = false,
19835
- disableNameKeywordFilter = false
19836
- } = options;
19861
+ const { disableNamespaceFilter = false, disableNameKeywordFilter = false } = options;
19837
19862
  const { value: nsFilters = [] } = useNamespacesFilter();
19838
19863
  const namespaceFilters = useMemo(() => {
19839
- if (disableNamespaceFilter) {
19840
- return [];
19841
- }
19842
19864
  const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
19843
- if (filters2.length === 0) {
19865
+ if (disableNamespaceFilter || filters2.length === 0) {
19844
19866
  return [];
19845
19867
  }
19846
19868
  return [
19847
19869
  {
19848
- operator: "or",
19849
- value: filters2.map((filter) => ({
19850
- field: "metadata.namespace",
19851
- operator: "eq",
19852
- value: filter
19853
- }))
19870
+ field: "metadata.namespace",
19871
+ operator: "in",
19872
+ value: filters2
19854
19873
  }
19855
19874
  ];
19856
19875
  }, [nsFilters, disableNamespaceFilter]);
@@ -19869,9 +19888,7 @@ function useRefineFilters(options = {}) {
19869
19888
  ];
19870
19889
  }, [nameKeyword, disableNameKeywordFilter]);
19871
19890
  const filters = useMemo(
19872
- () => ({
19873
- permanent: [...namespaceFilters, ...nameKeywordFilters]
19874
- }),
19891
+ () => [...namespaceFilters, ...nameKeywordFilters],
19875
19892
  [namespaceFilters, nameKeywordFilters]
19876
19893
  );
19877
19894
  return filters;