@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.
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-c93276c4.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,
@@ -12919,6 +13006,7 @@ const WorkloadPodsTable_975j2t = "";
12919
13006
  const WorkloadPodsTable = ({
12920
13007
  namespace: namespace2,
12921
13008
  selector,
13009
+ className,
12922
13010
  hideToolbar,
12923
13011
  filter,
12924
13012
  hideNodeColumn
@@ -12973,7 +13061,7 @@ const WorkloadPodsTable = ({
12973
13061
  }
12974
13062
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
12975
13063
  direction: "vertical",
12976
- className: "c1dicff8",
13064
+ className: cx_default("c1dicff8", className),
12977
13065
  children: [hideToolbar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
12978
13066
  selectedKeys,
12979
13067
  hideCreate: true
@@ -13380,7 +13468,14 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
13380
13468
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
13381
13469
  path: [],
13382
13470
  renderContent: (_, record) => {
13383
- 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
+ );
13384
13479
  }
13385
13480
  });
13386
13481
  const PodSelectorField = () => ({
@@ -13551,13 +13646,14 @@ const PVCRefField = (i18n2) => {
13551
13646
  key: "pvc",
13552
13647
  path: ["pvc"],
13553
13648
  title: i18n2.t("dovetail.pvc"),
13554
- renderContent(value2, pvc2) {
13649
+ renderContent(value2, pv2) {
13555
13650
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
13556
13651
  ResourceLink,
13557
13652
  {
13558
13653
  resourceKind: "persistentvolumeclaims",
13559
- namespace: pvc2.pvcNamespace || "default",
13560
- name: value2
13654
+ namespace: pv2.pvcNamespace || "default",
13655
+ name: value2,
13656
+ uid: pv2.pvcUid
13561
13657
  }
13562
13658
  );
13563
13659
  }
@@ -19945,17 +20041,14 @@ const ResourceTableGroup = (resource, title) => ({
19945
20041
  const PageShow = (props) => {
19946
20042
  var _a;
19947
20043
  const parsed = useParsed();
20044
+ const msg = useMessage();
19948
20045
  const { resource } = useResource();
19949
20046
  const configs = useContext(ConfigsContext);
19950
20047
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
19951
20048
  const nav = useNavigation();
19952
20049
  const i18n2 = useTranslation();
19953
- const { queryResult } = useShow({
19954
- id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id,
19955
- queryOptions: {
19956
- retry: 1
19957
- },
19958
- errorNotification: () => {
20050
+ const notExistMsg = useMemo(
20051
+ () => {
19959
20052
  var _a2;
19960
20053
  return {
19961
20054
  key: "resource-non-exist",
@@ -19967,14 +20060,33 @@ const PageShow = (props) => {
19967
20060
  description: "Error",
19968
20061
  type: "error"
19969
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;
19970
20073
  }
19971
20074
  });
19972
20075
  const { isLoading, isError } = queryResult;
19973
20076
  useEffect(() => {
19974
- 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
+ }
19975
20087
  nav.list(resource);
19976
20088
  }
19977
- }, [isError, nav, resource]);
20089
+ }, [isError, nav, resource, queryResult, parsed, msg, notExistMsg, isLoading]);
19978
20090
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
19979
20091
  };
19980
20092
  const index_az4wrx = "";
@@ -33574,6 +33686,11 @@ const Shell = React__default.forwardRef(function Shell2(props, ref) {
33574
33686
  var _a;
33575
33687
  (_a = termInstanceRef.current) == null ? void 0 : _a.writeln(data2);
33576
33688
  }, []);
33689
+ const onClear = useCallback(() => {
33690
+ var _a;
33691
+ clear();
33692
+ (_a = props.onClear) == null ? void 0 : _a.call(props);
33693
+ }, [clear, props.onClear]);
33577
33694
  useEffect(() => {
33578
33695
  const destroy = setupTerminal();
33579
33696
  return () => {
@@ -33641,7 +33758,7 @@ const Shell = React__default.forwardRef(function Shell2(props, ref) {
33641
33758
  operations,
33642
33759
  onSearchNext: searchNext,
33643
33760
  onSearchPre: searchPrevious,
33644
- onClear: clear,
33761
+ onClear,
33645
33762
  onDownloadLog: downloadContent,
33646
33763
  onSetFontSize: (fontSize) => {
33647
33764
  setOptions({
@@ -36207,8 +36324,6 @@ function ResourceShow(props) {
36207
36324
  }
36208
36325
  );
36209
36326
  }
36210
- const button_1uhn9v1 = "";
36211
- const WarningButtonStyle = "wwyz7ti";
36212
36327
  var isCheckBoxInput = (element) => element.type === "checkbox";
36213
36328
  var isDateObject = (value2) => value2 instanceof Date;
36214
36329
  var isNullOrUndefined = (value2) => value2 == null;
@@ -37813,7 +37928,7 @@ const RefineFormContent = (props) => {
37813
37928
  config,
37814
37929
  formResult,
37815
37930
  resourceId,
37816
- errorMsg
37931
+ errorMsgs
37817
37932
  } = props;
37818
37933
  const {
37819
37934
  control,
@@ -37833,10 +37948,10 @@ const RefineFormContent = (props) => {
37833
37948
  for (const func of c2.validators) {
37834
37949
  const {
37835
37950
  isValid,
37836
- errorMsg: errorMsg2
37951
+ errorMsg
37837
37952
  } = func(value2, formValue);
37838
37953
  if (!isValid)
37839
- return errorMsg2;
37954
+ return errorMsg;
37840
37955
  }
37841
37956
  return true;
37842
37957
  }
@@ -37916,7 +38031,7 @@ const RefineFormContent = (props) => {
37916
38031
  size: 16,
37917
38032
  className: "c1xsnuvk",
37918
38033
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
37919
- errorMsgs: errorMsg ? [errorMsg] : [],
38034
+ errorMsgs: errorMsgs || [],
37920
38035
  style: {
37921
38036
  marginBottom: 16
37922
38037
  },
@@ -38563,8 +38678,8 @@ const useForm = ({
38563
38678
  const useRefineForm = (props) => {
38564
38679
  var _a, _b, _c;
38565
38680
  const { config, id, refineProps } = props;
38566
- const [responseErrorMsg, setResponseErrorMsg] = useState("");
38567
- const i18n2 = useTranslation();
38681
+ const [responseErrorMsgs, setResponseErrorMsgs] = useState([]);
38682
+ const { i18n: i18n2 } = useTranslation();
38568
38683
  const result = useForm({
38569
38684
  mode: "onSubmit",
38570
38685
  reValidateMode: "onChange",
@@ -38577,7 +38692,7 @@ const useRefineForm = (props) => {
38577
38692
  message: i18n2.t(
38578
38693
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38579
38694
  {
38580
- kind: addSpaceBeforeLetter(config.displayName || config.kind),
38695
+ kind: transformResourceKindInSentence(config.displayName || config.kind, i18n2.language),
38581
38696
  name: (_a2 = formValue.metadata) == null ? void 0 : _a2.name,
38582
38697
  interpolation: { escapeValue: false }
38583
38698
  }
@@ -38603,11 +38718,11 @@ const useRefineForm = (props) => {
38603
38718
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
38604
38719
  (_b2 = response.json) == null ? void 0 : _b2.call(response).then((body) => {
38605
38720
  var _a3, _b3;
38606
- 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)));
38607
38722
  });
38608
38723
  }
38609
- }, [config.formConfig, result]);
38610
- return { formResult: result, responseErrorMsg };
38724
+ }, [config.formConfig, result, i18n2]);
38725
+ return { formResult: result, responseErrorMsgs };
38611
38726
  };
38612
38727
  const index_2ivb33 = "";
38613
38728
  const Style = "s1bsn3us";
@@ -38617,7 +38732,7 @@ const Separator = () => {
38617
38732
  });
38618
38733
  };
38619
38734
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38620
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-89d9acb5.js"));
38735
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-8907845f.js"));
38621
38736
  const YamlEditorComponent = forwardRef(
38622
38737
  function YamlEditorComponent2(props, ref) {
38623
38738
  const {
@@ -39234,6 +39349,10 @@ function YamlForm(props) {
39234
39349
  const action = actionFromProps || actionFromResource;
39235
39350
  const configs = useContext(ConfigsContext);
39236
39351
  const config = configs[(resource == null ? void 0 : resource.name) || ""];
39352
+ const {
39353
+ t: t2,
39354
+ i18n: i18n2
39355
+ } = useTranslation();
39237
39356
  const {
39238
39357
  formProps,
39239
39358
  saveButtonProps,
@@ -39259,7 +39378,7 @@ function YamlForm(props) {
39259
39378
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39260
39379
  return {
39261
39380
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39262
- kind: addSpaceBeforeLetter(displayName),
39381
+ kind: transformResourceKindInSentence(displayName, i18n2.language),
39263
39382
  name: data2 == null ? void 0 : data2.data.id,
39264
39383
  interpolation: {
39265
39384
  escapeValue: false
@@ -39276,10 +39395,6 @@ function YamlForm(props) {
39276
39395
  },
39277
39396
  ...useFormProps
39278
39397
  });
39279
- const {
39280
- t: t2,
39281
- i18n: i18n2
39282
- } = useTranslation();
39283
39398
  const FormWrapper = isShowLayout ? FormLayout : React__default.Fragment;
39284
39399
  const formWrapperProps = isShowLayout ? {
39285
39400
  saveButtonProps
@@ -39458,7 +39573,7 @@ function FormModal(props) {
39458
39573
  return /* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
39459
39574
  formResult: refineFormResult.formResult,
39460
39575
  config,
39461
- errorMsg: refineFormResult.responseErrorMsg,
39576
+ errorMsgs: refineFormResult.responseErrorMsgs,
39462
39577
  resourceId: id
39463
39578
  });
39464
39579
  })();
@@ -39489,7 +39604,7 @@ function FormModal(props) {
39489
39604
  }
39490
39605
  }, [pushModal]);
39491
39606
  const errorText = (() => {
39492
- if (!!refineFormResult.responseErrorMsg || isError) {
39607
+ if (!!refineFormResult.responseErrorMsgs.length || isError) {
39493
39608
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
39494
39609
  }
39495
39610
  })();
@@ -39502,7 +39617,7 @@ function FormModal(props) {
39502
39617
  }
39503
39618
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39504
39619
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39505
- resource: addSpaceBeforeLetter(label2)
39620
+ resource: transformResourceKindInSentence(label2, i18n2.language)
39506
39621
  });
39507
39622
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39508
39623
  const desc = useMemo(() => {
@@ -40669,7 +40784,7 @@ const PortMappingColumnRenderer = (i18n2) => {
40669
40784
  style: {
40670
40785
  whiteSpace: "pre"
40671
40786
  },
40672
- children: [v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
40787
+ children: [v.servicePort, " > ", v.targetPort, "/", v.protocol]
40673
40788
  }),
40674
40789
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
40675
40790
  }, v.servicePort));
@@ -40785,7 +40900,8 @@ const PVCRefColumnRenderer = (i18n2) => {
40785
40900
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
40786
40901
  resourceKind: "persistentvolumeclaims",
40787
40902
  namespace: pv2.pvcNamespace || "default",
40788
- name: value2
40903
+ name: value2,
40904
+ uid: pv2.pvcUid
40789
40905
  });
40790
40906
  }
40791
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-c93276c4.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";