@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.
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-042d724d.js";
1
+ import { j as jsxRuntimeExports } from "./index-ba328da4.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, Dropdown, Menu as Menu$1, Icon as Icon$1, Divider, StatusCapsule, 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 {
@@ -11232,16 +11243,11 @@ const ConditionsTable = ({ conditions = [] }) => {
11232
11243
  display: true,
11233
11244
  dataIndex: "status",
11234
11245
  title: t2("dovetail.state"),
11235
- render(value2) {
11236
- const colorMap = {
11237
- "True": "green",
11238
- "False": "red",
11239
- "Unknown": "warning"
11240
- };
11241
- return /* @__PURE__ */ jsxRuntimeExports.jsx(StatusCapsule, { color: colorMap[value2 || "Unknown"], className: cx_default(StateTagStyle, "no-background"), children: t2(`dovetail.${value2.toLowerCase()}`) });
11242
- },
11243
11246
  width: 120,
11244
- sortable: true
11247
+ sortable: true,
11248
+ render: (value2) => {
11249
+ return value2;
11250
+ }
11245
11251
  },
11246
11252
  {
11247
11253
  key: "lastTransitionTime",
@@ -11327,6 +11333,73 @@ function useDownloadYAML() {
11327
11333
  download(`${name2}.yaml`, content);
11328
11334
  };
11329
11335
  }
11336
+ const button_1v659kh = "";
11337
+ const WarningButtonStyle = "wwyz7ti";
11338
+ const CloseButtonStyle = "c1xsou5f";
11339
+ const useFailedModal_ny0yrd = "";
11340
+ const TextStyle = "t56wb76";
11341
+ const TipStyle = "tnei7dl";
11342
+ const useFailedModal = (resource) => {
11343
+ const configs = useContext(ConfigsContext);
11344
+ const config = configs[resource];
11345
+ const [visible, setVisible] = useState(false);
11346
+ const [id, setId] = useState("");
11347
+ const [errorMsgs, setErrorMsgs] = useState([]);
11348
+ const {
11349
+ t: t2,
11350
+ i18n: i18n2
11351
+ } = useTranslation();
11352
+ const displayName = config.displayName || config.kind;
11353
+ const resourceDisplayName = transformResourceKindInSentence(displayName, i18n2.language);
11354
+ const modalProps = {
11355
+ className: SmallModalStyle,
11356
+ title: t2("dovetail.cant_delete_resource", {
11357
+ resource: resourceDisplayName
11358
+ }),
11359
+ showOk: false,
11360
+ cancelButtonProps: {
11361
+ className: CloseButtonStyle
11362
+ },
11363
+ cancelText: t2("dovetail.close"),
11364
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
11365
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11366
+ className: cx_default(Typo.Label.l2_regular, TextStyle),
11367
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Trans, {
11368
+ i18nKey: "dovetail.cant_delete_resource_with_name",
11369
+ tOptions: {
11370
+ name: id,
11371
+ resource: resourceDisplayName
11372
+ },
11373
+ shouldUnescape: true,
11374
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, {
11375
+ color: "gray",
11376
+ className: NameTagStyle
11377
+ })
11378
+ })
11379
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11380
+ className: cx_default(Typo.Label.l4_regular, TipStyle),
11381
+ children: errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ol", {
11382
+ children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", {
11383
+ children: [index2 + 1 + ". ", " ", errorMsg]
11384
+ }, errorMsg))
11385
+ }) : first(errorMsgs)
11386
+ })]
11387
+ }),
11388
+ onCancel() {
11389
+ setVisible(false);
11390
+ }
11391
+ };
11392
+ function openFailedModal(id2, errorMsgs2) {
11393
+ setId(id2);
11394
+ setErrorMsgs(errorMsgs2);
11395
+ setVisible(true);
11396
+ }
11397
+ return {
11398
+ modalProps,
11399
+ visible,
11400
+ openFailedModal
11401
+ };
11402
+ };
11330
11403
  function useEdit() {
11331
11404
  const { resource } = useParsed();
11332
11405
  const go = useGo();
@@ -11417,14 +11490,20 @@ function K8sDropdown(props) {
11417
11490
  const resource = useResourceResult.resource;
11418
11491
  const configs = useContext(ConfigsContext);
11419
11492
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
11420
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
11493
+ const { t: t2, i18n: i18n2 } = useTranslation();
11494
+ const { modalProps: failedModalProps, visible: failedModalVisible, openFailedModal } = useFailedModal((resource == null ? void 0 : resource.name) || "");
11495
+ const { modalProps: deleteModalProps, visible: deleteModalVisible, openDeleteConfirmModal, setVisible: setDeleteModalVisible } = useDeleteModal(
11421
11496
  (resource == null ? void 0 : resource.name) || "",
11422
11497
  {
11423
- deleteTip: config.deleteTip
11498
+ deleteTip: config.deleteTip,
11499
+ onError: async (error) => {
11500
+ console.log(error);
11501
+ setDeleteModalVisible(false);
11502
+ openFailedModal(record.id, getCommonErrors(await error.response.json(), i18n2));
11503
+ }
11424
11504
  }
11425
11505
  );
11426
11506
  const download2 = useDownloadYAML();
11427
- const { t: t2 } = useTranslation();
11428
11507
  const openForm = useOpenForm({ id: record.id });
11429
11508
  const isInShowPage = useResourceResult.action === "show";
11430
11509
  const { data: canEditData } = useCan({
@@ -11488,7 +11567,8 @@ function K8sDropdown(props) {
11488
11567
  )
11489
11568
  }
11490
11569
  ),
11491
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...modalProps }) : null
11570
+ deleteModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...deleteModalProps }) : null,
11571
+ failedModalVisible ? /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { ...failedModalProps }) : null
11492
11572
  ] });
