@dovetail-v2/refine 0.4.2-beta.0 → 0.4.4

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.
Files changed (44) hide show
  1. package/dist/{PodShell-43c7028e.cjs → PodShell-a335b2b2.cjs} +4 -2
  2. package/dist/{PodShell-76331418.js → PodShell-a6ed3498.js} +4 -2
  3. package/dist/components/CopyButton/index.d.ts +7 -0
  4. package/dist/components/EditMetadataForm/LabelFormatPopover.d.ts +0 -1
  5. package/dist/components/Form/ExtraSubmitFooter.d.ts +23 -0
  6. package/dist/components/Form/FormModal.d.ts +1 -1
  7. package/dist/components/Form/RawYamlFormModal.d.ts +1 -1
  8. package/dist/components/Form/RefineFormContainer.d.ts +1 -1
  9. package/dist/components/Form/useReactHookForm.d.ts +1 -2
  10. package/dist/components/Form/useRefineForm.d.ts +1 -1
  11. package/dist/components/FormWidgets/NameInputWidget.d.ts +0 -48
  12. package/dist/components/KeyValueTableForm/FormatRulePopover.d.ts +7 -0
  13. package/dist/components/KeyValueTableForm/index.d.ts +3 -1
  14. package/dist/components/ServiceComponents/index.d.ts +10 -0
  15. package/dist/components/Shell/ShellToolbar.d.ts +1 -1
  16. package/dist/components/ShowContent/fields.d.ts +4 -0
  17. package/dist/components/index.d.ts +2 -3
  18. package/dist/contexts/component.d.ts +14 -5
  19. package/dist/contexts/index.d.ts +1 -0
  20. package/dist/hooks/use409Retry.d.ts +68 -0
  21. package/dist/hooks/useDeleteModal/index.d.ts +1 -0
  22. package/dist/hooks/useEagleTable/columns.d.ts +5 -4
  23. package/dist/hooks/useOpenForm.d.ts +1 -1
  24. package/dist/hooks/useSubmitForm.d.ts +1 -1
  25. package/dist/hooks/useTableData.d.ts +1 -1
  26. package/dist/i18n.d.ts +31 -0
  27. package/dist/{index-31874f77.cjs → index-053ee180.cjs} +1 -1
  28. package/dist/{index-ab97826a.js → index-d7bc2ee6.js} +1 -1
  29. package/dist/index.d.ts +0 -1
  30. package/dist/locales/en-US/index.d.ts +15 -0
  31. package/dist/locales/zh-CN/index.d.ts +16 -0
  32. package/dist/models/daemonset-model.d.ts +0 -3
  33. package/dist/models/statefulset-model.d.ts +0 -3
  34. package/dist/models/workload-base-model.d.ts +3 -0
  35. package/dist/models/workload-model.d.ts +3 -0
  36. package/dist/pages/deployments/form/index.d.ts +2 -1
  37. package/dist/plugins/model-plugin.d.ts +1 -1
  38. package/dist/refine.cjs +1607 -1333
  39. package/dist/refine.js +1611 -1337
  40. package/dist/shell.cjs +1 -1
  41. package/dist/shell.js +1 -1
  42. package/dist/style.css +268 -121
  43. package/dist/types/resource.d.ts +33 -9
  44. package/package.json +18 -7
package/dist/refine.js CHANGED
@@ -7,17 +7,18 @@ var __publicField = (obj, key2, value2) => {
7
7
  import dayjs from "dayjs";
8
8
  import i18n from "i18next";
9
9
  import { w as warnOnce, g as getDefaults, a as warn, b as getI18n, s as setDefaults, d as setI18n, I as I18nContext, j as jsxRuntimeExports, u as useTranslation, c as cx_default, S as SocketStatus } from "./common-241b21f8.js";
10
- import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useForm as useForm$2, pickNotDeprecated, useWarnAboutChange, useOne, useParsed, useGo, useCan, useTable, useDeleteMany, useShow, useRefineContext, useTranslate, flattenObjectKeys, useMenu, Refine } from "@refinedev/core";
10
+ import { ResourceContext, matchResourceFromRoute, useResource, useDeleteMany, useDelete, useNavigation, useBreadcrumb, useList, CanAccess, useUpdate, useForm as useForm$2, pickNotDeprecated, useWarnAboutChange, useParsed, useGo, useCan, useTable, useShow, useRefineContext, useTranslate, flattenObjectKeys, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import React, { createElement, isValidElement, cloneElement, Children, useContext, useCallback, createContext, useState, useEffect, useMemo, useRef, useImperativeHandle, forwardRef, Suspense, lazy, memo } from "react";
13
13
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
14
- import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, OverflowTooltip, Typo, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, ImmersiveDialog, SmallDialog, Fields, Units, Link as Link$1, Tooltip, Divider, Icon, Dropdown, Menu as Menu$1, LegacyModal, StatusCapsule, Popover, AntdTable, Upload, TableForm, ValidateTriggerType, AutoComplete, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Col, Row, useMessage, SearchInput, Token, AntdSelectOptGroup, WizardDialog, MenuItemGroup, Layout as Layout$1, InputGroup, InputInteger, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
15
- import { HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, OpenTerminal16GradientBlueIcon, ArrowChevronDown16BlueIcon, ArrowChevronUp16BlueIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
16
- import { first, get as get$2, cloneDeep, set, setWith, clone, debounce, isEqual as isEqual$1, isObject as isObject$4, uniq, omit as omit$1, merge, last, keyBy } from "lodash-es";
14
+ import { usePushModal, usePopModal, DeleteDialog, Tag, RejectDialog, RejectDialogType, OverflowTooltip, Typo, Input, Select, AntdOption, Button, Form, Space, TextArea, kitContext, Loading, Table as Table$2, Pagination, Alert, ImmersiveDialog, SmallDialog, Fields, Units, Tooltip, Icon, Link as Link$1, Divider, Dropdown, Menu as Menu$1, LegacyModal, StatusCapsule, Popover, AntdTable, Upload, TableForm, ValidateTriggerType, AutoComplete, getOptions, DonutChart, SegmentControl, Checkbox, Tabs as Tabs$1, TabsTabPane, Col, Row, useMessage, SearchInput, Token, AntdSelectOptGroup, WizardDialog, MenuItemGroup, Layout as Layout$1, InputGroup, InputInteger, Time as Time$1, ModalStack, KitStoreProvider, ConfigProvider } from "@cloudtower/eagle";
15
+ import { ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, InfoICircleFill16GrayIcon, InfoICircleFill16Gray70Icon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, OpenTerminal16GradientBlueIcon, ArrowChevronLeft16BoldBlueIcon, ExclamationErrorCircleFill16RedIcon, ArrowChevronDown16BlueIcon, ArrowChevronUp16BlueIcon, Pause16GradientBlueIcon, EditPen16BlueIcon } from "@cloudtower/icons-react";
16
+ import { first, get as get$2, cloneDeep, set, setWith, clone, debounce, isEqual as isEqual$1, omit as omit$1, isObject as isObject$4, uniq, merge, last, keyBy } from "lodash-es";
17
17
  import yaml$2 from "js-yaml";
18
18
  import { useForm as useForm$1 } from "sunflower-antd";
19
19
  import { useLocalStorage } from "usehooks-ts";
20
20
  import { paginateData, sortData, dataProvider, liveProvider } from "k8s-api-provider";
21
+ import copyToClipboard$1 from "copy-to-clipboard";
21
22
  import { LogViewer } from "@patternfly/react-log-viewer";
22
23
  import { Controller, useForm as useForm$3 } from "react-hook-form";
23
24
  import * as monaco from "monaco-editor";
@@ -437,6 +438,18 @@ function Trans(_ref) {
437
438
  ...additionalProps
438
439
  });
439
440
  }
441
+ const add_container$1 = "Add container";
442
+ const container_index$1 = "Container {{index}}";
443
+ const container_name$1 = "Container name";
444
+ const container_image$1 = "Container image";
445
+ const advanced_settings$1 = "Advanced settings";
446
+ const app$1 = {
447
+ add_container: add_container$1,
448
+ container_index: container_index$1,
449
+ container_name: container_name$1,
450
+ container_image: container_image$1,
451
+ advanced_settings: advanced_settings$1
452
+ };
440
453
  const copy$1 = "Copy";
441
454
  const reset_arguments$1 = "Reset";
442
455
  const view_changes$1 = "Show diff";
@@ -456,6 +469,8 @@ const state$1 = "Status";
456
469
  const name$1 = "Name";
457
470
  const pod$1 = "Pod";
458
471
  const cancel$1 = "Cancel";
472
+ const prev_step$1 = "Previous";
473
+ const next_step$1 = "Next";
459
474
  const create$1 = "Create";
460
475
  const confirm_delete_text$1 = "Are you sure you want to delete the {{kind}} <0>{{target}}</0>?";
461
476
  const edit$1 = "Edit";
@@ -602,7 +617,7 @@ const available_state$1 = "Available";
602
617
  const bound_state$1 = "Bound";
603
618
  const released_state$1 = "Released";
604
619
  const failed_state$1 = "Failed";
605
- const exec_pod = "Execute shell";
620
+ const exec_pod$1 = "Execute shell";
606
621
  const search$1 = "Search";
607
622
  const edit_label$1 = "Edit label";
608
623
  const csi$1 = "CSI driver";
@@ -618,6 +633,7 @@ const edit_form$1 = "Edit form";
618
633
  const data_expired$1 = "Data expired";
619
634
  const data_expired_body$1 = "The data in this form is no longer the latest version. To avoid saving errors, please discard this edit and reopen the form to edit again.";
620
635
  const data_expired_note$1 = "Your current entries will not be saved.";
636
+ const resource_version_conflict$1 = "The data in this form is no longer the latest version. Please discard this edit and reopen the form to edit again.";
621
637
  const abandon_edit$1 = "Discard edit";
622
638
  const exit_yaml_tip$1 = "If you go back to the form, any changes made to the YAML file will be lost.";
623
639
  const value_optional$1 = "Value (optional)";
@@ -714,6 +730,11 @@ const pause_scheduling$1 = "Suspend scheduling";
714
730
  const port_name$1 = "Port name";
715
731
  const target_port_range_limit$1 = "Only integers between 1 and 65535, or strings, are supported.";
716
732
  const service_port_name_tip$1 = "When the port count is 1, this field is optional; when it is greater than 1, this field is mandatory.";
