@dovetail-v2/refine 0.1.26 → 0.1.28

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.
@@ -1207,9 +1207,9 @@ var __publicField = (obj, key, value) => {
1207
1207
  const edit_distribute_storage_failed_toast$1 = "Failed to edit the capacity allocation";
1208
1208
  const edit_node_taint$1 = "Edit taint";
1209
1209
  const edit_node_taint_success_toast$1 = "Successfully edited the taint for the node {{name}}";
1210
- const node_taint_NoSchedule$1 = "Only prevent scheduling";
1211
- const node_taint_PreferNoSchedule$1 = "Prefer no scheduling";
1212
- const node_taint_NoExecute$1 = "Prevent scheduling and evict pods";
1210
+ const node_taint_NoSchedule$1 = "NoSchedule";
1211
+ const node_taint_PreferNoSchedule$1 = "PreferNoSchedule";
1212
+ const node_taint_NoExecute$1 = "NoExecute";
1213
1213
  const taint$1 = "Taint";
1214
1214
  const change_form_mode_alert$1 = "Switching from YAML editing to form editing will discard all changes made to the YAML file.";
1215
1215
  const pvc_storage_required$1 = "Please specify the allocation.";
@@ -1241,6 +1241,9 @@ var __publicField = (obj, key, value) => {
1241
1241
  const taint_effect_NoExecute_tooltip_2$1 = "Pods with tolerance but no duration set will continue running.";
1242
1242
  const taint_effect_NoExecute_tooltip_3$1 = "Pods with tolerance and a duration set will run for the specified time and then be evicted.";
1243
1243
  const taint_effect_PreferNoSchedule_tooltip$1 = "The control plane will try to avoid scheduling pods without taint tolerance to the node, but full avoidance isn't guaranteed.";
1244
+ const cant_delete_resource$1 = "Unable to delete {{resource}}";
1245
+ const cant_delete_resource_with_name$1 = "The {{resource}} <0>{name}</0> cannot be deleted.";
1246
+ const close$1 = "Close";
1244
1247
  const dovetail$1 = {
1245
1248
  copy: copy$2,
1246
1249
  reset_arguments: reset_arguments$1,
@@ -1478,7 +1481,10 @@ var __publicField = (obj, key, value) => {
1478
1481
  taint_effect_NoExecute_tooltip_1: taint_effect_NoExecute_tooltip_1$1,
1479
1482
  taint_effect_NoExecute_tooltip_2: taint_effect_NoExecute_tooltip_2$1,
1480
1483
  taint_effect_NoExecute_tooltip_3: taint_effect_NoExecute_tooltip_3$1,
1481
- taint_effect_PreferNoSchedule_tooltip: taint_effect_PreferNoSchedule_tooltip$1
1484
+ taint_effect_PreferNoSchedule_tooltip: taint_effect_PreferNoSchedule_tooltip$1,
1485
+ cant_delete_resource: cant_delete_resource$1,
1486
+ cant_delete_resource_with_name: cant_delete_resource_with_name$1,
1487
+ close: close$1
1482
1488
  };
1483
1489
  const EN = {
1484
1490
  dovetail: dovetail$1
@@ -1716,6 +1722,9 @@ var __publicField = (obj, key, value) => {
1716
1722
  const taint_effect_NoExecute_tooltip_3 = "容忍污点并设置了容忍时长的 Pod 将按指定时间运行,时间结束后被驱逐。";
1717
1723
  const taint_effect_PreferNoSchedule_tooltip = "控制平面将尝试避免将不能容忍污点的 Pod 调度到节点上,但无法保证完全避免。";
1718
1724
  const confirm$1 = "确认";
1725
+ const cant_delete_resource = "无法删除{{resource}}";
1726
+ const cant_delete_resource_with_name = "无法删除{{resource}} <0>{{name}}</0> 。";
1727
+ const close = "关闭";
1719
1728
  const dovetail = {
1720
1729
  copy: copy$1,
1721
1730
  reset_arguments,
@@ -1952,7 +1961,10 @@ var __publicField = (obj, key, value) => {
1952
1961
  taint_effect_NoExecute_tooltip_2,
1953
1962
  taint_effect_NoExecute_tooltip_3,
1954
1963
  taint_effect_PreferNoSchedule_tooltip,
1955
- confirm: confirm$1
1964
+ confirm: confirm$1,
1965
+ cant_delete_resource,
1966
+ cant_delete_resource_with_name,
1967
+ close
1956
1968
  };
1957
1969
  const ZH = {
1958
1970
  dovetail
@@ -8515,21 +8527,24 @@ var __publicField = (obj, key, value) => {
8515
8527
  const modal_1eijuvm = "";
8516
8528
  const FullscreenModalStyle = "fq4465w";
8517
8529
  const SmallModalStyle = "s1nc293e";
8530
+ const tag_18tv6ql = "";
8531
+ const StateTagStyle = "s82411";
8532
+ const NameTagStyle = "n9ja9cs";
8518
8533
  function shortenedImage(image2) {
8519
8534
  return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
8520
8535
  }
8521
8536
  function isFirstLetterEnglish(str) {
8522
8537
  return /^[a-zA-Z]/.test(str);
8523
8538
  }
8524
- function addSpaceBeforeLetter(str) {
8525
- return isFirstLetterEnglish(str) ? ` ${str.toLocaleLowerCase()}` : str;
8539
+ function transformResourceKindInSentence(str, language) {
8540
+ return isFirstLetterEnglish(str) ? ` ${language !== "zh-CN" ? str.toLocaleLowerCase() : str}` : str;
8526
8541
  }
8527
- const useDeleteModal_mi8he5 = "";
8528
- const TextStyle = "t1vq0ett";
8529
- const TipStyle = "t139onst";
8530
- const NameStyle$1 = "n18lzor8";
8542
+ const useDeleteModal_10guo0m = "";
8543
+ const TextStyle$1 = "t1vq0ett";
8544
+ const TipStyle$1 = "t139onst";
8531
8545
  const useDeleteModal = (resource, {
8532
- deleteTip
8546
+ deleteTip,
8547
+ onError
8533
8548
  } = {}) => {
8534
8549
  const configs = React.useContext(ConfigsContext);
8535
8550
  const config = configs[resource];
@@ -8541,10 +8556,11 @@ var __publicField = (obj, key, value) => {
8541
8556
  const navigation = core.useNavigation();
8542
8557
  const [id, setId] = React.useState("");
8543
8558
  const {
8544
- t: t2
8559
+ t: t2,
8560
+ i18n: i18n2
8545
8561
  } = useTranslation();
8546
8562
  const displayName = config.displayName || config.kind;
8547
- const resourceDisplayName = addSpaceBeforeLetter(displayName);
8563
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
8548
8564
  const modalProps = {
8549
8565
  className: SmallModalStyle,
8550
8566
  title: t2("dovetail.delete_resource", {
@@ -8558,7 +8574,7 @@ var __publicField = (obj, key, value) => {
8558
8574
  cancelText: t2("dovetail.cancel"),
8559
8575
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
8560
8576
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8561
- className: cx_default(eagle.Typo.Label.l2_regular, TextStyle),
8577
+ className: cx_default(eagle.Typo.Label.l2_regular, TextStyle$1),
8562
8578
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
8563
8579
  i18nKey: "dovetail.confirm_delete_text",
8564
8580
  tOptions: {
@@ -8568,11 +8584,11 @@ var __publicField = (obj, key, value) => {
8568
8584
  shouldUnescape: true,
8569
8585
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tag, {
8570
8586
  color: "gray",
8571
- className: NameStyle$1
8587
+ className: NameTagStyle
8572
8588
  })
8573
8589
  })
8574
8590
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8575
- className: cx_default(eagle.Typo.Label.l4_regular, TipStyle),
8591
+ className: cx_default(eagle.Typo.Label.l4_regular, TipStyle$1),
8576
8592
  children: deleteTip || t2("dovetail.delete_tip")
8577
8593
  })]
8578
8594
  }),
@@ -8594,17 +8610,9 @@ var __publicField = (obj, key, value) => {
8594
8610
  type: "success"
8595
8611
  };
8596
8612
  },
8597
- errorNotification() {
8598
- return {
8599
- message: t2("dovetail.delete_failed_toast", {
8600
- name: id,
8601
- kind: resourceDisplayName,
8602
- interpolation: {
8603
- escapeValue: false
8604
- }
8605
- }).trim(),
8606
- type: "error"
8607
- };
8613
+ errorNotification(error) {
8614
+ onError == null ? void 0 : onError(error);
8615
+ return false;
8608
8616
  }
8609
8617
  });
8610
8618
  setVisible(false);
@@ -8624,6 +8632,7 @@ var __publicField = (obj, key, value) => {
8624
8632
  return {
8625
8633
  modalProps,
8626
8634
  visible,
8635
+ setVisible,
8627
8636
  openDeleteConfirmModal
8628
8637
  };
8629
8638
  };
@@ -9358,7 +9367,7 @@ var __publicField = (obj, key, value) => {
9358
9367
  {
9359
9368
  message: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9360
9369
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: title || i18n2.t(isEdit ? "dovetail.save_failed_tip" : "dovetail.create_failed_tip") }),
9361
- errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
9370
+ errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
9362
9371
  index2 + 1 + ". ",
9363
9372
  " ",
9364
9373
  errorMsg
@@ -9487,7 +9496,7 @@ var __publicField = (obj, key, value) => {
9487
9496
  popModal();
9488
9497
  }
9489
9498
  });
9490
- const close = React.useCallback(() => {
9499
+ const close2 = React.useCallback(() => {
9491
9500
  popModal();
9492
9501
  reset();
9493
9502
  }, [reset]);
@@ -9496,7 +9505,7 @@ var __publicField = (obj, key, value) => {
9496
9505
  title: title || i18n2.t("dovetail.edit"),
9497
9506
  confirmLoading: submitting,
9498
9507
  onOk: onSubmit,
9499
- onCancel: close,
9508
+ onCancel: close2,
9500
9509
  okText: i18n2.t("dovetail.save"),
9501
9510
  normal: true,
9502
9511
  destroyOnClose: true,
@@ -10943,6 +10952,10 @@ var __publicField = (obj, key, value) => {
10943
10952
  var _a;
10944
10953
  return (_a = this._rawYaml.spec.claimRef) == null ? void 0 : _a.namespace;
10945
10954
  }
10955
+ get pvcUid() {
10956
+ var _a;
10957
+ return (_a = this._rawYaml.spec.claimRef) == null ? void 0 : _a.uid;
10958
+ }
10946
10959
  get storageBytes() {
10947
10960
  return parseSi(lodashEs.get(this._rawYaml, ["spec", "capacity", "storage"]));
10948
10961
  }
@@ -11103,8 +11116,6 @@ var __publicField = (obj, key, value) => {
11103
11116
  children: tags
11104
11117
  });
11105
11118
  };
11106
- const tag_how7no = "";
11107
- const StateTagStyle = "s82411";
11108
11119
  function addId(arr, idKey) {
11109
11120
  return arr.map((e2) => {
11110
11121
  return {
@@ -11238,16 +11249,11 @@ var __publicField = (obj, key, value) => {
11238
11249
  display: true,
11239
11250
  dataIndex: "status",
11240
11251
  title: t2("dovetail.state"),
11241
- render(value2) {
11242
- const colorMap = {
11243
- "True": "green",
11244
- "False": "red",
11245
- "Unknown": "warning"
11246
- };
11247
- return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.StatusCapsule, { color: colorMap[value2 || "Unknown"], className: cx_default(StateTagStyle, "no-background"), children: t2(`dovetail.${value2.toLowerCase()}`) });
11248
- },
11249
11252
  width: 120,
11250
- sortable: true
11253
+ sortable: true,
11254
+ render: (value2) => {
11255
+ return value2;
11256
+ }
11251
11257
  },
11252
11258
  {
11253
11259
  key: "lastTransitionTime",
@@ -11333,6 +11339,73 @@ var __publicField = (obj, key, value) => {
11333
11339
  download(`${name2}.yaml`, content);
11334
11340
  };
11335
11341
  }
11342
+ const button_1v659kh = "";
11343
+ const WarningButtonStyle = "wwyz7ti";
11344
+ const CloseButtonStyle = "c1xsou5f";
11345
+ const useFailedModal_ny0yrd = "";
11346
+ const TextStyle = "t56wb76";
11347
+ const TipStyle = "tnei7dl";
11348
+ const useFailedModal = (resource) => {
11349
+ const configs = React.useContext(ConfigsContext);
11350
+ const config = configs[resource];
11351
+ const [visible, setVisible] = React.useState(false);
11352
+ const [id, setId] = React.useState("");
11353
+ const [errorMsgs, setErrorMsgs] = React.useState([]);
11354
+ const {
11355
+ t: t2,
11356
+ i18n: i18n2
11357
+ } = useTranslation();
11358
+ const displayName = config.displayName || config.kind;
11359
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
11360
+ const modalProps = {
11361
+ className: SmallModalStyle,
11362
+ title: t2("dovetail.cant_delete_resource", {
11363
+ resource: resourceDisplayName
11364
+ }),
11365
+ showOk: false,
11366
+ cancelButtonProps: {
11367
+ className: CloseButtonStyle
11368
+ },
11369
+ cancelText: t2("dovetail.close"),
11370
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11371
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11372
+ className: cx_default(eagle.Typo.Label.l2_regular, TextStyle),
11373
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
11374
+ i18nKey: "dovetail.cant_delete_resource_with_name",
11375
+ tOptions: {
11376
+ name: id,
11377
+ resource: resourceDisplayName
11378
+ },
11379
+ shouldUnescape: true,
11380
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tag, {
11381
+ color: "gray",
11382
+ className: NameTagStyle
11383
+ })
11384
+ })
11385
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11386
+ className: cx_default(eagle.Typo.Label.l4_regular, TipStyle),
11387
+ children: errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", {
11388
+ children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", {
11389
+ children: [index2 + 1 + ". ", " ", errorMsg]
11390
+ }, errorMsg))
11391
+ }) : lodashEs.first(errorMsgs)
11392
+ })]
11393
+ }),
11394
+ onCancel() {
11395
+ setVisible(false);
11396
+ }
11397
+ };
11398
+ function openFailedModal(id2, errorMsgs2) {
11399
+ setId(id2);
11400
+ setErrorMsgs(errorMsgs2);
11401
+ setVisible(true);
11402
+ }
11403
+ return {
11404
+ modalProps,
11405
+ visible,
11406
+ openFailedModal
11407
+ };
11408
+ };
11336
11409
  function useEdit() {
11337
11410
  const { resource } = core.useParsed();
11338
11411
  const go = core.useGo();
@@ -11423,14 +11496,20 @@ var __publicField = (obj, key, value) => {
11423
11496
  const resource = useResourceResult.resource;
11424
11497
  const configs = React.useContext(ConfigsContext);
11425
11498
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
11426
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
11499
+ const { t: t2, i18n: i18n2 } = useTranslation();
11500
+ const { modalProps: failedModalProps, visible: failedModalVisible, openFailedModal } = useFailedModal((resource == null ? void 0 : resource.name) || "");
11501
+ const { modalProps: deleteModalProps, visible: deleteModalVisible, openDeleteConfirmModal, setVisible: setDeleteModalVisible } = useDeleteModal(
11427
11502
  (resource == null ? void 0 : resource.name) || "",
11428
11503
  {
11429
- deleteTip: config.deleteTip
11504
+ deleteTip: config.deleteTip,
11505
+ onError: async (error) => {
11506
+ console.log(error);
11507
+ setDeleteModalVisible(false);
11508
+ openFailedModal(record.id, getCommonErrors(await error.response.json(), i18n2));
11509
+ }
11430
11510
  }
11431
11511
  );
11432
11512
  const download2 = useDownloadYAML();
11433
- const { t: t2 } = useTranslation();
11434
11513
  const openForm = useOpenForm({ id: record.id });
11435
11514
  const isInShowPage = useResourceResult.action === "show";
11436
11515
  const { data: canEditData } = core.useCan({
@@ -11494,7 +11573,8 @@ var __publicField = (obj, key, value) => {
11494
11573
  )
11495
11574
  }
11496
11575
  ),
11497
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
11576
+ deleteModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...deleteModalProps }) : null,
11577
+ failedModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...failedModalProps }) : null
11498
11578
  ] });
