@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.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
  });
@@ -10584,22 +10608,22 @@ function useOpenForm() {
10584
10608
  const go = core.useGo();
10585
10609
  return function openForm(options) {
10586
10610
  var _a, _b;
10587
- 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);
10588
- if (finalResourceName || (options == null ? void 0 : options.config)) {
10589
- const config = (options == null ? void 0 : options.config) || configs[finalResourceName || ""];
10590
- const formType = (_b = config.formConfig) == null ? void 0 : _b.formContainerType;
10611
+ 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);
10612
+ if (finalResourceName || (options == null ? void 0 : options.resourceConfig)) {
10613
+ const resourceConfig = (options == null ? void 0 : options.resourceConfig) || configs[finalResourceName || ""];
10614
+ const formType = (_b = resourceConfig.formConfig) == null ? void 0 : _b.formContainerType;
10591
10615
  if (formType === void 0 || formType === FormContainerType.MODAL) {
10592
10616
  pushModal({
10593
10617
  component: () => {
10594
10618
  var _a2;
10595
- const ModalComponent = ((_a2 = config.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
10619
+ const ModalComponent = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
10596
10620
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10597
10621
  ModalComponent,
10598
10622
  {
10599
10623
  id: options == null ? void 0 : options.id,
10600
- config,
10624
+ resourceConfig,
10601
10625
  yamlFormProps: {
10602
- config
10626
+ resourceConfig
10603
10627
  },
10604
10628
  options,
10605
10629
  onSuccess: options == null ? void 0 : options.onSuccess
@@ -10837,23 +10861,20 @@ function K8sDropdown(props) {
10837
10861
  const {
10838
10862
  record,
10839
10863
  size = "normal",
10840
- resourceName: resourceNameFromProps,
10841
- config: configFromProps,
10864
+ resourceConfig,
10842
10865
  customButton,
10843
- deleteDialogProps,
10844
- displayName,
10845
- hideEdit
10866
+ deleteDialogProps
10846
10867
  } = props;
10847
10868
  const globalStore = useGlobalStore();
10848
10869
  const useResourceResult = core.useResource();
10849
10870
  const configs = React.useContext(ConfigsContext);
10850
- const resourceName = resourceNameFromProps || getResourceNameByKind(record.kind || "", configs);
10851
- const config = configFromProps || configs[resourceName || ""];
10871
+ const resourceName = (resourceConfig == null ? void 0 : resourceConfig.name) || getResourceNameByKind(record.kind || "", configs);
10872
+ const config = resourceConfig || configs[resourceName || ""];
10852
10873
  const { t: t2, i18n: i18n2 } = common.useTranslation();
10853
10874
  const { openDeleteConfirmModal } = useDeleteModal({
10854
10875
  resourceName: resourceName || "",
10855
10876
  deleteDialogProps,
10856
- displayName,
10877
+ displayName: config.displayName,
10857
10878
  meta: record.apiVersion ? {
10858
10879
  kind: record.kind || "",
10859
10880
  resourceBasePath: (
@@ -10884,12 +10905,12 @@ function K8sDropdown(props) {
10884
10905
  eagle.Dropdown,
10885
10906
  {
10886
10907
  overlay: /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Menu, { children: [
10887
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || hideEdit || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10908
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false || (config == null ? void 0 : config.hideEdit) ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10888
10909
  eagle.Menu.Item,
10889
10910
  {
10890
- onClick: () => openForm({ id: record.id, resourceName, config }),
10911
+ onClick: () => openForm({ id: record.id, resourceName, resourceConfig: config }),
10891
10912
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: formType === FormType.FORM ? `${t2("dovetail.edit")}${transformResourceKindInSentence(
10892
- displayName || (config == null ? void 0 : config.displayName) || record.kind || "",
10913
+ config.displayName || record.kind || "",
10893
10914
  i18n2.language
10894
10915
  )}` : t2("dovetail.edit_yaml") })
10895
10916
  }
@@ -11037,6 +11058,12 @@ const useEagleTable = (params) => {
11037
11058
  }
11038
11059
  ]);
11039
11060
  }, []);
11061
+ React.useEffect(() => {
11062
+ if (lodashEs.isEqual(params.filters, table.filters)) {
11063
+ return;
11064
+ }
11065
+ table.setFilters(params.filters || [], "replace");
11066
+ }, [params.filters]);
11040
11067
  return {
11041
11068
  tableProps: finalProps,
11042
11069
  selectedKeys,
@@ -11520,7 +11547,7 @@ const IngressRulesTable = ({ ingress }) => {
11520
11547
  }
11521
11548
  );
11522
11549
  };
11523
- const KeyValue_1cqk7i8 = "";
11550
+ const KeyValue_1qasuz9 = "";
11524
11551
  const ContentBlockStyle = "c8jy7dc";
11525
11552
  const KeyStyle = "k2sddxl";
11526
11553
  const ValueStyle$2 = "v16vicsr";
@@ -12935,7 +12962,10 @@ const PVCapacityField = (i18n2) => {
12935
12962
  }
12936
12963
  };
12937
12964
  };
12938
- const PVCStorageField = (i18n2) => {
12965
+ const PVCStorageField = ({
12966
+ i18n: i18n2,
12967
+ editProps
12968
+ }) => {
12939
12969
  return {
12940
12970
  key: "storage",
12941
12971
  col: 12,
@@ -12944,6 +12974,8 @@ const PVCStorageField = (i18n2) => {
12944
12974
  renderContent(value2, pvc2) {
12945
12975
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(PVCDistributeStorage, {
12946
12976
  pvc: pvc2,
12977
+ label: editProps == null ? void 0 : editProps.label,
12978
+ onBlur: editProps == null ? void 0 : editProps.onBlur,
12947
12979
  editable: true
12948
12980
  });
12949
12981
  }
@@ -13867,7 +13899,7 @@ function Tabs(props) {
13867
13899
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
13868
13900
  }) });
13869
13901
  }
13870
- const ShowContentView_196cma3 = "";
13902
+ const ShowContentView_1xfhkd = "";
13871
13903
  const ShowContentWrapperStyle = "soapvs9";
13872
13904
  const BackButton = "b13d603q";
13873
13905
  const ToolBarWrapper = "tm8eaia";
@@ -14132,9 +14164,6 @@ const ShowContentView = (props) => {
14132
14164
  const basicInfo = showConfig.basicGroup ? renderGroup(showConfig.basicGroup, true) : null;
14133
14165
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
14134
14166
  className: common.cx_default(ShowContentWrapperStyle, className),
14135
- style: {
14136
- background: size === "small" ? "#fff" : void 0
14137
- },
14138
14167
  children: [hideTopBar ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Space, {
14139
14168
  direction: "vertical",
14140
14169
  className: ShowContentHeaderStyle,
@@ -14657,9 +14686,8 @@ function ResourceList(props) {
14657
14686
  const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
14658
14687
  const filters = useRefineFilters();
14659
14688
  const { tableProps, selectedKeys } = useEagleTable({
14660
- useTableParams: {
14661
- filters
14662
- },
14689
+ useTableParams: {},
14690
+ filters,
14663
14691
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
14664
14692
  tableProps: {
14665
14693
  defaultSize: 50,
@@ -14684,10 +14712,10 @@ function ResourceShow(props) {
14684
14712
  }
14685
14713
  );
14686
14714
  }
14687
- function getInitialValues(config) {
14688
- return config.initValue || {
14689
- apiVersion: config.apiVersion,
14690
- kind: config.kind,
14715
+ function getInitialValues(resourceConfig) {
14716
+ return resourceConfig.initValue || {
14717
+ apiVersion: resourceConfig.apiVersion,
14718
+ kind: resourceConfig.kind,
14691
14719
  ...BASE_INIT_VALUE,
14692
14720
  spec: {}
14693
14721
  };
@@ -14826,19 +14854,19 @@ const SpaceStyle = "sea7f83";
14826
14854
  const VerticalFormItemStyle = "v1jthrhz";
14827
14855
  const IntegerStyle = "i1brpchs";
14828
14856
  const ContentWrapper = "c11mae2d";
14829
- function useFieldsConfig(config, formConfig, resourceId, step, customOptions, transformedInitValues) {
14857
+ function useFieldsConfig(resourceConfig, formConfig, resourceId, step, customOptions, transformedInitValues) {
14830
14858
  var _a, _b, _c;
14831
14859
  const action = resourceId ? "edit" : "create";
14832
14860
  const listQuery = core.useList({
14833
- resource: config == null ? void 0 : config.name,
14834
- meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
14861
+ resource: resourceConfig == null ? void 0 : resourceConfig.name,
14862
+ meta: { resourceBasePath: resourceConfig == null ? void 0 : resourceConfig.basePath, kind: resourceConfig == null ? void 0 : resourceConfig.kind },
14835
14863
  pagination: {
14836
14864
  mode: "off"
14837
14865
  }
14838
14866
  });
14839
14867
  const showQuery = core.useShow({
14840
- resource: config == null ? void 0 : config.name,
14841
- meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
14868
+ resource: resourceConfig == null ? void 0 : resourceConfig.name,
14869
+ meta: { resourceBasePath: resourceConfig == null ? void 0 : resourceConfig.basePath, kind: resourceConfig == null ? void 0 : resourceConfig.kind },
14842
14870
  id: resourceId
14843
14871
  });
14844
14872
  return (_c = formConfig == null ? void 0 : formConfig.fields) == null ? void 0 : _c.call(formConfig, {
@@ -14934,7 +14962,7 @@ const MemoizedFormField = React.memo(function FormField({
14934
14962
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
14935
14963
  eagle.Form.Item,
14936
14964
  {
14937
- label: fieldConfig.label,
14965
+ label: typeof fieldConfig.label === "function" ? fieldConfig.label(currentFormValue) : fieldConfig.label,
14938
14966
  colon: false,
14939
14967
  labelCol: fieldConfig.layout === FormItemLayout.VERTICAL ? {} : { flex: `0 0 ${(formConfig == null ? void 0 : formConfig.labelWidth) || "216px"}` },
14940
14968
  help: fieldConfig.isHideErrorStatus ? "" : (_a = fieldState.error) == null ? void 0 : _a.message,
@@ -14953,7 +14981,7 @@ const MemoizedFormField = React.memo(function FormField({
14953
14981
  });
14954
14982
  function FieldsContent(props) {
14955
14983
  const {
14956
- config,
14984
+ resourceConfig,
14957
14985
  formConfig,
14958
14986
  resourceId,
14959
14987
  step,
@@ -14965,7 +14993,7 @@ function FieldsContent(props) {
14965
14993
  const { control, getValues, watch, trigger } = formResult;
14966
14994
  const action = resourceId ? "edit" : "create";
14967
14995
  const formFieldsConfig = useFieldsConfig(
14968
- config,
14996
+ resourceConfig,
14969
14997
  { fields },
14970
14998
  resourceId,
14971
14999
  step,
@@ -14983,7 +15011,7 @@ function FieldsContent(props) {
14983
15011
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: ContentWrapper, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
14984
15012
  FieldsContent,
14985
15013
  {
14986
- config,
15014
+ resourceConfig,
14987
15015
  formConfig,
14988
15016
  resourceId,
14989
15017
  step,
@@ -15013,7 +15041,7 @@ function FieldsContent(props) {
15013
15041
  }
15014
15042
  const RefineFormContent = (props) => {
15015
15043
  const {
15016
- config,
15044
+ resourceConfig: config,
15017
15045
  formResult,
15018
15046
  resourceId,
15019
15047
  errorMsgs,
@@ -15027,7 +15055,7 @@ const RefineFormContent = (props) => {
15027
15055
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
15028
15056
  FieldsContent,
15029
15057
  {
15030
- config,
15058
+ resourceConfig: config,
15031
15059
  formConfig,
15032
15060
  fields: formConfig == null ? void 0 : formConfig.fields,
15033
15061
  resourceId,
@@ -15738,7 +15766,7 @@ const useForm = ({
15738
15766
  };
15739
15767
  };
15740
15768
  const useRefineForm = (props) => {
15741
- const { formConfig, config, id, refineProps, options } = props;
15769
+ const { formConfig, resourceConfig, id, refineProps, options } = props;
15742
15770
  const { transformInitValues, transformApplyValues } = usePathMap({
15743
15771
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
15744
15772
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
@@ -15757,7 +15785,7 @@ const useRefineForm = (props) => {
15757
15785
  return {
15758
15786
  message: i18n2.t(id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast", {
15759
15787
  kind: transformResourceKindInSentence(
15760
- config.displayName || config.kind,
15788
+ resourceConfig.displayName || resourceConfig.kind,
15761
15789
  i18n2.language
15762
15790
  ),
15763
15791
  name: (_a = formValue.metadata) == null ? void 0 : _a.name,
@@ -15767,13 +15795,13 @@ const useRefineForm = (props) => {
15767
15795
  type: "success"
15768
15796
  };
15769
15797
  },
15770
- resource: config.name,
15798
+ resource: resourceConfig.name,
15771
15799
  action: id ? "edit" : "create",
15772
15800
  id,
15773
15801
  liveMode: "off",
15774
15802
  ...refineProps
15775
15803
  },
15776
- defaultValues: (options == null ? void 0 : options.initialValues) || (config == null ? void 0 : config.initValue),
15804
+ defaultValues: (options == null ? void 0 : options.initialValues) || (resourceConfig == null ? void 0 : resourceConfig.initValue),
15777
15805
  transformApplyValues,
15778
15806
  transformInitValues,
15779
15807
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16471,7 +16499,7 @@ function YamlForm(props) {
16471
16499
  schemaStrategy = "Optional",
16472
16500
  isShowLayout = true,
16473
16501
  useFormProps,
16474
- config,
16502
+ resourceConfig,
16475
16503
  transformInitValues,
16476
16504
  transformApplyValues,
16477
16505
  beforeSubmit,
@@ -16515,7 +16543,7 @@ function YamlForm(props) {
16515
16543
  beforeSubmit,
16516
16544
  successNotification(data2) {
16517
16545
  var _a;
16518
- const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
16546
+ const displayName = resourceConfig.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
16519
16547
  return {
16520
16548
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
16521
16549
  kind: transformResourceKindInSentence(displayName, i18n2.language),
@@ -16532,10 +16560,10 @@ function YamlForm(props) {
16532
16560
  transformApplyValues,
16533
16561
  mutationMeta: {
16534
16562
  updateType: "put",
16535
- dataProviderName: config.dataProviderName,
16536
- resourceBasePath: config.basePath,
16537
- kind: config.kind,
16538
- label: `${config.kind}s`
16563
+ dataProviderName: resourceConfig.dataProviderName,
16564
+ resourceBasePath: resourceConfig.basePath,
16565
+ kind: resourceConfig.kind,
16566
+ label: `${resourceConfig.kind}s`
16539
16567
  },
16540
16568
  ...useFormProps
16541
16569
  });
@@ -16618,7 +16646,7 @@ function YamlForm(props) {
16618
16646
  }
16619
16647
  const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16620
16648
  id,
16621
- config,
16649
+ resourceConfig,
16622
16650
  step,
16623
16651
  customYamlFormProps,
16624
16652
  formConfig,
@@ -16631,7 +16659,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16631
16659
  var _a, _b;
16632
16660
  const action = id ? "edit" : "create";
16633
16661
  const refineFormResult = useRefineForm({
16634
- config,
16662
+ resourceConfig,
16635
16663
  id,
16636
16664
  refineProps: {
16637
16665
  onMutationSuccess: (data2) => {
@@ -16657,7 +16685,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16657
16685
  }
16658
16686
  });
16659
16687
  const fieldsConfig = useFieldsConfig(
16660
- config,
16688
+ resourceConfig,
16661
16689
  { fields: formConfig == null ? void 0 : formConfig.fields },
16662
16690
  id,
16663
16691
  step,
@@ -16673,8 +16701,8 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16673
16701
  if (isYamlMode) {
16674
16702
  return {
16675
16703
  ...customYamlFormProps,
16676
- resource: config.name,
16677
- config,
16704
+ resource: resourceConfig.name,
16705
+ resourceConfig,
16678
16706
  transformInitValues: void 0,
16679
16707
  transformApplyValues: void 0,
16680
16708
  initialValuesForCreate: transformApplyValues(
@@ -16690,10 +16718,10 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16690
16718
  redirect: false
16691
16719
  },
16692
16720
  rules: fieldsConfig == null ? void 0 : fieldsConfig.filter(
16693
- (config2) => "isSkipValidationInYaml" in config2 && !config2.isSkipValidationInYaml
16694
- ).map((config2) => ({
16695
- path: "path" in config2 ? config2.path : [],
16696
- validators: "validators" in config2 ? config2.validators : void 0
16721
+ (config) => "isSkipValidationInYaml" in config && !config.isSkipValidationInYaml
16722
+ ).map((config) => ({
16723
+ path: "path" in config ? config.path : [],
16724
+ validators: "validators" in config ? config.validators : void 0
16697
16725
  })),
16698
16726
  onSaveButtonPropsChange,
16699
16727
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16706,14 +16734,14 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16706
16734
  };
16707
16735
  }
16708
16736
  return {
16709
- config
16737
+ resourceConfig
16710
16738
  };
16711
16739
  }, [
16712
16740
  action,
16713
16741
  isYamlMode,
16714
16742
  customYamlFormProps,
16715
16743
  fieldsConfig,
16716
- config,
16744
+ resourceConfig,
16717
16745
  id,
16718
16746
  refineFormResult,
16719
16747
  formConfig == null ? void 0 : formConfig.beforeSubmit,
@@ -16755,7 +16783,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16755
16783
  RefineFormContent,
16756
16784
  {
16757
16785
  formResult: refineFormResult.formResult,
16758
- config,
16786
+ resourceConfig,
16759
16787
  step,
16760
16788
  formConfig,
16761
16789
  errorMsgs: [
@@ -16772,7 +16800,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
16772
16800
  function YamlFormContainer({
16773
16801
  id,
16774
16802
  customYamlFormProps,
16775
- config,
16803
+ resourceConfig,
16776
16804
  formConfig,
16777
16805
  onSuccess,
16778
16806
  onError,
@@ -16787,12 +16815,12 @@ function YamlFormContainer({
16787
16815
  const yamlFormProps = React.useMemo(() => {
16788
16816
  return {
16789
16817
  ...customYamlFormProps,
16790
- resource: config.name,
16791
- config,
16818
+ resource: resourceConfig.name,
16819
+ resourceConfig,
16792
16820
  transformInitValues,
16793
16821
  transformApplyValues,
16794
16822
  beforeSubmit: formConfig == null ? void 0 : formConfig.beforeSubmit,
16795
- initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || getInitialValues(config),
16823
+ initialValuesForCreate: (customYamlFormProps == null ? void 0 : customYamlFormProps.initialValuesForCreate) || getInitialValues(resourceConfig),
16796
16824
  initialValuesForEdit: void 0,
16797
16825
  id,
16798
16826
  action,
@@ -16813,7 +16841,7 @@ function YamlFormContainer({
16813
16841
  id,
16814
16842
  action,
16815
16843
  customYamlFormProps,
16816
- config,
16844
+ resourceConfig,
16817
16845
  formConfig == null ? void 0 : formConfig.beforeSubmit,
16818
16846
  transformInitValues,
16819
16847
  transformApplyValues,
@@ -16861,7 +16889,7 @@ function FormModal(props) {
16861
16889
  yamlFormProps: customYamlFormProps,
16862
16890
  modalProps,
16863
16891
  options,
16864
- config,
16892
+ resourceConfig,
16865
16893
  onSuccess
16866
16894
  } = props;
16867
16895
  const {
@@ -16875,10 +16903,10 @@ function FormModal(props) {
16875
16903
  const refineFormContainerRef = React.useRef(null);
16876
16904
  const popModal = eagle.usePopModal();
16877
16905
  const pushModal = eagle.usePushModal();
16878
- const isDisabledChangeMode = config.formConfig && "isDisabledChangeMode" in config.formConfig && config.formConfig.isDisabledChangeMode;
16906
+ const isDisabledChangeMode = resourceConfig.formConfig && "isDisabledChangeMode" in resourceConfig.formConfig && resourceConfig.formConfig.isDisabledChangeMode;
16879
16907
  const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
16880
16908
  const action = id ? "edit" : "create";
16881
- const isYamlForm = ((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.YAML;
16909
+ const isYamlForm = ((_a = resourceConfig.formConfig) == null ? void 0 : _a.formType) === FormType.YAML;
16882
16910
  const onOk = React.useCallback((e2) => {
16883
16911
  var _a2;
16884
16912
  setIsError(false);
@@ -16906,30 +16934,30 @@ function FormModal(props) {
16906
16934
  }, [isError, id, i18n2]);
16907
16935
  const title = React.useMemo(() => {
16908
16936
  var _a2, _b2, _c2, _d2;
16909
- if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formTitle) === "string")
16910
- return (_b2 = config.formConfig) == null ? void 0 : _b2.formTitle;
16911
- if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
16912
- return (_d2 = config.formConfig) == null ? void 0 : _d2.formTitle(action);
16937
+ if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formTitle) === "string")
16938
+ return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formTitle;
16939
+ if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formTitle) === "function") {
16940
+ return (_d2 = resourceConfig.formConfig) == null ? void 0 : _d2.formTitle(action);
16913
16941
  }
16914
- const label2 = config.displayName || (config == null ? void 0 : config.kind);
16942
+ const label2 = resourceConfig.displayName || (resourceConfig == null ? void 0 : resourceConfig.kind);
16915
16943
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
16916
16944
  resource: transformResourceKindInSentence(label2, i18n2.language)
16917
16945
  });
16918
- }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
16946
+ }, [action, resourceConfig.formConfig, resourceConfig.displayName, resourceConfig == null ? void 0 : resourceConfig.kind, i18n2, id]);
16919
16947
  const desc = React.useMemo(() => {
16920
16948
  var _a2, _b2, _c2, _d2;
16921
- if (typeof ((_a2 = config.formConfig) == null ? void 0 : _a2.formDesc) === "string")
16922
- return (_b2 = config.formConfig) == null ? void 0 : _b2.formDesc;
16923
- if (typeof ((_c2 = config.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
16924
- return (_d2 = config.formConfig) == null ? void 0 : _d2.formDesc(action);
16949
+ if (typeof ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formDesc) === "string")
16950
+ return (_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.formDesc;
16951
+ if (typeof ((_c2 = resourceConfig.formConfig) == null ? void 0 : _c2.formDesc) === "function") {
16952
+ return (_d2 = resourceConfig.formConfig) == null ? void 0 : _d2.formDesc(action);
16925
16953
  }
16926
16954
  return "";
16927
- }, [action, config.formConfig]);
16955
+ }, [action, resourceConfig.formConfig]);
16928
16956
  const formEle = React.useMemo(() => {
16929
16957
  var _a2;
16930
16958
  const commonFormProps = {
16931
16959
  id,
16932
- config,
16960
+ resourceConfig,
16933
16961
  customYamlFormProps,
16934
16962
  onSaveButtonPropsChange: setSaveButtonProps,
16935
16963
  onError: () => {
@@ -16941,28 +16969,28 @@ function FormModal(props) {
16941
16969
  onSuccess == null ? void 0 : onSuccess(data2);
16942
16970
  }
16943
16971
  };
16944
- if (config.formConfig && (((_a2 = config.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in config.formConfig)) {
16972
+ if (resourceConfig.formConfig && (((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formType) === FormType.FORM || "fields" in resourceConfig.formConfig)) {
16945
16973
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(RefineFormContainer, {
16946
16974
  ...commonFormProps,
16947
16975
  ref: refineFormContainerRef,
16948
16976
  step,
16949
16977
  options,
16950
16978
  isYamlMode,
16951
- formConfig: config.formConfig
16979
+ formConfig: resourceConfig.formConfig
16952
16980
  });
16953
16981
  }
16954
16982
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(YamlFormContainer, {
16955
16983
  ...commonFormProps,
16956
- formConfig: config.formConfig
16984
+ formConfig: resourceConfig.formConfig
16957
16985
  });
16958
- }, [id, customYamlFormProps, config, isYamlMode, step, options, popModal, setSaveButtonProps, onSuccess]);
16986
+ }, [id, customYamlFormProps, resourceConfig, isYamlMode, step, options, popModal, setSaveButtonProps, onSuccess]);
16959
16987
  const steps = React.useMemo(() => {
16960
16988
  var _a2, _b2;
16961
16989
  if (isYamlMode) {
16962
16990
  return void 0;
16963
16991
  }
16964
- if (config.formConfig && "steps" in config.formConfig) {
16965
- return (_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.steps) == null ? void 0 : _b2.map((step2, index2) => ({
16992
+ if (resourceConfig.formConfig && "steps" in resourceConfig.formConfig) {
16993
+ return (_b2 = (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.steps) == null ? void 0 : _b2.map((step2, index2) => ({
16966
16994
  title: step2.title,
16967
16995
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, {
16968
16996
  children: [desc && index2 === 0 ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
@@ -16973,7 +17001,7 @@ function FormModal(props) {
16973
17001
  }));
16974
17002
  }
16975
17003
  return void 0;
16976
- }, [config.formConfig, desc, formEle, isYamlMode]);
17004
+ }, [resourceConfig.formConfig, desc, formEle, isYamlMode]);
16977
17005
  const handleStepChange = React.useCallback(async (nextStep) => {
16978
17006
  var _a2, _b2;
16979
17007
  const isNextStep = nextStep > step;
@@ -16995,8 +17023,8 @@ function FormModal(props) {
16995
17023
  className: TitleWrapperStyle,
16996
17024
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
16997
17025
  children: title
16998
- }), ((_b = config.formConfig) == null ? void 0 : _b.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
16999
- formConfig: config.formConfig,
17026
+ }), ((_b = resourceConfig.formConfig) == null ? void 0 : _b.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
17027
+ formConfig: resourceConfig.formConfig,
17000
17028
  mode,
17001
17029
  onChangeMode
17002
17030
  }) : null]
@@ -17008,9 +17036,9 @@ function FormModal(props) {
17008
17036
  onOk,
17009
17037
  okButtonProps: {
17010
17038
  ...lodashEs.omit(saveButtonProps, "onClick"),
17011
- children: (_c = config.formConfig) == null ? void 0 : _c.saveButtonText
17039
+ children: (_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText
17012
17040
  },
17013
- okText: ((_d = config.formConfig) == null ? void 0 : _d.saveButtonText) || okText,
17041
+ okText: ((_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText) || okText,
17014
17042
  destroyOnClose: true,
17015
17043
  destroyOtherStep: true,
17016
17044
  ...modalProps,
@@ -17034,7 +17062,7 @@ const RefineFormPage = (props) => {
17034
17062
  const {
17035
17063
  formResult
17036
17064
  } = useRefineForm({
17037
- config,
17065
+ resourceConfig: config,
17038
17066
  id
17039
17067
  });
17040
17068
  const action = id ? "edit" : "create";
@@ -17053,7 +17081,7 @@ const RefineFormPage = (props) => {
17053
17081
  direction: "vertical",
17054
17082
  className: "c1pvtlkp",
17055
17083
  children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(RefineFormContent, {
17056
- config,
17084
+ resourceConfig: config,
17057
17085
  formResult,
17058
17086
  resourceId: id,
17059
17087
  transformedInitValues: formResult.transformedInitValues
@@ -17066,18 +17094,18 @@ const RefineFormPage = (props) => {
17066
17094
  };
17067
17095
  function ResourceForm(props) {
17068
17096
  var _a;
17069
- const { config } = props;
17097
+ const { resourceConfig } = props;
17070
17098
  const formProps = React.useMemo(() => {
17071
17099
  var _a2, _b;
17072
17100
  return {
17073
- initialValues: getInitialValues(config),
17074
- transformInitValues: (_a2 = config.formConfig) == null ? void 0 : _a2.transformInitValues,
17075
- transformApplyValues: (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues,
17076
- config
17101
+ initialValues: getInitialValues(resourceConfig),
17102
+ transformInitValues: (_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.transformInitValues,
17103
+ transformApplyValues: (_b = resourceConfig.formConfig) == null ? void 0 : _b.transformApplyValues,
17104
+ resourceConfig
17077
17105
  };
17078
- }, [config]);
17079
- if (((_a = config.formConfig) == null ? void 0 : _a.formType) === FormType.FORM) {
17080
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(RefineFormPage, { config });
17106
+ }, [resourceConfig]);
17107
+ if (((_a = resourceConfig.formConfig) == null ? void 0 : _a.formType) === FormType.FORM) {
17108
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(RefineFormPage, { config: resourceConfig });
17081
17109
  }
17082
17110
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(YamlForm, { ...formProps });
17083
17111
  }
@@ -17090,8 +17118,8 @@ function ResourceCRUD(props) {
17090
17118
  !config.noShow ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/show`, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceShow, { config }) }) : null,
17091
17119
  // the modals would render in ModalStack
17092
17120
  ((_a = config.formConfig) == null ? void 0 : _a.formContainerType) === FormContainerType.PAGE ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
17093
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/create`, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceForm, { config }) }),
17094
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/edit`, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceForm, { config }) })
17121
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/create`, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceForm, { resourceConfig: config }) }),
17122
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(reactRouterDom.Route, { path: `${urlPrefix}/${config.name}/edit`, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceForm, { resourceConfig: config }) })
17095
17123
  ] }) : null
17096
17124
  ] }, config.name);
17097
17125
  }) });
@@ -19849,27 +19877,18 @@ function useNamespaceRefineFilter() {
19849
19877
  }
19850
19878
  const NAME_KEYWORD_PARAM = "name_keyword";
19851
19879
  function useRefineFilters(options = {}) {
19852
- const {
19853
- disableNamespaceFilter = false,
19854
- disableNameKeywordFilter = false
19855
- } = options;
19880
+ const { disableNamespaceFilter = false, disableNameKeywordFilter = false } = options;
19856
19881
  const { value: nsFilters = [] } = useNamespacesFilter();
19857
19882
  const namespaceFilters = React.useMemo(() => {
19858
- if (disableNamespaceFilter) {
19859
- return [];
19860
- }
19861
19883
  const filters2 = nsFilters.filter((filter) => filter !== ALL_NS);
19862
- if (filters2.length === 0) {
19884
+ if (disableNamespaceFilter || filters2.length === 0) {
19863
19885
  return [];
19864
19886
  }
19865
19887
  return [
19866
19888
  {
19867
- operator: "or",
19868
- value: filters2.map((filter) => ({
19869
- field: "metadata.namespace",
19870
- operator: "eq",
19871
- value: filter
19872
- }))
19889
+ field: "metadata.namespace",
19890
+ operator: "in",
19891
+ value: filters2
19873
19892
  }
19874
19893
  ];
19875
19894
  }, [nsFilters, disableNamespaceFilter]);
@@ -19888,9 +19907,7 @@ function useRefineFilters(options = {}) {
19888
19907
  ];
19889
19908
  }, [nameKeyword, disableNameKeywordFilter]);
19890
19909
  const filters = React.useMemo(
19891
- () => ({
19892
- permanent: [...namespaceFilters, ...nameKeywordFilters]
19893
- }),
19910
+ () => [...namespaceFilters, ...nameKeywordFilters],
19894
19911
  [namespaceFilters, nameKeywordFilters]
19895
19912
  );
19896
19913
  return filters;