@dovetail-v2/refine 0.1.25 → 0.1.27

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 {
@@ -11333,6 +11344,73 @@ var __publicField = (obj, key, value) => {
11333
11344
  download(`${name2}.yaml`, content);
11334
11345
  };
11335
11346
  }
11347
+ const button_1v659kh = "";
11348
+ const WarningButtonStyle = "wwyz7ti";
11349
+ const CloseButtonStyle = "c1xsou5f";
11350
+ const useFailedModal_ny0yrd = "";
11351
+ const TextStyle = "t56wb76";
11352
+ const TipStyle = "tnei7dl";
11353
+ const useFailedModal = (resource) => {
11354
+ const configs = React.useContext(ConfigsContext);
11355
+ const config = configs[resource];
11356
+ const [visible, setVisible] = React.useState(false);
11357
+ const [id, setId] = React.useState("");
11358
+ const [errorMsgs, setErrorMsgs] = React.useState([]);
11359
+ const {
11360
+ t: t2,
11361
+ i18n: i18n2
11362
+ } = useTranslation();
11363
+ const displayName = config.displayName || config.kind;
11364
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
11365
+ const modalProps = {
11366
+ className: SmallModalStyle,
11367
+ title: t2("dovetail.cant_delete_resource", {
11368
+ resource: resourceDisplayName
11369
+ }),
11370
+ showOk: false,
11371
+ cancelButtonProps: {
11372
+ className: CloseButtonStyle
11373
+ },
11374
+ cancelText: t2("dovetail.close"),
11375
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11376
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11377
+ className: cx_default(eagle.Typo.Label.l2_regular, TextStyle),
11378
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
11379
+ i18nKey: "dovetail.cant_delete_resource_with_name",
11380
+ tOptions: {
11381
+ name: id,
11382
+ resource: resourceDisplayName
11383
+ },
11384
+ shouldUnescape: true,
11385
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tag, {
11386
+ color: "gray",
11387
+ className: NameTagStyle
11388
+ })
11389
+ })
11390
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11391
+ className: cx_default(eagle.Typo.Label.l4_regular, TipStyle),
11392
+ children: errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", {
11393
+ children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", {
11394
+ children: [index2 + 1 + ". ", " ", errorMsg]
11395
+ }, errorMsg))
11396
+ }) : lodashEs.first(errorMsgs)
11397
+ })]
11398
+ }),
11399
+ onCancel() {
11400
+ setVisible(false);
11401
+ }
11402
+ };
11403
+ function openFailedModal(id2, errorMsgs2) {
11404
+ setId(id2);
11405
+ setErrorMsgs(errorMsgs2);
11406
+ setVisible(true);
11407
+ }
11408
+ return {
11409
+ modalProps,
11410
+ visible,
11411
+ openFailedModal
11412
+ };
11413
+ };
11336
11414
  function useEdit() {
11337
11415
  const { resource } = core.useParsed();
11338
11416
  const go = core.useGo();
@@ -11423,14 +11501,20 @@ var __publicField = (obj, key, value) => {
11423
11501
  const resource = useResourceResult.resource;
11424
11502
  const configs = React.useContext(ConfigsContext);
11425
11503
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
11426
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
11504
+ const { t: t2, i18n: i18n2 } = useTranslation();
11505
+ const { modalProps: failedModalProps, visible: failedModalVisible, openFailedModal } = useFailedModal((resource == null ? void 0 : resource.name) || "");
11506
+ const { modalProps: deleteModalProps, visible: deleteModalVisible, openDeleteConfirmModal, setVisible: setDeleteModalVisible } = useDeleteModal(
11427
11507
  (resource == null ? void 0 : resource.name) || "",
11428
11508
  {
11429
- deleteTip: config.deleteTip
11509
+ deleteTip: config.deleteTip,
11510
+ onError: async (error) => {
11511
+ console.log(error);
11512
+ setDeleteModalVisible(false);
11513
+ openFailedModal(record.id, getCommonErrors(await error.response.json(), i18n2));
11514
+ }
11430
11515
  }
11431
11516
  );
11432
11517
  const download2 = useDownloadYAML();
11433
- const { t: t2 } = useTranslation();
11434
11518
  const openForm = useOpenForm({ id: record.id });
11435
11519
  const isInShowPage = useResourceResult.action === "show";
11436
11520
  const { data: canEditData } = core.useCan({
@@ -11494,7 +11578,8 @@ var __publicField = (obj, key, value) => {
11494
11578
  )
11495
11579
  }
11496
11580
  ),
11497
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
11581
+ deleteModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...deleteModalProps }) : null,
11582
+ failedModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...failedModalProps }) : null
11498
11583
  ] });
11499
11584
  }
11500
11585
  var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
@@ -11594,7 +11679,7 @@ var __publicField = (obj, key, value) => {
11594
11679
  };