11499
11579
  }
11500
11580
  var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
@@ -11594,7 +11674,7 @@ var __publicField = (obj, key, value) => {
11594
11674
  };
11595
11675
  function CreateButton(props) {
11596
11676
  var _a;
11597
- const { t: t2 } = useTranslation();
11677
+ const { t: t2, i18n: i18n2 } = useTranslation();
11598
11678
  const openForm = useOpenForm();
11599
11679
  const { resource } = core.useResource();
11600
11680
  const configs = React.useContext(ConfigsContext);
@@ -11608,7 +11688,7 @@ var __publicField = (obj, key, value) => {
11608
11688
  type: "primary",
11609
11689
  onClick: openForm,
11610
11690
  children: createButtonText || t2("dovetail.create_resource", {
11611
- resource: addSpaceBeforeLetter(label2)
11691
+ resource: transformResourceKindInSentence(label2, i18n2.language)
11612
11692
  })
11613
11693
  }
11614
11694
  );
@@ -11887,7 +11967,8 @@ var __publicField = (obj, key, value) => {
11887
11967
  const {
11888
11968
  resourceKind: resourceName,
11889
11969
  namespace: namespace2,
11890
- name: resourceId
11970
+ name: resourceId,
11971
+ uid
11891
11972
  } = props;
11892
11973
  const navigation = core.useNavigation();
11893
11974
  const go = core.useGo();
@@ -11895,7 +11976,8 @@ var __publicField = (obj, key, value) => {
11895
11976
  go({
11896
11977
  to: navigation.showUrl(resourceName, ""),
11897
11978
  query: {
11898
- id: namespace2 ? `${namespace2}/${resourceId}` : resourceId
11979
+ id: namespace2 ? `${namespace2}/${resourceId}` : resourceId,
11980
+ uid
11899
11981
  },
11900
11982
  options: {
11901
11983
  keepQuery: true
@@ -12783,8 +12865,6 @@ var __publicField = (obj, key, value) => {
12783
12865
  const {
12784
12866
  t: t2
12785
12867
  } = useTranslation();
12786
- const component = React.useContext(ComponentContext);
12787
- const Table2 = component.Table || Table$1;
12788
12868
  const taintsWithId = addId(taints, "key");
12789
12869
  const columns = [{
12790
12870
  key: "key",
@@ -12838,7 +12918,7 @@ var __publicField = (obj, key, value) => {
12838
12918
  type: ErrorContentType.Card
12839
12919
  });
12840
12920
  }
12841
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Table2, {
12921
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
12842
12922
  tableKey: "condition",
12843
12923
  loading: false,
12844
12924
  data: finalData,
@@ -12868,7 +12948,7 @@ var __publicField = (obj, key, value) => {
12868
12948
  const { Table: TableComponent } = React.useContext(ComponentContext);
12869
12949
  const Table2 = TableComponent || Table$1;
12870
12950
  const { i18n: i18n2 } = useTranslation();
12871
- const resourceType = addSpaceBeforeLetter(displayName);
12951
+ const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
12872
12952
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12873
12953
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12874
12954
  WidgetErrorContent,
@@ -13387,7 +13467,14 @@ var __publicField = (obj, key, value) => {
13387
13467
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
13388
13468
  path: [],
13389
13469
  renderContent: (_, record) => {
13390
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, breakLine: false, clusterVip });
13470
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13471
+ ServiceOutClusterAccessComponent,
13472
+ {
13473
+ service: record,
13474
+ breakLine: false,
13475
+ clusterVip
13476
+ }
13477
+ );
13391
13478
  }
13392
13479
  });
13393
13480
  const PodSelectorField = () => ({
@@ -13558,13 +13645,14 @@ var __publicField = (obj, key, value) => {
13558
13645
  key: "pvc",
13559
13646
  path: ["pvc"],
13560
13647
  title: i18n2.t("dovetail.pvc"),
13561
- renderContent(value2, pvc2) {
13648
+ renderContent(value2, pv2) {
13562
13649
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
13563
13650
  ResourceLink,
13564
13651
  {
13565
13652
  resourceKind: "persistentvolumeclaims",
13566
- namespace: pvc2.pvcNamespace || "default",
13567
- name: value2
13653
+ namespace: pv2.pvcNamespace || "default",
13654
+ name: value2,
13655
+ uid: pv2.pvcUid
13568
13656
  }
13569
13657
  );
13570
13658
  }
@@ -19952,17 +20040,14 @@ var __publicField = (obj, key, value) => {
19952
20040
  const PageShow = (props) => {
19953
20041
  var _a;
19954
20042
  const parsed = core.useParsed();
20043
+ const msg = eagle.useMessage();
19955
20044
  const { resource } = core.useResource();
19956
20045
  const configs = React.useContext(ConfigsContext);
19957
20046
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
19958
20047
  const nav = core.useNavigation();
19959
20048
  const i18n2 = useTranslation();
19960
- const { queryResult } = core.useShow({
19961
- id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
19962
- queryOptions: {
19963
- retry: 1
19964
- },
19965
- errorNotification: () => {
20049
+ const notExistMsg = React.useMemo(
20050
+ () => {
19966
20051
  var _a2;
19967
20052
  return {
19968
20053
  key: "resource-non-exist",
@@ -19974,14 +20059,33 @@ var __publicField = (obj, key, value) => {
19974
20059
  description: "Error",
19975
20060
  type: "error"
19976
20061
  };
20062
+ },
20063
+ [config.displayName, i18n2, parsed, resource == null ? void 0 : resource.name]
20064
+ );
20065
+ const { queryResult } = core.useShow({
20066
+ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
20067
+ queryOptions: {
20068
+ retry: 1
20069
+ },
20070
+ errorNotification: () => {
20071
+ return notExistMsg;
19977
20072
  }
19978
20073
  });
19979
20074
  const { isLoading, isError } = queryResult;
19980
20075
  React.useEffect(() => {
19981
- if (isError && resource) {
20076
+ var _a2, _b, _c;
20077
+ const isNotExist = !isLoading && ((_a2 = parsed.params) == null ? void 0 : _a2.uid) !== void 0 && ((_b = parsed.params) == null ? void 0 : _b.uid) !== ((_c = queryResult.data) == null ? void 0 : _c.data.metadata.uid);
20078
+ if ((isError || isNotExist) && resource) {
20079
+ if (isNotExist) {
20080
+ msg.open({
20081
+ content: notExistMsg.message,
20082
+ duration: 4.5,
20083
+ ...notExistMsg
20084
+ });
20085
+ }
19982
20086
  nav.list(resource);
19983
20087
  }
19984
- }, [isError, nav, resource]);
20088
+ }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
19985
20089
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
19986
20090
  };
19987
20091
  const index_az4wrx = "";
@@ -36219,8 +36323,6 @@ WARNING: This link could potentially be dangerous`)) {
36219
36323
  }
36220
36324
  );
36221
36325
  }
36222
- const button_1uhn9v1 = "";
36223
- const WarningButtonStyle = "wwyz7ti";
36224
36326
  var isCheckBoxInput = (element) => element.type === "checkbox";
36225
36327
  var isDateObject = (value2) => value2 instanceof Date;
36226
36328
  var isNullOrUndefined = (value2) => value2 == null;
@@ -37825,7 +37927,7 @@ WARNING: This link could potentially be dangerous`)) {
37825
37927
  config,
37826
37928
  formResult,
37827
37929
  resourceId,
37828
- errorMsg
37930
+ errorMsgs
37829
37931
  } = props;
37830
37932
  const {
37831
37933
  control,
@@ -37845,10 +37947,10 @@ WARNING: This link could potentially be dangerous`)) {
37845
37947
  for (const func of c2.validators) {
37846
37948
  const {
37847
37949
  isValid,
37848
- errorMsg: errorMsg2
37950
+ errorMsg
37849
37951
  } = func(value2, formValue);
37850
37952
  if (!isValid)
37851
- return errorMsg2;
37953
+ return errorMsg;
37852
37954
  }
37853
37955
  return true;
37854
37956
  }
@@ -37928,7 +38030,7 @@ WARNING: This link could potentially be dangerous`)) {
37928
38030
  size: 16,
37929
38031
  className: "c1xsnuvk",
37930
38032
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
37931
- errorMsgs: errorMsg ? [errorMsg] : [],
38033
+ errorMsgs: errorMsgs || [],
37932
38034
  style: {
37933
38035
  marginBottom: 16
37934
38036
  },
@@ -38575,10 +38677,10 @@ WARNING: This link could potentially be dangerous`)) {
38575
38677
  const useRefineForm = (props) => {
38576
38678
  var _a, _b, _c;
38577
38679
  const { config, id, refineProps } = props;
38578
- const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
38579
- const i18n2 = useTranslation();
38680
+ const [responseErrorMsgs, setResponseErrorMsgs] = React.useState([]);
38681
+ const { i18n: i18n2 } = useTranslation();
38580
38682
  const result = useForm({
38581
- mode: "onSubmit",
38683
+ mode: "onTouched",
38582
38684
  reValidateMode: "onChange",
38583
38685
  refineCoreProps: {
38584
38686
  errorNotification: false,
@@ -38589,7 +38691,7 @@ WARNING: This link could potentially be dangerous`)) {
38589
38691
  message: i18n2.t(
38590
38692
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38591
38693
  {
38592
- kind: addSpaceBeforeLetter(config.displayName || config.kind),
38694
+ kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
38593
38695
  name: (_a2 = formValue.metadata) == null ? void 0 : _a2.name,
38594
38696
  interpolation: { escapeValue: false }
38595
38697
  }
@@ -38615,11 +38717,11 @@ WARNING: This link could potentially be dangerous`)) {
38615
38717
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
38616
38718
  (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
38617
38719
  var _a3, _b3;
38618
- setResponseErrorMsg(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || body.message);
38720
+ setResponseErrorMsgs([].concat(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || getCommonErrors(body, i18n2)));
38619
38721
  });
38620
38722
  }
38621
- }, [config.formConfig, result]);
38622
- return { formResult: result, responseErrorMsg };
38723
+ }, [config.formConfig, result, i18n2]);
38724
+ return { formResult: result, responseErrorMsgs };
38623
38725
  };
38624
38726
  const index_2ivb33 = "";
38625
38727
  const Style = "s1bsn3us";
@@ -39246,6 +39348,10 @@ WARNING: This link could potentially be dangerous`)) {
39246
39348
  const action = actionFromProps || actionFromResource;
39247
39349
  const configs = React.useContext(ConfigsContext);
39248
39350
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
39351
+ const {
39352
+ t: t2,
39353
+ i18n: i18n2
39354
+ } = useTranslation();
39249
39355
  const {
39250
39356
  formProps,
39251
39357
  saveButtonProps,
@@ -39271,7 +39377,7 @@ WARNING: This link could potentially be dangerous`)) {
39271
39377
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39272
39378
  return {
39273
39379
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39274
- kind: addSpaceBeforeLetter(displayName),
39380
+ kind: transformResourceKindInSentence(displayName, i18n2.language),
39275
39381
  name: data2 == null ? void 0 : data2.data.id,
39276
39382
  interpolation: {
39277
39383
  escapeValue: false
@@ -39288,10 +39394,6 @@ WARNING: This link could potentially be dangerous`)) {
39288
39394
  },
39289
39395
  ...useFormProps
39290
39396
  });
39291
- const {
39292
- t: t2,
39293
- i18n: i18n2
39294
- } = useTranslation();
39295
39397
  const FormWrapper = isShowLayout ? FormLayout : React.Fragment;
39296
39398
  const formWrapperProps = isShowLayout ? {
39297
39399
  saveButtonProps
@@ -39470,7 +39572,7 @@ WARNING: This link could potentially be dangerous`)) {
39470
39572
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
39471
39573
  formResult: refineFormResult.formResult,
39472
39574
  config,
39473
- errorMsg: refineFormResult.responseErrorMsg,
39575
+ errorMsgs: refineFormResult.responseErrorMsgs,
39474
39576
  resourceId: id
39475
39577
  });
39476
39578
  })();
@@ -39501,7 +39603,7 @@ WARNING: This link could potentially be dangerous`)) {
39501
39603
  }
39502
39604
  }, [pushModal]);
39503
39605
  const errorText = (() => {
39504
- if (!!refineFormResult.responseErrorMsg || isError) {
39606
+ if (!!refineFormResult.responseErrorMsgs.length || isError) {
39505
39607
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
39506
39608
  }
39507
39609
  })();
@@ -39514,7 +39616,7 @@ WARNING: This link could potentially be dangerous`)) {
39514
39616
  }
39515
39617
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39516
39618
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39517
- resource: addSpaceBeforeLetter(label2)
39619
+ resource: transformResourceKindInSentence(label2, i18n2.language)
39518
39620
  });
39519
39621
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39520
39622
  const desc = React.useMemo(() => {
@@ -40681,7 +40783,7 @@ WARNING: This link could potentially be dangerous`)) {
40681
40783
  style: {
40682
40784
  whiteSpace: "pre"
40683
40785
  },
40684
- children: [v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
40786
+ children: [v.servicePort, " > ", v.targetPort, "/", v.protocol]
40685
40787
  }),
40686
40788
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
40687
40789
  }, v.servicePort));
@@ -40797,7 +40899,8 @@ WARNING: This link could potentially be dangerous`)) {
40797
40899
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
40798
40900
  resourceKind: "persistentvolumeclaims",
40799
40901
  namespace: pv2.pvcNamespace || "default",
40800
- name: value2
40902
+ name: value2,
40903
+ uid: pv2.pvcUid
40801
40904
  });
40802
40905
  }
40803
40906
  };