11493
11573
  }
11494
11574
  var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
@@ -11588,7 +11668,7 @@ const useEagleTable = (params) => {
11588
11668
  };
11589
11669
  function CreateButton(props) {
11590
11670
  var _a;
11591
- const { t: t2 } = useTranslation();
11671
+ const { t: t2, i18n: i18n2 } = useTranslation();
11592
11672
  const openForm = useOpenForm();
11593
11673
  const { resource } = useResource();
11594
11674
  const configs = useContext(ConfigsContext);
@@ -11602,7 +11682,7 @@ function CreateButton(props) {
11602
11682
  type: "primary",
11603
11683
  onClick: openForm,
11604
11684
  children: createButtonText || t2("dovetail.create_resource", {
11605
- resource: addSpaceBeforeLetter(label2)
11685
+ resource: transformResourceKindInSentence(label2, i18n2.language)
11606
11686
  })
11607
11687
  }
11608
11688
  );
@@ -11881,7 +11961,8 @@ const ResourceLink = (props) => {
11881
11961
  const {
11882
11962
  resourceKind: resourceName,
11883
11963
  namespace: namespace2,
11884
- name: resourceId
11964
+ name: resourceId,
11965
+ uid
11885
11966
  } = props;
11886
11967
  const navigation = useNavigation();
11887
11968
  const go = useGo();
@@ -11889,7 +11970,8 @@ const ResourceLink = (props) => {
11889
11970
  go({
11890
11971
  to: navigation.showUrl(resourceName, ""),
11891
11972
  query: {
11892
- id: namespace2 ? `${namespace2}/${resourceId}` : resourceId
11973
+ id: namespace2 ? `${namespace2}/${resourceId}` : resourceId,
11974
+ uid
11893
11975
  },
11894
11976
  options: {
11895
11977
  keepQuery: true
@@ -12777,8 +12859,6 @@ const NodeTaintsTable = ({
12777
12859
  const {
12778
12860
  t: t2
12779
12861
  } = useTranslation();
12780
- const component = useContext(ComponentContext);
12781
- const Table2 = component.Table || Table$1;
12782
12862
  const taintsWithId = addId(taints, "key");
12783
12863
  const columns = [{
12784
12864
  key: "key",
@@ -12832,7 +12912,7 @@ const NodeTaintsTable = ({
12832
12912
  type: ErrorContentType.Card
12833
12913
  });
12834
12914
  }
12835
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Table2, {
12915
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
12836
12916
  tableKey: "condition",
12837
12917
  loading: false,
12838
12918
  data: finalData,
@@ -12862,7 +12942,7 @@ function Table(props) {
12862
12942
  const { Table: TableComponent } = useContext(ComponentContext);
12863
12943
  const Table2 = TableComponent || Table$1;
12864
12944
  const { i18n: i18n2 } = useTranslation();
12865
- const resourceType = addSpaceBeforeLetter(displayName);
12945
+ const resourceType = transformResourceKindInSentence(displayName, i18n2.language);
12866
12946
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12867
12947
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12868
12948
  WidgetErrorContent,
@@ -13381,7 +13461,14 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
13381
13461
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
13382
13462
  path: [],
13383
13463
  renderContent: (_, record) => {
13384
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, breakLine: false, clusterVip });
13464
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13465
+ ServiceOutClusterAccessComponent,
13466
+ {
13467
+ service: record,
13468
+ breakLine: false,
13469
+ clusterVip
13470
+ }
13471
+ );
13385
13472
  }
13386
13473
  });
13387
13474
  const PodSelectorField = () => ({
@@ -13552,13 +13639,14 @@ const PVCRefField = (i18n2) => {
13552
13639
  key: "pvc",
13553
13640
  path: ["pvc"],
13554
13641
  title: i18n2.t("dovetail.pvc"),
13555
- renderContent(value2, pvc2) {
13642
+ renderContent(value2, pv2) {
13556
13643
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
13557
13644
  ResourceLink,
13558
13645
  {
13559
13646
  resourceKind: "persistentvolumeclaims",
13560
- namespace: pvc2.pvcNamespace || "default",
13561
- name: value2
13647
+ namespace: pv2.pvcNamespace || "default",
13648
+ name: value2,
13649
+ uid: pv2.pvcUid
13562
13650
  }
13563
13651
  );
13564
13652
  }
@@ -19946,17 +20034,14 @@ const ResourceTableGroup = (resource, title) => ({
19946
20034
  const PageShow = (props) => {
19947
20035
  var _a;
19948
20036
  const parsed = useParsed();
20037
+ const msg = useMessage();
19949
20038
  const { resource } = useResource();
19950
20039
  const configs = useContext(ConfigsContext);
19951
20040
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
19952
20041
  const nav = useNavigation();
19953
20042
  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: () => {
20043
+ const notExistMsg = useMemo(
20044
+ () => {
19960
20045
  var _a2;
19961
20046
  return {
19962
20047
  key: "resource-non-exist",
@@ -19968,14 +20053,33 @@ const PageShow = (props) => {
19968
20053
  description: "Error",
19969
20054
  type: "error"
19970
20055
  };
20056
+ },
20057
+ [config.displayName, i18n2, parsed, resource == null ? void 0 : resource.name]
20058
+ );
20059
+ const { queryResult } = useShow({
20060
+ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
20061
+ queryOptions: {
20062
+ retry: 1
20063
+ },
20064
+ errorNotification: () => {
20065
+ return notExistMsg;
19971
20066
  }
19972
20067
  });
19973
20068
  const { isLoading, isError } = queryResult;
19974
20069
  useEffect(() => {
19975
- if (isError && resource) {
20070
+ var _a2, _b, _c;
20071
+ 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);
20072
+ if ((isError || isNotExist) && resource) {
20073
+ if (isNotExist) {
20074
+ msg.open({
20075
+ content: notExistMsg.message,
20076
+ duration: 4.5,
20077
+ ...notExistMsg
20078
+ });
20079
+ }
19976
20080
  nav.list(resource);
19977
20081
  }
19978
- }, [isError, nav, resource]);
20082
+ }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
19979
20083
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
19980
20084
  };
19981
20085
  const index_az4wrx = "";
@@ -36213,8 +36317,6 @@ function ResourceShow(props) {
36213
36317
  }
36214
36318
  );
36215
36319
  }
36216
- const button_1uhn9v1 = "";
36217
- const WarningButtonStyle = "wwyz7ti";
36218
36320
  var isCheckBoxInput = (element) => element.type === "checkbox";
36219
36321
  var isDateObject = (value2) => value2 instanceof Date;
36220
36322
  var isNullOrUndefined = (value2) => value2 == null;
@@ -37819,7 +37921,7 @@ const RefineFormContent = (props) => {
37819
37921
  config,
37820
37922
  formResult,
37821
37923
  resourceId,
37822
- errorMsg
37924
+ errorMsgs
37823
37925
  } = props;
37824
37926
  const {
37825
37927
  control,
@@ -37839,10 +37941,10 @@ const RefineFormContent = (props) => {
37839
37941
  for (const func of c2.validators) {
37840
37942
  const {
37841
37943
  isValid,
37842
- errorMsg: errorMsg2
37944
+ errorMsg
37843
37945
  } = func(value2, formValue);
37844
37946
  if (!isValid)
37845
- return errorMsg2;
37947
+ return errorMsg;
37846
37948
  }
37847
37949
  return true;
37848
37950
  }
@@ -37922,7 +38024,7 @@ const RefineFormContent = (props) => {
37922
38024
  size: 16,
37923
38025
  className: "c1xsnuvk",
37924
38026
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
37925
- errorMsgs: errorMsg ? [errorMsg] : [],
38027
+ errorMsgs: errorMsgs || [],
37926
38028
  style: {
37927
38029
  marginBottom: 16
37928
38030
  },
@@ -38569,10 +38671,10 @@ const useForm = ({
38569
38671
  const useRefineForm = (props) => {
38570
38672
  var _a, _b, _c;
38571
38673
  const { config, id, refineProps } = props;
38572
- const [responseErrorMsg, setResponseErrorMsg] = useState("");
38573
- const i18n2 = useTranslation();
38674
+ const [responseErrorMsgs, setResponseErrorMsgs] = useState([]);
38675
+ const { i18n: i18n2 } = useTranslation();
38574
38676
  const result = useForm({
38575
- mode: "onSubmit",
38677
+ mode: "onTouched",
38576
38678
  reValidateMode: "onChange",
38577
38679
  refineCoreProps: {
38578
38680
  errorNotification: false,
@@ -38583,7 +38685,7 @@ const useRefineForm = (props) => {
38583
38685
  message: i18n2.t(
38584
38686
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38585
38687
  {
38586
- kind: addSpaceBeforeLetter(config.displayName || config.kind),
38688
+ kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
38587
38689
  name: (_a2 = formValue.metadata) == null ? void 0 : _a2.name,
38588
38690
  interpolation: { escapeValue: false }
38589
38691
  }
@@ -38609,11 +38711,11 @@ const useRefineForm = (props) => {
38609
38711
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
38610
38712
  (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
38611
38713
  var _a3, _b3;
38612
- setResponseErrorMsg(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || body.message);
38714
+ setResponseErrorMsgs([].concat(((_b3 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b3.call(_a3, body)) || getCommonErrors(body, i18n2)));
38613
38715
  });
38614
38716
  }
38615
- }, [config.formConfig, result]);
38616
- return { formResult: result, responseErrorMsg };
38717
+ }, [config.formConfig, result, i18n2]);
38718
+ return { formResult: result, responseErrorMsgs };
38617
38719
  };
38618
38720
  const index_2ivb33 = "";
38619
38721
  const Style = "s1bsn3us";
@@ -38623,7 +38725,7 @@ const Separator = () => {
38623
38725
  });
38624
38726
  };
38625
38727
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38626
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-e2011bb6.js"));
38728
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-0b32c27a.js"));
38627
38729
  const YamlEditorComponent = forwardRef(
38628
38730
  function YamlEditorComponent2(props, ref) {
38629
38731
  const {
@@ -39240,6 +39342,10 @@ function YamlForm(props) {
39240
39342
  const action = actionFromProps || actionFromResource;
39241
39343
  const configs = useContext(ConfigsContext);
39242
39344
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
39345
+ const {
39346
+ t: t2,
39347
+ i18n: i18n2
39348
+ } = useTranslation();
39243
39349
  const {
39244
39350
  formProps,
39245
39351
  saveButtonProps,
@@ -39265,7 +39371,7 @@ function YamlForm(props) {
39265
39371
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39266
39372
  return {
39267
39373
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39268
- kind: addSpaceBeforeLetter(displayName),
39374
+ kind: transformResourceKindInSentence(displayName, i18n2.language),
39269
39375
  name: data2 == null ? void 0 : data2.data.id,
39270
39376
  interpolation: {
39271
39377
  escapeValue: false
@@ -39282,10 +39388,6 @@ function YamlForm(props) {
39282
39388
  },
39283
39389
  ...useFormProps
39284
39390
  });
39285
- const {
39286
- t: t2,
39287
- i18n: i18n2
39288
- } = useTranslation();
39289
39391
  const FormWrapper = isShowLayout ? FormLayout : React__default.Fragment;
39290
39392
  const formWrapperProps = isShowLayout ? {
39291
39393
  saveButtonProps
@@ -39464,7 +39566,7 @@ function FormModal(props) {
39464
39566
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
39465
39567
  formResult: refineFormResult.formResult,
39466
39568
  config,
39467
- errorMsg: refineFormResult.responseErrorMsg,
39569
+ errorMsgs: refineFormResult.responseErrorMsgs,
39468
39570
  resourceId: id
39469
39571
  });
39470
39572
  })();
@@ -39495,7 +39597,7 @@ function FormModal(props) {
39495
39597
  }
39496
39598
  }, [pushModal]);
39497
39599
  const errorText = (() => {
39498
- if (!!refineFormResult.responseErrorMsg || isError) {
39600
+ if (!!refineFormResult.responseErrorMsgs.length || isError) {
39499
39601
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
39500
39602
  }
39501
39603
  })();
@@ -39508,7 +39610,7 @@ function FormModal(props) {
39508
39610
  }
39509
39611
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39510
39612
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39511
- resource: addSpaceBeforeLetter(label2)
39613
+ resource: transformResourceKindInSentence(label2, i18n2.language)
39512
39614
  });
39513
39615
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39514
39616
  const desc = useMemo(() => {
@@ -40675,7 +40777,7 @@ const PortMappingColumnRenderer = (i18n2) => {
40675
40777
  style: {
40676
40778
  whiteSpace: "pre"
40677
40779
  },
40678
- children: [v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
40780
+ children: [v.servicePort, " > ", v.targetPort, "/", v.protocol]
40679
40781
  }),
40680
40782
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
40681
40783
  }, v.servicePort));
@@ -40791,7 +40893,8 @@ const PVCRefColumnRenderer = (i18n2) => {
40791
40893
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
40792
40894
  resourceKind: "persistentvolumeclaims",
40793
40895
  namespace: pv2.pvcNamespace || "default",
40794
- name: value2
40896
+ name: value2,
40897
+ uid: pv2.pvcUid
40795
40898
  });
40796
40899
  }
40797
40900
  };
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-ba328da4.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "react";