11595
11680
  function CreateButton(props) {
11596
11681
  var _a;
11597
- const { t: t2 } = useTranslation();
11682
+ const { t: t2, i18n: i18n2 } = useTranslation();
11598
11683
  const openForm = useOpenForm();
11599
11684
  const { resource } = core.useResource();
11600
11685
  const configs = React.useContext(ConfigsContext);
@@ -11608,7 +11693,7 @@ var __publicField = (obj, key, value) => {
11608
11693
  type: "primary",
11609
11694
  onClick: openForm,
11610
11695
  children: createButtonText || t2("dovetail.create_resource", {
11611
- resource: addSpaceBeforeLetter(label2)
11696
+ resource: transformResourceKindInSentence(label2, i18n2.language)
11612
11697
  })
11613
11698
  }
11614
11699
  );
@@ -11887,7 +11972,8 @@ var __publicField = (obj, key, value) => {
11887
11972
  const {
11888
11973
  resourceKind: resourceName,
11889
11974
  namespace: namespace2,
11890
- name: resourceId
11975
+ name: resourceId,
11976
+ uid
11891
11977
  } = props;
11892
11978
  const navigation = core.useNavigation();
11893
11979
  const go = core.useGo();
@@ -11895,7 +11981,8 @@ var __publicField = (obj, key, value) => {
11895
11981
  go({
11896
11982
  to: navigation.showUrl(resourceName, ""),
11897
11983
  query: {
11898
- id: namespace2 ? `${namespace2}/${resourceId}` : resourceId
11984
+ id: namespace2 ? `${namespace2}/${resourceId}` : resourceId,
11985
+ uid
11899
11986
  },
11900
11987
  options: {
11901
11988
  keepQuery: true
@@ -12868,7 +12955,7 @@ var __publicField = (obj, key, value) => {
12868
12955
  const { Table: TableComponent } = React.useContext(ComponentContext);
12869
12956
  const Table2 = TableComponent || Table$1;
12870
12957
  const { i18n: i18n2 } = useTranslation();
12871
- const resourceType = addSpaceBeforeLetter(displayName);
12958
+ const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
12872
12959
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12873
12960
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12874
12961
  WidgetErrorContent,
@@ -12925,6 +13012,7 @@ var __publicField = (obj, key, value) => {
12925
13012
  const WorkloadPodsTable = ({
12926
13013
  namespace: namespace2,
12927
13014
  selector,
13015
+ className,
12928
13016
  hideToolbar,
12929
13017
  filter,
12930
13018
  hideNodeColumn
@@ -12979,7 +13067,7 @@ var __publicField = (obj, key, value) => {
12979
13067
  }
12980
13068
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
12981
13069
  direction: "vertical",
12982
- className: "c1dicff8",
13070
+ className: cx_default("c1dicff8", className),
12983
13071
  children: [hideToolbar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
12984
13072
  selectedKeys,
12985
13073
  hideCreate: true
@@ -13386,7 +13474,14 @@ var __publicField = (obj, key, value) => {
13386
13474
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
13387
13475
  path: [],
13388
13476
  renderContent: (_, record) => {
13389
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, breakLine: false, clusterVip });
13477
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13478
+ ServiceOutClusterAccessComponent,
13479
+ {
13480
+ service: record,
13481
+ breakLine: false,
13482
+ clusterVip
13483
+ }
13484
+ );
13390
13485
  }
13391
13486
  });
13392
13487
  const PodSelectorField = () => ({
@@ -13557,13 +13652,14 @@ var __publicField = (obj, key, value) => {
13557
13652
  key: "pvc",
13558
13653
  path: ["pvc"],
13559
13654
  title: i18n2.t("dovetail.pvc"),
13560
- renderContent(value2, pvc2) {
13655
+ renderContent(value2, pv2) {
13561
13656
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
13562
13657
  ResourceLink,
13563
13658
  {
13564
13659
  resourceKind: "persistentvolumeclaims",
13565
- namespace: pvc2.pvcNamespace || "default",
13566
- name: value2
13660
+ namespace: pv2.pvcNamespace || "default",
13661
+ name: value2,
13662
+ uid: pv2.pvcUid
13567
13663
  }
13568
13664
  );
13569
13665
  }
@@ -19951,17 +20047,14 @@ var __publicField = (obj, key, value) => {
19951
20047
  const PageShow = (props) => {
19952
20048
  var _a;
19953
20049
  const parsed = core.useParsed();
20050
+ const msg = eagle.useMessage();
19954
20051
  const { resource } = core.useResource();
19955
20052
  const configs = React.useContext(ConfigsContext);
19956
20053
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
19957
20054
  const nav = core.useNavigation();
19958
20055
  const i18n2 = useTranslation();
19959
- const { queryResult } = core.useShow({
19960
- id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
19961
- queryOptions: {
19962
- retry: 1
19963
- },
19964
- errorNotification: () => {
20056
+ const notExistMsg = React.useMemo(
20057
+ () => {
19965
20058
  var _a2;
19966
20059
  return {
19967
20060
  key: "resource-non-exist",
@@ -19973,14 +20066,33 @@ var __publicField = (obj, key, value) => {
19973
20066
  description: "Error",
19974
20067
  type: "error"
19975
20068
  };
20069
+ },
20070
+ [config.displayName, i18n2, parsed, resource == null ? void 0 : resource.name]
20071
+ );
20072
+ const { queryResult } = core.useShow({
20073
+ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
20074
+ queryOptions: {
20075
+ retry: 1
20076
+ },
20077
+ errorNotification: () => {
20078
+ return notExistMsg;
19976
20079
  }
19977
20080
  });
19978
20081
  const { isLoading, isError } = queryResult;
19979
20082
  React.useEffect(() => {
19980
- if (isError && resource) {
20083
+ var _a2, _b, _c;
20084
+ 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);
20085
+ if ((isError || isNotExist) && resource) {
20086
+ if (isNotExist) {
20087
+ msg.open({
20088
+ content: notExistMsg.message,
20089
+ duration: 4.5,
20090
+ ...notExistMsg
20091
+ });
20092
+ }
19981
20093
  nav.list(resource);
19982
20094
  }
19983
- }, [isError, nav, resource]);
20095
+ }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
19984
20096
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
19985
20097
  };
19986
20098
  const index_az4wrx = "";
@@ -33580,6 +33692,11 @@ WARNING: This link could potentially be dangerous`)) {
33580
33692
  var _a;
33581
33693
  (_a = termInstanceRef.current) == null ? void 0 : _a.writeln(data2);
33582
33694
  }, []);
33695
+ const onClear = React.useCallback(() => {
33696
+ var _a;
33697
+ clear();
33698
+ (_a = props.onClear) == null ? void 0 : _a.call(props);
33699
+ }, [clear, props.onClear]);
33583
33700
  React.useEffect(() => {
33584
33701
  const destroy = setupTerminal();
33585
33702
  return () => {
@@ -33647,7 +33764,7 @@ WARNING: This link could potentially be dangerous`)) {
33647
33764
  operations,
33648
33765
  onSearchNext: searchNext,
33649
33766
  onSearchPre: searchPrevious,
33650
- onClear: clear,
33767
+ onClear,
33651
33768
  onDownloadLog: downloadContent,
33652
33769
  onSetFontSize: (fontSize) => {
33653
33770
  setOptions({
@@ -36213,8 +36330,6 @@ WARNING: This link could potentially be dangerous`)) {
36213
36330
  }
36214
36331
  );
36215
36332
  }
36216
- const button_1uhn9v1 = "";
36217
- const WarningButtonStyle = "wwyz7ti";
36218
36333
  var isCheckBoxInput = (element) => element.type === "checkbox";
36219
36334
  var isDateObject = (value2) => value2 instanceof Date;
36220
36335
  var isNullOrUndefined = (value2) => value2 == null;
@@ -37819,7 +37934,7 @@ WARNING: This link could potentially be dangerous`)) {
37819
37934
  config,
37820
37935
  formResult,
37821
37936
  resourceId,
37822
- errorMsg
37937
+ errorMsgs
37823
37938
  } = props;
37824
37939
  const {
37825
37940
  control,
@@ -37839,10 +37954,10 @@ WARNING: This link could potentially be dangerous`)) {
37839
37954
  for (const func of c2.validators) {
37840
37955
  const {
37841
37956
  isValid,
37842
- errorMsg: errorMsg2
37957
+ errorMsg
37843
37958
  } = func(value2, formValue);
37844
37959
  if (!isValid)
37845
- return errorMsg2;
37960
+ return errorMsg;
37846
37961
  }
37847
37962
  return true;
37848
37963
  }
@@ -37922,7 +38037,7 @@ WARNING: This link could potentially be dangerous`)) {
37922
38037
  size: 16,
37923
38038
  className: "c1xsnuvk",
37924
38039
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
37925
- errorMsgs: errorMsg ? [errorMsg] : [],
38040
+ errorMsgs: errorMsgs || [],
37926
38041
  style: {
37927
38042
  marginBottom: 16
37928
38043
  },
@@ -38569,8 +38684,8 @@ WARNING: This link could potentially be dangerous`)) {
38569
38684
  const useRefineForm = (props) => {
38570
38685
  var _a, _b, _c;
38571
38686
  const { config, id, refineProps } = props;
38572
- const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
38573
- const i18n2 = useTranslation();
38687
+ const [responseErrorMsgs, setResponseErrorMsgs] = React.useState([]);
38688
+ const { i18n: i18n2 } = useTranslation();
38574
38689
  const result = useForm({
38575
38690
  mode: "onSubmit",
38576
38691
  reValidateMode: "onChange",
@@ -38583,7 +38698,7 @@ WARNING: This link could potentially be dangerous`)) {
38583
38698
  message: i18n2.t(
38584
38699
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38585
38700
  {
38586
- kind: addSpaceBeforeLetter(config.displayName || config.kind),
38701
+ kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
38587
38702
  name: (_a2 = formValue.metadata) == null ? void 0 : _a2.name,
38588
38703
  interpolation: { escapeValue: false }
38589
38704
  }
@@ -38609,11 +38724,11 @@ WARNING: This link could potentially be dangerous`)) {
38609
38724
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
38610
38725
  (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
38611
38726
  var _a3, _b3;
38612
- setResponseErrorMsg(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || body.message);
38727
+ setResponseErrorMsgs([].concat(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || getCommonErrors(body, i18n2)));
38613
38728
  });
38614
38729
  }
38615
- }, [config.formConfig, result]);
38616
- return { formResult: result, responseErrorMsg };
38730
+ }, [config.formConfig, result, i18n2]);
38731
+ return { formResult: result, responseErrorMsgs };
38617
38732
  };
38618
38733
  const index_2ivb33 = "";
38619
38734
  const Style = "s1bsn3us";
@@ -39240,6 +39355,10 @@ WARNING: This link could potentially be dangerous`)) {
39240
39355
  const action = actionFromProps || actionFromResource;
39241
39356
  const configs = React.useContext(ConfigsContext);
39242
39357
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
39358
+ const {
39359
+ t: t2,
39360
+ i18n: i18n2
39361
+ } = useTranslation();
39243
39362
  const {
39244
39363
  formProps,
39245
39364
  saveButtonProps,
@@ -39265,7 +39384,7 @@ WARNING: This link could potentially be dangerous`)) {
39265
39384
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39266
39385
  return {
39267
39386
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39268
- kind: addSpaceBeforeLetter(displayName),
39387
+ kind: transformResourceKindInSentence(displayName, i18n2.language),
39269
39388
  name: data2 == null ? void 0 : data2.data.id,
39270
39389
  interpolation: {
39271
39390
  escapeValue: false
@@ -39282,10 +39401,6 @@ WARNING: This link could potentially be dangerous`)) {
39282
39401
  },
39283
39402
  ...useFormProps
39284
39403
  });
39285
- const {
39286
- t: t2,
39287
- i18n: i18n2
39288
- } = useTranslation();
39289
39404
  const FormWrapper = isShowLayout ? FormLayout : React.Fragment;
39290
39405
  const formWrapperProps = isShowLayout ? {
39291
39406
  saveButtonProps
@@ -39464,7 +39579,7 @@ WARNING: This link could potentially be dangerous`)) {
39464
39579
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
39465
39580
  formResult: refineFormResult.formResult,
39466
39581
  config,
39467
- errorMsg: refineFormResult.responseErrorMsg,
39582
+ errorMsgs: refineFormResult.responseErrorMsgs,
39468
39583
  resourceId: id
39469
39584
  });
39470
39585
  })();
@@ -39495,7 +39610,7 @@ WARNING: This link could potentially be dangerous`)) {
39495
39610
  }
39496
39611
  }, [pushModal]);
39497
39612
  const errorText = (() => {
39498
- if (!!refineFormResult.responseErrorMsg || isError) {
39613
+ if (!!refineFormResult.responseErrorMsgs.length || isError) {
39499
39614
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
39500
39615
  }
39501
39616
  })();
@@ -39508,7 +39623,7 @@ WARNING: This link could potentially be dangerous`)) {
39508
39623
  }
39509
39624
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39510
39625
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39511
- resource: addSpaceBeforeLetter(label2)
39626
+ resource: transformResourceKindInSentence(label2, i18n2.language)
39512
39627
  });
39513
39628
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39514
39629
  const desc = React.useMemo(() => {
@@ -40675,7 +40790,7 @@ WARNING: This link could potentially be dangerous`)) {
40675
40790
  style: {
40676
40791
  whiteSpace: "pre"
40677
40792
  },
40678
- children: [v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
40793
+ children: [v.servicePort, " > ", v.targetPort, "/", v.protocol]
40679
40794
  }),
40680
40795
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
40681
40796
  }, v.servicePort));
@@ -40791,7 +40906,8 @@ WARNING: This link could potentially be dangerous`)) {
40791
40906
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
40792
40907
  resourceKind: "persistentvolumeclaims",
40793
40908
  namespace: pv2.pvcNamespace || "default",
40794
- name: value2
40909
+ name: value2,
40910
+ uid: pv2.pvcUid
40795
40911
  });
40796
40912
  }
40797
40913
  };