@dovetail-v2/refine 0.1.26 → 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.
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-042d724d.js";
1
+ import { j as jsxRuntimeExports } from "./index-ac6b2e58.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -10,7 +10,7 @@ import React__default, { createElement, isValidElement, cloneElement, Children,
10
10
  import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useParsed, useGo, useCan, useTable, useDeleteMany, useShow, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
13
- import { Typo, Tag, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, usePopModal, Modal, usePushModal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, Tabs as Tabs$1, TabsTabPane, Row, Col, Popover, AntdTable, TableForm, getOptions, DonutChart, SegmentControl, Checkbox, DropdownMenu, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, useMessage, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
13
+ import { Typo, Tag, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, usePopModal, Modal, usePushModal, Fields, Units, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, Tabs as Tabs$1, TabsTabPane, Row, Col, Popover, AntdTable, TableForm, getOptions, DonutChart, SegmentControl, Checkbox, useMessage, DropdownMenu, SearchInput, Token, AntdSelectOptGroup, MenuItemGroup, Layout as Layout$1, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
14
14
  import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, FontSize16GrayIcon, FontSize16BlueIcon, LogCollection16GrayIcon, LogCollection16GradientBlueIcon, TrashBinDeletePermanently16GrayIcon, TrashBinDeletePermanently16BlueIcon, Loading24GradientBlueIcon, OpenTerminal16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
15
15
  import { first, get as get$3, cloneDeep, set as set$1, omit as omit$1, merge, debounce, last, isObject as isObject$4, uniq, keyBy } from "lodash-es";
16
16
  import yaml$2 from "js-yaml";
@@ -1201,9 +1201,9 @@ const edit_distribute_storage_success_toast$1 = "Successfully edited the capacit
1201
1201
  const edit_distribute_storage_failed_toast$1 = "Failed to edit the capacity allocation";
1202
1202
  const edit_node_taint$1 = "Edit taint";
1203
1203
  const edit_node_taint_success_toast$1 = "Successfully edited the taint for the node {{name}}";
1204
- const node_taint_NoSchedule$1 = "Only prevent scheduling";
1205
- const node_taint_PreferNoSchedule$1 = "Prefer no scheduling";
1206
- const node_taint_NoExecute$1 = "Prevent scheduling and evict pods";
1204
+ const node_taint_NoSchedule$1 = "NoSchedule";
1205
+ const node_taint_PreferNoSchedule$1 = "PreferNoSchedule";
1206
+ const node_taint_NoExecute$1 = "NoExecute";
1207
1207
  const taint$1 = "Taint";
1208
1208
  const change_form_mode_alert$1 = "Switching from YAML editing to form editing will discard all changes made to the YAML file.";
1209
1209
  const pvc_storage_required$1 = "Please specify the allocation.";
@@ -1235,6 +1235,9 @@ const taint_effect_NoExecute_tooltip_1$1 = "Pods without taint tolerance will be
1235
1235
  const taint_effect_NoExecute_tooltip_2$1 = "Pods with tolerance but no duration set will continue running.";
1236
1236
  const taint_effect_NoExecute_tooltip_3$1 = "Pods with tolerance and a duration set will run for the specified time and then be evicted.";
1237
1237
  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.";
1238
+ const cant_delete_resource$1 = "Unable to delete {{resource}}";
1239
+ const cant_delete_resource_with_name$1 = "The {{resource}} <0>{name}</0> cannot be deleted.";
1240
+ const close$1 = "Close";
1238
1241
  const dovetail$1 = {
1239
1242
  copy: copy$2,
1240
1243
  reset_arguments: reset_arguments$1,
@@ -1472,7 +1475,10 @@ const dovetail$1 = {
1472
1475
  taint_effect_NoExecute_tooltip_1: taint_effect_NoExecute_tooltip_1$1,
1473
1476
  taint_effect_NoExecute_tooltip_2: taint_effect_NoExecute_tooltip_2$1,
1474
1477
  taint_effect_NoExecute_tooltip_3: taint_effect_NoExecute_tooltip_3$1,
1475
- taint_effect_PreferNoSchedule_tooltip: taint_effect_PreferNoSchedule_tooltip$1
1478
+ taint_effect_PreferNoSchedule_tooltip: taint_effect_PreferNoSchedule_tooltip$1,
1479
+ cant_delete_resource: cant_delete_resource$1,
1480
+ cant_delete_resource_with_name: cant_delete_resource_with_name$1,
1481
+ close: close$1
1476
1482
  };
1477
1483
  const EN = {
1478
1484
  dovetail: dovetail$1
@@ -1710,6 +1716,9 @@ const taint_effect_NoExecute_tooltip_2 = "容忍污点但未设置容忍时长
1710
1716
  const taint_effect_NoExecute_tooltip_3 = "容忍污点并设置了容忍时长的 Pod 将按指定时间运行,时间结束后被驱逐。";
1711
1717
  const taint_effect_PreferNoSchedule_tooltip = "控制平面将尝试避免将不能容忍污点的 Pod 调度到节点上,但无法保证完全避免。";
1712
1718
  const confirm$1 = "确认";
1719
+ const cant_delete_resource = "无法删除{{resource}}";
1720
+ const cant_delete_resource_with_name = "无法删除{{resource}} <0>{{name}}</0> 。";
1721
+ const close = "关闭";
1713
1722
  const dovetail = {
1714
1723
  copy: copy$1,
1715
1724
  reset_arguments,
@@ -1946,7 +1955,10 @@ const dovetail = {
1946
1955
  taint_effect_NoExecute_tooltip_2,
1947
1956
  taint_effect_NoExecute_tooltip_3,
1948
1957
  taint_effect_PreferNoSchedule_tooltip,
1949
- confirm: confirm$1
1958
+ confirm: confirm$1,
1959
+ cant_delete_resource,
1960
+ cant_delete_resource_with_name,
1961
+ close
1950
1962
  };
1951
1963
  const ZH = {
1952
1964
  dovetail
@@ -8509,21 +8521,24 @@ const ConfigsContext = createContext({});
8509
8521
  const modal_1eijuvm = "";
8510
8522
  const FullscreenModalStyle = "fq4465w";
8511
8523
  const SmallModalStyle = "s1nc293e";
8524
+ const tag_18tv6ql = "";
8525
+ const StateTagStyle = "s82411";
8526
+ const NameTagStyle = "n9ja9cs";
8512
8527
  function shortenedImage(image2) {
8513
8528
  return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
8514
8529
  }
8515
8530
  function isFirstLetterEnglish(str) {
8516
8531
  return /^[a-zA-Z]/.test(str);
8517
8532
  }
8518
- function addSpaceBeforeLetter(str) {
8519
- return isFirstLetterEnglish(str) ? ` ${str.toLocaleLowerCase()}` : str;
8533
+ function transformResourceKindInSentence(str, language) {
8534
+ return isFirstLetterEnglish(str) ? ` ${language !== "zh-CN" ? str.toLocaleLowerCase() : str}` : str;
8520
8535
  }
8521
- const useDeleteModal_mi8he5 = "";
8522
- const TextStyle = "t1vq0ett";
8523
- const TipStyle = "t139onst";
8524
- const NameStyle$1 = "n18lzor8";
8536
+ const useDeleteModal_10guo0m = "";
8537
+ const TextStyle$1 = "t1vq0ett";
8538
+ const TipStyle$1 = "t139onst";
8525
8539
  const useDeleteModal = (resource, {
8526
- deleteTip
8540
+ deleteTip,
8541
+ onError
8527
8542
  } = {}) => {
8528
8543
  const configs = useContext(ConfigsContext);
8529
8544
  const config = configs[resource];
@@ -8535,10 +8550,11 @@ const useDeleteModal = (resource, {
8535
8550
  const navigation = useNavigation();
8536
8551
  const [id, setId] = useState("");
8537
8552
  const {
8538
- t: t2
8553
+ t: t2,
8554
+ i18n: i18n2
8539
8555
  } = useTranslation();
8540
8556
  const displayName = config.displayName || config.kind;
8541
- const resourceDisplayName = addSpaceBeforeLetter(displayName);
8557
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
8542
8558
  const modalProps = {
8543
8559
  className: SmallModalStyle,
8544
8560
  title: t2("dovetail.delete_resource", {
@@ -8552,7 +8568,7 @@ const useDeleteModal = (resource, {
8552
8568
  cancelText: t2("dovetail.cancel"),
8553
8569
  children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
8554
8570
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8555
- className: cx_default(Typo.Label.l2_regular, TextStyle),
8571
+ className: cx_default(Typo.Label.l2_regular, TextStyle$1),
8556
8572
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
8557
8573
  i18nKey: "dovetail.confirm_delete_text",
8558
8574
  tOptions: {
@@ -8562,11 +8578,11 @@ const useDeleteModal = (resource, {
8562
8578
  shouldUnescape: true,
8563
8579
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, {
8564
8580
  color: "gray",
8565
- className: NameStyle$1
8581
+ className: NameTagStyle
8566
8582
  })
8567
8583
  })
8568
8584
  }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8569
- className: cx_default(Typo.Label.l4_regular, TipStyle),
8585
+ className: cx_default(Typo.Label.l4_regular, TipStyle$1),
8570
8586
  children: deleteTip || t2("dovetail.delete_tip")
8571
8587
  })]
8572
8588
  }),
@@ -8588,17 +8604,9 @@ const useDeleteModal = (resource, {
8588
8604
  type: "success"
8589
8605
  };
8590
8606
  },
8591
- errorNotification() {
8592
- return {
8593
- message: t2("dovetail.delete_failed_toast", {
8594
- name: id,
8595
- kind: resourceDisplayName,
8596
- interpolation: {
8597
- escapeValue: false
8598
- }
8599
- }).trim(),
8600
- type: "error"
8601
- };
8607
+ errorNotification(error) {
8608
+ onError == null ? void 0 : onError(error);
8609
+ return false;
8602
8610
  }
8603
8611
  });
8604
8612
  setVisible(false);
@@ -8618,6 +8626,7 @@ const useDeleteModal = (resource, {
8618
8626
  return {
8619
8627
  modalProps,
8620
8628
  visible,
8629
+ setVisible,
8621
8630
  openDeleteConfirmModal
8622
8631
  };
8623
8632
  };
@@ -9352,7 +9361,7 @@ function FormErrorAlert(props) {
9352
9361
  {
9353
9362
  message: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9354
9363
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: title || i18n2.t(isEdit ? "dovetail.save_failed_tip" : "dovetail.create_failed_tip") }),
9355
- errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
9364
+ errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
9356
9365
  index2 + 1 + ". ",
9357
9366
  " ",
9358
9367
  errorMsg
@@ -9481,7 +9490,7 @@ function EditFieldModal(props) {
9481
9490
  popModal();
9482
9491
  }
9483
9492
  });
9484
- const close = useCallback(() => {
9493
+ const close2 = useCallback(() => {
9485
9494
  popModal();
9486
9495
  reset();
9487
9496
  }, [reset]);
@@ -9490,7 +9499,7 @@ function EditFieldModal(props) {
9490
9499
  title: title || i18n2.t("dovetail.edit"),
9491
9500
  confirmLoading: submitting,
9492
9501
  onOk: onSubmit,
9493
- onCancel: close,
9502
+ onCancel: close2,
9494
9503
  okText: i18n2.t("dovetail.save"),
9495
9504
  normal: true,
9496
9505
  destroyOnClose: true,
@@ -10937,6 +10946,10 @@ class PersistentVolumeModel extends ResourceModel {
10937
10946
  var _a;
10938
10947
  return (_a = this._rawYaml.spec.claimRef) == null ? void 0 : _a.namespace;
10939
10948
  }
10949
+ get pvcUid() {
10950
+ var _a;
10951
+ return (_a = this._rawYaml.spec.claimRef) == null ? void 0 : _a.uid;
10952
+ }
10940
10953
  get storageBytes() {
10941
10954
  return parseSi(get$3(this._rawYaml, ["spec", "capacity", "storage"]));
10942
10955
  }
@@ -11097,8 +11110,6 @@ const Tags = (props) => {
11097
11110
  children: tags
11098
11111
  });
11099
11112
  };
11100
- const tag_how7no = "";
11101
- const StateTagStyle = "s82411";
11102
11113
  function addId(arr, idKey) {
11103
11114
  return arr.map((e2) => {
11104
11115
  return {
@@ -11327,6 +11338,73 @@ function useDownloadYAML() {
11327
11338
  download(`${name2}.yaml`, content);
11328
11339
  };
11329
11340
  }
11341
+ const button_1v659kh = "";
11342
+ const WarningButtonStyle = "wwyz7ti";
11343
+ const CloseButtonStyle = "c1xsou5f";
11344
+ const useFailedModal_ny0yrd = "";
11345
+ const TextStyle = "t56wb76";
11346
+ const TipStyle = "tnei7dl";
11347
+ const useFailedModal = (resource) => {
11348
+ const configs = useContext(ConfigsContext);
11349
+ const config = configs[resource];
11350
+ const [visible, setVisible] = useState(false);
11351
+ const [id, setId] = useState("");
11352
+ const [errorMsgs, setErrorMsgs] = useState([]);
11353
+ const {
11354
+ t: t2,
11355
+ i18n: i18n2
11356
+ } = useTranslation();
11357
+ const displayName = config.displayName || config.kind;
11358
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
11359
+ const modalProps = {
11360
+ className: SmallModalStyle,
11361
+ title: t2("dovetail.cant_delete_resource", {
11362
+ resource: resourceDisplayName
11363
+ }),
11364
+ showOk: false,
11365
+ cancelButtonProps: {
11366
+ className: CloseButtonStyle
11367
+ },
11368
+ cancelText: t2("dovetail.close"),
11369
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11370
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11371
+ className: cx_default(Typo.Label.l2_regular, TextStyle),
11372
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
11373
+ i18nKey: "dovetail.cant_delete_resource_with_name",
11374
+ tOptions: {
11375
+ name: id,
11376
+ resource: resourceDisplayName
11377
+ },
11378
+ shouldUnescape: true,
11379
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, {
11380
+ color: "gray",
11381
+ className: NameTagStyle
11382
+ })
11383
+ })
11384
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11385
+ className: cx_default(Typo.Label.l4_regular, TipStyle),
11386
+ children: errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", {
11387
+ children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", {
11388
+ children: [index2 + 1 + ". ", " ", errorMsg]
11389
+ }, errorMsg))
11390
+ }) : first(errorMsgs)
11391
+ })]
11392
+ }),
11393
+ onCancel() {
11394
+ setVisible(false);
11395
+ }
11396
+ };
11397
+ function openFailedModal(id2, errorMsgs2) {
11398
+ setId(id2);
11399
+ setErrorMsgs(errorMsgs2);
11400
+ setVisible(true);
11401
+ }
11402
+ return {
11403
+ modalProps,
11404
+ visible,
11405
+ openFailedModal
11406
+ };
11407
+ };
11330
11408
  function useEdit() {
11331
11409
  const { resource } = useParsed();
11332
11410
  const go = useGo();
@@ -11417,14 +11495,20 @@ function K8sDropdown(props) {
11417
11495
  const resource = useResourceResult.resource;
11418
11496
  const configs = useContext(ConfigsContext);
11419
11497
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
11420
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
11498
+ const { t: t2, i18n: i18n2 } = useTranslation();
11499
+ const { modalProps: failedModalProps, visible: failedModalVisible, openFailedModal } = useFailedModal((resource == null ? void 0 : resource.name) || "");
11500
+ const { modalProps: deleteModalProps, visible: deleteModalVisible, openDeleteConfirmModal, setVisible: setDeleteModalVisible } = useDeleteModal(
11421
11501
  (resource == null ? void 0 : resource.name) || "",
11422
11502
  {
11423
- deleteTip: config.deleteTip
11503
+ deleteTip: config.deleteTip,
11504
+ onError: async (error) => {
11505
+ console.log(error);
11506
+ setDeleteModalVisible(false);
11507
+ openFailedModal(record.id, getCommonErrors(await error.response.json(), i18n2));
11508
+ }
11424
11509
  }
11425
11510
  );
11426
11511
  const download2 = useDownloadYAML();
11427
- const { t: t2 } = useTranslation();
11428
11512
  const openForm = useOpenForm({ id: record.id });
11429
11513
  const isInShowPage = useResourceResult.action === "show";
11430
11514
  const { data: canEditData } = useCan({
@@ -11488,7 +11572,8 @@ function K8sDropdown(props) {
11488
11572
  )
11489
11573
  }
11490
11574
  ),
11491
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...modalProps }) : null
11575
+ deleteModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...deleteModalProps }) : null,
11576
+ failedModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...failedModalProps }) : null
11492
11577
  ] });