733
+ const network_error$1 = "Network error";
734
+ const retry_when_access_data_failed$1 = "Failed to load data. Click to retry.";
735
+ const service$1 = "Service";
736
+ const ingress$1 = "Ingress";
737
+ const fstype$1 = "Filesystem type";
717
738
  const dovetail$1 = {
718
739
  copy: copy$1,
719
740
  reset_arguments: reset_arguments$1,
@@ -734,6 +755,8 @@ const dovetail$1 = {
734
755
  name: name$1,
735
756
  pod: pod$1,
736
757
  cancel: cancel$1,
758
+ prev_step: prev_step$1,
759
+ next_step: next_step$1,
737
760
  "delete": "Delete",
738
761
  create: create$1,
739
762
  confirm_delete_text: confirm_delete_text$1,
@@ -883,7 +906,7 @@ const dovetail$1 = {
883
906
  bound_state: bound_state$1,
884
907
  released_state: released_state$1,
885
908
  failed_state: failed_state$1,
886
- exec_pod,
909
+ exec_pod: exec_pod$1,
887
910
  search: search$1,
888
911
  edit_label: edit_label$1,
889
912
  csi: csi$1,
@@ -899,6 +922,7 @@ const dovetail$1 = {
899
922
  data_expired: data_expired$1,
900
923
  data_expired_body: data_expired_body$1,
901
924
  data_expired_note: data_expired_note$1,
925
+ resource_version_conflict: resource_version_conflict$1,
902
926
  abandon_edit: abandon_edit$1,
903
927
  exit_yaml_tip: exit_yaml_tip$1,
904
928
  value_optional: value_optional$1,
@@ -994,11 +1018,29 @@ const dovetail$1 = {
994
1018
  pause_scheduling: pause_scheduling$1,
995
1019
  port_name: port_name$1,
996
1020
  target_port_range_limit: target_port_range_limit$1,
997
- service_port_name_tip: service_port_name_tip$1
1021
+ service_port_name_tip: service_port_name_tip$1,
1022
+ network_error: network_error$1,
1023
+ retry_when_access_data_failed: retry_when_access_data_failed$1,
1024
+ service: service$1,
1025
+ ingress: ingress$1,
1026
+ fstype: fstype$1
998
1027
  };
999
1028
  const EN = {
1029
+ app: app$1,
1000
1030
  dovetail: dovetail$1
1001
1031
  };
1032
+ const add_container = "添加容器";
1033
+ const container_index = "容器 {{index}}";
1034
+ const container_name = "容器名称";
1035
+ const container_image = "容器镜像";
1036
+ const advanced_settings = "高级设置";
1037
+ const app = {
1038
+ add_container,
1039
+ container_index,
1040
+ container_name,
1041
+ container_image,
1042
+ advanced_settings
1043
+ };
1002
1044
  const copy = "复制";
1003
1045
  const reset_arguments = "重置";
1004
1046
  const view_changes = "查看改动";
@@ -1010,6 +1052,8 @@ const edit_yaml = "编辑 YAML";
1010
1052
  const copied = "已复制";
1011
1053
  const already_reset = "已重置";
1012
1054
  const cancel = "取消";
1055
+ const prev_step = "上一步";
1056
+ const next_step = "下一步";
1013
1057
  const create = "创建";
1014
1058
  const delete_resource = "删除{{resource}}";
1015
1059
  const confirm_delete_text = "确认删除{{kind}} <0>{{target}}</0> 吗?";
@@ -1182,6 +1226,7 @@ const edit_form = "编辑表单";
1182
1226
  const data_expired = "数据已过期";
1183
1227
  const data_expired_body = "当前表单中的数据已不是最新版。为避免保存失败,请放弃本次编辑,并重新打开表单进行编辑。";
1184
1228
  const data_expired_note = "当前已填写内容将不会保留。";
1229
+ const resource_version_conflict = "当前表单中的数据已不是最新版,请放弃本次编辑,并重新打开表单进行编辑。";
1185
1230
  const abandon_edit = "放弃编辑";
1186
1231
  const exit_yaml_tip = "返回编辑表单,不会保留对 YAML 文件做出的所有更改。";
1187
1232
  const form = "表单";
@@ -1275,6 +1320,12 @@ const no_labels = "无标签";
1275
1320
  const no_annotations = "无注解";
1276
1321
  const pause_scheduling = "暂停调度";
1277
1322
  const service_port_name_tip = "端口数量为 1 时,名称为选填项;大于 1 时,名称为必填项。";
1323
+ const exec_pod = "执行 Shell";
1324
+ const network_error = "网络错误";
1325
+ const retry_when_access_data_failed = "数据加载失败,点击重试。";
1326
+ const service = "服务";
1327
+ const ingress = "Ingress";
1328
+ const fstype = "文件系统类型";
1278
1329
  const dovetail = {
1279
1330
  copy,
1280
1331
  reset_arguments,
@@ -1287,6 +1338,8 @@ const dovetail = {
1287
1338
  copied,
1288
1339
  already_reset,
1289
1340
  cancel,
1341
+ prev_step,
1342
+ next_step,
1290
1343
  "delete": "删除",
1291
1344
  create,
1292
1345
  delete_resource,
@@ -1462,6 +1515,7 @@ const dovetail = {
1462
1515
  data_expired,
1463
1516
  data_expired_body,
1464
1517
  data_expired_note,
1518
+ resource_version_conflict,
1465
1519
  abandon_edit,
1466
1520
  exit_yaml_tip,
1467
1521
  form,
@@ -1554,9 +1608,16 @@ const dovetail = {
1554
1608
  no_labels,
1555
1609
  no_annotations,
1556
1610
  pause_scheduling,
1557
- service_port_name_tip
1611
+ service_port_name_tip,
1612
+ exec_pod,
1613
+ network_error,
1614
+ retry_when_access_data_failed,
1615
+ service,
1616
+ ingress,
1617
+ fstype
1558
1618
  };
1559
1619
  const ZH = {
1620
+ app,
1560
1621
  dovetail
1561
1622
  };
1562
1623
  const resources = {
@@ -7288,9 +7349,7 @@ class K8sOpenAPI {
7288
7349
  return this.schemas;
7289
7350
  }
7290
7351
  try {
7291
- const response = await fetch(
7292
- `${this.pathPrefix}${this.resourceBasePath}`
7293
- );
7352
+ const response = await fetch(`${this.pathPrefix}${this.resourceBasePath}`);
7294
7353
  const result = await response.json();
7295
7354
  this.schemas = Object.values(result.components.schemas);
7296
7355
  if (this.schemas) {
@@ -7362,33 +7421,42 @@ function useApiGroupSchema() {
7362
7421
  loading: false,
7363
7422
  error: null
7364
7423
  });
7365
- const fetchSchema = useCallback(async (apiGroups, schemaUrlPrefix) => {
7366
- setState((prev) => ({ ...prev, loading: true, error: null }));
7367
- try {
7368
- const results = await Promise.all(
7369
- apiGroups.map(async (apiGroup) => {
7370
- if (state2.schemasMap[apiGroup]) {
7371
- return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7372
- }
7373
- const groupSchemas = await schemaStore.fetchSchemas(apiGroup, schemaUrlPrefix);
7374
- return { apiGroup, schemas: groupSchemas || [] };
7375
- })
7376
- );
7377
- const newSchemasMap = results.reduce((acc, { apiGroup, schemas }) => {
7378
- acc[apiGroup] = schemas;
7379
- return acc;
7380
- }, {});
7381
- const allSchemas = results.flatMap(({ schemas }) => schemas);
7382
- setState({
7383
- schemas: allSchemas,
7384
- schemasMap: newSchemasMap,
7385
- loading: false,
7386
- error: null
7387
- });
7388
- } catch (e2) {
7389
- setState((prev) => ({ ...prev, loading: false, error: e2 }));
7390
- }
7391
- }, [state2.schemasMap]);
7424
+ const fetchSchema = useCallback(
7425
+ async (apiGroups, schemaUrlPrefix) => {
7426
+ setState((prev) => ({ ...prev, loading: true, error: null }));
7427
+ try {
7428
+ const results = await Promise.all(
7429
+ apiGroups.map(async (apiGroup) => {
7430
+ if (state2.schemasMap[apiGroup]) {
7431
+ return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7432
+ }
7433
+ const groupSchemas = await schemaStore.fetchSchemas(
7434
+ apiGroup,
7435
+ schemaUrlPrefix
7436
+ );
7437
+ return { apiGroup, schemas: groupSchemas || [] };
7438
+ })
7439
+ );
7440
+ const newSchemasMap = results.reduce(
7441
+ (acc, { apiGroup, schemas }) => {
7442
+ acc[apiGroup] = schemas;
7443
+ return acc;
7444
+ },
7445
+ {}
7446
+ );
7447
+ const allSchemas = results.flatMap(({ schemas }) => schemas);
7448
+ setState({
7449
+ schemas: allSchemas,
7450
+ schemasMap: newSchemasMap,
7451
+ loading: false,
7452
+ error: null
7453
+ });
7454
+ } catch (e2) {
7455
+ setState((prev) => ({ ...prev, loading: false, error: e2 }));
7456
+ }
7457
+ },
7458
+ [state2.schemasMap]
7459
+ );
7392
7460
  return { ...state2, fetchSchema };
7393
7461
  }
7394
7462
  function useSchema(options) {
@@ -7404,7 +7472,11 @@ function useSchema(options) {
7404
7472
  setLoading(true);
7405
7473
  setError(null);
7406
7474
  try {
7407
- const schema2 = await schemaStore.fetchSchema((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath, schemaUrlPrefix, (_b2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _b2.kind);
7475
+ const schema2 = await schemaStore.fetchSchema(
7476
+ (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath,
7477
+ schemaUrlPrefix,
7478
+ (_b2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _b2.kind
7479
+ );
7408
7480
  setSchema(schema2 || null);
7409
7481
  setError(null);
7410
7482
  } catch (e2) {
@@ -7425,6 +7497,34 @@ function useSchema(options) {
7425
7497
  fetchSchema
7426
7498
  };
7427
7499
  }
7500
+ const useDeleteManyModal = (resource, ids) => {
7501
+ const { mutate } = useDeleteMany();
7502
+ const [visible, setVisible] = useState(false);
7503
+ const { t: t2 } = useTranslation();
7504
+ const modalProps = {
7505
+ title: t2("dovetail.delete"),
7506
+ okText: t2("dovetail.delete"),
7507
+ okButtonProps: {
7508
+ danger: true
7509
+ },
7510
+ cancelText: t2("dovetail.cancel"),
7511
+ children: t2("dovetail.confirm_delete_text", {
7512
+ target: ids,
7513
+ interpolation: { escapeValue: false }
7514
+ }),
7515
+ onOk() {
7516
+ mutate({
7517
+ resource,
7518
+ ids
7519
+ });
7520
+ setVisible(false);
7521
+ },
7522
+ onCancel() {
7523
+ setVisible(false);
7524
+ }
7525
+ };
7526
+ return { modalProps, visible, setVisible };
7527
+ };
7428
7528
  const ConfigsContext = createContext({});
7429
7529
  function getCommonErrors(responseBody, i18n2) {
7430
7530
  var _a;
@@ -7468,12 +7568,16 @@ function getCommonErrors(responseBody, i18n2) {
7468
7568
  }
7469
7569
  return [
7470
7570
  i18n2.t(
7471
- [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
7571
+ [
7572
+ `error.${responseBody.code}`,
7573
+ `error.${responseBody.reason}`,
7574
+ responseBody.message || ""
7575
+ ],
7472
7576
  { fallbackLng: "" }
7473
7577
  )
7474
7578
  ];
7475
7579
  }
7476
- const tag_18x9v7m = "";
7580
+ const tag_19ts6m8 = "";
7477
7581
  const StateTagStyle = "s82411";
7478
7582
  const NameTagStyle = "n9ja9cs";
7479
7583
  function shortenedImage(image2) {
@@ -7873,48 +7977,6 @@ function NameInputWidget(props) {
7873
7977
  const { action } = useResource();
7874
7978
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { ...props, disabled: action === "edit" });
7875
7979
  }
7876
- const dnsSubDomainRules = [
7877
- {
7878
- required: true,
7879
- message: "名称不能为空"
7880
- },
7881
- {
7882
- pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7883
- message: "名称只能包含小写字母、数字,以及 '-' 和 '.',且必须以字母或数字开头和结束"
7884
- },
7885
- {
7886
- max: 253,
7887
- message: "名称长度不能超过253个字符"
7888
- }
7889
- ];
7890
- const rfc1123LabelRules = [
7891
- {
7892
- required: true,
7893
- message: "名称不能为空"
7894
- },
7895
- {
7896
- pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7897
- message: "名称只能包含小写字母、数字,以及 '-',且以字母或数字开头和结束"
7898
- },
7899
- {
7900
- max: 63,
7901
- message: "名称长度不能超过63个字符"
7902
- }
7903
- ];
7904
- const rfc1035LabelRules = [
7905
- {
7906
- required: true,
7907
- message: "名称不能为空"
7908
- },
7909
- {
7910
- pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7911
- message: "名称只能包含小写字母、数字,以及 '-',且以字母开头,字母或数字结束"
7912
- },
7913
- {
7914
- max: 63,
7915
- message: "名称长度不能超过63个字符"
7916
- }
7917
- ];
7918
7980
  function NamespaceSelectWidget(props) {
7919
7981
  const { action } = useResource();
7920
7982
  const { data: data2 } = useList({
@@ -7976,10 +8038,13 @@ function KeyValueListWidget(props) {
7976
8038
  const onChange = useCallback(
7977
8039
  (newItems) => {
7978
8040
  var _a;
7979
- const newValue = newItems.reduce((result, item) => {
7980
- result[item.key] = item.value;
7981
- return result;
7982
- }, {});
8041
+ const newValue = newItems.reduce(
8042
+ (result, item) => {
8043
+ result[item.key] = item.value;
8044
+ return result;
8045
+ },
8046
+ {}
8047
+ );
7983
8048
  (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
7984
8049
  },
7985
8050
  [props]
@@ -8025,7 +8090,7 @@ function KeyValueListWidget(props) {
8025
8090
  }
8026
8091
  function MetadataForm() {
8027
8092
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
8028
- /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8093
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, { label: "Name", name: ["metadata", "name"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8029
8094
  /* @__PURE__ */ jsxRuntimeExports.jsx(
8030
8095
  Form.Item,
8031
8096
  {
@@ -8040,6 +8105,12 @@ function MetadataForm() {
8040
8105
  ] });
8041
8106
  }
8042
8107
  const ComponentContext = createContext({});
8108
+ function ComponentContextProvider({
8109
+ value: value2,
8110
+ children
8111
+ }) {
8112
+ return React.createElement(ComponentContext.Provider, { value: value2 }, children);
8113
+ }
8043
8114
  const GlobalStoreContext = createContext({});
8044
8115
  const index_1s9fcl3 = "";
8045
8116
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
@@ -8203,21 +8274,31 @@ function Table$1(props) {
8203
8274
  })]
8204
8275
  });
8205
8276
  }
8206
- function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
8277
+ function useTableData({
8278
+ data: data2,
8279
+ columns,
8280
+ pageSize = 10,
8281
+ defaultSorters
8282
+ }) {
8207
8283
  const [currentPage, setCurrentPage] = useState(1);
8208
8284
  const [sorters, setSorters] = useState(defaultSorters || []);
8209
- const onSorterChange = useCallback((order, key2) => {
8210
- var _a;
8211
- const ORDER_MAP = {
8212
- descend: "desc",
8213
- ascend: "asc"
8214
- };
8215
- const sorters2 = [{
8216
- field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8217
- order: order ? ORDER_MAP[order] : order
8218
- }];
8219
- setSorters(sorters2);
8220
- }, [columns]);
8285
+ const onSorterChange = useCallback(
8286
+ (order, key2) => {
8287
+ var _a;
8288
+ const ORDER_MAP = {
8289
+ descend: "desc",
8290
+ ascend: "asc"
8291
+ };
8292
+ const sorters2 = [
8293
+ {
8294
+ field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8295
+ order: order ? ORDER_MAP[order] : order
8296
+ }
8297
+ ];
8298
+ setSorters(sorters2);
8299
+ },
8300
+ [columns]
8301
+ );
8221
8302
  return {
8222
8303
  data: paginateData(
8223
8304
  {
@@ -8297,7 +8378,7 @@ const PodSelectorTable = ({ podSelectors = {} }) => {
8297
8378
  }
8298
8379
  );
8299
8380
  };
8300
- const PortsTable = ({ service }) => {
8381
+ const PortsTable = ({ service: service2 }) => {
8301
8382
  const { t: t2 } = useTranslation();
8302
8383
  const component = useContext(ComponentContext);
8303
8384
  const Table2 = component.Table || Table$1;
@@ -8344,7 +8425,7 @@ const PortsTable = ({ service }) => {
8344
8425
  width: 199
8345
8426
  }
8346
8427
  ];
8347
- const ports = (service._rawYaml.spec.ports || []).map((port2) => ({
8428
+ const ports = (service2._rawYaml.spec.ports || []).map((port2) => ({
8348
8429
  ...port2,
8349
8430
  id: port2.name || ""
8350
8431
  }));
@@ -8759,6 +8840,38 @@ function PVCDistributeStorage({
8759
8840
  )
8760
8841
  ] });
8761
8842
  }
8843
+ const index_1oorxg6 = "";
8844
+ const CopyIconStyle = "c1oll6q9";
8845
+ const CopyButton = ({
8846
+ value: value2,
8847
+ className
8848
+ }) => {
8849
+ const {
8850
+ i18n: i18n2
8851
+ } = useTranslation();
8852
+ const [tooltip, setTooltip] = useState(i18n2.t("dovetail.copy"));
8853
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
8854
+ title: tooltip,
8855
+ onVisibleChange: (visible) => {
8856
+ if (!visible) {
8857
+ setTimeout(() => {
8858
+ setTooltip(i18n2.t("dovetail.copy"));
8859
+ }, 80);
8860
+ }
8861
+ },
8862
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, {
8863
+ src: ClipboardCopy16GradientGrayIcon,
8864
+ hoverSrc: ClipboardCopy16GradientBlueIcon,
8865
+ className: cx_default(CopyIconStyle, className),
8866
+ iconWidth: 16,
8867
+ iconHeight: 16,
8868
+ onClick: () => {
8869
+ copyToClipboard$1(value2);
8870
+ setTooltip(i18n2.t("dovetail.copied"));
8871
+ }
8872
+ })
8873
+ });
8874
+ };
8762
8875
  class ResourceModel {
8763
8876
  constructor(_rawYaml, _globalStore) {
8764
8877
  __publicField(this, "id");
@@ -8876,74 +8989,70 @@ const BASE_INIT_VALUE = {
8876
8989
  }
8877
8990
  };
8878
8991
  const DEPLOYMENT_INIT_VALUE = {
8879
- "apiVersion": "apps/v1",
8880
- "kind": "Deployment",
8881
- "metadata": {
8882
- "name": "example",
8883
- "namespace": "default"
8992
+ apiVersion: "apps/v1",
8993
+ kind: "Deployment",
8994
+ metadata: {
8995
+ name: "example",
8996
+ namespace: "default"
8884
8997
  },
8885
- "spec": {
8886
- "selector": {
8887
- "matchLabels": {
8888
- "app": "deployment-example"
8998
+ spec: {
8999
+ selector: {
9000
+ matchLabels: {
9001
+ app: "deployment-example"
8889
9002
  }
8890
9003
  },
8891
- "replicas": 3,
8892
- "template": {
8893
- "metadata": {
8894
- "labels": {
8895
- "app": "deployment-example"
9004
+ replicas: 3,
9005
+ template: {
9006
+ metadata: {
9007
+ labels: {
9008
+ app: "deployment-example"
8896
9009
  }
8897
9010
  },
8898
- "spec": {
8899
- "containers": [
9011
+ spec: {
9012
+ containers: [
8900
9013
  {
8901
- "name": "deployment-example",
8902
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
8903
- "ports": [
9014
+ name: "deployment-example",
9015
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9016
+ ports: [
8904
9017
  {
8905
- "containerPort": 8080,
8906
- "protocol": "TCP"
9018
+ containerPort: 8080,
9019
+ protocol: "TCP"
8907
9020
  }
8908
9021
  ]
8909
9022
  }
8910
9023
  ]
8911
9024
  }
8912
9025
  },
8913
- "strategy": {
8914
- "type": "RollingUpdate",
8915
- "rollingUpdate": {
8916
- "maxSurge": "25%",
8917
- "maxUnavailable": "25%"
9026
+ strategy: {
9027
+ type: "RollingUpdate",
9028
+ rollingUpdate: {
9029
+ maxSurge: "25%",
9030
+ maxUnavailable: "25%"
8918
9031
  }
8919
9032
  }
8920
9033
  }
8921
9034
  };
8922
9035
  const CRONJOB_INIT_VALUE = {
8923
- "apiVersion": "batch/v1",
8924
- "kind": "CronJob",
8925
- "metadata": {
8926
- "name": "example",
8927
- "namespace": "default"
9036
+ apiVersion: "batch/v1",
9037
+ kind: "CronJob",
9038
+ metadata: {
9039
+ name: "example",
9040
+ namespace: "default"
8928
9041
  },
8929
- "spec": {
8930
- "schedule": "@daily",
8931
- "jobTemplate": {
8932
- "spec": {
8933
- "template": {
8934
- "spec": {
8935
- "containers": [
9042
+ spec: {
9043
+ schedule: "@daily",
9044
+ jobTemplate: {
9045
+ spec: {
9046
+ template: {
9047
+ spec: {
9048
+ containers: [
8936
9049
  {
8937
- "name": "example",
8938
- "image": "registry.smtx.io/kubesmart/alpine:3",
8939
- "args": [
8940
- "/bin/sh",
8941
- "-c",
8942
- "date; echo Hello from the Kubernetes cluster"
8943
- ]
9050
+ name: "example",
9051
+ image: "registry.smtx.io/kubesmart/alpine:3",
9052
+ args: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
8944
9053
  }
8945
9054
  ],
8946
- "restartPolicy": "OnFailure"
9055
+ restartPolicy: "OnFailure"
8947
9056
  }
8948
9057
  }
8949
9058
  }
@@ -8951,32 +9060,32 @@ const CRONJOB_INIT_VALUE = {
8951
9060
  }
8952
9061
  };
8953
9062
  const DAEMONSET_INIT_VALUE = {
8954
- "apiVersion": "apps/v1",
8955
- "kind": "DaemonSet",
8956
- "metadata": {
8957
- "name": "example",
8958
- "namespace": "default"
9063
+ apiVersion: "apps/v1",
9064
+ kind: "DaemonSet",
9065
+ metadata: {
9066
+ name: "example",
9067
+ namespace: "default"
8959
9068
  },
8960
- "spec": {
8961
- "selector": {
8962
- "matchLabels": {
8963
- "app": "daemonset-example"
9069
+ spec: {
9070
+ selector: {
9071
+ matchLabels: {
9072
+ app: "daemonset-example"
8964
9073
  }
8965
9074
  },
8966
- "template": {
8967
- "metadata": {
8968
- "labels": {
8969
- "app": "daemonset-example"
9075
+ template: {
9076
+ metadata: {
9077
+ labels: {
9078
+ app: "daemonset-example"
8970
9079
  }
8971
9080
  },
8972
- "spec": {
8973
- "containers": [
9081
+ spec: {
9082
+ containers: [
8974
9083
  {
8975
- "name": "daemonset-example",
8976
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
8977
- "ports": [
9084
+ name: "daemonset-example",
9085
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9086
+ ports: [
8978
9087
  {
8979
- "containerPort": 8080
9088
+ containerPort: 8080
8980
9089
  }
8981
9090
  ]
8982
9091
  }
@@ -8986,98 +9095,86 @@ const DAEMONSET_INIT_VALUE = {
8986
9095
  }
8987
9096
  };
8988
9097
  const JOB_INIT_VALUE = {
8989
- "apiVersion": "batch/v1",
8990
- "kind": "Job",
8991
- "metadata": {
8992
- "name": "example",
8993
- "namespace": "default"
9098
+ apiVersion: "batch/v1",
9099
+ kind: "Job",
9100
+ metadata: {
9101
+ name: "example",
9102
+ namespace: "default"
8994
9103
  },
8995
- "spec": {
8996
- "selector": {},
8997
- "template": {
8998
- "metadata": {
8999
- "name": "job-example"
9104
+ spec: {
9105
+ selector: {},
9106
+ template: {
9107
+ metadata: {
9108
+ name: "job-example"
9000
9109
  },
9001
- "spec": {
9002
- "containers": [
9110
+ spec: {
9111
+ containers: [
9003
9112
  {
9004
- "name": "job-example",
9005
- "image": "registry.smtx.io/kubesmart/alpine:3",
9006
- "command": [
9007
- "/bin/sh",
9008
- "-c",
9009
- "date; echo Hello from the Kubernetes cluster"
9010
- ]
9113
+ name: "job-example",
9114
+ image: "registry.smtx.io/kubesmart/alpine:3",
9115
+ command: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
9011
9116
  }
9012
9117
  ],
9013
- "restartPolicy": "Never"
9118
+ restartPolicy: "Never"
9014
9119
  }
9015
9120
  }
9016
9121
  }
9017
9122
  };
9018
9123
  const STATEFULSET_INIT_VALUE = {
9019
- "apiVersion": "apps/v1",
9020
- "kind": "StatefulSet",
9021
- "metadata": {
9022
- "name": "example",
9023
- "namespace": "default"
9124
+ apiVersion: "apps/v1",
9125
+ kind: "StatefulSet",
9126
+ metadata: {
9127
+ name: "example",
9128
+ namespace: "default"
9024
9129
  },
9025
- "spec": {
9026
- "serviceName": "statefulset-example",
9027
- "replicas": 3,
9028
- "selector": {
9029
- "matchLabels": {
9030
- "app": "statefulset-example"
9130
+ spec: {
9131
+ serviceName: "statefulset-example",
9132
+ replicas: 3,
9133
+ selector: {
9134
+ matchLabels: {
9135
+ app: "statefulset-example"
9031
9136
  }
9032
9137
  },
9033
- "template": {
9034
- "metadata": {
9035
- "labels": {
9036
- "app": "statefulset-example"
9138
+ template: {
9139
+ metadata: {
9140
+ labels: {
9141
+ app: "statefulset-example"
9037
9142
  }
9038
9143
  },
9039
- "spec": {
9040
- "terminationGracePeriodSeconds": 10,
9041
- "containers": [
9144
+ spec: {
9145
+ terminationGracePeriodSeconds: 10,
9146
+ containers: [
9042
9147
  {
9043
- "name": "statefulset-example",
9044
- "image": "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9045
- "command": [
9046
- "dufs"
9047
- ],
9048
- "args": [
9049
- "-A",
9050
- "--render-try-index",
9051
- "/data"
9052
- ],
9053
- "ports": [
9148
+ name: "statefulset-example",
9149
+ image: "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9150
+ command: ["dufs"],
9151
+ args: ["-A", "--render-try-index", "/data"],
9152
+ ports: [
9054
9153
  {
9055
- "containerPort": 5e3,
9056
- "name": "http"
9154
+ containerPort: 5e3,
9155
+ name: "http"
9057
9156
  }
9058
9157
  ],
9059
- "volumeMounts": [
9158
+ volumeMounts: [
9060
9159
  {
9061
- "name": "file",
9062
- "mountPath": "/data"
9160
+ name: "file",
9161
+ mountPath: "/data"
9063
9162
  }
9064
9163
  ]
9065
9164
  }
9066
9165
  ]
9067
9166
  }
9068
9167
  },
9069
- "volumeClaimTemplates": [
9168
+ volumeClaimTemplates: [
9070
9169
  {
9071
- "metadata": {
9072
- "name": "file"
9170
+ metadata: {
9171
+ name: "file"
9073
9172
  },
9074
- "spec": {
9075
- "accessModes": [
9076
- "ReadWriteOnce"
9077
- ],
9078
- "resources": {
9079
- "requests": {
9080
- "storage": "1Gi"
9173
+ spec: {
9174
+ accessModes: ["ReadWriteOnce"],
9175
+ resources: {
9176
+ requests: {
9177
+ storage: "1Gi"
9081
9178
  }
9082
9179
  }
9083
9180
  }
@@ -9086,37 +9183,35 @@ const STATEFULSET_INIT_VALUE = {
9086
9183
  }
9087
9184
  };
9088
9185
  const POD_INIT_VALUE = {
9089
- "apiVersion": "v1",
9090
- "kind": "Pod",
9091
- "metadata": {
9092
- "name": "example",
9093
- "namespace": "default",
9094
- "labels": {
9095
- "app": "example"
9186
+ apiVersion: "v1",
9187
+ kind: "Pod",
9188
+ metadata: {
9189
+ name: "example",
9190
+ namespace: "default",
9191
+ labels: {
9192
+ app: "example"
9096
9193
  }
9097
9194
  },
9098
- "spec": {
9099
- "securityContext": {
9100
- "runAsNonRoot": true,
9101
- "seccompProfile": {
9102
- "type": "RuntimeDefault"
9195
+ spec: {
9196
+ securityContext: {
9197
+ runAsNonRoot: true,
9198
+ seccompProfile: {
9199
+ type: "RuntimeDefault"
9103
9200
  }
9104
9201
  },
9105
- "containers": [
9202
+ containers: [
9106
9203
  {
9107
- "name": "example",
9108
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9109
- "ports": [
9204
+ name: "example",
9205
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9206
+ ports: [
9110
9207
  {
9111
- "containerPort": 8080
9208
+ containerPort: 8080
9112
9209
  }
9113
9210
  ],
9114
- "securityContext": {
9115
- "allowPrivilegeEscalation": false,
9116
- "capabilities": {
9117
- "drop": [
9118
- "ALL"
9119
- ]
9211
+ securityContext: {
9212
+ allowPrivilegeEscalation: false,
9213
+ capabilities: {
9214
+ drop: ["ALL"]
9120
9215
  }
9121
9216
  }
9122
9217
  }
@@ -9124,143 +9219,143 @@ const POD_INIT_VALUE = {
9124
9219
  }
9125
9220
  };
9126
9221
  const SERVICE_CLUSTER_IP_INIT_VALUE = {
9127
- "apiVersion": "v1",
9128
- "kind": "Service",
9129
- "metadata": {
9130
- "name": "example",
9131
- "namespace": "default"
9222
+ apiVersion: "v1",
9223
+ kind: "Service",
9224
+ metadata: {
9225
+ name: "example",
9226
+ namespace: "default"
9132
9227
  },
9133
- "spec": {
9134
- "selector": {
9135
- "app": "example"
9228
+ spec: {
9229
+ selector: {
9230
+ app: "example"
9136
9231
  },
9137
- "ports": [
9232
+ ports: [
9138
9233
  {
9139
- "name": "example",
9140
- "port": 8080,
9141
- "protocol": "TCP",
9142
- "targetPort": 8080
9234
+ name: "example",
9235
+ port: 8080,
9236
+ protocol: "TCP",
9237
+ targetPort: 8080
9143
9238
  }
9144
9239
  ],
9145
- "sessionAffinity": "None",
9146
- "type": "ClusterIP"
9240
+ sessionAffinity: "None",
9241
+ type: "ClusterIP"
9147
9242
  }
9148
9243
  };
9149
9244
  const SERVICE_NODE_PORT_INIT_VALUE = {
9150
- "apiVersion": "v1",
9151
- "kind": "Service",
9152
- "metadata": {
9153
- "name": "example",
9154
- "namespace": "default"
9245
+ apiVersion: "v1",
9246
+ kind: "Service",
9247
+ metadata: {
9248
+ name: "example",
9249
+ namespace: "default"
9155
9250
  },
9156
- "spec": {
9157
- "selector": {
9158
- "app": "example"
9251
+ spec: {
9252
+ selector: {
9253
+ app: "example"
9159
9254
  },
9160
- "ports": [
9255
+ ports: [
9161
9256
  {
9162
- "name": "example",
9163
- "port": 8080,
9164
- "protocol": "TCP",
9165
- "targetPort": 8080
9257
+ name: "example",
9258
+ port: 8080,
9259
+ protocol: "TCP",
9260
+ targetPort: 8080
9166
9261
  }
9167
9262
  ],
9168
- "sessionAffinity": "None",
9169
- "type": "NodePort"
9263
+ sessionAffinity: "None",
9264
+ type: "NodePort"
9170
9265
  }
9171
9266
  };
9172
9267
  const SERVICE_LOAD_BALANCER_INIT_VALUE = {
9173
- "apiVersion": "v1",
9174
- "kind": "Service",
9175
- "metadata": {
9176
- "name": "example",
9177
- "namespace": "default"
9268
+ apiVersion: "v1",
9269
+ kind: "Service",
9270
+ metadata: {
9271
+ name: "example",
9272
+ namespace: "default"
9178
9273
  },
9179
- "spec": {
9180
- "selector": {
9181
- "app": "example"
9274
+ spec: {
9275
+ selector: {
9276
+ app: "example"
9182
9277
  },
9183
- "ports": [
9278
+ ports: [
9184
9279
  {
9185
- "name": "example",
9186
- "port": 80,
9187
- "protocol": "TCP",
9188
- "targetPort": 8080
9280
+ name: "example",
9281
+ port: 80,
9282
+ protocol: "TCP",
9283
+ targetPort: 8080
9189
9284
  }
9190
9285
  ],
9191
- "sessionAffinity": "None",
9192
- "type": "LoadBalancer"
9286
+ sessionAffinity: "None",
9287
+ type: "LoadBalancer"
9193
9288
  }
9194
9289
  };
9195
9290
  const SERVICE_EXTERNAL_NAME_INIT_VALUE = {
9196
- "apiVersion": "v1",
9197
- "kind": "Service",
9198
- "metadata": {
9199
- "name": "example",
9200
- "namespace": "default"
9291
+ apiVersion: "v1",
9292
+ kind: "Service",
9293
+ metadata: {
9294
+ name: "example",
9295
+ namespace: "default"
9201
9296
  },
9202
- "spec": {
9203
- "selector": {
9204
- "app": "example"
9297
+ spec: {
9298
+ selector: {
9299
+ app: "example"
9205
9300
  },
9206
- "ports": [
9301
+ ports: [
9207
9302
  {
9208
- "name": "example",
9209
- "port": 8080,
9210
- "protocol": "TCP",
9211
- "targetPort": 8080
9303
+ name: "example",
9304
+ port: 8080,
9305
+ protocol: "TCP",
9306
+ targetPort: 8080
9212
9307
  }
9213
9308
  ],
9214
- "sessionAffinity": "None",
9215
- "type": "ExternalName",
9216
- "externalName": "app.example.com"
9309
+ sessionAffinity: "None",
9310
+ type: "ExternalName",
9311
+ externalName: "app.example.com"
9217
9312
  }
9218
9313
  };
9219
9314
  const SERVICE_HEADLESS_INIT_VALUE = {
9220
- "apiVersion": "v1",
9221
- "kind": "Service",
9222
- "metadata": {
9223
- "name": "example",
9224
- "namespace": "default"
9315
+ apiVersion: "v1",
9316
+ kind: "Service",
9317
+ metadata: {
9318
+ name: "example",
9319
+ namespace: "default"
9225
9320
  },
9226
- "spec": {
9227
- "selector": {
9228
- "app": "example"
9321
+ spec: {
9322
+ selector: {
9323
+ app: "example"
9229
9324
  },
9230
- "clusterIP": "None",
9231
- "ports": [
9325
+ clusterIP: "None",
9326
+ ports: [
9232
9327
  {
9233
- "name": "example",
9234
- "port": null,
9235
- "protocol": "TCP",
9236
- "targetPort": null
9328
+ name: "example",
9329
+ port: null,
9330
+ protocol: "TCP",
9331
+ targetPort: null
9237
9332
  }
9238
9333
  ],
9239
- "sessionAffinity": "None",
9240
- "type": "ClusterIP"
9334
+ sessionAffinity: "None",
9335
+ type: "ClusterIP"
9241
9336
  }
9242
9337
  };
9243
9338
  const INGRESS_INIT_VALUE = {
9244
- "apiVersion": "networking.k8s.io/v1",
9245
- "kind": "Ingress",
9246
- "metadata": {
9247
- "name": "example",
9248
- "namespace": "default"
9339
+ apiVersion: "networking.k8s.io/v1",
9340
+ kind: "Ingress",
9341
+ metadata: {
9342
+ name: "example",
9343
+ namespace: "default"
9249
9344
  },
9250
- "spec": {
9251
- "rules": [
9345
+ spec: {
9346
+ rules: [
9252
9347
  {
9253
- "host": "example.com",
9254
- "http": {
9255
- "paths": [
9348
+ host: "example.com",
9349
+ http: {
9350
+ paths: [
9256
9351
  {
9257
- "path": "/testpath",
9258
- "pathType": "Prefix",
9259
- "backend": {
9260
- "service": {
9261
- "name": "test",
9262
- "port": {
9263
- "number": 80
9352
+ path: "/testpath",
9353
+ pathType: "Prefix",
9354
+ backend: {
9355
+ service: {
9356
+ name: "test",
9357
+ port: {
9358
+ number: 80
9264
9359
  }
9265
9360
  }
9266
9361
  }
@@ -9272,28 +9367,28 @@ const INGRESS_INIT_VALUE = {
9272
9367
  }
9273
9368
  };
9274
9369
  const NETWORK_POLICY_INIT_VALUE = {
9275
- "apiVersion": "networking.k8s.io/v1",
9276
- "kind": "NetworkPolicy",
9277
- "metadata": {
9278
- "name": "example",
9279
- "namespace": "default"
9370
+ apiVersion: "networking.k8s.io/v1",
9371
+ kind: "NetworkPolicy",
9372
+ metadata: {
9373
+ name: "example",
9374
+ namespace: "default"
9280
9375
  },
9281
- "spec": {
9282
- "podSelector": {},
9283
- "policyTypes": []
9376
+ spec: {
9377
+ podSelector: {},
9378
+ policyTypes: []
9284
9379
  }
9285
9380
  };
9286
9381
  const CONFIG_MAP_INIT_VALUE = {
9287
- "apiVersion": "v1",
9288
- "kind": "ConfigMap",
9289
- "metadata": {
9290
- "name": "example",
9291
- "namespace": "default"
9382
+ apiVersion: "v1",
9383
+ kind: "ConfigMap",
9384
+ metadata: {
9385
+ name: "example",
9386
+ namespace: "default"
9292
9387
  },
9293
- "data": {
9294
- "key": "value"
9388
+ data: {
9389
+ key: "value"
9295
9390
  },
9296
- "immutable": false
9391
+ immutable: false
9297
9392
  };
9298
9393
  const SERVER_INSTANCE_INIT_VALUE = {
9299
9394
  apiVersion: "kubesmart.smtx.io/v1alpha1",
@@ -9315,138 +9410,136 @@ const SERVER_INSTANCE_INIT_VALUE = {
9315
9410
  };
9316
9411
  const REDEPLOY_TIMESTAMP_KEY = "kubectl.kubernetes.io/restartedAt";
9317
9412
  const SECRET_OPAQUE_INIT_VALUE = {
9318
- "apiVersion": "v1",
9319
- "kind": "Secret",
9320
- "metadata": {
9321
- "name": "example",
9322
- "namespace": "default"
9413
+ apiVersion: "v1",
9414
+ kind: "Secret",
9415
+ metadata: {
9416
+ name: "example",
9417
+ namespace: "default"
9323
9418
  },
9324
- "type": "Opaque",
9325
- "data": {
9326
- "key": "value"
9419
+ type: "Opaque",
9420
+ data: {
9421
+ key: "value"
9327
9422
  }
9328
9423
  };
9329
9424
  const SECRET_IMAGE_REPO_INIT_VALUE = {
9330
- "apiVersion": "v1",
9331
- "kind": "Secret",
9332
- "metadata": {
9333
- "name": "example",
9334
- "namespace": "default"
9425
+ apiVersion: "v1",
9426
+ kind: "Secret",
9427
+ metadata: {
9428
+ name: "example",
9429
+ namespace: "default"
9335
9430
  },
9336
- "type": "kubernetes.io/dockerconfigjson",
9337
- "data": {
9431
+ type: "kubernetes.io/dockerconfigjson",
9432
+ data: {
9338
9433
  ".dockerconfigjson": ""
9339
9434
  }
9340
9435
  };
9341
9436
  const SECRET_BASIC_AUTH_INIT_VALUE = {
9342
- "apiVersion": "v1",
9343
- "kind": "Secret",
9344
- "metadata": {
9345
- "name": "example",
9346
- "namespace": "default"
9437
+ apiVersion: "v1",
9438
+ kind: "Secret",
9439
+ metadata: {
9440
+ name: "example",
9441
+ namespace: "default"
9347
9442
  },
9348
- "type": "kubernetes.io/basic-auth",
9349
- "data": {
9350
- "username": "example",
9351
- "password": "example"
9443
+ type: "kubernetes.io/basic-auth",
9444
+ data: {
9445
+ username: "example",
9446
+ password: "example"
9352
9447
  }
9353
9448
  };
9354
9449
  const SECRET_SSH_AUTH_INIT_VALUE = {
9355
- "apiVersion": "v1",
9356
- "kind": "Secret",
9357
- "metadata": {
9358
- "name": "example",
9359
- "namespace": "default"
9450
+ apiVersion: "v1",
9451
+ kind: "Secret",
9452
+ metadata: {
9453
+ name: "example",
9454
+ namespace: "default"
9360
9455
  },
9361
- "type": "kubernetes.io/ssh-auth",
9362
- "data": {
9456
+ type: "kubernetes.io/ssh-auth",
9457
+ data: {
9363
9458
  "ssh-publickey": "",
9364
9459
  "ssh-privatekey": ""
9365
9460
  }
9366
9461
  };
9367
9462
  const SECRET_TLS_INIT_VALUE = {
9368
- "apiVersion": "v1",
9369
- "kind": "Secret",
9370
- "metadata": {
9371
- "name": "example",
9372
- "namespace": "default"
9463
+ apiVersion: "v1",
9464
+ kind: "Secret",
9465
+ metadata: {
9466
+ name: "example",
9467
+ namespace: "default"
9373
9468
  },
9374
- "type": "kubernetes.io/tls",
9375
- "data": {
9469
+ type: "kubernetes.io/tls",
9470
+ data: {
9376
9471
  "tls.crt": "",
9377
9472
  "tls.key": ""
9378
9473
  }
9379
9474
  };
9380
9475
  const SECRET_CUSTOM_INIT_VALUE = {
9381
- "apiVersion": "v1",
9382
- "kind": "Secret",
9383
- "metadata": {
9384
- "name": "example",
9385
- "namespace": "default"
9476
+ apiVersion: "v1",
9477
+ kind: "Secret",
9478
+ metadata: {
9479
+ name: "example",
9480
+ namespace: "default"
9386
9481
  },
9387
- "type": "",
9388
- "data": {}
9482
+ type: "",
9483
+ data: {}
9389
9484
  };
9390
9485
  const NODE_INIT_VALUE = {
9391
- "apiVersion": "v1",
9392
- "kind": "Node",
9393
- "metadata": {
9394
- "name": "example",
9395
- "namespace": "default"
9486
+ apiVersion: "v1",
9487
+ kind: "Node",
9488
+ metadata: {
9489
+ name: "example",
9490
+ namespace: "default"
9396
9491
  },
9397
- "spec": {}
9492
+ spec: {}
9398
9493
  };
9399
9494
  const STORAGE_CLASS_INIT_VALUE = {
9400
- "apiVersion": "storage.k8s.io/v1",
9401
- "kind": "StorageClass",
9402
- "metadata": {
9403
- "name": ""
9495
+ apiVersion: "storage.k8s.io/v1",
9496
+ kind: "StorageClass",
9497
+ metadata: {
9498
+ name: ""
9404
9499
  },
9405
- "parameters": {
9500
+ parameters: {
9406
9501
  "csi.storage.k8s.io/fstype": "ext4"
9407
9502
  },
9408
- "provisioner": "",
9409
- "reclaimPolicy": "Delete",
9410
- "allowVolumeExpansion": true,
9411
- "volumeBindingMode": "Immediate"
9503
+ provisioner: "",
9504
+ reclaimPolicy: "Delete",
9505
+ allowVolumeExpansion: true,
9506
+ volumeBindingMode: "Immediate"
9412
9507
  };
9413
9508
  const PV_INIT_VALUE = {
9414
- "apiVersion": "v1",
9415
- "kind": "PersistentVolume",
9416
- "metadata": {
9417
- "name": "pvc-hostpath"
9509
+ apiVersion: "v1",
9510
+ kind: "PersistentVolume",
9511
+ metadata: {
9512
+ name: "pvc-hostpath"
9418
9513
  },
9419
- "spec": {
9420
- "accessModes": [
9421
- "ReadWriteOnce"
9422
- ],
9423
- "capacity": {
9424
- "storage": "10Gi"
9514
+ spec: {
9515
+ accessModes: ["ReadWriteOnce"],
9516
+ capacity: {
9517
+ storage: "10Gi"
9425
9518
  },
9426
- "hostPath": {
9427
- "type": "DirectoryOrCreate",
9428
- "path": "/root/test"
9519
+ hostPath: {
9520
+ type: "DirectoryOrCreate",
9521
+ path: "/root/test"
9429
9522
  },
9430
- "persistentVolumeReclaimPolicy": "Delete",
9431
- "volumeMode": "Filesystem"
9523
+ persistentVolumeReclaimPolicy: "Delete",
9524
+ volumeMode: "Filesystem"
9432
9525
  }
9433
9526
  };
9434
9527
  const PVC_INIT_VALUE = {
9435
- "apiVersion": "v1",
9436
- "kind": "PersistentVolumeClaim",
9437
- "metadata": {
9438
- "name": "",
9439
- "namespace": "default"
9528
+ apiVersion: "v1",
9529
+ kind: "PersistentVolumeClaim",
9530
+ metadata: {
9531
+ name: "",
9532
+ namespace: "default"
9440
9533
  },
9441
- "spec": {
9442
- "accessModes": [],
9443
- "resources": {
9444
- "requests": {
9445
- "storage": "10Gi"
9534
+ spec: {
9535
+ accessModes: [],
9536
+ resources: {
9537
+ requests: {
9538
+ storage: "10Gi"
9446
9539
  }
9447
9540
  },
9448
- "storageClassName": "",
9449
- "volumeMode": "Filesystem"
9541
+ storageClassName: "",
9542
+ volumeMode: "Filesystem"
9450
9543
  }
9451
9544
  };
9452
9545
  var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
@@ -9553,6 +9646,16 @@ class WorkloadBaseModel extends ResourceModel {
9553
9646
  );
9554
9647
  return (containers == null ? void 0 : containers.map((container2) => shortenedImage(container2.image || ""))) || [];
9555
9648
  }
9649
+ async fetchRestarts(selector, namespace2) {
9650
+ const pods = await this._globalStore.get("pods", {
9651
+ resourceBasePath: "/api/v1",
9652
+ kind: "Pod"
9653
+ });
9654
+ const myPods = pods.items.filter(
9655
+ (p) => matchSelector(p, selector, namespace2)
9656
+ );
9657
+ return lodashExports.sumBy(myPods, "restarts");
9658
+ }
9556
9659
  }
9557
9660
  class JobModel extends WorkloadBaseModel {
9558
9661
  constructor(_rawYaml, _globalStore) {
@@ -9564,18 +9667,11 @@ class JobModel extends WorkloadBaseModel {
9564
9667
  await this.getRestarts();
9565
9668
  }
9566
9669
  async getRestarts() {
9567
- const pods = await this._globalStore.get("pods", {
9568
- resourceBasePath: "/api/v1",
9569
- kind: "Pod"
9570
- });
9571
- const myPods = pods.items.filter(
9572
- (p) => {
9573
- var _a;
9574
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9575
- }
9670
+ var _a;
9671
+ this.restarts = await this.fetchRestarts(
9672
+ (_a = this.spec) == null ? void 0 : _a.selector,
9673
+ this.metadata.namespace
9576
9674
  );
9577
- const result = lodashExports.sumBy(myPods, "restarts");
9578
- this.restarts = result;
9579
9675
  }
9580
9676
  get duration() {
9581
9677
  var _a, _b;
@@ -9640,18 +9736,11 @@ class WorkloadModel extends WorkloadBaseModel {
9640
9736
  await this.getIngresses();
9641
9737
  }
9642
9738
  async getRestarts() {
9643
- const pods = await this._globalStore.get("pods", {
9644
- resourceBasePath: "/api/v1",
9645
- kind: "Pod"
9646
- });
9647
- const myPods = pods.items.filter(
9648
- (p) => {
9649
- var _a;
9650
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9651
- }
9739
+ var _a;
9740
+ this.restarts = await this.fetchRestarts(
9741
+ (_a = this.spec) == null ? void 0 : _a.selector,
9742
+ this.metadata.namespace
9652
9743
  );
9653
- const result = lodashExports.sumBy(myPods, "restarts");
9654
- this.restarts = result;
9655
9744
  }
9656
9745
  async getServices() {
9657
9746
  const services = await this._globalStore.get("services", {
@@ -9668,10 +9757,10 @@ class WorkloadModel extends WorkloadBaseModel {
9668
9757
  }
9669
9758
  async getIngresses() {
9670
9759
  const allIngresses = /* @__PURE__ */ new Map();
9671
- for (const service of this.services) {
9672
- for (const ingress of service.ingresses) {
9673
- const key2 = `${ingress.namespace}-${ingress.name}`;
9674
- allIngresses.set(key2, ingress);
9760
+ for (const service2 of this.services) {
9761
+ for (const ingress2 of service2.ingresses) {
9762
+ const key2 = `${ingress2.namespace}-${ingress2.name}`;
9763
+ allIngresses.set(key2, ingress2);
9675
9764
  }
9676
9765
  }
9677
9766
  this.ingresses = Array.from(allIngresses.values());
@@ -9704,6 +9793,23 @@ class WorkloadModel extends WorkloadBaseModel {
9704
9793
  }
9705
9794
  return newOne;
9706
9795
  }
9796
+ getControllerRevisions(controllerRevisions) {
9797
+ return controllerRevisions.filter(
9798
+ (cr) => {
9799
+ var _a, _b;
9800
+ return (_b = (_a = cr.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9801
+ (ref) => ref.kind === this.kind && ref.uid === this.metadata.uid
9802
+ );
9803
+ }
9804
+ );
9805
+ }
9806
+ getRevision(controllerRevisions) {
9807
+ const myRevisions = this.getControllerRevisions(controllerRevisions);
9808
+ return myRevisions.reduce(
9809
+ (result, cr) => Math.max(result, Number(cr.revision || 0)),
9810
+ 0
9811
+ );
9812
+ }
9707
9813
  }
9708
9814
  class PodModel extends WorkloadBaseModel {
9709
9815
  constructor(_rawYaml, _globalStore) {
@@ -9980,22 +10086,6 @@ class DaemonSetModel extends WorkloadModel {
9980
10086
  super(_rawYaml, _globalStore);
9981
10087
  this._rawYaml = _rawYaml;
9982
10088
  }
9983
- getControllerRevisions(controllerVisions) {
9984
- return controllerVisions.filter(
9985
- (controllerRevision) => {
9986
- var _a, _b;
9987
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9988
- (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
9989
- );
9990
- }
9991
- );
9992
- }
9993
- getRevision(controllerVisions) {
9994
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
9995
- return myControllerVisions.reduce((result, controllerRevision) => {
9996
- return Math.max(result, Number(controllerRevision.revision || 0));
9997
- }, 0);
9998
- }
9999
10089
  get stateDisplay() {
10000
10090
  var _a, _b;
10001
10091
  if (((_a = this.status) == null ? void 0 : _a.desiredNumberScheduled) !== ((_b = this.status) == null ? void 0 : _b.numberReady)) {
@@ -10015,22 +10105,6 @@ class StatefulSetModel extends WorkloadModel {
10015
10105
  super(_rawYaml, _globalStore);
10016
10106
  this._rawYaml = _rawYaml;
10017
10107
  }
10018
- getControllerRevisions(controllerVisions) {
10019
- return controllerVisions.filter(
10020
- (controllerRevision) => {
10021
- var _a, _b;
10022
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
10023
- (ownerReference) => ownerReference.kind === "StatefulSet" && ownerReference.uid === this.metadata.uid
10024
- );
10025
- }
10026
- );
10027
- }
10028
- getRevision(controllerVisions) {
10029
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
10030
- return myControllerVisions.reduce((result, controllerRevision) => {
10031
- return Math.max(result, Number(controllerRevision.revision || 0));
10032
- }, 0);
10033
- }
10034
10108
  get stateDisplay() {
10035
10109
  var _a, _b, _c;
10036
10110
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -10063,11 +10137,9 @@ class ServiceModel extends ResourceModel {
10063
10137
  resourceBasePath: "/apis/networking.k8s.io/v1",
10064
10138
  kind: "Ingress"
10065
10139
  });
10066
- const myIngresses = ingresses.items.filter((ingress) => {
10067
- const rules = ingress.getFlattenedRules([]);
10068
- return rules.some(
10069
- (rule2) => rule2.serviceName === this.name
10070
- );
10140
+ const myIngresses = ingresses.items.filter((ingress2) => {
10141
+ const rules = ingress2.getFlattenedRules([]);
10142
+ return rules.some((rule2) => rule2.serviceName === this.name);
10071
10143
  });
10072
10144
  this.ingresses = myIngresses;
10073
10145
  }
@@ -10259,15 +10331,15 @@ class IngressClassModel extends ResourceModel {
10259
10331
  return (_a = this.spec) == null ? void 0 : _a.controller;
10260
10332
  }
10261
10333
  }
10262
- const index_1rec449 = "";
10334
+ const index_1ndmolf = "";
10263
10335
  const ServiceInClusterAccessComponent = ({
10264
- service
10336
+ service: service2
10265
10337
  }) => {
10266
- const spec = service._rawYaml.spec;
10267
- switch (service.displayType) {
10338
+ const spec = service2._rawYaml.spec;
10339
+ switch (service2.displayType) {
10268
10340
  case ServiceTypeEnum.ExternalName:
10269
10341
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
10270
- value: service.dnsRecord
10342
+ value: service2.dnsRecord
10271
10343
  });
10272
10344
  case ServiceTypeEnum.Headless:
10273
10345
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10283,46 +10355,79 @@ const BreakLineStyle = "b1vtjd4k";
10283
10355
  const LinkStyle$2 = "luro4rx";
10284
10356
  const ShowLinkStyle = "s1gydjqf";
10285
10357
  const DashedUnderlineSpanStyle = "dvp1i89";
10358
+ const AccessAddressStyle = "azmggeh";
10359
+ const ServiceAccessAddress = ({
10360
+ children,
10361
+ copyValue
10362
+ }) => {
10363
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
10364
+ className: AccessAddressStyle,
10365
+ children: [children, /* @__PURE__ */ jsxRuntimeExports.jsx(CopyButton, {
10366
+ value: copyValue
10367
+ })]
10368
+ });
10369
+ };
10370
+ function renderAccessItems(items, separator) {
10371
+ if (!items.length) {
10372
+ return void 0;
10373
+ }
10374
+ const result = [];
10375
+ for (let i2 = 0; i2 < items.length; i2++) {
10376
+ result.push(/* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, {
10377
+ children: items[i2]
10378
+ }, `item-${i2}`));
10379
+ if (i2 < items.length - 1) {
10380
+ result.push(/* @__PURE__ */ jsxRuntimeExports.jsx(React.Fragment, {
10381
+ children: separator
10382
+ }, `separator-${i2}`));
10383
+ }
10384
+ }
10385
+ return result;
10386
+ }
10286
10387
  const ServiceOutClusterAccessComponent = ({
10287
- service,
10388
+ service: service2,
10288
10389
  breakLine = true,
10289
10390
  clusterVip,
10290
- showDashedUnderline = true
10391
+ showDashedUnderline = true,
10392
+ showCopyButton = false
10291
10393
  }) => {
10292
- var _a, _b, _c, _d, _e;
10394
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10293
10395
  const {
10294
10396
  i18n: i18n2
10295
10397
  } = useTranslation();
10296
- const spec = service._rawYaml.spec;
10297
- const status = service._rawYaml.status;
10398
+ const spec = service2._rawYaml.spec;
10399
+ const status = service2._rawYaml.status;
10298
10400
  let content = "-";
10299
10401
  switch (spec.type) {
10300
10402
  case ServiceTypeEnum.NodePort:
10301
10403
  if (!breakLine) {
10302
- content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p) => [/* @__PURE__ */ jsxRuntimeExports.jsx(Link$1, {
10303
- href: `http://${clusterVip}:${p.nodePort}`,
10304
- target: "_blank",
10305
- className: cx_default(ShowLinkStyle, Typo.Label.l4_regular_title),
10306
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
10307
- title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10308
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10309
- className: DashedUnderlineSpanStyle,
10310
- style: showDashedUnderline ? void 0 : {
10311
- borderBottom: "none"
10312
- },
10313
- children: `${clusterVip}:${p.nodePort}`
10404
+ content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v && v.nodePort).map((p) => {
10405
+ const address = `${clusterVip}:${p.nodePort}`;
10406
+ const link = /* @__PURE__ */ jsxRuntimeExports.jsx(Link$1, {
10407
+ href: `http://${address}`,
10408
+ target: "_blank",
10409
+ className: cx_default(ShowLinkStyle, Typo.Label.l4_regular_title),
10410
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip, {
10411
+ title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10412
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10413
+ className: DashedUnderlineSpanStyle,
10414
+ style: showDashedUnderline ? void 0 : {
10415
+ borderBottom: "none"
10416
+ },
10417
+ children: address
10418
+ })
10314
10419
  })
10315
- })
10316
- }, p.name)]);
10317
- if (content && content instanceof Array) {
10318
- const result = [];
10319
- for (let i2 = 0; i2 < content.length; i2++) {
10320
- result.push(content[i2]);
10321
- if (i2 < content.length - 1) {
10322
- result.push(", ");
10323
- }
10420
+ }, p.name || p.nodePort);
10421
+ if (!showCopyButton) {
10422
+ return link;
10324
10423
  }
10325
- content = result;
10424
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceAccessAddress, {
10425
+ copyValue: address,
10426
+ children: link
10427
+ }, p.name || p.nodePort);
10428
+ });
10429
+ if (content && content instanceof Array) {
10430
+ content = renderAccessItems(content, ", ");
10326
10431
  }
10327
10432
  break;
10328
10433
  }
@@ -10345,15 +10450,31 @@ const ServiceOutClusterAccessComponent = ({
10345
10450
  children: content
10346
10451
  });
10347
10452
  case ServiceTypeEnum.ExternalName:
10453
+ if (showCopyButton) {
10454
+ content = renderAccessItems(((_c = spec.externalIPs) == null ? void 0 : _c.map((ip) => /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceAccessAddress, {
10455
+ copyValue: ip,
10456
+ children: ip
10457
+ }, ip))) || [], breakLine ? "\n" : ", ");
10458
+ break;
10459
+ }
10348
10460
  content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
10349
10461
  useOverflow: false,
10350
- value: (_c = spec.externalIPs) == null ? void 0 : _c.join(breakLine ? "\n" : ", ")
10462
+ value: (_d = spec.externalIPs) == null ? void 0 : _d.join(breakLine ? "\n" : ", ")
10351
10463
  });
10352
10464
  break;
10353
10465
  case ServiceTypeEnum.LoadBalancer:
10466
+ if (showCopyButton) {
10467
+ content = renderAccessItems(((_f = (_e = status.loadBalancer) == null ? void 0 : _e.ingress) == null ? void 0 : _f.map(({
10468
+ ip
10469
+ }) => ip).filter((ip) => !!ip).map((ip) => /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceAccessAddress, {
10470
+ copyValue: ip,
10471
+ children: ip
10472
+ }, ip))) || [], breakLine ? "\n" : ", ");
10473
+ break;
10474
+ }
10354
10475
  content = /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
10355
10476
  useOverflow: false,
10356
- value: (_e = (_d = status.loadBalancer) == null ? void 0 : _d.ingress) == null ? void 0 : _e.map(({
10477
+ value: (_h = (_g = status.loadBalancer) == null ? void 0 : _g.ingress) == null ? void 0 : _h.map(({
10357
10478
  ip
10358
10479
  }) => ip).join(breakLine ? "\n" : ", ")
10359
10480
  });
@@ -10380,7 +10501,7 @@ const ServiceOutClusterAccessComponent = ({
10380
10501
  children: content || "-"
10381
10502
  });
10382
10503
  };
10383
- const index_1es4s7t = "";
10504
+ const index_1l1kti4 = "";
10384
10505
  const TagWrapper = "t13a6vox";
10385
10506
  const TagStyle = "t12ikbmp";
10386
10507
  const Tags = (props) => {
@@ -10646,67 +10767,53 @@ function immutableSet(obj, path2, value2) {
10646
10767
  return setWith(clone(obj), path2, value2, clone);
10647
10768
  }
10648
10769
  function usePathMap(options) {
10649
- const { pathMap, transformInitValues: transformInitValuesFromOptions, transformApplyValues: transformApplyValuesFromOptions } = options;
10650
- const transformInitValues = useCallback((values) => {
10651
- const initValues = values._rawYaml || values;
10652
- let result = initValues;
10653
- for (const { from, to } of pathMap || []) {
10654
- result = immutableSet(initValues, to, get$2(initValues, from));
10655
- const fromPath = [...from];
10656
- const lastKey = fromPath.pop();
10657
- if (lastKey) {
10658
- const obj = get$2(result, fromPath);
10659
- if (obj && typeof obj === "object") {
10660
- delete obj[lastKey];
10661
- }
10662
- }
10663
- }
10664
- return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10665
- }, [transformInitValuesFromOptions, pathMap]);
10666
- const transformApplyValues = useCallback((values) => {
10667
- let result = values;
10668
- for (const { from, to } of pathMap || []) {
10669
- result = immutableSet(
10670
- values,
10671
- from,
10672
- get$2(result, to)
10673
- );
10674
- const toPath = [...to];
10675
- const lastKey = toPath.pop();
10676
- if (lastKey) {
10677
- const obj = get$2(result, toPath);
10678
- if (obj && typeof obj === "object") {
10679
- delete obj[lastKey];
10770
+ const {
10771
+ pathMap,
10772
+ transformInitValues: transformInitValuesFromOptions,
10773
+ transformApplyValues: transformApplyValuesFromOptions
10774
+ } = options;
10775
+ const transformInitValues = useCallback(
10776
+ (values) => {
10777
+ const initValues = values._rawYaml || values;
10778
+ let result = initValues;
10779
+ for (const { from, to } of pathMap || []) {
10780
+ result = immutableSet(initValues, to, get$2(initValues, from));
10781
+ const fromPath = [...from];
10782
+ const lastKey = fromPath.pop();
10783
+ if (lastKey) {
10784
+ const obj = get$2(result, fromPath);
10785
+ if (obj && typeof obj === "object") {
10786
+ delete obj[lastKey];
10787
+ }
10680
10788
  }
10681
10789
  }
10682
- }
10683
- return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10684
- }, [transformApplyValuesFromOptions, pathMap]);
10790
+ return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10791
+ },
10792
+ [transformInitValuesFromOptions, pathMap]
10793
+ );
10794
+ const transformApplyValues = useCallback(
10795
+ (values) => {
10796
+ let result = values;
10797
+ for (const { from, to } of pathMap || []) {
10798
+ result = immutableSet(values, from, get$2(result, to));
10799
+ const toPath = [...to];
10800
+ const lastKey = toPath.pop();
10801
+ if (lastKey) {
10802
+ const obj = get$2(result, toPath);
10803
+ if (obj && typeof obj === "object") {
10804
+ delete obj[lastKey];
10805
+ }
10806
+ }
10807
+ }
10808
+ return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10809
+ },
10810
+ [transformApplyValuesFromOptions, pathMap]
10811
+ );
10685
10812
  return {
10686
10813
  transformInitValues,
10687
10814
  transformApplyValues
10688
10815
  };
10689
10816
  }
10690
- const useResourceVersionCheck = ({
10691
- queryResult
10692
- }) => {
10693
- var _a, _b, _c;
10694
- const initialResourceVersionRef = useRef();
10695
- const [isExpired, setIsExpired] = useState(false);
10696
- const currentResourceVersion = (_c = (_b = (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.metadata) == null ? void 0 : _c.resourceVersion;
10697
- useEffect(() => {
10698
- if (!currentResourceVersion)
10699
- return;
10700
- if (!initialResourceVersionRef.current) {
10701
- initialResourceVersionRef.current = currentResourceVersion;
10702
- return;
10703
- }
10704
- if (currentResourceVersion !== initialResourceVersionRef.current) {
10705
- setIsExpired(true);
10706
- }
10707
- }, [currentResourceVersion]);
10708
- return isExpired;
10709
- };
10710
10817
  function getInitialValues(resourceConfig) {
10711
10818
  return resourceConfig.initValue || {
10712
10819
  apiVersion: resourceConfig.apiVersion,
@@ -10715,42 +10822,6 @@ function getInitialValues(resourceConfig) {
10715
10822
  spec: {}
10716
10823
  };
10717
10824
  }
10718
- const button_1v659kh = "";
10719
- const WarningButtonStyle = "wwyz7ti";
10720
- const DataExpiredModal_eazxh6 = "";
10721
- const NoteStyle = "n609wlp";
10722
- function DataExpiredModal({
10723
- onAbandon
10724
- }) {
10725
- const {
10726
- t: t2
10727
- } = useTranslation();
10728
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(SmallDialog, {
10729
- title: t2("dovetail.data_expired"),
10730
- closable: false,
10731
- maskClosable: false,
10732
- cancelButtonProps: {
10733
- style: {
10734
- display: "none"
10735
- }
10736
- },
10737
- okText: t2("dovetail.abandon_edit"),
10738
- okButtonProps: {
10739
- className: WarningButtonStyle
10740
- },
10741
- onOk: (popModal) => {
10742
- popModal();
10743
- onAbandon();
10744
- },
10745
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10746
- className: Typo.Label.l2_regular,
10747
- children: t2("dovetail.data_expired_body")
10748
- }), /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10749
- className: `${Typo.Label.l2_regular} ${NoteStyle}`,
10750
- children: t2("dovetail.data_expired_note")
10751
- })]
10752
- });
10753
- }
10754
10825
  const index_az4wrx = "";
10755
10826
  const WrapperStyle$5 = "w1akirqw";
10756
10827
  const TitleStyle$2 = "t30srnq";
@@ -10790,7 +10861,7 @@ const Separator = () => {
10790
10861
  const style_1o641u6 = "";
10791
10862
  const ToolBarStyle = "t1joof7s";
10792
10863
  const ToolBarHeaderStyle = "tti58uh";
10793
- const ErrorIconStyle = "e15yt16p";
10864
+ const ErrorIconStyle$1 = "e15yt16p";
10794
10865
  const WrapperStyle$4 = "w3ccqks";
10795
10866
  const TitleStyle$1 = "t7zbd78";
10796
10867
  const IconStyle = "i1e4ouxy";
@@ -10800,278 +10871,276 @@ const ErrorWrapperStyle = "e19q2bnp";
10800
10871
  const YamlEditorStyle = "y16u5v3w";
10801
10872
  const MonacoYamlEditor$3 = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
10802
10873
  const MonacoYamlDiffEditor$2 = React.lazy(() => Promise.resolve().then(() => MonacoYamlDiffEditor$1));
10803
- const YamlEditorComponent = forwardRef(
10804
- function YamlEditorComponent2(props, ref) {
10805
- const {
10806
- title,
10807
- collapsable = true,
10808
- isDefaultCollapsed,
10809
- value: value2,
10810
- defaultValue = "",
10811
- height,
10812
- readOnly,
10813
- errorMsgs = [],
10814
- schemas,
10815
- eleRef,
10816
- className,
10817
- debounceTime,
10818
- isScrollOnFocus = true,
10819
- isHideActions = false
10820
- } = props;
10821
- const { t: t2 } = useTranslation();
10822
- const [isCollapsed, setIsCollapsed] = useState(
10823
- collapsable ? isDefaultCollapsed : false
10824
- );
10825
- const [isDiff, setIsDiff] = useState(false);
10826
- const [_value, _setValue] = useState(value2 || defaultValue);
10827
- const editorInstance = useRef();
10828
- const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
10829
- const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
10830
- const defaultValueString = useMemo(() => {
10831
- if (typeof defaultValue === "string") {
10832
- return defaultValue;
10833
- }
10834
- return yaml$2.dump(defaultValue);
10835
- }, [defaultValue]);
10836
- const _valueString = useMemo(() => {
10837
- if (typeof _value === "string") {
10838
- return _value;
10839
- }
10840
- return yaml$2.dump(_value);
10841
- }, [_value]);
10842
- const onChange = useCallback(
10843
- (newVal) => {
10844
- var _a;
10845
- _setValue(newVal);
10846
- (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10847
- },
10848
- [props.onChange]
10849
- );
10850
- const finalOnChange = useMemo(() => {
10851
- return debounceTime ? debounce(onChange, debounceTime) : onChange;
10852
- }, [onChange, debounceTime]);
10853
- const onValidate = useCallback(
10854
- (valid, schemaValid) => {
10855
- var _a;
10856
- (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10857
- },
10858
- [props.onValidate]
10859
- );
10860
- const onEditorCreate = useCallback(
10861
- (editor) => {
10862
- var _a, _b, _c;
10863
- if (editor.getValue() !== _value) {
10864
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10865
- }
10866
- (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10867
- },
10868
- [_value, props.onEditorCreate]
10869
- );
10870
- const getInstance = useCallback((ins) => {
10871
- editorInstance.current = ins;
10872
- }, []);
10873
- const getEditorValue = useCallback(() => {
10874
+ const YamlEditorComponent = forwardRef(function YamlEditorComponent2(props, ref) {
10875
+ const {
10876
+ title,
10877
+ collapsable = true,
10878
+ isDefaultCollapsed,
10879
+ value: value2,
10880
+ defaultValue = "",
10881
+ height,
10882
+ readOnly,
10883
+ errorMsgs = [],
10884
+ schemas,
10885
+ eleRef,
10886
+ className,
10887
+ debounceTime,
10888
+ isScrollOnFocus = true,
10889
+ isHideActions = false
10890
+ } = props;
10891
+ const { t: t2 } = useTranslation();
10892
+ const [isCollapsed, setIsCollapsed] = useState(
10893
+ collapsable ? isDefaultCollapsed : false
10894
+ );
10895
+ const [isDiff, setIsDiff] = useState(false);
10896
+ const [_value, _setValue] = useState(value2 || defaultValue);
10897
+ const editorInstance = useRef();
10898
+ const [copyTooltip, setCopyTooltip] = useState(t2("dovetail.copy"));
10899
+ const [resetTooltip, setResetTooltip] = useState(t2("dovetail.reset_arguments"));
10900
+ const defaultValueString = useMemo(() => {
10901
+ if (typeof defaultValue === "string") {
10902
+ return defaultValue;
10903
+ }
10904
+ return yaml$2.dump(defaultValue);
10905
+ }, [defaultValue]);
10906
+ const _valueString = useMemo(() => {
10907
+ if (typeof _value === "string") {
10908
+ return _value;
10909
+ }
10910
+ return yaml$2.dump(_value);
10911
+ }, [_value]);
10912
+ const onChange = useCallback(
10913
+ (newVal) => {
10874
10914
  var _a;
10875
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10876
- }, []);
10877
- useEffect(() => {
10878
- var _a, _b;
10879
- if (value2 !== void 0 && !isEqual$1(value2, _value)) {
10880
- const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10881
- _setValue(value2);
10882
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10915
+ _setValue(newVal);
10916
+ (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10917
+ },
10918
+ [props.onChange]
10919
+ );
10920
+ const finalOnChange = useMemo(() => {
10921
+ return debounceTime ? debounce(onChange, debounceTime) : onChange;
10922
+ }, [onChange, debounceTime]);
10923
+ const onValidate = useCallback(
10924
+ (valid, schemaValid) => {
10925
+ var _a;
10926
+ (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10927
+ },
10928
+ [props.onValidate]
10929
+ );
10930
+ const onEditorCreate = useCallback(
10931
+ (editor) => {
10932
+ var _a, _b, _c;
10933
+ if (editor.getValue() !== _value) {
10934
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10883
10935
  }
10884
- }, [value2]);
10885
- useImperativeHandle(ref, () => {
10886
- return {
10887
- setValue: _setValue,
10888
- setEditorValue: (value22) => {
10889
- var _a, _b;
10890
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10891
- },
10892
- getEditorValue,
10893
- getEditorInstance: () => editorInstance.current || null
10894
- };
10895
- });
10896
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(
10897
- "div",
10898
- {
10899
- className: cx_default(WrapperStyle$4, className),
10900
- "data-is-error": !!errorMsgs.length,
10901
- ref: eleRef,
10902
- children: [
10903
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
10904
- Space,
10905
- {
10906
- className: cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10907
- direction: "vertical",
10908
- size: 0,
10909
- children: [
10910
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { className: ToolBarHeaderStyle, children: [
10911
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 8, children: [
10912
- collapsable && /* @__PURE__ */ jsxRuntimeExports.jsx(
10913
- Icon,
10914
- {
10915
- src: HierarchyTriangleRight16GrayIcon,
10916
- hoverSrc: HierarchyTriangleRight16BlueIcon,
10917
- className: cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
10918
- iconWidth: 16,
10919
- iconHeight: 16,
10920
- onClick: () => setIsCollapsed(!isCollapsed)
10921
- }
10922
- ),
10923
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
10924
- ] }),
10925
- isHideActions ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 14, children: [
10926
- isDiff ? void 0 : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10927
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10928
- Tooltip,
10929
- {
10930
- title: isCollapsed ? "" : copyTooltip,
10931
- onVisibleChange: (visible) => {
10932
- if (!visible) {
10933
- setTimeout(() => {
10934
- setCopyTooltip(t2("dovetail.copy"));
10935
- }, 80);
10936
- }
10937
- },
10938
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10939
- Icon,
10940
- {
10941
- "data-disabled": isCollapsed,
10942
- src: ClipboardCopy16GradientGrayIcon,
10943
- hoverSrc: isCollapsed ? void 0 : ClipboardCopy16GradientBlueIcon,
10944
- className: IconStyle,
10945
- iconWidth: 16,
10946
- iconHeight: 16,
10947
- onClick: () => {
10948
- if (!isCollapsed) {
10949
- copyToClipboard(getEditorValue());
10950
- setCopyTooltip(t2("dovetail.copied"));
10951
- }
10952
- }
10953
- }
10954
- )
10955
- }
10956
- ),
10957
- /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, {}),
10958
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10959
- Tooltip,
10960
- {
10961
- title: isCollapsed ? "" : resetTooltip,
10962
- onVisibleChange: (visible) => {
10963
- if (!visible) {
10964
- setTimeout(() => {
10965
- setResetTooltip(t2("dovetail.reset_arguments"));
10966
- }, 80);
10967
- }
10968
- },
10969
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10970
- Icon,
10971
- {
10972
- "data-disabled": isCollapsed,
10973
- src: Retry16GradientGrayIcon,
10974
- hoverSrc: isCollapsed ? void 0 : Retry16GradientBlueIcon,
10975
- className: IconStyle,
10976
- iconWidth: 16,
10977
- iconHeight: 16,
10978
- onClick: () => {
10979
- var _a;
10980
- if (!isCollapsed) {
10981
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
10982
- setResetTooltip(t2("dovetail.already_reset"));
10983
- }
10984
- }
10985
- }
10986
- )
10987
- }
10988
- ),
10989
- /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, {})
10990
- ] }),
10936
+ (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10937
+ },
10938
+ [_value, props.onEditorCreate]
10939
+ );
10940
+ const getInstance = useCallback((ins) => {
10941
+ editorInstance.current = ins;
10942
+ }, []);
10943
+ const getEditorValue = useCallback(() => {
10944
+ var _a;
10945
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10946
+ }, []);
10947
+ useEffect(() => {
10948
+ var _a, _b;
10949
+ if (value2 !== void 0 && !isEqual$1(value2, _value)) {
10950
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10951
+ _setValue(value2);
10952
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10953
+ }
10954
+ }, [value2]);
10955
+ useImperativeHandle(ref, () => {
10956
+ return {
10957
+ setValue: _setValue,
10958
+ setEditorValue: (value22) => {
10959
+ var _a, _b;
10960
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10961
+ },
10962
+ getEditorValue,
10963
+ getEditorInstance: () => editorInstance.current || null
10964
+ };
10965
+ });
10966
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(
10967
+ "div",
10968
+ {
10969
+ className: cx_default(WrapperStyle$4, className),
10970
+ "data-is-error": !!errorMsgs.length,
10971
+ ref: eleRef,
10972
+ children: [
10973
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
10974
+ Space,
10975
+ {
10976
+ className: cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10977
+ direction: "vertical",
10978
+ size: 0,
10979
+ children: [
10980
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { className: ToolBarHeaderStyle, children: [
10981
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 8, children: [
10982
+ collapsable && /* @__PURE__ */ jsxRuntimeExports.jsx(
10983
+ Icon,
10984
+ {
10985
+ src: HierarchyTriangleRight16GrayIcon,
10986
+ hoverSrc: HierarchyTriangleRight16BlueIcon,
10987
+ className: cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
10988
+ iconWidth: 16,
10989
+ iconHeight: 16,
10990
+ onClick: () => setIsCollapsed(!isCollapsed)
10991
+ }
10992
+ ),
10993
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
10994
+ ] }),
10995
+ isHideActions ? null : /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { size: 14, children: [
10996
+ isDiff ? void 0 : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10991
10997
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10992
10998
  Tooltip,
10993
10999
  {
10994
- title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
10995
- children: isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11000
+ title: isCollapsed ? "" : copyTooltip,
11001
+ onVisibleChange: (visible) => {
11002
+ if (!visible) {
11003
+ setTimeout(() => {
11004
+ setCopyTooltip(t2("dovetail.copy"));
11005
+ }, 80);
11006
+ }
11007
+ },
11008
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10996
11009
  Icon,
10997
11010
  {
10998
11011
  "data-disabled": isCollapsed,
10999
- src: EditPen16GradientGrayIcon,
11000
- hoverSrc: isCollapsed ? void 0 : EditPen16GradientBlueIcon,
11012
+ src: ClipboardCopy16GradientGrayIcon,
11013
+ hoverSrc: isCollapsed ? void 0 : ClipboardCopy16GradientBlueIcon,
11001
11014
  className: IconStyle,
11002
11015
  iconWidth: 16,
11003
11016
  iconHeight: 16,
11004
- onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11017
+ onClick: () => {
11018
+ if (!isCollapsed) {
11019
+ copyToClipboard(getEditorValue());
11020
+ setCopyTooltip(t2("dovetail.copied"));
11021
+ }
11022
+ }
11023
+ }
11024
+ )
11025
+ }
11026
+ ),
11027
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, {}),
11028
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
11029
+ Tooltip,
11030
+ {
11031
+ title: isCollapsed ? "" : resetTooltip,
11032
+ onVisibleChange: (visible) => {
11033
+ if (!visible) {
11034
+ setTimeout(() => {
11035
+ setResetTooltip(t2("dovetail.reset_arguments"));
11036
+ }, 80);
11005
11037
  }
11006
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
11038
+ },
11039
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11007
11040
  Icon,
11008
11041
  {
11009
11042
  "data-disabled": isCollapsed,
11010
- src: Showdiff16GradientGrayIcon,
11011
- hoverSrc: isCollapsed ? void 0 : Showdiff16GradientBlueIcon,
11043
+ src: Retry16GradientGrayIcon,
11044
+ hoverSrc: isCollapsed ? void 0 : Retry16GradientBlueIcon,
11012
11045
  className: IconStyle,
11013
11046
  iconWidth: 16,
11014
11047
  iconHeight: 16,
11015
- onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11048
+ onClick: () => {
11049
+ var _a;
11050
+ if (!isCollapsed) {
11051
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
11052
+ setResetTooltip(t2("dovetail.already_reset"));
11053
+ }
11054
+ }
11016
11055
  }
11017
11056
  )
11018
11057
  }
11019
- )
11020
- ] })
11021
- ] }),
11022
- errorMsgs.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11023
- /* @__PURE__ */ jsxRuntimeExports.jsx(XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle }),
11024
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11025
- errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11026
- errorMsg
11027
- ] }, errorMsg)) })
11028
- ] }) : void 0
11029
- ]
11030
- }
11031
- ),
11032
- /* @__PURE__ */ jsxRuntimeExports.jsxs(
11033
- "div",
11034
- {
11035
- style: {
11036
- display: isCollapsed ? "none" : "block",
11037
- width: "100%",
11038
- height: height || "500px",
11039
- zIndex: 1
11040
- },
11041
- children: [
11042
- /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11043
- MonacoYamlEditor$3,
11044
- {
11045
- id: props.id,
11046
- getInstance,
11047
- defaultValue: _value,
11048
- height,
11049
- onChange: finalOnChange,
11050
- onValidate,
11051
- onEditorCreate,
11052
- onBlur: props.onBlur,
11053
- schemas,
11054
- readOnly,
11055
- isScrollOnFocus
11056
- }
11057
- ) }) }),
11058
- isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11059
- MonacoYamlDiffEditor$2,
11060
- {
11061
- id: props.id,
11062
- origin: defaultValueString,
11063
- modified: _valueString,
11064
- height
11065
- }
11066
- ) }) : null
11067
- ]
11068
- }
11069
- )
11070
- ]
11071
- }
11072
- );
11073
- }
11074
- );
11058
+ ),
11059
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Separator, {})
11060
+ ] }),
11061
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
11062
+ Tooltip,
11063
+ {
11064
+ title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
11065
+ children: isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11066
+ Icon,
11067
+ {
11068
+ "data-disabled": isCollapsed,
11069
+ src: EditPen16GradientGrayIcon,
11070
+ hoverSrc: isCollapsed ? void 0 : EditPen16GradientBlueIcon,
11071
+ className: IconStyle,
11072
+ iconWidth: 16,
11073
+ iconHeight: 16,
11074
+ onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11075
+ }
11076
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(
11077
+ Icon,
11078
+ {
11079
+ "data-disabled": isCollapsed,
11080
+ src: Showdiff16GradientGrayIcon,
11081
+ hoverSrc: isCollapsed ? void 0 : Showdiff16GradientBlueIcon,
11082
+ className: IconStyle,
11083
+ iconWidth: 16,
11084
+ iconHeight: 16,
11085
+ onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11086
+ }
11087
+ )
11088
+ }
11089
+ )
11090
+ ] })
11091
+ ] }),
11092
+ errorMsgs.length ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11093
+ /* @__PURE__ */ jsxRuntimeExports.jsx(XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle$1 }),
11094
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11095
+ errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11096
+ errorMsg
11097
+ ] }, errorMsg)) })
11098
+ ] }) : void 0
11099
+ ]
11100
+ }
11101
+ ),
11102
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
11103
+ "div",
11104
+ {
11105
+ style: {
11106
+ display: isCollapsed ? "none" : "block",
11107
+ width: "100%",
11108
+ height: height || "500px",
11109
+ zIndex: 1
11110
+ },
11111
+ children: [
11112
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11113
+ MonacoYamlEditor$3,
11114
+ {
11115
+ id: props.id,
11116
+ getInstance,
11117
+ defaultValue: _value,
11118
+ height,
11119
+ onChange: finalOnChange,
11120
+ onValidate,
11121
+ onEditorCreate,
11122
+ onBlur: props.onBlur,
11123
+ schemas,
11124
+ readOnly,
11125
+ isScrollOnFocus
11126
+ }
11127
+ ) }) }),
11128
+ isDiff ? /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
11129
+ MonacoYamlDiffEditor$2,
11130
+ {
11131
+ id: props.id,
11132
+ origin: defaultValueString,
11133
+ modified: _valueString,
11134
+ height
11135
+ }
11136
+ ) }) : null
11137
+ ]
11138
+ }
11139
+ )
11140
+ ]
11141
+ }
11142
+ );
11143
+ });
11075
11144
  function copyToClipboard(text) {
11076
11145
  const input = document.createElement("textarea");
11077
11146
  input.value = text;
@@ -11080,17 +11149,71 @@ function copyToClipboard(text) {
11080
11149
  document.execCommand("copy");
11081
11150
  document.body.removeChild(input);
11082
11151
  }
11152
+ const useGlobalStore = (name2 = "default") => {
11153
+ const globalStores = useContext(GlobalStoreContext);
11154
+ return globalStores[name2];
11155
+ };
11156
+ const ResourceVersionConflictRetryContext = createContext(null);
11157
+ function Retry409Provider({
11158
+ children
11159
+ }) {
11160
+ const initialResourceRef = useRef();
11161
+ return createElement(
11162
+ ResourceVersionConflictRetryContext.Provider,
11163
+ {
11164
+ value: initialResourceRef
11165
+ },
11166
+ children
11167
+ );
11168
+ }
11169
+ function use409Retry({
11170
+ action,
11171
+ dataProviderName,
11172
+ id,
11173
+ mutationMeta
11174
+ }) {
11175
+ const { t: t2 } = useTranslation();
11176
+ const globalStore = useGlobalStore(dataProviderName);
11177
+ const sharedInitialResourceRef = useContext(ResourceVersionConflictRetryContext);
11178
+ const localInitialResourceRef = useRef();
11179
+ const initialResourceRef = sharedInitialResourceRef || localInitialResourceRef;
11180
+ const isEditAction = action === "edit" || !!id;
11181
+ const captureInitialResource = useCallback((resource) => {
11182
+ var _a;
11183
+ if (!isEditAction || initialResourceRef.current || !resource) {
11184
+ return;
11185
+ }
11186
+ const rawResource = (_a = globalStore == null ? void 0 : globalStore.restoreItem) == null ? void 0 : _a.call(globalStore, resource);
11187
+ if (!rawResource) {
11188
+ return;
11189
+ }
11190
+ initialResourceRef.current = cloneDeep(rawResource);
11191
+ }, [globalStore, initialResourceRef, isEditAction]);
11192
+ const retryMutationMeta = useMemo(() => {
11193
+ const restMutationMeta = omit$1(mutationMeta, "resourceVersionConflictRetry");
11194
+ if (!isEditAction) {
11195
+ return restMutationMeta;
11196
+ }
11197
+ return {
11198
+ ...restMutationMeta,
11199
+ resourceVersionConflictRetry: {
11200
+ // refine 的 mutationMeta 在 hook 创建时就会固定;用 getter 让 provider 在保存瞬间读取最新的初始版本。
11201
+ get initialResource() {
11202
+ return initialResourceRef.current;
11203
+ },
11204
+ conflictMessage: t2("dovetail.resource_version_conflict")
11205
+ }
11206
+ };
11207
+ }, [initialResourceRef, isEditAction, mutationMeta, t2]);
11208
+ return {
11209
+ captureInitialResource,
11210
+ mutationMeta: retryMutationMeta
11211
+ };
11212
+ }
11083
11213
  function useK8sYamlEditor() {
11084
11214
  const foldSymbol = useCallback(function(editor, symbol) {
11085
11215
  const model = editor.getModel();
11086
- const matchs = (model == null ? void 0 : model.findMatches(
11087
- symbol,
11088
- false,
11089
- false,
11090
- false,
11091
- "",
11092
- false
11093
- ).filter((match) => match.range.startColumn === 1)) || [];
11216
+ const matchs = (model == null ? void 0 : model.findMatches(symbol, false, false, false, "", false).filter((match) => match.range.startColumn === 1)) || [];
11094
11217
  return new Promise(async (resolve, reject) => {
11095
11218
  try {
11096
11219
  for (const match of matchs) {
@@ -11104,19 +11227,22 @@ function useK8sYamlEditor() {
11104
11227
  }
11105
11228
  });
11106
11229
  }, []);
11107
- const fold2 = useCallback(async function(editor) {
11108
- await editor.getAction("editor.unfoldAll").run();
11109
- const symbols = [
11110
- " annotations:",
11111
- " managedFields:",
11112
- "status:",
11113
- " kubectl.kubernetes.io/last-applied-configuration:"
11114
- ];
11115
- for (const symbol of symbols) {
11116
- await foldSymbol(editor, symbol);
11117
- }
11118
- editor.setScrollPosition({ scrollTop: 0 });
11119
- }, [foldSymbol]);
11230
+ const fold2 = useCallback(
11231
+ async function(editor) {
11232
+ await editor.getAction("editor.unfoldAll").run();
11233
+ const symbols = [
11234
+ " annotations:",
11235
+ " managedFields:",
11236
+ "status:",
11237
+ " kubectl.kubernetes.io/last-applied-configuration:"
11238
+ ];
11239
+ for (const symbol of symbols) {
11240
+ await foldSymbol(editor, symbol);
11241
+ }
11242
+ editor.setScrollPosition({ scrollTop: 0 });
11243
+ },
11244
+ [foldSymbol]
11245
+ );
11120
11246
  return {
11121
11247
  fold: fold2
11122
11248
  };
@@ -11190,10 +11316,6 @@ function generateYamlBySchema(defaultValue, schema) {
11190
11316
  const content = yaml$2.dump(merged);
11191
11317
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
11192
11318
  }
11193
- const useGlobalStore = (name2 = "default") => {
11194
- const globalStores = useContext(GlobalStoreContext);
11195
- return globalStores[name2];
11196
- };
11197
11319
  const useYamlForm = ({
11198
11320
  action: actionFromProps,
11199
11321
  resource,
@@ -11231,7 +11353,7 @@ const useYamlForm = ({
11231
11353
  onSubmitAbort,
11232
11354
  rules
11233
11355
  } = {}) => {
11234
- var _a;
11356
+ var _a, _b;
11235
11357
  const editor = useRef(null);
11236
11358
  const { t: t2 } = useTranslation();
11237
11359
  const [isYamlValid, setIsYamlValid] = useState(true);
@@ -11242,7 +11364,17 @@ const useYamlForm = ({
11242
11364
  const [beforeSubmitErrors, setBeforeSubmitErrors] = useState([]);
11243
11365
  const [errorResponseBody, setErrorResponseBody] = useState(null);
11244
11366
  const useResourceResult = useResource();
11245
- const globalStore = useGlobalStore();
11367
+ const globalStore = useGlobalStore(dataProviderName);
11368
+ const action = useMemo(
11369
+ () => actionFromProps || useResourceResult.action,
11370
+ [actionFromProps, useResourceResult.action]
11371
+ );
11372
+ const { captureInitialResource, mutationMeta: finalMutationMeta } = use409Retry({
11373
+ action,
11374
+ dataProviderName,
11375
+ id: idFromProps,
11376
+ mutationMeta
11377
+ });
11246
11378
  const {
11247
11379
  schema,
11248
11380
  loading: isLoadingSchema,
@@ -11279,7 +11411,7 @@ const useYamlForm = ({
11279
11411
  meta: pickNotDeprecated(meta, metaData),
11280
11412
  metaData: pickNotDeprecated(meta, metaData),
11281
11413
  queryMeta,
11282
- mutationMeta,
11414
+ mutationMeta: finalMutationMeta,
11283
11415
  liveMode,
11284
11416
  liveParams,
11285
11417
  mutationMode,
@@ -11294,12 +11426,12 @@ const useYamlForm = ({
11294
11426
  overtimeOptions
11295
11427
  });
11296
11428
  const { formLoading, onFinish, queryResult } = useFormCoreResult;
11429
+ useEffect(() => {
11430
+ var _a2;
11431
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
11432
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
11297
11433
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
11298
11434
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
11299
- const action = useMemo(
11300
- () => actionFromProps || useResourceResult.action,
11301
- [actionFromProps, useResourceResult.action]
11302
- );
11303
11435
  const initialValues = useMemo(() => {
11304
11436
  var _a2;
11305
11437
  const initialValues2 = (action === "edit" && ((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) ? initialValuesForEdit || (globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data)) : initialValuesForCreate) || {};
@@ -11307,7 +11439,14 @@ const useYamlForm = ({
11307
11439
  pruneBeforeEdit(initialValues2);
11308
11440
  }
11309
11441
  return (transformInitValues == null ? void 0 : transformInitValues(initialValues2)) || initialValues2;
11310
- }, [queryResult, globalStore, initialValuesForCreate, action, initialValuesForEdit, transformInitValues]);
11442
+ }, [
11443
+ queryResult,
11444
+ globalStore,
11445
+ initialValuesForCreate,
11446
+ action,
11447
+ initialValuesForEdit,
11448
+ transformInitValues
11449
+ ]);
11311
11450
  const finalErrors = useMemo(() => {
11312
11451
  return uniq([...editorErrors, ...rulesErrors]);
11313
11452
  }, [editorErrors, rulesErrors]);
@@ -11342,10 +11481,10 @@ const useYamlForm = ({
11342
11481
  }
11343
11482
  },
11344
11483
  onEditorCreate(editorInstance) {
11345
- var _a3, _b;
11484
+ var _a3, _b2;
11346
11485
  const editorValue = yaml$2.dump(initialValues);
11347
11486
  (_a3 = editor.current) == null ? void 0 : _a3.setEditorValue(editorValue);
11348
- (_b = editor.current) == null ? void 0 : _b.setValue(editorValue);
11487
+ (_b2 = editor.current) == null ? void 0 : _b2.setValue(editorValue);
11349
11488
  if (action === "edit") {
11350
11489
  fold2(editorInstance);
11351
11490
  }
@@ -11358,7 +11497,7 @@ const useYamlForm = ({
11358
11497
  initialValues,
11359
11498
  schemas,
11360
11499
  resource,
11361
- (_a = useResourceResult.resource) == null ? void 0 : _a.name,
11500
+ (_b = useResourceResult.resource) == null ? void 0 : _b.name,
11362
11501
  action,
11363
11502
  finalErrors,
11364
11503
  fold2
@@ -11398,7 +11537,7 @@ const useYamlForm = ({
11398
11537
  formProps: {
11399
11538
  ...formSF.formProps,
11400
11539
  onFinish: async (values) => {
11401
- var _a2, _b;
11540
+ var _a2, _b2;
11402
11541
  setBeforeSubmitErrors([]);
11403
11542
  onSubmitStart == null ? void 0 : onSubmitStart();
11404
11543
  const errors = [
@@ -11418,19 +11557,22 @@ const useYamlForm = ({
11418
11557
  return;
11419
11558
  }
11420
11559
  try {
11421
- const objectValues = editor.current ? yaml$2.load(((_b = editor.current) == null ? void 0 : _b.getEditorValue()) || "") : values;
11560
+ const objectValues = editor.current ? yaml$2.load(((_b2 = editor.current) == null ? void 0 : _b2.getEditorValue()) || "") : values;
11422
11561
  let finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
11423
11562
  if (beforeSubmit) {
11424
11563
  try {
11425
11564
  let hasErrors = false;
11426
11565
  setIsBeforeSubmitLoading(true);
11427
- const result = await beforeSubmit(finalValues, (errors2) => {
11428
- if (errors2 && errors2.length > 0) {
11429
- setBeforeSubmitErrors(errors2);
11430
- onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11431
- hasErrors = true;
11566
+ const result = await beforeSubmit(
11567
+ finalValues,
11568
+ (errors2) => {
11569
+ if (errors2 && errors2.length > 0) {
11570
+ setBeforeSubmitErrors(errors2);
11571
+ onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11572
+ hasErrors = true;
11573
+ }
11432
11574
  }
11433
- });
11575
+ );
11434
11576
  if (hasErrors) {
11435
11577
  onSubmitAbort == null ? void 0 : onSubmitAbort();
11436
11578
  return;
@@ -11520,6 +11662,7 @@ function YamlForm(props) {
11520
11662
  id,
11521
11663
  action: actionFromProps,
11522
11664
  resource: resource == null ? void 0 : resource.name,
11665
+ dataProviderName: resourceConfig.dataProviderName,
11523
11666
  editorOptions: {
11524
11667
  isSkipSchema: schemaStrategy === "None"
11525
11668
  /* None */
@@ -11642,31 +11785,6 @@ function YamlFormContainer({
11642
11785
  onSaveButtonPropsChange
11643
11786
  }) {
11644
11787
  const action = id ? "edit" : "create";
11645
- const pushModal = usePushModal();
11646
- const popModal = usePopModal();
11647
- const hasShownExpiredRef = useRef(false);
11648
- const [isSubmitting, setIsSubmitting] = useState(false);
11649
- const queryResult = useOne({
11650
- resource: resourceConfig.name,
11651
- id,
11652
- liveMode: id ? "auto" : "off",
11653
- queryOptions: { enabled: !!id }
11654
- });
11655
- const isExpired = useResourceVersionCheck({ queryResult });
11656
- useEffect(() => {
11657
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
11658
- return;
11659
- }
11660
- hasShownExpiredRef.current = true;
11661
- pushModal({
11662
- component: DataExpiredModal,
11663
- props: {
11664
- onAbandon: () => {
11665
- popModal();
11666
- }
11667
- }
11668
- });
11669
- }, [isExpired, isSubmitting, pushModal, popModal]);
11670
11788
  const { transformInitValues, transformApplyValues } = usePathMap({
11671
11789
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
11672
11790
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
@@ -11686,13 +11804,7 @@ function YamlFormContainer({
11686
11804
  action,
11687
11805
  isShowLayout: false,
11688
11806
  useFormProps: {
11689
- redirect: false,
11690
- onSubmitStart: () => {
11691
- setIsSubmitting(true);
11692
- },
11693
- onSubmitAbort: () => {
11694
- setIsSubmitting(false);
11695
- }
11807
+ redirect: false
11696
11808
  },
11697
11809
  rules: void 0,
11698
11810
  onSaveButtonPropsChange,
@@ -11800,6 +11912,7 @@ function RawYamlFormModal(props) {
11800
11912
  },
11801
11913
  okText: ((_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText) || okText,
11802
11914
  destroyOnClose: true,
11915
+ isContentFull: true,
11803
11916
  children: [desc ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
11804
11917
  className: FormDescStyle$1,
11805
11918
  children: desc
@@ -11842,8 +11955,9 @@ function useOpenForm() {
11842
11955
  if (formType === void 0 || formType === FormContainerType.MODAL) {
11843
11956
  pushModal({
11844
11957
  component: () => {
11845
- var _a2;
11846
- if (options == null ? void 0 : options.useYamlEditor) {
11958
+ var _a2, _b2, _c;
11959
+ const isYamlOnlyForm = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formType) !== FormType.FORM && !((_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.CustomFormModal);
11960
+ if ((options == null ? void 0 : options.useYamlEditor) || isYamlOnlyForm) {
11847
11961
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
11848
11962
  RawYamlFormModal,
11849
11963
  {
@@ -11856,7 +11970,7 @@ function useOpenForm() {
11856
11970
  }
11857
11971
  );
11858
11972
  }
11859
- const ModalComponent = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
11973
+ const ModalComponent = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.CustomFormModal) || FormModal;
11860
11974
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
11861
11975
  ModalComponent,
11862
11976
  {
@@ -12376,34 +12490,6 @@ function CreateButton(props) {
12376
12490
  }
12377
12491
  );
12378
12492
  }
12379
- const useDeleteManyModal = (resource, ids) => {
12380
- const { mutate } = useDeleteMany();
12381
- const [visible, setVisible] = useState(false);
12382
- const { t: t2 } = useTranslation();
12383
- const modalProps = {
12384
- title: t2("dovetail.delete"),
12385
- okText: t2("dovetail.delete"),
12386
- okButtonProps: {
12387
- danger: true
12388
- },
12389
- cancelText: t2("dovetail.cancel"),
12390
- children: t2("dovetail.confirm_delete_text", {
12391
- target: ids,
12392
- interpolation: { escapeValue: false }
12393
- }),
12394
- onOk() {
12395
- mutate({
12396
- resource,
12397
- ids
12398
- });
12399
- setVisible(false);
12400
- },
12401
- onCancel() {
12402
- setVisible(false);
12403
- }
12404
- };
12405
- return { modalProps, visible, setVisible };
12406
- };
12407
12493
  const DeleteManyButton = (props) => {
12408
12494
  const { resource } = useResource();
12409
12495
  const { t: t2 } = useTranslation();
@@ -12707,94 +12793,109 @@ const ResourceLink = (props) => {
12707
12793
  value: ""
12708
12794
  });
12709
12795
  };
12710
- const IngressRulesTable = ({ ingress }) => {
12711
- const { t: t2 } = useTranslation();
12712
- const { data: serviceData } = useList({
12796
+ const IngressRulesTable_1nylejt = "";
12797
+ const PathCellStyle = "pmi0ggi";
12798
+ const PathTextStyle = "p1gmjxeo";
12799
+ const PathCopyStyle = "p1379cb5";
12800
+ const IngressRulesTable = ({
12801
+ ingress: ingress2
12802
+ }) => {
12803
+ const {
12804
+ t: t2
12805
+ } = useTranslation();
12806
+ const {
12807
+ data: serviceData
12808
+ } = useList({
12713
12809
  resource: "services",
12714
12810
  meta: {
12715
12811
  kind: "Service",
12716
12812
  apiVersion: "v1"
12717
12813
  }
12718
12814
  });
12719
- const flattenedRules = useMemo(
12720
- () => (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [],
12721
- [serviceData == null ? void 0 : serviceData.data, ingress]
12722
- );
12815
+ const flattenedRules = useMemo(() => (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [], [serviceData == null ? void 0 : serviceData.data, ingress2]);
12723
12816
  const rows = useMemo(() => {
12724
12817
  return addId(flattenedRules || [], "fullPath");
12725
12818
  }, [flattenedRules]);
12726
12819
  const component = useContext(ComponentContext);
12727
12820
  const Table2 = component.Table || Table$1;
12728
12821
  const currentSize = 10;
12729
- const columns = [
12730
- {
12731
- key: "pathType",
12732
- display: true,
12733
- dataIndex: "pathType",
12734
- title: t2("dovetail.path_type"),
12735
- width: 160,
12736
- sortable: true
12737
- },
12738
- {
12739
- key: "fullPath",
12740
- display: true,
12741
- dataIndex: "fullPath",
12742
- title: t2("dovetail.path"),
12743
- width: 478,
12744
- sortable: true,
12745
- render(value2) {
12746
- return /* @__PURE__ */ jsxRuntimeExports.jsx(LinkFallback, { fullPath: value2 });
12747
- }
12748
- },
12749
- {
12750
- key: "serviceName",
12751
- display: true,
12752
- dataIndex: "serviceName",
12753
- title: t2("dovetail.target_service"),
12754
- sortable: true,
12755
- width: 160,
12756
- render: (serviceName, record) => {
12757
- return record.serviceName ? /* @__PURE__ */ jsxRuntimeExports.jsx(
12758
- ResourceLink,
12759
- {
12760
- resourceName: "services",
12761
- namespace: ingress.metadata.namespace || "default",
12762
- name: serviceName
12763
- }
12764
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12822
+ const columns = [{
12823
+ key: "pathType",
12824
+ display: true,
12825
+ dataIndex: "pathType",
12826
+ title: t2("dovetail.path_type"),
12827
+ width: 160,
12828
+ sortable: true
12829
+ }, {
12830
+ key: "fullPath",
12831
+ display: true,
12832
+ dataIndex: "fullPath",
12833
+ title: t2("dovetail.path"),
12834
+ width: 478,
12835
+ sortable: true,
12836
+ render(value2) {
12837
+ if (!value2) {
12838
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
12839
+ value: ""
12840
+ });
12765
12841
  }
12766
- },
12767
- {
12768
- key: "servicePort",
12769
- display: true,
12770
- dataIndex: "servicePort",
12771
- title: t2("dovetail.target_service_port"),
12772
- width: 120,
12773
- sortable: true
12774
- },
12775
- {
12776
- key: "secret",
12777
- display: true,
12778
- dataIndex: "host",
12779
- title: t2("dovetail.cert"),
12780
- width: 160,
12781
- render(host2) {
12782
- var _a, _b;
12783
- const secretName = (_b = (_a = ingress._rawYaml.spec.tls) == null ? void 0 : _a.find(
12784
- ({ hosts }) => hosts == null ? void 0 : hosts.includes(host2)
12785
- )) == null ? void 0 : _b.secretName;
12786
- return secretName ? /* @__PURE__ */ jsxRuntimeExports.jsx(
12787
- ResourceLink,
12788
- {
12789
- resourceName: "secrets",
12790
- namespace: ingress.metadata.namespace || "default",
12791
- name: secretName
12792
- }
12793
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12794
- },
12795
- sortable: true
12842
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
12843
+ className: PathCellStyle,
12844
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
12845
+ className: PathTextStyle,
12846
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(LinkFallback, {
12847
+ fullPath: value2
12848
+ })
12849
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(CopyButton, {
12850
+ value: value2,
12851
+ className: PathCopyStyle
12852
+ })]
12853
+ });
12854
+ }
12855
+ }, {
12856
+ key: "serviceName",
12857
+ display: true,
12858
+ dataIndex: "serviceName",
12859
+ title: t2("dovetail.target_service"),
12860
+ sortable: true,
12861
+ width: 160,
12862
+ render: (serviceName, record) => {
12863
+ return record.serviceName ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
12864
+ resourceName: "services",
12865
+ namespace: ingress2.metadata.namespace || "default",
12866
+ name: serviceName
12867
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
12868
+ value: ""
12869
+ });
12796
12870
  }
12797
- ];
12871
+ }, {
12872
+ key: "servicePort",
12873
+ display: true,
12874
+ dataIndex: "servicePort",
12875
+ title: t2("dovetail.target_service_port"),
12876
+ width: 120,
12877
+ sortable: true
12878
+ }, {
12879
+ key: "secret",
12880
+ display: true,
12881
+ dataIndex: "host",
12882
+ title: t2("dovetail.cert"),
12883
+ width: 160,
12884
+ render(host2) {
12885
+ var _a, _b;
12886
+ const secretName = (_b = (_a = ingress2._rawYaml.spec.tls) == null ? void 0 : _a.find(({
12887
+ hosts
12888
+ }) => hosts == null ? void 0 : hosts.includes(host2))) == null ? void 0 : _b.secretName;
12889
+ return secretName ? /* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
12890
+ resourceName: "secrets",
12891
+ namespace: ingress2.metadata.namespace || "default",
12892
+ name: secretName
12893
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
12894
+ value: ""
12895
+ });
12896
+ },
12897
+ sortable: true
12898
+ }];
12798
12899
  const {
12799
12900
  data: finalData,
12800
12901
  currentPage,
@@ -12805,31 +12906,27 @@ const IngressRulesTable = ({ ingress }) => {
12805
12906
  data: rows
12806
12907
  });
12807
12908
  if ((rows == null ? void 0 : rows.length) === 0) {
12808
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
12809
- WidgetErrorContent,
12810
- {
12811
- errorText: t2("dovetail.no_resource", { kind: t2("dovetail.rule") }),
12812
- type: ErrorContentType.List
12813
- }
12814
- );
12909
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
12910
+ errorText: t2("dovetail.no_resource", {
12911
+ kind: t2("dovetail.rule")
12912
+ }),
12913
+ type: ErrorContentType.List
12914
+ });
12815
12915
  }
12816
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
12817
- Table2,
12818
- {
12819
- tableKey: "ingressRules",
12820
- loading: false,
12821
- data: finalData,
12822
- total: rows.length,
12823
- columns: addDefaultRenderToColumns(columns),
12824
- rowKey: "pathType",
12825
- empty: t2("dovetail.empty"),
12826
- defaultSize: currentSize,
12827
- currentPage,
12828
- onPageChange,
12829
- onSorterChange,
12830
- showMenuColumn: false
12831
- }
12832
- );
12916
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Table2, {
12917
+ tableKey: "ingressRules",
12918
+ loading: false,
12919
+ data: finalData,
12920
+ total: rows.length,
12921
+ columns: addDefaultRenderToColumns(columns),
12922
+ rowKey: "pathType",
12923
+ empty: t2("dovetail.empty"),
12924
+ defaultSize: currentSize,
12925
+ currentPage,
12926
+ onPageChange,
12927
+ onSorterChange,
12928
+ showMenuColumn: false
12929
+ });
12833
12930
  };
12834
12931
  const KeyValue_1qasuz9 = "";
12835
12932
  const ContentBlockStyle = "c8jy7dc";
@@ -12958,9 +13055,7 @@ function readFileAsBase64(file) {
12958
13055
  if (isUtf8(arrayBuffer)) {
12959
13056
  resolve(await file.text());
12960
13057
  } else {
12961
- const base64String = btoa(
12962
- String.fromCharCode(...new Uint8Array(arrayBuffer))
12963
- );
13058
+ const base64String = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
12964
13059
  resolve(base64String);
12965
13060
  }
12966
13061
  return;
@@ -12971,31 +13066,63 @@ function readFileAsBase64(file) {
12971
13066
  reader.readAsArrayBuffer(file);
12972
13067
  });
12973
13068
  }
12974
- const LabelFormatPopover_piveun = "";
12975
- const PodLabelFormatRulePopoverStyle = "p5jt6nm";
12976
- const LabelFormatPopover = ({
12977
- noValueValidation
12978
- }) => {
12979
- const {
12980
- t: t2
12981
- } = useTranslation();
12982
- const data2 = [{
12983
- object: t2("dovetail.key"),
12984
- contains: t2("dovetail.prefix"),
12985
- optional: t2("dovetail.no"),
12986
- rule: [t2("dovetail.prefix_format_rule_1"), t2("dovetail.prefix_format_rule_2"), t2("dovetail.prefix_format_rule_3")]
12987
- }, {
12988
- object: t2("dovetail.key"),
12989
- contains: t2("dovetail.name"),
12990
- optional: t2("dovetail.yes"),
12991
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
12992
- }];
13069
+ const FormatRulePopover_1b8vyke = "";
13070
+ const FormatRulePopoverStyle = "f1eyh8ow";
13071
+ const FormatRulePopover = ({
13072
+ buttonText,
13073
+ columns,
13074
+ dataSource
13075
+ }) => /* @__PURE__ */ jsxRuntimeExports.jsx(Popover, {
13076
+ trigger: "click",
13077
+ overlayClassName: FormatRulePopoverStyle,
13078
+ placement: "bottomRight",
13079
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx(AntdTable, {
13080
+ bordered: true,
13081
+ dataSource,
13082
+ columns,
13083
+ pagination: false,
13084
+ rowKey: (_, index2) => String(index2)
13085
+ }),
13086
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
13087
+ size: "small",
13088
+ type: "link",
13089
+ children: buttonText
13090
+ })
13091
+ });
13092
+ const LabelFormatPopover = ({ noValueValidation }) => {
13093
+ const { t: t2 } = useTranslation();
13094
+ const data2 = [
13095
+ {
13096
+ object: t2("dovetail.key"),
13097
+ contains: t2("dovetail.prefix"),
13098
+ optional: t2("dovetail.no"),
13099
+ rule: [
13100
+ t2("dovetail.prefix_format_rule_1"),
13101
+ t2("dovetail.prefix_format_rule_2"),
13102
+ t2("dovetail.prefix_format_rule_3")
13103
+ ]
13104
+ },
13105
+ {
13106
+ object: t2("dovetail.key"),
13107
+ contains: t2("dovetail.name"),
13108
+ optional: t2("dovetail.yes"),
13109
+ rule: [
13110
+ t2("dovetail.name_format_rule_1"),
13111
+ t2("dovetail.name_format_rule_2"),
13112
+ t2("dovetail.name_format_rule_3")
13113
+ ]
13114
+ }
13115
+ ];
12993
13116
  if (!noValueValidation) {
12994
13117
  data2.push({
12995
13118
  object: t2("dovetail.value"),
12996
13119
  contains: t2("dovetail.name"),
12997
13120
  optional: t2("dovetail.no"),
12998
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
13121
+ rule: [
13122
+ t2("dovetail.name_format_rule_1"),
13123
+ t2("dovetail.name_format_rule_2"),
13124
+ t2("dovetail.name_format_rule_3")
13125
+ ]
12999
13126
  });
13000
13127
  } else {
13001
13128
  data2.push({
@@ -13005,57 +13132,42 @@ const LabelFormatPopover = ({
13005
13132
  rule: [t2("dovetail.no_limitation_rule")]
13006
13133
  });
13007
13134
  }
13008
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Popover, {
13009
- trigger: "click",
13010
- overlayClassName: PodLabelFormatRulePopoverStyle,
13011
- placement: "bottomRight",
13012
- content: /* @__PURE__ */ jsxRuntimeExports.jsx(AntdTable, {
13013
- bordered: true,
13135
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
13136
+ FormatRulePopover,
13137
+ {
13138
+ buttonText: t2("dovetail.look_format_requirement"),
13014
13139
  dataSource: data2,
13015
- columns: [{
13016
- key: "object",
13017
- title: t2("dovetail.object"),
13018
- dataIndex: "object",
13019
- render: (cell, record, index2) => {
13020
- return {
13021
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
13022
- className: Typo.Label.l4_bold,
13023
- children: cell
13024
- }),
13140
+ columns: [
13141
+ {
13142
+ key: "object",
13143
+ title: t2("dovetail.object"),
13144
+ dataIndex: "object",
13145
+ render: (cell, _record, index2) => ({
13146
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: Typo.Label.l4_bold, children: cell }),
13025
13147
  props: {
13026
13148
  rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
13027
13149
  }
13028
- };
13029
- }
13030
- }, {
13031
- key: "contains",
13032
- title: t2("dovetail.contains"),
13033
- dataIndex: "contains"
13034
- }, {
13035
- key: "optional",
13036
- title: t2("dovetail.optional"),
13037
- dataIndex: "optional"
13038
- }, {
13039
- key: "rule",
13040
- title: t2("dovetail.format_requirements"),
13041
- dataIndex: "rule",
13042
- render: (cell) => {
13043
- return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
13044
- className: "rule-list",
13045
- children: cell.map((rule2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
13046
- children: rule2
13047
- }, index2))
13048
- });
13150
+ })
13151
+ },
13152
+ {
13153
+ key: "contains",
13154
+ title: t2("dovetail.contains"),
13155
+ dataIndex: "contains"
13156
+ },
13157
+ {
13158
+ key: "optional",
13159
+ title: t2("dovetail.optional"),
13160
+ dataIndex: "optional"
13161
+ },
13162
+ {
13163
+ key: "rule",
13164
+ title: t2("dovetail.format_requirements"),
13165
+ dataIndex: "rule",
13166
+ render: (cell) => /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { style: { listStyle: "disc", listStylePosition: "inside" }, children: cell.map((rule2, i2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", { style: { textIndent: 8 }, children: rule2 }, i2)) })
13049
13167
  }
13050
- }],
13051
- pagination: false
13052
- }),
13053
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
13054
- size: "small",
13055
- type: "link",
13056
- children: t2("dovetail.look_format_requirement")
13057
- })
13058
- });
13168
+ ]
13169
+ }
13170
+ );
13059
13171
  };
13060
13172
  const index_t3zi07 = "";
13061
13173
  function _KeyValueTableForm(props, ref) {
@@ -13076,7 +13188,8 @@ function _KeyValueTableForm(props, ref) {
13076
13188
  validateKey,
13077
13189
  validateValue,
13078
13190
  onSubmit,
13079
- keyTitle
13191
+ keyTitle,
13192
+ formatPopover
13080
13193
  } = props;
13081
13194
  const {
13082
13195
  t: t2,
@@ -13260,7 +13373,7 @@ function _KeyValueTableForm(props, ref) {
13260
13373
  validateTriggerType: ValidateTriggerType.Aggressive,
13261
13374
  disableBatchFilling: true,
13262
13375
  hideEmptyTable: true
13263
- }), isHideLabelFormatPopover || _value.length === 0 ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
13376
+ }), isHideLabelFormatPopover || _value.length === 0 ? null : formatPopover ?? /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {
13264
13377
  noValueValidation
13265
13378
  })]
13266
13379
  });
@@ -13699,7 +13812,7 @@ const StateTag = (props) => {
13699
13812
  }
13700
13813
  );
13701
13814
  };
13702
- const WorkloadPodsTable_975j2t = "";
13815
+ const WorkloadPodsTable_a750q3 = "";
13703
13816
  const WorkloadPodsTable = ({
13704
13817
  namespace: namespace2,
13705
13818
  selector,
@@ -13735,14 +13848,16 @@ const WorkloadPodsTable = ({
13735
13848
  kind: "Pod"
13736
13849
  },
13737
13850
  filters: {
13738
- permanent: [{
13739
- field: "",
13740
- value: "",
13741
- fn(item) {
13742
- return filter ? filter(item) : matchSelector(item, selector, namespace2);
13851
+ permanent: [
13852
+ {
13853
+ field: "",
13854
+ value: "",
13855
+ fn(item) {
13856
+ return filter ? filter(item) : matchSelector(item, selector, namespace2);
13857
+ }
13743
13858
  }
13744
13859
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13745
- }]
13860
+ ]
13746
13861
  }
13747
13862
  }
13748
13863
  });
@@ -14218,7 +14333,8 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
14218
14333
  service: record,
14219
14334
  breakLine: false,
14220
14335
  clusterVip,
14221
- showDashedUnderline: false
14336
+ showDashedUnderline: false,
14337
+ showCopyButton: true
14222
14338
  });
14223
14339
  }
14224
14340
  });
@@ -14236,14 +14352,14 @@ const PodSelectorField = () => ({
14236
14352
  const PortsTableField = () => ({
14237
14353
  key: "ports",
14238
14354
  path: [],
14239
- renderContent: (_, service) => {
14355
+ renderContent: (_, service2) => {
14240
14356
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
14241
14357
  style: {
14242
14358
  padding: "0 24px",
14243
14359
  height: "100%"
14244
14360
  },
14245
14361
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(PortsTable, {
14246
- service
14362
+ service: service2
14247
14363
  })
14248
14364
  });
14249
14365
  }
@@ -14940,11 +15056,11 @@ const NetworkPolicyIngressRulesTab = ({
14940
15056
  fields: [{
14941
15057
  key: "Ingress",
14942
15058
  path: ["spec", "ingress"],
14943
- render: (ingress) => {
15059
+ render: (ingress2) => {
14944
15060
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
14945
15061
  className: NetworkPolicyRulesViewerStyle,
14946
15062
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(NetworkPolicyRulesViewer, {
14947
- ingressOrEgress: ingress
15063
+ ingressOrEgress: ingress2
14948
15064
  })
14949
15065
  });
14950
15066
  }
@@ -15019,7 +15135,9 @@ const PodContainersTable = ({
15019
15135
  const isInit = initContainerStatuses.some(
15020
15136
  (c2) => c2.containerID === record.containerID
15021
15137
  );
15022
- return i18n2.t(isInit ? "dovetail.init_container" : "dovetail.regular_container");
15138
+ return i18n2.t(
15139
+ isInit ? "dovetail.init_container" : "dovetail.regular_container"
15140
+ );
15023
15141
  }
15024
15142
  },
15025
15143
  {
@@ -15049,10 +15167,12 @@ const PodContainersTable = ({
15049
15167
  [i18n2, initContainerStatuses]
15050
15168
  );
15051
15169
  const dataSource = useMemo(
15052
- () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map((container2) => ({
15053
- ...container2,
15054
- startedAt: get$2(container2, ["state", "running", "startedAt"]) || get$2(container2, ["state", "terminated", "startedAt"])
15055
- })),
15170
+ () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map(
15171
+ (container2) => ({
15172
+ ...container2,
15173
+ startedAt: get$2(container2, ["state", "running", "startedAt"]) || get$2(container2, ["state", "terminated", "startedAt"])
15174
+ })
15175
+ ),
15056
15176
  [containerStatuses, initContainerStatuses]
15057
15177
  );
15058
15178
  const {
@@ -15063,10 +15183,12 @@ const PodContainersTable = ({
15063
15183
  } = useTableData({
15064
15184
  data: dataSource,
15065
15185
  columns,
15066
- defaultSorters: [{
15067
- field: "startedAt",
15068
- order: "desc"
15069
- }]
15186
+ defaultSorters: [
15187
+ {
15188
+ field: "startedAt",
15189
+ order: "desc"
15190
+ }
15191
+ ]
15070
15192
  });
15071
15193
  if (dataSource.length === 0) {
15072
15194
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -15084,7 +15206,9 @@ const PodContainersTable = ({
15084
15206
  loading: false,
15085
15207
  data: finalData,
15086
15208
  total: dataSource.length,
15087
- columns: addDefaultRenderToColumns(columns),
15209
+ columns: addDefaultRenderToColumns(
15210
+ columns
15211
+ ),
15088
15212
  rowKey: "containerID",
15089
15213
  error: false,
15090
15214
  defaultSize: currentSize,
@@ -15207,11 +15331,11 @@ const NetworkPolicyIngressRulesGroup = (i18n2) => ({
15207
15331
  {
15208
15332
  key: "Ingress",
15209
15333
  path: ["spec", "ingress"],
15210
- renderContent: (ingress) => {
15334
+ renderContent: (ingress2) => {
15211
15335
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
15212
15336
  NetworkPolicyRulesViewer,
15213
15337
  {
15214
- ingressOrEgress: ingress,
15338
+ ingressOrEgress: ingress2,
15215
15339
  kind: ` ${i18n2.t("dovetail.ingress_rule")}`
15216
15340
  }
15217
15341
  );
@@ -15265,7 +15389,7 @@ function Tabs(props) {
15265
15389
  return /* @__PURE__ */ jsxRuntimeExports.jsx(TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
15266
15390
  }) });
15267
15391
  }
15268
- const ShowContentView_11vyp5a = "";
15392
+ const ShowContentView_szlndu = "";
15269
15393
  const ShowContentWrapperStyle = "soapvs9";
15270
15394
  const BackButton = "b13d603q";
15271
15395
  const ToolBarWrapper = "tm8eaia";
@@ -15709,7 +15833,7 @@ function ReplicasDropdown(props) {
15709
15833
  ] });
15710
15834
  }
15711
15835
  const PodShell = lazy(
15712
- () => import("./PodShell-76331418.js").then((module2) => ({ default: module2.PodShell }))
15836
+ () => import("./PodShell-a6ed3498.js").then((module2) => ({ default: module2.PodShell }))
15713
15837
  );
15714
15838
  function PodShellModal(props) {
15715
15839
  const { pod: pod2 } = props;
@@ -16056,8 +16180,121 @@ function ResourceShow(props) {
16056
16180
  }
16057
16181
  );
16058
16182
  }
16059
- const modal_1eijuvm = "";
16183
+ const button_a1727f = "";
16184
+ const WarningButtonStyle = "wwyz7ti";
16185
+ const modal_1muog24 = "";
16060
16186
  const SmallModalStyle = "s1nc293e";
16187
+ const ExtraSubmitFooter_15u4r8u = "";
16188
+ const FooterStyle = "f16wn4bu";
16189
+ const FooterLeftStyle = "fk5l2b4";
16190
+ const FooterRightStyle = "f1r3vl4u";
16191
+ const ErrorStyle = "e1y8i1r4";
16192
+ const ErrorIconStyle = "e16fn5cj";
16193
+ const PrevIconStyle = "prji3wx";
16194
+ function useExtraSubmitFooter({
16195
+ action,
16196
+ cancelText,
16197
+ defaultSubmitText,
16198
+ errorText,
16199
+ extraSubmitButton,
16200
+ fallbackFooter,
16201
+ isYamlMode,
16202
+ nextStepText,
16203
+ prevStepText,
16204
+ saveButtonProps,
16205
+ step,
16206
+ stepCount,
16207
+ onCancel,
16208
+ onNextStep,
16209
+ onPrevStep,
16210
+ onSubmit
16211
+ }) {
16212
+ const shouldShowExtraSubmitButton = useMemo(() => {
16213
+ if (!extraSubmitButton || isYamlMode) {
16214
+ return false;
16215
+ }
16216
+ if (extraSubmitButton.action && extraSubmitButton.action !== action) {
16217
+ return false;
16218
+ }
16219
+ if (extraSubmitButton.step !== step) {
16220
+ return false;
16221
+ }
16222
+ return step < stepCount - 1;
16223
+ }, [action, extraSubmitButton, isYamlMode, step, stepCount]);
16224
+ return useMemo(() => {
16225
+ if (!shouldShowExtraSubmitButton) {
16226
+ return fallbackFooter;
16227
+ }
16228
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ExtraSubmitFooter, {
16229
+ cancelText,
16230
+ errorText,
16231
+ extraSubmitText: (extraSubmitButton == null ? void 0 : extraSubmitButton.text) || defaultSubmitText,
16232
+ nextStepText,
16233
+ prevText: prevStepText,
16234
+ saveButtonProps,
16235
+ showPrevButton: step > 0,
16236
+ onCancel,
16237
+ onNextStep,
16238
+ onPrevStep,
16239
+ onSubmit
16240
+ });
16241
+ }, [cancelText, defaultSubmitText, errorText, extraSubmitButton == null ? void 0 : extraSubmitButton.text, fallbackFooter, onCancel, onNextStep, onPrevStep, onSubmit, nextStepText, prevStepText, saveButtonProps, shouldShowExtraSubmitButton, step]);
16242
+ }
16243
+ const ExtraSubmitFooter = ({
16244
+ cancelText,
16245
+ errorText,
16246
+ extraSubmitText,
16247
+ nextStepText,
16248
+ prevText,
16249
+ saveButtonProps,
16250
+ showPrevButton,
16251
+ onCancel,
16252
+ onNextStep,
16253
+ onPrevStep,
16254
+ onSubmit
16255
+ }) => {
16256
+ const finalSaveButtonProps = omit$1(saveButtonProps, "onClick");
16257
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
16258
+ className: FooterStyle,
16259
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
16260
+ className: FooterLeftStyle,
16261
+ children: [showPrevButton ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, {
16262
+ type: "link",
16263
+ onClick: onPrevStep,
16264
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(ArrowChevronLeft16BoldBlueIcon, {
16265
+ className: PrevIconStyle
16266
+ }), prevText]
16267
+ }) : null, errorText ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
16268
+ className: cx_default(ErrorStyle, Typo.Label.l2_regular),
16269
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(ExclamationErrorCircleFill16RedIcon, {
16270
+ className: ErrorIconStyle
16271
+ }), errorText]
16272
+ }) : null]
16273
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
16274
+ className: FooterRightStyle,
16275
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
16276
+ type: "quiet",
16277
+ size: "large",
16278
+ onClick: onCancel,
16279
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
16280
+ className: Typo.Label.l1_bold_title,
16281
+ children: cancelText
16282
+ })
16283
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
16284
+ size: "large",
16285
+ type: "secondary",
16286
+ onClick: onNextStep,
16287
+ children: nextStepText
16288
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
16289
+ ...finalSaveButtonProps,
16290
+ size: "large",
16291
+ type: "primary",
16292
+ onClick: onSubmit,
16293
+ children: extraSubmitText
16294
+ })]
16295
+ })]
16296
+ });
16297
+ };
16061
16298
  function FormModeSegmentControl({
16062
16299
  formConfig,
16063
16300
  mode,
@@ -16891,9 +17128,16 @@ const useForm = ({
16891
17128
  onSubmitAbort,
16892
17129
  ...rest
16893
17130
  } = {}) => {
17131
+ var _a;
16894
17132
  const { options } = useRefineContext();
16895
17133
  const disableServerSideValidation = (options == null ? void 0 : options.disableServerSideValidation) || disableServerSideValidationProp;
16896
17134
  const translate = useTranslate();
17135
+ const { captureInitialResource, mutationMeta } = use409Retry({
17136
+ action: refineCoreProps == null ? void 0 : refineCoreProps.action,
17137
+ dataProviderName: refineCoreProps == null ? void 0 : refineCoreProps.dataProviderName,
17138
+ id: refineCoreProps == null ? void 0 : refineCoreProps.id,
17139
+ mutationMeta: refineCoreProps == null ? void 0 : refineCoreProps.mutationMeta
17140
+ });
16897
17141
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
16898
17142
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
16899
17143
  const useHookFormResult = useForm$3({
@@ -16903,6 +17147,7 @@ const useForm = ({
16903
17147
  const [transformedInitValues, setTransformedInitValues] = useState(useHookFormResult.getValues());
16904
17148
  const [beforeSubmitErrors, setBeforeSubmitErrors] = useState([]);
16905
17149
  const [isBeforeSubmitLoading, setIsBeforeSubmitLoading] = useState(false);
17150
+ const hasAppliedInitialDataRef = useRef(false);
16906
17151
  const {
16907
17152
  watch,
16908
17153
  setValue,
@@ -16913,10 +17158,11 @@ const useForm = ({
16913
17158
  } = useHookFormResult;
16914
17159
  const useFormCoreResult = useForm$2({
16915
17160
  ...refineCoreProps,
17161
+ mutationMeta,
16916
17162
  onMutationError: (error, _variables, _context) => {
16917
- var _a, _b;
17163
+ var _a2, _b;
16918
17164
  if (disableServerSideValidation) {
16919
- (_a = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a.call(refineCoreProps, error, _variables, _context);
17165
+ (_a2 = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a2.call(refineCoreProps, error, _variables, _context);
16920
17166
  return;
16921
17167
  }
16922
17168
  const errors = error == null ? void 0 : error.errors;
@@ -16949,10 +17195,14 @@ const useForm = ({
16949
17195
  });
16950
17196
  const { queryResult, onFinish, formLoading, onFinishAutoSave } = useFormCoreResult;
16951
17197
  useEffect(() => {
16952
- var _a;
16953
- if (formState.isDirty)
17198
+ var _a2;
17199
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
17200
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
17201
+ useEffect(() => {
17202
+ var _a2;
17203
+ if (hasAppliedInitialDataRef.current || formState.isDirty)
16954
17204
  return;
16955
- const data2 = (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data;
17205
+ const data2 = (_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data;
16956
17206
  if (!data2)
16957
17207
  return;
16958
17208
  const transformedData = transformInitValues ? transformInitValues(data2) : data2;
@@ -16968,6 +17218,7 @@ const useForm = ({
16968
17218
  });
16969
17219
  }
16970
17220
  });
17221
+ hasAppliedInitialDataRef.current = true;
16971
17222
  setTransformedInitValues(getValues());
16972
17223
  }, [queryResult == null ? void 0 : queryResult.data, setValue, transformInitValues, formState.isDirty, getValues]);
16973
17224
  useEffect(() => {
@@ -16980,13 +17231,13 @@ const useForm = ({
16980
17231
  }, [watch]);
16981
17232
  const onValuesChange = useCallback(
16982
17233
  (changeValues) => {
16983
- var _a;
17234
+ var _a2;
16984
17235
  if (warnWhenUnsavedChanges) {
16985
17236
  setWarnWhen(true);
16986
17237
  }
16987
17238
  if (refineCoreProps == null ? void 0 : refineCoreProps.autoSave) {
16988
17239
  setWarnWhen(false);
16989
- const onFinishProps = (_a = refineCoreProps.autoSave) == null ? void 0 : _a.onFinish;
17240
+ const onFinishProps = (_a2 = refineCoreProps.autoSave) == null ? void 0 : _a2.onFinish;
16990
17241
  if (onFinishProps) {
16991
17242
  return onFinishAutoSave(onFinishProps(changeValues));
16992
17243
  }
@@ -17083,6 +17334,10 @@ const useRefineForm = (props) => {
17083
17334
  errorNotification: false,
17084
17335
  successNotification: () => {
17085
17336
  var _a;
17337
+ if (formConfig == null ? void 0 : formConfig.successMessage) {
17338
+ const msg = typeof formConfig.successMessage === "function" ? formConfig.successMessage(id ? "edit" : "create") : formConfig.successMessage;
17339
+ return { message: msg, description: "Success", type: "success" };
17340
+ }
17086
17341
  const formValue = result.getValues();
17087
17342
  return {
17088
17343
  message: i18n2.t(id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast", {
@@ -17100,6 +17355,7 @@ const useRefineForm = (props) => {
17100
17355
  resource: resourceConfig.name,
17101
17356
  action: id ? "edit" : "create",
17102
17357
  id,
17358
+ dataProviderName: resourceConfig.dataProviderName,
17103
17359
  liveMode: id ? "auto" : "off",
17104
17360
  ...refineProps
17105
17361
  },
@@ -17113,10 +17369,11 @@ const useRefineForm = (props) => {
17113
17369
  ...formConfig == null ? void 0 : formConfig.useFormProps
17114
17370
  });
17115
17371
  useEffect(() => {
17116
- var _a, _b;
17372
+ var _a, _b, _c;
17117
17373
  const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
17374
+ const message2 = (_b = result.refineCore.mutationResult.error) == null ? void 0 : _b.message;
17118
17375
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
17119
- (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
17376
+ (_c = response.json) == null ? void 0 : _c.call(response).then((body) => {
17120
17377
  var _a2;
17121
17378
  setResponseErrorMsgs(
17122
17379
  [].concat(
@@ -17124,8 +17381,10 @@ const useRefineForm = (props) => {
17124
17381
  )
17125
17382
  );
17126
17383
  });
17384
+ } else if (message2 && responseErrorMsgs[0] !== message2) {
17385
+ setResponseErrorMsgs([message2]);
17127
17386
  }
17128
- }, [formConfig, result, i18n2]);
17387
+ }, [formConfig, result, i18n2, responseErrorMsgs]);
17129
17388
  return {
17130
17389
  formResult: result,
17131
17390
  responseErrorMsgs,
@@ -17146,10 +17405,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17146
17405
  }, ref) {
17147
17406
  var _a, _b;
17148
17407
  const action = id ? "edit" : "create";
17149
- const pushModal = usePushModal();
17150
- const popModal = usePopModal();
17151
- const hasShownExpiredRef = useRef(false);
17152
- const [isSubmitting, setIsSubmitting] = useState(false);
17153
17408
  const refineFormResult = useRefineForm({
17154
17409
  resourceConfig,
17155
17410
  id,
@@ -17158,7 +17413,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17158
17413
  onSuccess == null ? void 0 : onSuccess(data2);
17159
17414
  },
17160
17415
  onMutationError() {
17161
- setIsSubmitting(false);
17162
17416
  onError == null ? void 0 : onError();
17163
17417
  },
17164
17418
  redirect: false,
@@ -17172,35 +17426,11 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17172
17426
  ...options,
17173
17427
  onBeforeSubmitError: (errors) => {
17174
17428
  if (errors.length) {
17175
- setIsSubmitting(false);
17176
17429
  onError == null ? void 0 : onError();
17177
17430
  }
17178
- },
17179
- onSubmitStart: () => {
17180
- setIsSubmitting(true);
17181
- },
17182
- onSubmitAbort: () => {
17183
- setIsSubmitting(false);
17184
17431
  }
17185
17432
  }
17186
17433
  });
17187
- const isExpired = useResourceVersionCheck({
17188
- queryResult: refineFormResult.formResult.refineCore.queryResult
17189
- });
17190
- useEffect(() => {
17191
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
17192
- return;
17193
- }
17194
- hasShownExpiredRef.current = true;
17195
- pushModal({
17196
- component: DataExpiredModal,
17197
- props: {
17198
- onAbandon: () => {
17199
- popModal();
17200
- }
17201
- }
17202
- });
17203
- }, [isExpired, isSubmitting, pushModal, popModal]);
17204
17434
  const fieldsConfig = useFieldsConfig(
17205
17435
  resourceConfig,
17206
17436
  { fields: formConfig == null ? void 0 : formConfig.fields },
@@ -17215,6 +17445,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17215
17445
  transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
17216
17446
  });
17217
17447
  const yamlFormProps = useMemo(() => {
17448
+ var _a2;
17218
17449
  if (isYamlMode) {
17219
17450
  return {
17220
17451
  ...customYamlFormProps,
@@ -17233,12 +17464,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17233
17464
  isShowLayout: false,
17234
17465
  useFormProps: {
17235
17466
  redirect: false,
17236
- onSubmitStart: () => {
17237
- setIsSubmitting(true);
17238
- },
17239
- onSubmitAbort: () => {
17240
- setIsSubmitting(false);
17241
- }
17467
+ mutationMeta: (_a2 = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a2.mutationMeta
17242
17468
  },
17243
17469
  rules: fieldsConfig == null ? void 0 : fieldsConfig.filter(
17244
17470
  (config) => "isSkipValidationInYaml" in config && !config.isSkipValidationInYaml
@@ -17268,6 +17494,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17268
17494
  id,
17269
17495
  refineFormResult,
17270
17496
  formConfig == null ? void 0 : formConfig.beforeSubmit,
17497
+ (_a = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a.mutationMeta,
17271
17498
  transformApplyValues,
17272
17499
  onSaveButtonPropsChange,
17273
17500
  onSuccess,
@@ -17287,18 +17514,20 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17287
17514
  }),
17288
17515
  [refineFormResult.formResult]
17289
17516
  );
17290
- if (action === "edit" && !((_b = (_a = refineFormResult.formResult.getValues()) == null ? void 0 : _a.metadata) == null ? void 0 : _b.name)) {
17517
+ const currentFormValues = refineFormResult.formResult.getValues();
17518
+ const isReady = (formConfig == null ? void 0 : formConfig.isDataReady) ? formConfig.isDataReady(currentFormValues) : !!((_b = currentFormValues == null ? void 0 : currentFormValues.metadata) == null ? void 0 : _b.name);
17519
+ if (action === "edit" && !isReady) {
17291
17520
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {});
17292
17521
  }
17293
17522
  if (isYamlMode) {
17294
17523
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
17295
17524
  }
17296
17525
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
17297
- !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) ? /* @__PURE__ */ jsxRuntimeExports.jsx(
17526
+ !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) && (formConfig == null ? void 0 : formConfig.changeModeAlert) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
17298
17527
  Alert,
17299
17528
  {
17300
17529
  type: "warning",
17301
- message: i18n.t("dovetail.change_form_mode_alert"),
17530
+ message: (formConfig == null ? void 0 : formConfig.changeModeAlert) ?? i18n.t("dovetail.change_form_mode_alert"),
17302
17531
  style: { marginBottom: "16px" }
17303
17532
  }
17304
17533
  ) : void 0,
@@ -17352,7 +17581,7 @@ function ConfirmModal({
17352
17581
  });
17353
17582
  }
17354
17583
  function FormModal(props) {
17355
- var _a, _b, _c, _d, _e;
17584
+ var _a, _b, _c, _d, _e, _f;
17356
17585
  const {
17357
17586
  id,
17358
17587
  yamlFormProps: customYamlFormProps,
@@ -17490,37 +17719,59 @@ function FormModal(props) {
17490
17719
  setStep(nextStep);
17491
17720
  }
17492
17721
  }, [step]);
17493
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(WizardDialog, {
17494
- style: {
17495
- "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17496
- },
17497
- title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
17498
- className: TitleWrapperStyle,
17499
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
17500
- children: title
17501
- }), ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
17502
- formConfig: resourceConfig.formConfig,
17503
- mode,
17504
- onChangeMode
17505
- }) : null]
17506
- }),
17507
- error: errorText,
17508
- steps,
17722
+ const extraSubmitButton = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? resourceConfig.formConfig.extraSubmitButton : void 0;
17723
+ const footer = useExtraSubmitFooter({
17724
+ action,
17725
+ cancelText: (modalProps == null ? void 0 : modalProps.cancelText) || i18n2.t("dovetail.cancel"),
17726
+ defaultSubmitText: okText,
17727
+ errorText,
17728
+ extraSubmitButton,
17729
+ fallbackFooter: modalProps == null ? void 0 : modalProps.footer,
17730
+ isYamlMode,
17731
+ nextStepText: (modalProps == null ? void 0 : modalProps.nextText) || i18n2.t("dovetail.next_step"),
17732
+ prevStepText: (modalProps == null ? void 0 : modalProps.prevText) || i18n2.t("dovetail.prev_step"),
17733
+ saveButtonProps,
17509
17734
  step,
17510
- onStepChange: handleStepChange,
17511
- onOk,
17512
- okButtonProps: {
17513
- ...omit$1(saveButtonProps, "onClick"),
17514
- children: (_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText
17515
- },
17516
- okText: ((_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText) || okText,
17517
- destroyOnClose: true,
17518
- destroyOtherStep: true,
17519
- ...modalProps,
17520
- children: [desc ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
17521
- className: FormDescStyle,
17522
- children: desc
17523
- }) : void 0, formEle]
17735
+ stepCount: (steps == null ? void 0 : steps.length) || 0,
17736
+ onCancel: popModal,
17737
+ onNextStep: () => handleStepChange(step + 1),
17738
+ onPrevStep: () => handleStepChange(step - 1),
17739
+ onSubmit: onOk
17740
+ });
17741
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Retry409Provider, {
17742
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs(WizardDialog, {
17743
+ style: {
17744
+ "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17745
+ },
17746
+ title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
17747
+ className: TitleWrapperStyle,
17748
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
17749
+ children: title
17750
+ }), ((_d = resourceConfig.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? /* @__PURE__ */ jsxRuntimeExports.jsx(FormModeSegmentControl, {
17751
+ formConfig: resourceConfig.formConfig,
17752
+ mode,
17753
+ onChangeMode
17754
+ }) : null]
17755
+ }),
17756
+ error: errorText,
17757
+ steps,
17758
+ step,
17759
+ onStepChange: handleStepChange,
17760
+ onOk,
17761
+ okButtonProps: {
17762
+ ...omit$1(saveButtonProps, "onClick"),
17763
+ children: (_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText
17764
+ },
17765
+ okText: ((_f = resourceConfig.formConfig) == null ? void 0 : _f.saveButtonText) || okText,
17766
+ footer,
17767
+ destroyOnClose: true,
17768
+ destroyOtherStep: true,
17769
+ ...modalProps,
17770
+ children: [desc ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
17771
+ className: FormDescStyle,
17772
+ children: desc
17773
+ }) : void 0, formEle]
17774
+ })
17524
17775
  });
17525
17776
  }
17526
17777
  const RefineFormPage_1v0fhor = "";
@@ -17626,31 +17877,43 @@ function CronJobDropdown(props) {
17626
17877
  values: v,
17627
17878
  successNotification() {
17628
17879
  return {
17629
- message: t2(suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast", {
17630
- kind: record.kind,
17631
- name: id,
17632
- interpolation: {
17633
- escapeValue: false
17880
+ message: t2(
17881
+ suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast",
17882
+ {
17883
+ kind: record.kind,
17884
+ name: id,
17885
+ interpolation: {
17886
+ escapeValue: false
17887
+ }
17634
17888
  }
17635
- }),
17889
+ ),
17636
17890
  type: "success"
17637
17891
  };
17638
17892
  },
17639
17893
  errorNotification() {
17640
17894
  return {
17641
- message: t2(suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast", {
17642
- kind: record.kind,
17643
- name: id,
17644
- interpolation: {
17645
- escapeValue: false
17895
+ message: t2(
17896
+ suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast",
17897
+ {
17898
+ kind: record.kind,
17899
+ name: id,
17900
+ interpolation: {
17901
+ escapeValue: false
17902
+ }
17646
17903
  }
17647
- }),
17904
+ ),
17648
17905
  type: "error"
17649
17906
  };
17650
17907
  }
17651
17908
  });
17652
17909
  },
17653
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon, { src: suspended ? RecoverContinue16GradientBlueIcon : Pause16GradientBlueIcon, children: t2(suspended ? "dovetail.resume" : "dovetail.suspend") })
17910
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
17911
+ Icon,
17912
+ {
17913
+ src: suspended ? RecoverContinue16GradientBlueIcon : Pause16GradientBlueIcon,
17914
+ children: t2(suspended ? "dovetail.resume" : "dovetail.suspend")
17915
+ }
17916
+ )
17654
17917
  }
17655
17918
  ) : null });
17656
17919
  }
@@ -18167,7 +18430,9 @@ const DeleteButton = () => {
18167
18430
  const { resource } = useResource();
18168
18431
  const { id } = useParsed();
18169
18432
  const { t: t2 } = useTranslation();
18170
- const { openDeleteConfirmModal } = useDeleteModal({ resourceName: (resource == null ? void 0 : resource.name) || "" });
18433
+ const { openDeleteConfirmModal } = useDeleteModal({
18434
+ resourceName: (resource == null ? void 0 : resource.name) || ""
18435
+ });
18171
18436
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(
18172
18437
  Button,
18173
18438
  {
@@ -18178,7 +18443,7 @@ const DeleteButton = () => {
18178
18443
  }
18179
18444
  ) });
18180
18445
  };
18181
- const index_1tehui8 = "";
18446
+ const index_e6cgji = "";
18182
18447
  const MenuStyle = "mdppgn0";
18183
18448
  const Menu = () => {
18184
18449
  const {
@@ -19315,9 +19580,9 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19315
19580
  });
19316
19581
  const nodePortsFromOtherServices = useMemo(() => {
19317
19582
  var _a;
19318
- return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service) => service.id !== serviceId).map((service) => {
19583
+ return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service2) => service2.id !== serviceId).map((service2) => {
19319
19584
  var _a2, _b;
19320
- return (_b = (_a2 = service == null ? void 0 : service.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19585
+ return (_b = (_a2 = service2 == null ? void 0 : service2.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19321
19586
  }).flat().filter((port2) => port2 !== void 0)) || [];
19322
19587
  }, [services, serviceId]);
19323
19588
  const columns = useMemo(() => {
@@ -19510,7 +19775,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19510
19775
  }
19511
19776
  );
19512
19777
  });
19513
- const IngressRulesComponent = ({ ingress, noLink }) => {
19778
+ const IngressRulesComponent = ({ ingress: ingress2, noLink }) => {
19514
19779
  const { data: serviceData } = useList({
19515
19780
  resource: "services",
19516
19781
  meta: {
@@ -19518,12 +19783,12 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19518
19783
  apiVersion: "v1"
19519
19784
  }
19520
19785
  });
19521
- const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19786
+ const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19522
19787
  const result = flattenedRules.map((r2) => {
19523
19788
  var _a, _b;
19524
19789
  const arrow = " → ";
19525
19790
  const divider = " | ";
19526
- const secretName = (_b = (_a = ingress.spec.tls) == null ? void 0 : _a.find(
19791
+ const secretName = (_b = (_a = ingress2.spec.tls) == null ? void 0 : _a.find(
19527
19792
  ({ hosts }) => hosts == null ? void 0 : hosts.includes(r2.host || "")
19528
19793
  )) == null ? void 0 : _b.secretName;
19529
19794
  let tooltip = r2.fullPath;
@@ -19544,7 +19809,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19544
19809
  ResourceLink,
19545
19810
  {
19546
19811
  resourceName: "services",
19547
- namespace: ingress.metadata.namespace || "default",
19812
+ namespace: ingress2.metadata.namespace || "default",
19548
19813
  name: r2.serviceName
19549
19814
  }
19550
19815
  ),
@@ -19559,7 +19824,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19559
19824
  ResourceLink,
19560
19825
  {
19561
19826
  resourceName: "secrets",
19562
- namespace: ingress.metadata.namespace || "default",
19827
+ namespace: ingress2.metadata.namespace || "default",
19563
19828
  name: secretName
19564
19829
  }
19565
19830
  )
@@ -19928,7 +20193,10 @@ function ServiceOutClusterAccessTitle() {
19928
20193
  })
19929
20194
  });
19930
20195
  }
19931
- const ServiceOutClusterAccessColumnRenderer = (clusterVip) => {
20196
+ const ServiceOutClusterAccessColumnRenderer = (_i18n, options) => {
20197
+ const {
20198
+ clusterVip
20199
+ } = options;
19932
20200
  return {
19933
20201
  key: "outClusterAccess",
19934
20202
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
@@ -19968,10 +20236,8 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19968
20236
  }
19969
20237
  };
19970
20238
  };
19971
- const IngressRulesColumnRenderer = ({
19972
- i18n: i18n2,
19973
- noLink
19974
- }) => {
20239
+ const IngressRulesColumnRenderer = (i18n2, options) => {
20240
+ const noLink = options == null ? void 0 : options.noLink;
19975
20241
  const dataIndex = ["spec", "rules"];
19976
20242
  return {
19977
20243
  key: "type",
@@ -20432,39 +20698,45 @@ const Dovetail = (props) => {
20432
20698
  antd4Configs: {
20433
20699
  getPopupContainer: antdGetPopupContainer || (() => document.body)
20434
20700
  },
20435
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20436
- Refine,
20701
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20702
+ GlobalStoreContext.Provider,
20437
20703
  {
20438
- dataProvider: dataProvider(globalStoreMap.default),
20439
- liveProvider: liveProvider(globalStoreMap.default),
20440
- routerProvider,
20441
- notificationProvider,
20442
- options: {
20443
- warnWhenUnsavedChanges: true,
20444
- liveMode: "auto",
20445
- disableTelemetry: true
20446
- },
20447
- accessControlProvider,
20448
- resources: resourcesConfig.map((c2) => {
20449
- return {
20450
- name: c2.name,
20451
- meta: {
20452
- dataProviderName: c2.dataProviderName,
20453
- resourceBasePath: c2.basePath,
20454
- kind: c2.kind,
20455
- parent: c2.parent,
20456
- label: `${c2.kind}s`
20704
+ value: globalStoreMap,
20705
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
20706
+ Refine,
20707
+ {
20708
+ dataProvider: dataProvider(globalStoreMap.default),
20709
+ liveProvider: liveProvider(globalStoreMap.default),
20710
+ routerProvider,
20711
+ notificationProvider,
20712
+ options: {
20713
+ warnWhenUnsavedChanges: true,
20714
+ liveMode: "auto",
20715
+ disableTelemetry: true
20457
20716
  },
20458
- list: `${urlPrefix}/${c2.name}`,
20459
- show: `${urlPrefix}/${c2.name}/show`,
20460
- create: `${urlPrefix}/${c2.name}/create`,
20461
- edit: `${urlPrefix}/${c2.name}/edit`
20462
- };
20463
- }),
20464
- ...props,
20465
- children: content
20717
+ accessControlProvider,
20718
+ resources: resourcesConfig.map((c2) => {
20719
+ return {
20720
+ name: c2.name,
20721
+ meta: {
20722
+ dataProviderName: c2.dataProviderName,
20723
+ resourceBasePath: c2.basePath,
20724
+ kind: c2.kind,
20725
+ parent: c2.parent,
20726
+ label: `${c2.kind}s`
20727
+ },
20728
+ list: `${urlPrefix}/${c2.name}`,
20729
+ show: `${urlPrefix}/${c2.name}/show`,
20730
+ create: `${urlPrefix}/${c2.name}/create`,
20731
+ edit: `${urlPrefix}/${c2.name}/edit`
20732
+ };
20733
+ }),
20734
+ ...props,
20735
+ children: content
20736
+ }
20737
+ )
20466
20738
  }
20467
- ) })
20739
+ )
20468
20740
  }
20469
20741
  ) }) }) }) });
20470
20742
  };
@@ -20525,8 +20797,8 @@ class ModelPlugin {
20525
20797
  restoreItem(item) {
20526
20798
  return item._rawYaml;
20527
20799
  }
20528
- setModelMap(key2, model) {
20529
- this.ModelMap.set(key2, model);
20800
+ setModelMap(key2, ModelClass) {
20801
+ this.ModelMap.set(key2, ModelClass);
20530
20802
  }
20531
20803
  }
20532
20804
  const modelPlugin = new ModelPlugin();
@@ -20632,12 +20904,14 @@ export {
20632
20904
  ColumnKeys,
20633
20905
  CommonSorter,
20634
20906
  ComponentContext,
20907
+ ComponentContextProvider,
20635
20908
  ConditionsField,
20636
20909
  ConditionsGroup,
20637
20910
  ConditionsTab,
20638
20911
  ConditionsTable,
20639
20912
  ConfigsContext,
20640
20913
  ControllerRevisionModel,
20914
+ CopyButton,
20641
20915
  CreateButton,
20642
20916
  CronJobDropdown,
20643
20917
  CronJobModel,
@@ -20665,7 +20939,7 @@ export {
20665
20939
  EditLabelForm,
20666
20940
  EditNodeTaintDropdownMenuItem,
20667
20941
  EditNodeTaintForm,
20668
- WidgetErrorContent as ErrorContent,
20942
+ ErrorContent,
20669
20943
  ErrorContentType,
20670
20944
  ErrorWrapper,
20671
20945
  EventModel,
@@ -20678,6 +20952,7 @@ export {
20678
20952
  FormModal,
20679
20953
  FormMode,
20680
20954
  FormType,
20955
+ FormatRulePopover,
20681
20956
  GlobalStoreContext,
20682
20957
  INGRESS_INIT_VALUE,
20683
20958
  ImageField,
@@ -20873,6 +21148,7 @@ export {
20873
21148
  Time,
20874
21149
  ValidateRfc1035Name,
20875
21150
  index as ValueDisplay,
21151
+ WidgetErrorContent,
20876
21152
  WorkloadBaseModel,
20877
21153
  WorkloadDropdown,
20878
21154
  WorkloadImageColumnRenderer,
@@ -20883,7 +21159,6 @@ export {
20883
21159
  YamlEditorComponent,
20884
21160
  YamlForm,
20885
21161
  addDefaultRenderToColumns,
20886
- dnsSubDomainRules,
20887
21162
  dovetailRefineI18n,
20888
21163
  generateSchemaTypeValue,
20889
21164
  generateValueFromSchema,
@@ -20897,12 +21172,11 @@ export {
20897
21172
  relationPlugin,
20898
21173
  renderCommonFormFiled,
20899
21174
  resolveRef,
20900
- rfc1035LabelRules,
20901
- rfc1123LabelRules,
20902
21175
  routerProvider,
20903
21176
  shortenedImage,
20904
21177
  transformResourceKindInSentence,
20905
21178
  useApiGroupSchema,
21179
+ useDeleteManyModal,
20906
21180
  useDeleteModal,
20907
21181
  useDeleteModalOnly,
20908
21182
  useDownloadYAML,