11493
11578
  }
11494
11579
  var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
@@ -11588,7 +11673,7 @@ const useEagleTable = (params) => {
11588
11673
  };
11589
11674
  function CreateButton(props) {
11590
11675
  var _a;
11591
- const { t: t2 } = useTranslation();
11676
+ const { t: t2, i18n: i18n2 } = useTranslation();
11592
11677
  const openForm = useOpenForm();
11593
11678
  const { resource } = useResource();
11594
11679
  const configs = useContext(ConfigsContext);
@@ -11602,7 +11687,7 @@ function CreateButton(props) {
11602
11687
  type: "primary",
11603
11688
  onClick: openForm,
11604
11689
  children: createButtonText || t2("dovetail.create_resource", {
11605
- resource: addSpaceBeforeLetter(label2)
11690
+ resource: transformResourceKindInSentence(label2, i18n2.language)
11606
11691
  })
11607
11692
  }
11608
11693
  );
@@ -11881,7 +11966,8 @@ const ResourceLink = (props) => {
11881
11966
  const {
11882
11967
  resourceKind: resourceName,
11883
11968
  namespace: namespace2,
11884
- name: resourceId
11969
+ name: resourceId,
11970
+ uid
11885
11971
  } = props;
11886
11972
  const navigation = useNavigation();
11887
11973
  const go = useGo();
@@ -11889,7 +11975,8 @@ const ResourceLink = (props) => {
11889
11975
  go({
11890
11976
  to: navigation.showUrl(resourceName, ""),
11891
11977
  query: {
11892
- id: namespace2 ? `${namespace2}/${resourceId}` : resourceId
11978
+ id: namespace2 ? `${namespace2}/${resourceId}` : resourceId,
11979
+ uid
11893
11980
  },
11894
11981
  options: {
11895
11982
  keepQuery: true
@@ -12862,7 +12949,7 @@ function Table(props) {
12862
12949
  const { Table: TableComponent } = useContext(ComponentContext);
12863
12950
  const Table2 = TableComponent || Table$1;
12864
12951
  const { i18n: i18n2 } = useTranslation();
12865
- const resourceType = addSpaceBeforeLetter(displayName);
12952
+ const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
12866
12953
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12867
12954
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12868
12955
  WidgetErrorContent,
@@ -13381,7 +13468,14 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
13381
13468
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
13382
13469
  path: [],
13383
13470
  renderContent: (_, record) => {
13384
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, breakLine: false, clusterVip });
13471
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13472
+ ServiceOutClusterAccessComponent,
13473
+ {
13474
+ service: record,
13475
+ breakLine: false,
13476
+ clusterVip
13477
+ }
13478
+ );
13385
13479
  }
13386
13480
  });
13387
13481
  const PodSelectorField = () => ({
@@ -13552,13 +13646,14 @@ const PVCRefField = (i18n2) => {
13552
13646
  key: "pvc",
13553
13647
  path: ["pvc"],
13554
13648
  title: i18n2.t("dovetail.pvc"),
13555
- renderContent(value2, pvc2) {
13649
+ renderContent(value2, pv2) {
13556
13650
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
13557
13651
  ResourceLink,
13558
13652
  {
13559
13653
  resourceKind: "persistentvolumeclaims",
13560
- namespace: pvc2.pvcNamespace || "default",
13561
- name: value2
13654
+ namespace: pv2.pvcNamespace || "default",
13655
+ name: value2,
13656
+ uid: pv2.pvcUid
13562
13657
  }
13563
13658
  );
13564
13659
  }
@@ -19946,17 +20041,14 @@ const ResourceTableGroup = (resource, title) => ({
19946
20041
  const PageShow = (props) => {
19947
20042
  var _a;
19948
20043
  const parsed = useParsed();
20044
+ const msg = useMessage();
19949
20045
  const { resource } = useResource();
19950
20046
  const configs = useContext(ConfigsContext);
19951
20047
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
19952
20048
  const nav = useNavigation();
19953
20049
  const i18n2 = useTranslation();
19954
- const { queryResult } = useShow({
19955
- id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
19956
- queryOptions: {
19957
- retry: 1
19958
- },
19959
- errorNotification: () => {
20050
+ const notExistMsg = useMemo(
20051
+ () => {
19960
20052
  var _a2;
19961
20053
  return {
19962
20054
  key: "resource-non-exist",
@@ -19968,14 +20060,33 @@ const PageShow = (props) => {
19968
20060
  description: "Error",
19969
20061
  type: "error"
19970
20062
  };
20063
+ },
20064
+ [config.displayName, i18n2, parsed, resource == null ? void 0 : resource.name]
20065
+ );
20066
+ const { queryResult } = useShow({
20067
+ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
20068
+ queryOptions: {
20069
+ retry: 1
20070
+ },
20071
+ errorNotification: () => {
20072
+ return notExistMsg;
19971
20073
  }
19972
20074
  });
19973
20075
  const { isLoading, isError } = queryResult;
19974
20076
  useEffect(() => {
19975
- if (isError && resource) {
20077
+ var _a2, _b, _c;
20078
+ 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);
20079
+ if ((isError || isNotExist) && resource) {
20080
+ if (isNotExist) {
20081
+ msg.open({
20082
+ content: notExistMsg.message,
20083
+ duration: 4.5,
20084
+ ...notExistMsg
20085
+ });
20086
+ }
19976
20087
  nav.list(resource);
19977
20088
  }
19978
- }, [isError, nav, resource]);
20089
+ }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
19979
20090
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
19980
20091
  };
19981
20092
  const index_az4wrx = "";
@@ -36213,8 +36324,6 @@ function ResourceShow(props) {
36213
36324
  }
36214
36325
  );
36215
36326
  }
36216
- const button_1uhn9v1 = "";
36217
- const WarningButtonStyle = "wwyz7ti";
36218
36327
  var isCheckBoxInput = (element) => element.type === "checkbox";
36219
36328
  var isDateObject = (value2) => value2 instanceof Date;
36220
36329
  var isNullOrUndefined = (value2) => value2 == null;
@@ -37819,7 +37928,7 @@ const RefineFormContent = (props) => {
37819
37928
  config,
37820
37929
  formResult,
37821
37930
  resourceId,
37822
- errorMsg
37931
+ errorMsgs
37823
37932
  } = props;
37824
37933
  const {
37825
37934
  control,
@@ -37839,10 +37948,10 @@ const RefineFormContent = (props) => {
37839
37948
  for (const func of c2.validators) {
37840
37949
  const {
37841
37950
  isValid,
37842
- errorMsg: errorMsg2
37951
+ errorMsg
37843
37952
  } = func(value2, formValue);
37844
37953
  if (!isValid)
37845
- return errorMsg2;
37954
+ return errorMsg;
37846
37955
  }
37847
37956
  return true;
37848
37957
  }
@@ -37922,7 +38031,7 @@ const RefineFormContent = (props) => {
37922
38031
  size: 16,
37923
38032
  className: "c1xsnuvk",
37924
38033
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
37925
- errorMsgs: errorMsg ? [errorMsg] : [],
38034
+ errorMsgs: errorMsgs || [],
37926
38035
  style: {
37927
38036
  marginBottom: 16
37928
38037
  },
@@ -38569,8 +38678,8 @@ const useForm = ({
38569
38678
  const useRefineForm = (props) => {
38570
38679
  var _a, _b, _c;
38571
38680
  const { config, id, refineProps } = props;
38572
- const [responseErrorMsg, setResponseErrorMsg] = useState("");
38573
- const i18n2 = useTranslation();
38681
+ const [responseErrorMsgs, setResponseErrorMsgs] = useState([]);
38682
+ const { i18n: i18n2 } = useTranslation();
38574
38683
  const result = useForm({
38575
38684
  mode: "onSubmit",
38576
38685
  reValidateMode: "onChange",
@@ -38583,7 +38692,7 @@ const useRefineForm = (props) => {
38583
38692
  message: i18n2.t(
38584
38693
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38585
38694
  {
38586
- kind: addSpaceBeforeLetter(config.displayName || config.kind),
38695
+ kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
38587
38696
  name: (_a2 = formValue.metadata) == null ? void 0 : _a2.name,
38588
38697
  interpolation: { escapeValue: false }
38589
38698
  }
@@ -38609,11 +38718,11 @@ const useRefineForm = (props) => {
38609
38718
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
38610
38719
  (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
38611
38720
  var _a3, _b3;
38612
- setResponseErrorMsg(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || body.message);
38721
+ setResponseErrorMsgs([].concat(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || getCommonErrors(body, i18n2)));
38613
38722
  });
38614
38723
  }
38615
- }, [config.formConfig, result]);
38616
- return { formResult: result, responseErrorMsg };
38724
+ }, [config.formConfig, result, i18n2]);
38725
+ return { formResult: result, responseErrorMsgs };
38617
38726
  };
38618
38727
  const index_2ivb33 = "";
38619
38728
  const Style = "s1bsn3us";
@@ -38623,7 +38732,7 @@ const Separator = () => {
38623
38732
  });
38624
38733
  };
38625
38734
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38626
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-e2011bb6.js"));
38735
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-8907845f.js"));
38627
38736
  const YamlEditorComponent = forwardRef(
38628
38737
  function YamlEditorComponent2(props, ref) {
38629
38738
  const {
@@ -39240,6 +39349,10 @@ function YamlForm(props) {
39240
39349
  const action = actionFromProps || actionFromResource;
39241
39350
  const configs = useContext(ConfigsContext);
39242
39351
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
39352
+ const {
39353
+ t: t2,
39354
+ i18n: i18n2
39355
+ } = useTranslation();
39243
39356
  const {
39244
39357
  formProps,
39245
39358
  saveButtonProps,
@@ -39265,7 +39378,7 @@ function YamlForm(props) {
39265
39378
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39266
39379
  return {
39267
39380
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39268
- kind: addSpaceBeforeLetter(displayName),
39381
+ kind: transformResourceKindInSentence(displayName, i18n2.language),
39269
39382
  name: data2 == null ? void 0 : data2.data.id,
39270
39383
  interpolation: {
39271
39384
  escapeValue: false
@@ -39282,10 +39395,6 @@ function YamlForm(props) {
39282
39395
  },
39283
39396
  ...useFormProps
39284
39397
  });
39285
- const {
39286
- t: t2,
39287
- i18n: i18n2
39288
- } = useTranslation();
39289
39398
  const FormWrapper = isShowLayout ? FormLayout : React__default.Fragment;
39290
39399
  const formWrapperProps = isShowLayout ? {
39291
39400
  saveButtonProps
@@ -39464,7 +39573,7 @@ function FormModal(props) {
39464
39573
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
39465
39574
  formResult: refineFormResult.formResult,
39466
39575
  config,
39467
- errorMsg: refineFormResult.responseErrorMsg,
39576
+ errorMsgs: refineFormResult.responseErrorMsgs,
39468
39577
  resourceId: id
39469
39578
  });
39470
39579
  })();
@@ -39495,7 +39604,7 @@ function FormModal(props) {
39495
39604
  }
39496
39605
  }, [pushModal]);
39497
39606
  const errorText = (() => {
39498
- if (!!refineFormResult.responseErrorMsg || isError) {
39607
+ if (!!refineFormResult.responseErrorMsgs.length || isError) {
39499
39608
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
39500
39609
  }
39501
39610
  })();
@@ -39508,7 +39617,7 @@ function FormModal(props) {
39508
39617
  }
39509
39618
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39510
39619
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39511
- resource: addSpaceBeforeLetter(label2)
39620
+ resource: transformResourceKindInSentence(label2, i18n2.language)
39512
39621
  });
39513
39622
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39514
39623
  const desc = useMemo(() => {
@@ -40675,7 +40784,7 @@ const PortMappingColumnRenderer = (i18n2) => {
40675
40784
  style: {
40676
40785
  whiteSpace: "pre"
40677
40786
  },
40678
- children: [v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
40787
+ children: [v.servicePort, " > ", v.targetPort, "/", v.protocol]
40679
40788
  }),
40680
40789
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
40681
40790
  }, v.servicePort));
@@ -40791,7 +40900,8 @@ const PVCRefColumnRenderer = (i18n2) => {
40791
40900
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
40792
40901
  resourceKind: "persistentvolumeclaims",
40793
40902
  namespace: pv2.pvcNamespace || "default",
40794
- name: value2
40903
+ name: value2,
40904
+ uid: pv2.pvcUid
40795
40905
  });
40796
40906
  }
40797
40907
  };
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { bN, cC, A, aW, aY, aF, ca, bk, a1, co, cc, aQ, T, C, i, cG, aI, bp, ac, cI, ai, ap, cR, ax, cd, cb, cU, aM, bw, w, aD, bD, cT, cD, bG, D, b1, as, bJ, ar, at, a0, c9, c8, cS, bi, aU, ad, bQ, cF, cH, cm, aG, aj, s, q, cJ, I, bt, aT, t, M, be, bg, ce, cL, aL, bs, aq, ay, az, a8, aA, aX, aE, bE, bH, a9, d2, cn, cx, bM, N, a2, e, aV, a6, bP, by, bx, cK, b$, cZ, g, cY, aJ, bq, cg, L, ba, bb, bo, H, bc, J, bd, B, b5, cA, z, b4, G, b8, E, b6, F, b7, K, c0, b9, cz, aa, d0, c$, P, bm, v, ae, ah, b_, bj, cP, cO, a$, bu, c6, c5, p, aK, bl, x, bv, b0, d1, y, cq, cE, bK, bR, bS, d4, aH, R, ag, an, am, bL, ak, cQ, c2, al, cB, c7, bh, bA, au, h, Q, O, bf, ct, cw, cs, cr, cu, cv, cp, ch, ck, cl, cj, ci, cf, cy, bT, aN, br, aB, m, bW, l, aZ, cX, o, bX, a_, n, aS, bn, k, cW, aP, aR, c4, bC, bB, c3, aO, S, bF, cV, c_, b2, b3, bz, bI, c1, bY, bZ, ab, $, cN, af, W, cM, ao, aw, av, f, aC, bU, U, a3, d, d7, d6, d9, d3, a7, da, d5, d8, a5, a4, r, a, c, X, V, Y, Z, u, bO, _, bV, b } from "./index-042d724d.js";
1
+ import { bN, cC, A, aW, aY, aF, ca, bk, a1, co, cc, aQ, T, C, i, cG, aI, bp, ac, cI, ai, ap, cR, ax, cd, cb, cU, aM, bw, w, aD, bD, cT, cD, bG, D, b1, as, bJ, ar, at, a0, c9, c8, cS, bi, aU, ad, bQ, cF, cH, cm, aG, aj, s, q, cJ, I, bt, aT, t, M, be, bg, ce, cL, aL, bs, aq, ay, az, a8, aA, aX, aE, bE, bH, a9, d2, cn, cx, bM, N, a2, e, aV, a6, bP, by, bx, cK, b$, cZ, g, cY, aJ, bq, cg, L, ba, bb, bo, H, bc, J, bd, B, b5, cA, z, b4, G, b8, E, b6, F, b7, K, c0, b9, cz, aa, d0, c$, P, bm, v, ae, ah, b_, bj, cP, cO, a$, bu, c6, c5, p, aK, bl, x, bv, b0, d1, y, cq, cE, bK, bR, bS, d4, aH, R, ag, an, am, bL, ak, cQ, c2, al, cB, c7, bh, bA, au, h, Q, O, bf, ct, cw, cs, cr, cu, cv, cp, ch, ck, cl, cj, ci, cf, cy, bT, aN, br, aB, m, bW, l, aZ, cX, o, bX, a_, n, aS, bn, k, cW, aP, aR, c4, bC, bB, c3, aO, S, bF, cV, c_, b2, b3, bz, bI, c1, bY, bZ, ab, $, cN, af, W, cM, ao, aw, av, f, aC, bU, U, a3, d, d7, d6, d9, d3, a7, da, d5, d8, a5, a4, r, a, c, X, V, Y, Z, u, bO, _, bV, b } from "./index-ac6b2e58.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "react";