@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.cjs CHANGED
@@ -20,6 +20,7 @@ const yaml$2 = require("js-yaml");
20
20
  const sunflowerAntd = require("sunflower-antd");
21
21
  const usehooksTs = require("usehooks-ts");
22
22
  const k8sApiProvider = require("k8s-api-provider");
23
+ const copyToClipboard$1 = require("copy-to-clipboard");
23
24
  const reactLogViewer = require("@patternfly/react-log-viewer");
24
25
  const reactHookForm = require("react-hook-form");
25
26
  const monaco = require("monaco-editor");
@@ -456,6 +457,18 @@ function Trans(_ref) {
456
457
  ...additionalProps
457
458
  });
458
459
  }
460
+ const add_container$1 = "Add container";
461
+ const container_index$1 = "Container {{index}}";
462
+ const container_name$1 = "Container name";
463
+ const container_image$1 = "Container image";
464
+ const advanced_settings$1 = "Advanced settings";
465
+ const app$1 = {
466
+ add_container: add_container$1,
467
+ container_index: container_index$1,
468
+ container_name: container_name$1,
469
+ container_image: container_image$1,
470
+ advanced_settings: advanced_settings$1
471
+ };
459
472
  const copy$1 = "Copy";
460
473
  const reset_arguments$1 = "Reset";
461
474
  const view_changes$1 = "Show diff";
@@ -475,6 +488,8 @@ const state$1 = "Status";
475
488
  const name$1 = "Name";
476
489
  const pod$1 = "Pod";
477
490
  const cancel$1 = "Cancel";
491
+ const prev_step$1 = "Previous";
492
+ const next_step$1 = "Next";
478
493
  const create$1 = "Create";
479
494
  const confirm_delete_text$1 = "Are you sure you want to delete the {{kind}} <0>{{target}}</0>?";
480
495
  const edit$1 = "Edit";
@@ -621,7 +636,7 @@ const available_state$1 = "Available";
621
636
  const bound_state$1 = "Bound";
622
637
  const released_state$1 = "Released";
623
638
  const failed_state$1 = "Failed";
624
- const exec_pod = "Execute shell";
639
+ const exec_pod$1 = "Execute shell";
625
640
  const search$1 = "Search";
626
641
  const edit_label$1 = "Edit label";
627
642
  const csi$1 = "CSI driver";
@@ -637,6 +652,7 @@ const edit_form$1 = "Edit form";
637
652
  const data_expired$1 = "Data expired";
638
653
  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.";
639
654
  const data_expired_note$1 = "Your current entries will not be saved.";
655
+ 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.";
640
656
  const abandon_edit$1 = "Discard edit";
641
657
  const exit_yaml_tip$1 = "If you go back to the form, any changes made to the YAML file will be lost.";
642
658
  const value_optional$1 = "Value (optional)";
@@ -733,6 +749,11 @@ const pause_scheduling$1 = "Suspend scheduling";
733
749
  const port_name$1 = "Port name";
734
750
  const target_port_range_limit$1 = "Only integers between 1 and 65535, or strings, are supported.";
735
751
  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.";
752
+ const network_error$1 = "Network error";
753
+ const retry_when_access_data_failed$1 = "Failed to load data. Click to retry.";
754
+ const service$1 = "Service";
755
+ const ingress$1 = "Ingress";
756
+ const fstype$1 = "Filesystem type";
736
757
  const dovetail$1 = {
737
758
  copy: copy$1,
738
759
  reset_arguments: reset_arguments$1,
@@ -753,6 +774,8 @@ const dovetail$1 = {
753
774
  name: name$1,
754
775
  pod: pod$1,
755
776
  cancel: cancel$1,
777
+ prev_step: prev_step$1,
778
+ next_step: next_step$1,
756
779
  "delete": "Delete",
757
780
  create: create$1,
758
781
  confirm_delete_text: confirm_delete_text$1,
@@ -902,7 +925,7 @@ const dovetail$1 = {
902
925
  bound_state: bound_state$1,
903
926
  released_state: released_state$1,
904
927
  failed_state: failed_state$1,
905
- exec_pod,
928
+ exec_pod: exec_pod$1,
906
929
  search: search$1,
907
930
  edit_label: edit_label$1,
908
931
  csi: csi$1,
@@ -918,6 +941,7 @@ const dovetail$1 = {
918
941
  data_expired: data_expired$1,
919
942
  data_expired_body: data_expired_body$1,
920
943
  data_expired_note: data_expired_note$1,
944
+ resource_version_conflict: resource_version_conflict$1,
921
945
  abandon_edit: abandon_edit$1,
922
946
  exit_yaml_tip: exit_yaml_tip$1,
923
947
  value_optional: value_optional$1,
@@ -1013,11 +1037,29 @@ const dovetail$1 = {
1013
1037
  pause_scheduling: pause_scheduling$1,
1014
1038
  port_name: port_name$1,
1015
1039
  target_port_range_limit: target_port_range_limit$1,
1016
- service_port_name_tip: service_port_name_tip$1
1040
+ service_port_name_tip: service_port_name_tip$1,
1041
+ network_error: network_error$1,
1042
+ retry_when_access_data_failed: retry_when_access_data_failed$1,
1043
+ service: service$1,
1044
+ ingress: ingress$1,
1045
+ fstype: fstype$1
1017
1046
  };
1018
1047
  const EN = {
1048
+ app: app$1,
1019
1049
  dovetail: dovetail$1
1020
1050
  };
1051
+ const add_container = "添加容器";
1052
+ const container_index = "容器 {{index}}";
1053
+ const container_name = "容器名称";
1054
+ const container_image = "容器镜像";
1055
+ const advanced_settings = "高级设置";
1056
+ const app = {
1057
+ add_container,
1058
+ container_index,
1059
+ container_name,
1060
+ container_image,
1061
+ advanced_settings
1062
+ };
1021
1063
  const copy = "复制";
1022
1064
  const reset_arguments = "重置";
1023
1065
  const view_changes = "查看改动";
@@ -1029,6 +1071,8 @@ const edit_yaml = "编辑 YAML";
1029
1071
  const copied = "已复制";
1030
1072
  const already_reset = "已重置";
1031
1073
  const cancel = "取消";
1074
+ const prev_step = "上一步";
1075
+ const next_step = "下一步";
1032
1076
  const create = "创建";
1033
1077
  const delete_resource = "删除{{resource}}";
1034
1078
  const confirm_delete_text = "确认删除{{kind}} <0>{{target}}</0> 吗?";
@@ -1201,6 +1245,7 @@ const edit_form = "编辑表单";
1201
1245
  const data_expired = "数据已过期";
1202
1246
  const data_expired_body = "当前表单中的数据已不是最新版。为避免保存失败,请放弃本次编辑,并重新打开表单进行编辑。";
1203
1247
  const data_expired_note = "当前已填写内容将不会保留。";
1248
+ const resource_version_conflict = "当前表单中的数据已不是最新版,请放弃本次编辑,并重新打开表单进行编辑。";
1204
1249
  const abandon_edit = "放弃编辑";
1205
1250
  const exit_yaml_tip = "返回编辑表单,不会保留对 YAML 文件做出的所有更改。";
1206
1251
  const form = "表单";
@@ -1294,6 +1339,12 @@ const no_labels = "无标签";
1294
1339
  const no_annotations = "无注解";
1295
1340
  const pause_scheduling = "暂停调度";
1296
1341
  const service_port_name_tip = "端口数量为 1 时,名称为选填项;大于 1 时,名称为必填项。";
1342
+ const exec_pod = "执行 Shell";
1343
+ const network_error = "网络错误";
1344
+ const retry_when_access_data_failed = "数据加载失败,点击重试。";
1345
+ const service = "服务";
1346
+ const ingress = "Ingress";
1347
+ const fstype = "文件系统类型";
1297
1348
  const dovetail = {
1298
1349
  copy,
1299
1350
  reset_arguments,
@@ -1306,6 +1357,8 @@ const dovetail = {
1306
1357
  copied,
1307
1358
  already_reset,
1308
1359
  cancel,
1360
+ prev_step,
1361
+ next_step,
1309
1362
  "delete": "删除",
1310
1363
  create,
1311
1364
  delete_resource,
@@ -1481,6 +1534,7 @@ const dovetail = {
1481
1534
  data_expired,
1482
1535
  data_expired_body,
1483
1536
  data_expired_note,
1537
+ resource_version_conflict,
1484
1538
  abandon_edit,
1485
1539
  exit_yaml_tip,
1486
1540
  form,
@@ -1573,9 +1627,16 @@ const dovetail = {
1573
1627
  no_labels,
1574
1628
  no_annotations,
1575
1629
  pause_scheduling,
1576
- service_port_name_tip
1630
+ service_port_name_tip,
1631
+ exec_pod,
1632
+ network_error,
1633
+ retry_when_access_data_failed,
1634
+ service,
1635
+ ingress,
1636
+ fstype
1577
1637
  };
1578
1638
  const ZH = {
1639
+ app,
1579
1640
  dovetail
1580
1641
  };
1581
1642
  const resources = {
@@ -7307,9 +7368,7 @@ class K8sOpenAPI {
7307
7368
  return this.schemas;
7308
7369
  }
7309
7370
  try {
7310
- const response = await fetch(
7311
- `${this.pathPrefix}${this.resourceBasePath}`
7312
- );
7371
+ const response = await fetch(`${this.pathPrefix}${this.resourceBasePath}`);
7313
7372
  const result = await response.json();
7314
7373
  this.schemas = Object.values(result.components.schemas);
7315
7374
  if (this.schemas) {
@@ -7381,33 +7440,42 @@ function useApiGroupSchema() {
7381
7440
  loading: false,
7382
7441
  error: null
7383
7442
  });
7384
- const fetchSchema = React.useCallback(async (apiGroups, schemaUrlPrefix) => {
7385
- setState((prev) => ({ ...prev, loading: true, error: null }));
7386
- try {
7387
- const results = await Promise.all(
7388
- apiGroups.map(async (apiGroup) => {
7389
- if (state2.schemasMap[apiGroup]) {
7390
- return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7391
- }
7392
- const groupSchemas = await schemaStore.fetchSchemas(apiGroup, schemaUrlPrefix);
7393
- return { apiGroup, schemas: groupSchemas || [] };
7394
- })
7395
- );
7396
- const newSchemasMap = results.reduce((acc, { apiGroup, schemas }) => {
7397
- acc[apiGroup] = schemas;
7398
- return acc;
7399
- }, {});
7400
- const allSchemas = results.flatMap(({ schemas }) => schemas);
7401
- setState({
7402
- schemas: allSchemas,
7403
- schemasMap: newSchemasMap,
7404
- loading: false,
7405
- error: null
7406
- });
7407
- } catch (e2) {
7408
- setState((prev) => ({ ...prev, loading: false, error: e2 }));
7409
- }
7410
- }, [state2.schemasMap]);
7443
+ const fetchSchema = React.useCallback(
7444
+ async (apiGroups, schemaUrlPrefix) => {
7445
+ setState((prev) => ({ ...prev, loading: true, error: null }));
7446
+ try {
7447
+ const results = await Promise.all(
7448
+ apiGroups.map(async (apiGroup) => {
7449
+ if (state2.schemasMap[apiGroup]) {
7450
+ return { apiGroup, schemas: state2.schemasMap[apiGroup] };
7451
+ }
7452
+ const groupSchemas = await schemaStore.fetchSchemas(
7453
+ apiGroup,
7454
+ schemaUrlPrefix
7455
+ );
7456
+ return { apiGroup, schemas: groupSchemas || [] };
7457
+ })
7458
+ );
7459
+ const newSchemasMap = results.reduce(
7460
+ (acc, { apiGroup, schemas }) => {
7461
+ acc[apiGroup] = schemas;
7462
+ return acc;
7463
+ },
7464
+ {}
7465
+ );
7466
+ const allSchemas = results.flatMap(({ schemas }) => schemas);
7467
+ setState({
7468
+ schemas: allSchemas,
7469
+ schemasMap: newSchemasMap,
7470
+ loading: false,
7471
+ error: null
7472
+ });
7473
+ } catch (e2) {
7474
+ setState((prev) => ({ ...prev, loading: false, error: e2 }));
7475
+ }
7476
+ },
7477
+ [state2.schemasMap]
7478
+ );
7411
7479
  return { ...state2, fetchSchema };
7412
7480
  }
7413
7481
  function useSchema(options) {
@@ -7423,7 +7491,11 @@ function useSchema(options) {
7423
7491
  setLoading(true);
7424
7492
  setError(null);
7425
7493
  try {
7426
- 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);
7494
+ const schema2 = await schemaStore.fetchSchema(
7495
+ (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath,
7496
+ schemaUrlPrefix,
7497
+ (_b2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _b2.kind
7498
+ );
7427
7499
  setSchema(schema2 || null);
7428
7500
  setError(null);
7429
7501
  } catch (e2) {
@@ -7444,6 +7516,34 @@ function useSchema(options) {
7444
7516
  fetchSchema
7445
7517
  };
7446
7518
  }
7519
+ const useDeleteManyModal = (resource, ids) => {
7520
+ const { mutate } = core.useDeleteMany();
7521
+ const [visible, setVisible] = React.useState(false);
7522
+ const { t: t2 } = common.useTranslation();
7523
+ const modalProps = {
7524
+ title: t2("dovetail.delete"),
7525
+ okText: t2("dovetail.delete"),
7526
+ okButtonProps: {
7527
+ danger: true
7528
+ },
7529
+ cancelText: t2("dovetail.cancel"),
7530
+ children: t2("dovetail.confirm_delete_text", {
7531
+ target: ids,
7532
+ interpolation: { escapeValue: false }
7533
+ }),
7534
+ onOk() {
7535
+ mutate({
7536
+ resource,
7537
+ ids
7538
+ });
7539
+ setVisible(false);
7540
+ },
7541
+ onCancel() {
7542
+ setVisible(false);
7543
+ }
7544
+ };
7545
+ return { modalProps, visible, setVisible };
7546
+ };
7447
7547
  const ConfigsContext = React.createContext({});
7448
7548
  function getCommonErrors(responseBody, i18n2) {
7449
7549
  var _a;
@@ -7487,12 +7587,16 @@ function getCommonErrors(responseBody, i18n2) {
7487
7587
  }
7488
7588
  return [
7489
7589
  i18n2.t(
7490
- [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
7590
+ [
7591
+ `error.${responseBody.code}`,
7592
+ `error.${responseBody.reason}`,
7593
+ responseBody.message || ""
7594
+ ],
7491
7595
  { fallbackLng: "" }
7492
7596
  )
7493
7597
  ];
7494
7598
  }
7495
- const tag_18x9v7m = "";
7599
+ const tag_19ts6m8 = "";
7496
7600
  const StateTagStyle = "s82411";
7497
7601
  const NameTagStyle = "n9ja9cs";
7498
7602
  function shortenedImage(image2) {
@@ -7892,48 +7996,6 @@ function NameInputWidget(props) {
7892
7996
  const { action } = core.useResource();
7893
7997
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Input, { ...props, disabled: action === "edit" });
7894
7998
  }
7895
- const dnsSubDomainRules = [
7896
- {
7897
- required: true,
7898
- message: "名称不能为空"
7899
- },
7900
- {
7901
- pattern: /^[a-z0-9]([-.a-z0-9]*[a-z0-9])?$/,
7902
- message: "名称只能包含小写字母、数字,以及 '-' 和 '.',且必须以字母或数字开头和结束"
7903
- },
7904
- {
7905
- max: 253,
7906
- message: "名称长度不能超过253个字符"
7907
- }
7908
- ];
7909
- const rfc1123LabelRules = [
7910
- {
7911
- required: true,
7912
- message: "名称不能为空"
7913
- },
7914
- {
7915
- pattern: /^[a-z0-9]([-a-z0-9]*[a-z0-9])?$/,
7916
- message: "名称只能包含小写字母、数字,以及 '-',且以字母或数字开头和结束"
7917
- },
7918
- {
7919
- max: 63,
7920
- message: "名称长度不能超过63个字符"
7921
- }
7922
- ];
7923
- const rfc1035LabelRules = [
7924
- {
7925
- required: true,
7926
- message: "名称不能为空"
7927
- },
7928
- {
7929
- pattern: /^[a-z]([-a-z0-9]*[a-z0-9])?$/,
7930
- message: "名称只能包含小写字母、数字,以及 '-',且以字母开头,字母或数字结束"
7931
- },
7932
- {
7933
- max: 63,
7934
- message: "名称长度不能超过63个字符"
7935
- }
7936
- ];
7937
7999
  function NamespaceSelectWidget(props) {
7938
8000
  const { action } = core.useResource();
7939
8001
  const { data: data2 } = core.useList({
@@ -7995,10 +8057,13 @@ function KeyValueListWidget(props) {
7995
8057
  const onChange = React.useCallback(
7996
8058
  (newItems) => {
7997
8059
  var _a;
7998
- const newValue = newItems.reduce((result, item) => {
7999
- result[item.key] = item.value;
8000
- return result;
8001
- }, {});
8060
+ const newValue = newItems.reduce(
8061
+ (result, item) => {
8062
+ result[item.key] = item.value;
8063
+ return result;
8064
+ },
8065
+ {}
8066
+ );
8002
8067
  (_a = props.onChange) == null ? void 0 : _a.call(props, newValue);
8003
8068
  },
8004
8069
  [props]
@@ -8044,7 +8109,7 @@ function KeyValueListWidget(props) {
8044
8109
  }
8045
8110
  function MetadataForm() {
8046
8111
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
8047
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Form.Item, { label: "Name", name: ["metadata", "name"], rules: rfc1123LabelRules, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8112
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Form.Item, { label: "Name", name: ["metadata", "name"], children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NameInputWidget, {}) }),
8048
8113
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
8049
8114
  eagle.Form.Item,
8050
8115
  {
@@ -8059,6 +8124,12 @@ function MetadataForm() {
8059
8124
  ] });
8060
8125
  }
8061
8126
  const ComponentContext = React.createContext({});
8127
+ function ComponentContextProvider({
8128
+ value: value2,
8129
+ children
8130
+ }) {
8131
+ return React.createElement(ComponentContext.Provider, { value: value2 }, children);
8132
+ }
8062
8133
  const GlobalStoreContext = React.createContext({});
8063
8134
  const index_1s9fcl3 = "";
8064
8135
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
@@ -8222,21 +8293,31 @@ function Table$1(props) {
8222
8293
  })]
8223
8294
  });
8224
8295
  }
8225
- function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
8296
+ function useTableData({
8297
+ data: data2,
8298
+ columns,
8299
+ pageSize = 10,
8300
+ defaultSorters
8301
+ }) {
8226
8302
  const [currentPage, setCurrentPage] = React.useState(1);
8227
8303
  const [sorters, setSorters] = React.useState(defaultSorters || []);
8228
- const onSorterChange = React.useCallback((order, key2) => {
8229
- var _a;
8230
- const ORDER_MAP = {
8231
- descend: "desc",
8232
- ascend: "asc"
8233
- };
8234
- const sorters2 = [{
8235
- field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8236
- order: order ? ORDER_MAP[order] : order
8237
- }];
8238
- setSorters(sorters2);
8239
- }, [columns]);
8304
+ const onSorterChange = React.useCallback(
8305
+ (order, key2) => {
8306
+ var _a;
8307
+ const ORDER_MAP = {
8308
+ descend: "desc",
8309
+ ascend: "asc"
8310
+ };
8311
+ const sorters2 = [
8312
+ {
8313
+ field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8314
+ order: order ? ORDER_MAP[order] : order
8315
+ }
8316
+ ];
8317
+ setSorters(sorters2);
8318
+ },
8319
+ [columns]
8320
+ );
8240
8321
  return {
8241
8322
  data: k8sApiProvider.paginateData(
8242
8323
  {
@@ -8316,7 +8397,7 @@ const PodSelectorTable = ({ podSelectors = {} }) => {
8316
8397
  }
8317
8398
  );
8318
8399
  };
8319
- const PortsTable = ({ service }) => {
8400
+ const PortsTable = ({ service: service2 }) => {
8320
8401
  const { t: t2 } = common.useTranslation();
8321
8402
  const component = React.useContext(ComponentContext);
8322
8403
  const Table2 = component.Table || Table$1;
@@ -8363,7 +8444,7 @@ const PortsTable = ({ service }) => {
8363
8444
  width: 199
8364
8445
  }
8365
8446
  ];
8366
- const ports = (service._rawYaml.spec.ports || []).map((port2) => ({
8447
+ const ports = (service2._rawYaml.spec.ports || []).map((port2) => ({
8367
8448
  ...port2,
8368
8449
  id: port2.name || ""
8369
8450
  }));
@@ -8778,6 +8859,38 @@ function PVCDistributeStorage({
8778
8859
  )
8779
8860
  ] });
8780
8861
  }
8862
+ const index_1oorxg6 = "";
8863
+ const CopyIconStyle = "c1oll6q9";
8864
+ const CopyButton = ({
8865
+ value: value2,
8866
+ className
8867
+ }) => {
8868
+ const {
8869
+ i18n: i18n2
8870
+ } = common.useTranslation();
8871
+ const [tooltip, setTooltip] = React.useState(i18n2.t("dovetail.copy"));
8872
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
8873
+ title: tooltip,
8874
+ onVisibleChange: (visible) => {
8875
+ if (!visible) {
8876
+ setTimeout(() => {
8877
+ setTooltip(i18n2.t("dovetail.copy"));
8878
+ }, 80);
8879
+ }
8880
+ },
8881
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, {
8882
+ src: iconsReact.ClipboardCopy16GradientGrayIcon,
8883
+ hoverSrc: iconsReact.ClipboardCopy16GradientBlueIcon,
8884
+ className: common.cx_default(CopyIconStyle, className),
8885
+ iconWidth: 16,
8886
+ iconHeight: 16,
8887
+ onClick: () => {
8888
+ copyToClipboard$1(value2);
8889
+ setTooltip(i18n2.t("dovetail.copied"));
8890
+ }
8891
+ })
8892
+ });
8893
+ };
8781
8894
  class ResourceModel {
8782
8895
  constructor(_rawYaml, _globalStore) {
8783
8896
  __publicField(this, "id");
@@ -8895,74 +9008,70 @@ const BASE_INIT_VALUE = {
8895
9008
  }
8896
9009
  };
8897
9010
  const DEPLOYMENT_INIT_VALUE = {
8898
- "apiVersion": "apps/v1",
8899
- "kind": "Deployment",
8900
- "metadata": {
8901
- "name": "example",
8902
- "namespace": "default"
9011
+ apiVersion: "apps/v1",
9012
+ kind: "Deployment",
9013
+ metadata: {
9014
+ name: "example",
9015
+ namespace: "default"
8903
9016
  },
8904
- "spec": {
8905
- "selector": {
8906
- "matchLabels": {
8907
- "app": "deployment-example"
9017
+ spec: {
9018
+ selector: {
9019
+ matchLabels: {
9020
+ app: "deployment-example"
8908
9021
  }
8909
9022
  },
8910
- "replicas": 3,
8911
- "template": {
8912
- "metadata": {
8913
- "labels": {
8914
- "app": "deployment-example"
9023
+ replicas: 3,
9024
+ template: {
9025
+ metadata: {
9026
+ labels: {
9027
+ app: "deployment-example"
8915
9028
  }
8916
9029
  },
8917
- "spec": {
8918
- "containers": [
9030
+ spec: {
9031
+ containers: [
8919
9032
  {
8920
- "name": "deployment-example",
8921
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
8922
- "ports": [
9033
+ name: "deployment-example",
9034
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9035
+ ports: [
8923
9036
  {
8924
- "containerPort": 8080,
8925
- "protocol": "TCP"
9037
+ containerPort: 8080,
9038
+ protocol: "TCP"
8926
9039
  }
8927
9040
  ]
8928
9041
  }
8929
9042
  ]
8930
9043
  }
8931
9044
  },
8932
- "strategy": {
8933
- "type": "RollingUpdate",
8934
- "rollingUpdate": {
8935
- "maxSurge": "25%",
8936
- "maxUnavailable": "25%"
9045
+ strategy: {
9046
+ type: "RollingUpdate",
9047
+ rollingUpdate: {
9048
+ maxSurge: "25%",
9049
+ maxUnavailable: "25%"
8937
9050
  }
8938
9051
  }
8939
9052
  }
8940
9053
  };
8941
9054
  const CRONJOB_INIT_VALUE = {
8942
- "apiVersion": "batch/v1",
8943
- "kind": "CronJob",
8944
- "metadata": {
8945
- "name": "example",
8946
- "namespace": "default"
9055
+ apiVersion: "batch/v1",
9056
+ kind: "CronJob",
9057
+ metadata: {
9058
+ name: "example",
9059
+ namespace: "default"
8947
9060
  },
8948
- "spec": {
8949
- "schedule": "@daily",
8950
- "jobTemplate": {
8951
- "spec": {
8952
- "template": {
8953
- "spec": {
8954
- "containers": [
9061
+ spec: {
9062
+ schedule: "@daily",
9063
+ jobTemplate: {
9064
+ spec: {
9065
+ template: {
9066
+ spec: {
9067
+ containers: [
8955
9068
  {
8956
- "name": "example",
8957
- "image": "registry.smtx.io/kubesmart/alpine:3",
8958
- "args": [
8959
- "/bin/sh",
8960
- "-c",
8961
- "date; echo Hello from the Kubernetes cluster"
8962
- ]
9069
+ name: "example",
9070
+ image: "registry.smtx.io/kubesmart/alpine:3",
9071
+ args: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
8963
9072
  }
8964
9073
  ],
8965
- "restartPolicy": "OnFailure"
9074
+ restartPolicy: "OnFailure"
8966
9075
  }
8967
9076
  }
8968
9077
  }
@@ -8970,32 +9079,32 @@ const CRONJOB_INIT_VALUE = {
8970
9079
  }
8971
9080
  };
8972
9081
  const DAEMONSET_INIT_VALUE = {
8973
- "apiVersion": "apps/v1",
8974
- "kind": "DaemonSet",
8975
- "metadata": {
8976
- "name": "example",
8977
- "namespace": "default"
9082
+ apiVersion: "apps/v1",
9083
+ kind: "DaemonSet",
9084
+ metadata: {
9085
+ name: "example",
9086
+ namespace: "default"
8978
9087
  },
8979
- "spec": {
8980
- "selector": {
8981
- "matchLabels": {
8982
- "app": "daemonset-example"
9088
+ spec: {
9089
+ selector: {
9090
+ matchLabels: {
9091
+ app: "daemonset-example"
8983
9092
  }
8984
9093
  },
8985
- "template": {
8986
- "metadata": {
8987
- "labels": {
8988
- "app": "daemonset-example"
9094
+ template: {
9095
+ metadata: {
9096
+ labels: {
9097
+ app: "daemonset-example"
8989
9098
  }
8990
9099
  },
8991
- "spec": {
8992
- "containers": [
9100
+ spec: {
9101
+ containers: [
8993
9102
  {
8994
- "name": "daemonset-example",
8995
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
8996
- "ports": [
9103
+ name: "daemonset-example",
9104
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9105
+ ports: [
8997
9106
  {
8998
- "containerPort": 8080
9107
+ containerPort: 8080
8999
9108
  }
9000
9109
  ]
9001
9110
  }
@@ -9005,98 +9114,86 @@ const DAEMONSET_INIT_VALUE = {
9005
9114
  }
9006
9115
  };
9007
9116
  const JOB_INIT_VALUE = {
9008
- "apiVersion": "batch/v1",
9009
- "kind": "Job",
9010
- "metadata": {
9011
- "name": "example",
9012
- "namespace": "default"
9117
+ apiVersion: "batch/v1",
9118
+ kind: "Job",
9119
+ metadata: {
9120
+ name: "example",
9121
+ namespace: "default"
9013
9122
  },
9014
- "spec": {
9015
- "selector": {},
9016
- "template": {
9017
- "metadata": {
9018
- "name": "job-example"
9123
+ spec: {
9124
+ selector: {},
9125
+ template: {
9126
+ metadata: {
9127
+ name: "job-example"
9019
9128
  },
9020
- "spec": {
9021
- "containers": [
9129
+ spec: {
9130
+ containers: [
9022
9131
  {
9023
- "name": "job-example",
9024
- "image": "registry.smtx.io/kubesmart/alpine:3",
9025
- "command": [
9026
- "/bin/sh",
9027
- "-c",
9028
- "date; echo Hello from the Kubernetes cluster"
9029
- ]
9132
+ name: "job-example",
9133
+ image: "registry.smtx.io/kubesmart/alpine:3",
9134
+ command: ["/bin/sh", "-c", "date; echo Hello from the Kubernetes cluster"]
9030
9135
  }
9031
9136
  ],
9032
- "restartPolicy": "Never"
9137
+ restartPolicy: "Never"
9033
9138
  }
9034
9139
  }
9035
9140
  }
9036
9141
  };
9037
9142
  const STATEFULSET_INIT_VALUE = {
9038
- "apiVersion": "apps/v1",
9039
- "kind": "StatefulSet",
9040
- "metadata": {
9041
- "name": "example",
9042
- "namespace": "default"
9143
+ apiVersion: "apps/v1",
9144
+ kind: "StatefulSet",
9145
+ metadata: {
9146
+ name: "example",
9147
+ namespace: "default"
9043
9148
  },
9044
- "spec": {
9045
- "serviceName": "statefulset-example",
9046
- "replicas": 3,
9047
- "selector": {
9048
- "matchLabels": {
9049
- "app": "statefulset-example"
9149
+ spec: {
9150
+ serviceName: "statefulset-example",
9151
+ replicas: 3,
9152
+ selector: {
9153
+ matchLabels: {
9154
+ app: "statefulset-example"
9050
9155
  }
9051
9156
  },
9052
- "template": {
9053
- "metadata": {
9054
- "labels": {
9055
- "app": "statefulset-example"
9157
+ template: {
9158
+ metadata: {
9159
+ labels: {
9160
+ app: "statefulset-example"
9056
9161
  }
9057
9162
  },
9058
- "spec": {
9059
- "terminationGracePeriodSeconds": 10,
9060
- "containers": [
9163
+ spec: {
9164
+ terminationGracePeriodSeconds: 10,
9165
+ containers: [
9061
9166
  {
9062
- "name": "statefulset-example",
9063
- "image": "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9064
- "command": [
9065
- "dufs"
9066
- ],
9067
- "args": [
9068
- "-A",
9069
- "--render-try-index",
9070
- "/data"
9071
- ],
9072
- "ports": [
9167
+ name: "statefulset-example",
9168
+ image: "registry.smtx.io/kubesmart/fileserver:v1.0.0",
9169
+ command: ["dufs"],
9170
+ args: ["-A", "--render-try-index", "/data"],
9171
+ ports: [
9073
9172
  {
9074
- "containerPort": 5e3,
9075
- "name": "http"
9173
+ containerPort: 5e3,
9174
+ name: "http"
9076
9175
  }
9077
9176
  ],
9078
- "volumeMounts": [
9177
+ volumeMounts: [
9079
9178
  {
9080
- "name": "file",
9081
- "mountPath": "/data"
9179
+ name: "file",
9180
+ mountPath: "/data"
9082
9181
  }
9083
9182
  ]
9084
9183
  }
9085
9184
  ]
9086
9185
  }
9087
9186
  },
9088
- "volumeClaimTemplates": [
9187
+ volumeClaimTemplates: [
9089
9188
  {
9090
- "metadata": {
9091
- "name": "file"
9189
+ metadata: {
9190
+ name: "file"
9092
9191
  },
9093
- "spec": {
9094
- "accessModes": [
9095
- "ReadWriteOnce"
9096
- ],
9097
- "resources": {
9098
- "requests": {
9099
- "storage": "1Gi"
9192
+ spec: {
9193
+ accessModes: ["ReadWriteOnce"],
9194
+ resources: {
9195
+ requests: {
9196
+ storage: "1Gi"
9100
9197
  }
9101
9198
  }
9102
9199
  }
@@ -9105,37 +9202,35 @@ const STATEFULSET_INIT_VALUE = {
9105
9202
  }
9106
9203
  };
9107
9204
  const POD_INIT_VALUE = {
9108
- "apiVersion": "v1",
9109
- "kind": "Pod",
9110
- "metadata": {
9111
- "name": "example",
9112
- "namespace": "default",
9113
- "labels": {
9114
- "app": "example"
9205
+ apiVersion: "v1",
9206
+ kind: "Pod",
9207
+ metadata: {
9208
+ name: "example",
9209
+ namespace: "default",
9210
+ labels: {
9211
+ app: "example"
9115
9212
  }
9116
9213
  },
9117
- "spec": {
9118
- "securityContext": {
9119
- "runAsNonRoot": true,
9120
- "seccompProfile": {
9121
- "type": "RuntimeDefault"
9214
+ spec: {
9215
+ securityContext: {
9216
+ runAsNonRoot: true,
9217
+ seccompProfile: {
9218
+ type: "RuntimeDefault"
9122
9219
  }
9123
9220
  },
9124
- "containers": [
9221
+ containers: [
9125
9222
  {
9126
- "name": "example",
9127
- "image": "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9128
- "ports": [
9223
+ name: "example",
9224
+ image: "registry.smtx.io/kubesmart/bitnami/nginx:1.25.2-debian-11-r2",
9225
+ ports: [
9129
9226
  {
9130
- "containerPort": 8080
9227
+ containerPort: 8080
9131
9228
  }
9132
9229
  ],
9133
- "securityContext": {
9134
- "allowPrivilegeEscalation": false,
9135
- "capabilities": {
9136
- "drop": [
9137
- "ALL"
9138
- ]
9230
+ securityContext: {
9231
+ allowPrivilegeEscalation: false,
9232
+ capabilities: {
9233
+ drop: ["ALL"]
9139
9234
  }
9140
9235
  }
9141
9236
  }
@@ -9143,143 +9238,143 @@ const POD_INIT_VALUE = {
9143
9238
  }
9144
9239
  };
9145
9240
  const SERVICE_CLUSTER_IP_INIT_VALUE = {
9146
- "apiVersion": "v1",
9147
- "kind": "Service",
9148
- "metadata": {
9149
- "name": "example",
9150
- "namespace": "default"
9241
+ apiVersion: "v1",
9242
+ kind: "Service",
9243
+ metadata: {
9244
+ name: "example",
9245
+ namespace: "default"
9151
9246
  },
9152
- "spec": {
9153
- "selector": {
9154
- "app": "example"
9247
+ spec: {
9248
+ selector: {
9249
+ app: "example"
9155
9250
  },
9156
- "ports": [
9251
+ ports: [
9157
9252
  {
9158
- "name": "example",
9159
- "port": 8080,
9160
- "protocol": "TCP",
9161
- "targetPort": 8080
9253
+ name: "example",
9254
+ port: 8080,
9255
+ protocol: "TCP",
9256
+ targetPort: 8080
9162
9257
  }
9163
9258
  ],
9164
- "sessionAffinity": "None",
9165
- "type": "ClusterIP"
9259
+ sessionAffinity: "None",
9260
+ type: "ClusterIP"
9166
9261
  }
9167
9262
  };
9168
9263
  const SERVICE_NODE_PORT_INIT_VALUE = {
9169
- "apiVersion": "v1",
9170
- "kind": "Service",
9171
- "metadata": {
9172
- "name": "example",
9173
- "namespace": "default"
9264
+ apiVersion: "v1",
9265
+ kind: "Service",
9266
+ metadata: {
9267
+ name: "example",
9268
+ namespace: "default"
9174
9269
  },
9175
- "spec": {
9176
- "selector": {
9177
- "app": "example"
9270
+ spec: {
9271
+ selector: {
9272
+ app: "example"
9178
9273
  },
9179
- "ports": [
9274
+ ports: [
9180
9275
  {
9181
- "name": "example",
9182
- "port": 8080,
9183
- "protocol": "TCP",
9184
- "targetPort": 8080
9276
+ name: "example",
9277
+ port: 8080,
9278
+ protocol: "TCP",
9279
+ targetPort: 8080
9185
9280
  }
9186
9281
  ],
9187
- "sessionAffinity": "None",
9188
- "type": "NodePort"
9282
+ sessionAffinity: "None",
9283
+ type: "NodePort"
9189
9284
  }
9190
9285
  };
9191
9286
  const SERVICE_LOAD_BALANCER_INIT_VALUE = {
9192
- "apiVersion": "v1",
9193
- "kind": "Service",
9194
- "metadata": {
9195
- "name": "example",
9196
- "namespace": "default"
9287
+ apiVersion: "v1",
9288
+ kind: "Service",
9289
+ metadata: {
9290
+ name: "example",
9291
+ namespace: "default"
9197
9292
  },
9198
- "spec": {
9199
- "selector": {
9200
- "app": "example"
9293
+ spec: {
9294
+ selector: {
9295
+ app: "example"
9201
9296
  },
9202
- "ports": [
9297
+ ports: [
9203
9298
  {
9204
- "name": "example",
9205
- "port": 80,
9206
- "protocol": "TCP",
9207
- "targetPort": 8080
9299
+ name: "example",
9300
+ port: 80,
9301
+ protocol: "TCP",
9302
+ targetPort: 8080
9208
9303
  }
9209
9304
  ],
9210
- "sessionAffinity": "None",
9211
- "type": "LoadBalancer"
9305
+ sessionAffinity: "None",
9306
+ type: "LoadBalancer"
9212
9307
  }
9213
9308
  };
9214
9309
  const SERVICE_EXTERNAL_NAME_INIT_VALUE = {
9215
- "apiVersion": "v1",
9216
- "kind": "Service",
9217
- "metadata": {
9218
- "name": "example",
9219
- "namespace": "default"
9310
+ apiVersion: "v1",
9311
+ kind: "Service",
9312
+ metadata: {
9313
+ name: "example",
9314
+ namespace: "default"
9220
9315
  },
9221
- "spec": {
9222
- "selector": {
9223
- "app": "example"
9316
+ spec: {
9317
+ selector: {
9318
+ app: "example"
9224
9319
  },
9225
- "ports": [
9320
+ ports: [
9226
9321
  {
9227
- "name": "example",
9228
- "port": 8080,
9229
- "protocol": "TCP",
9230
- "targetPort": 8080
9322
+ name: "example",
9323
+ port: 8080,
9324
+ protocol: "TCP",
9325
+ targetPort: 8080
9231
9326
  }
9232
9327
  ],
9233
- "sessionAffinity": "None",
9234
- "type": "ExternalName",
9235
- "externalName": "app.example.com"
9328
+ sessionAffinity: "None",
9329
+ type: "ExternalName",
9330
+ externalName: "app.example.com"
9236
9331
  }
9237
9332
  };
9238
9333
  const SERVICE_HEADLESS_INIT_VALUE = {
9239
- "apiVersion": "v1",
9240
- "kind": "Service",
9241
- "metadata": {
9242
- "name": "example",
9243
- "namespace": "default"
9334
+ apiVersion: "v1",
9335
+ kind: "Service",
9336
+ metadata: {
9337
+ name: "example",
9338
+ namespace: "default"
9244
9339
  },
9245
- "spec": {
9246
- "selector": {
9247
- "app": "example"
9340
+ spec: {
9341
+ selector: {
9342
+ app: "example"
9248
9343
  },
9249
- "clusterIP": "None",
9250
- "ports": [
9344
+ clusterIP: "None",
9345
+ ports: [
9251
9346
  {
9252
- "name": "example",
9253
- "port": null,
9254
- "protocol": "TCP",
9255
- "targetPort": null
9347
+ name: "example",
9348
+ port: null,
9349
+ protocol: "TCP",
9350
+ targetPort: null
9256
9351
  }
9257
9352
  ],
9258
- "sessionAffinity": "None",
9259
- "type": "ClusterIP"
9353
+ sessionAffinity: "None",
9354
+ type: "ClusterIP"
9260
9355
  }
9261
9356
  };
9262
9357
  const INGRESS_INIT_VALUE = {
9263
- "apiVersion": "networking.k8s.io/v1",
9264
- "kind": "Ingress",
9265
- "metadata": {
9266
- "name": "example",
9267
- "namespace": "default"
9358
+ apiVersion: "networking.k8s.io/v1",
9359
+ kind: "Ingress",
9360
+ metadata: {
9361
+ name: "example",
9362
+ namespace: "default"
9268
9363
  },
9269
- "spec": {
9270
- "rules": [
9364
+ spec: {
9365
+ rules: [
9271
9366
  {
9272
- "host": "example.com",
9273
- "http": {
9274
- "paths": [
9367
+ host: "example.com",
9368
+ http: {
9369
+ paths: [
9275
9370
  {
9276
- "path": "/testpath",
9277
- "pathType": "Prefix",
9278
- "backend": {
9279
- "service": {
9280
- "name": "test",
9281
- "port": {
9282
- "number": 80
9371
+ path: "/testpath",
9372
+ pathType: "Prefix",
9373
+ backend: {
9374
+ service: {
9375
+ name: "test",
9376
+ port: {
9377
+ number: 80
9283
9378
  }
9284
9379
  }
9285
9380
  }
@@ -9291,28 +9386,28 @@ const INGRESS_INIT_VALUE = {
9291
9386
  }
9292
9387
  };
9293
9388
  const NETWORK_POLICY_INIT_VALUE = {
9294
- "apiVersion": "networking.k8s.io/v1",
9295
- "kind": "NetworkPolicy",
9296
- "metadata": {
9297
- "name": "example",
9298
- "namespace": "default"
9389
+ apiVersion: "networking.k8s.io/v1",
9390
+ kind: "NetworkPolicy",
9391
+ metadata: {
9392
+ name: "example",
9393
+ namespace: "default"
9299
9394
  },
9300
- "spec": {
9301
- "podSelector": {},
9302
- "policyTypes": []
9395
+ spec: {
9396
+ podSelector: {},
9397
+ policyTypes: []
9303
9398
  }
9304
9399
  };
9305
9400
  const CONFIG_MAP_INIT_VALUE = {
9306
- "apiVersion": "v1",
9307
- "kind": "ConfigMap",
9308
- "metadata": {
9309
- "name": "example",
9310
- "namespace": "default"
9401
+ apiVersion: "v1",
9402
+ kind: "ConfigMap",
9403
+ metadata: {
9404
+ name: "example",
9405
+ namespace: "default"
9311
9406
  },
9312
- "data": {
9313
- "key": "value"
9407
+ data: {
9408
+ key: "value"
9314
9409
  },
9315
- "immutable": false
9410
+ immutable: false
9316
9411
  };
9317
9412
  const SERVER_INSTANCE_INIT_VALUE = {
9318
9413
  apiVersion: "kubesmart.smtx.io/v1alpha1",
@@ -9334,138 +9429,136 @@ const SERVER_INSTANCE_INIT_VALUE = {
9334
9429
  };
9335
9430
  const REDEPLOY_TIMESTAMP_KEY = "kubectl.kubernetes.io/restartedAt";
9336
9431
  const SECRET_OPAQUE_INIT_VALUE = {
9337
- "apiVersion": "v1",
9338
- "kind": "Secret",
9339
- "metadata": {
9340
- "name": "example",
9341
- "namespace": "default"
9432
+ apiVersion: "v1",
9433
+ kind: "Secret",
9434
+ metadata: {
9435
+ name: "example",
9436
+ namespace: "default"
9342
9437
  },
9343
- "type": "Opaque",
9344
- "data": {
9345
- "key": "value"
9438
+ type: "Opaque",
9439
+ data: {
9440
+ key: "value"
9346
9441
  }
9347
9442
  };
9348
9443
  const SECRET_IMAGE_REPO_INIT_VALUE = {
9349
- "apiVersion": "v1",
9350
- "kind": "Secret",
9351
- "metadata": {
9352
- "name": "example",
9353
- "namespace": "default"
9444
+ apiVersion: "v1",
9445
+ kind: "Secret",
9446
+ metadata: {
9447
+ name: "example",
9448
+ namespace: "default"
9354
9449
  },
9355
- "type": "kubernetes.io/dockerconfigjson",
9356
- "data": {
9450
+ type: "kubernetes.io/dockerconfigjson",
9451
+ data: {
9357
9452
  ".dockerconfigjson": ""
9358
9453
  }
9359
9454
  };
9360
9455
  const SECRET_BASIC_AUTH_INIT_VALUE = {
9361
- "apiVersion": "v1",
9362
- "kind": "Secret",
9363
- "metadata": {
9364
- "name": "example",
9365
- "namespace": "default"
9456
+ apiVersion: "v1",
9457
+ kind: "Secret",
9458
+ metadata: {
9459
+ name: "example",
9460
+ namespace: "default"
9366
9461
  },
9367
- "type": "kubernetes.io/basic-auth",
9368
- "data": {
9369
- "username": "example",
9370
- "password": "example"
9462
+ type: "kubernetes.io/basic-auth",
9463
+ data: {
9464
+ username: "example",
9465
+ password: "example"
9371
9466
  }
9372
9467
  };
9373
9468
  const SECRET_SSH_AUTH_INIT_VALUE = {
9374
- "apiVersion": "v1",
9375
- "kind": "Secret",
9376
- "metadata": {
9377
- "name": "example",
9378
- "namespace": "default"
9469
+ apiVersion: "v1",
9470
+ kind: "Secret",
9471
+ metadata: {
9472
+ name: "example",
9473
+ namespace: "default"
9379
9474
  },
9380
- "type": "kubernetes.io/ssh-auth",
9381
- "data": {
9475
+ type: "kubernetes.io/ssh-auth",
9476
+ data: {
9382
9477
  "ssh-publickey": "",
9383
9478
  "ssh-privatekey": ""
9384
9479
  }
9385
9480
  };
9386
9481
  const SECRET_TLS_INIT_VALUE = {
9387
- "apiVersion": "v1",
9388
- "kind": "Secret",
9389
- "metadata": {
9390
- "name": "example",
9391
- "namespace": "default"
9482
+ apiVersion: "v1",
9483
+ kind: "Secret",
9484
+ metadata: {
9485
+ name: "example",
9486
+ namespace: "default"
9392
9487
  },
9393
- "type": "kubernetes.io/tls",
9394
- "data": {
9488
+ type: "kubernetes.io/tls",
9489
+ data: {
9395
9490
  "tls.crt": "",
9396
9491
  "tls.key": ""
9397
9492
  }
9398
9493
  };
9399
9494
  const SECRET_CUSTOM_INIT_VALUE = {
9400
- "apiVersion": "v1",
9401
- "kind": "Secret",
9402
- "metadata": {
9403
- "name": "example",
9404
- "namespace": "default"
9495
+ apiVersion: "v1",
9496
+ kind: "Secret",
9497
+ metadata: {
9498
+ name: "example",
9499
+ namespace: "default"
9405
9500
  },
9406
- "type": "",
9407
- "data": {}
9501
+ type: "",
9502
+ data: {}
9408
9503
  };
9409
9504
  const NODE_INIT_VALUE = {
9410
- "apiVersion": "v1",
9411
- "kind": "Node",
9412
- "metadata": {
9413
- "name": "example",
9414
- "namespace": "default"
9505
+ apiVersion: "v1",
9506
+ kind: "Node",
9507
+ metadata: {
9508
+ name: "example",
9509
+ namespace: "default"
9415
9510
  },
9416
- "spec": {}
9511
+ spec: {}
9417
9512
  };
9418
9513
  const STORAGE_CLASS_INIT_VALUE = {
9419
- "apiVersion": "storage.k8s.io/v1",
9420
- "kind": "StorageClass",
9421
- "metadata": {
9422
- "name": ""
9514
+ apiVersion: "storage.k8s.io/v1",
9515
+ kind: "StorageClass",
9516
+ metadata: {
9517
+ name: ""
9423
9518
  },
9424
- "parameters": {
9519
+ parameters: {
9425
9520
  "csi.storage.k8s.io/fstype": "ext4"
9426
9521
  },
9427
- "provisioner": "",
9428
- "reclaimPolicy": "Delete",
9429
- "allowVolumeExpansion": true,
9430
- "volumeBindingMode": "Immediate"
9522
+ provisioner: "",
9523
+ reclaimPolicy: "Delete",
9524
+ allowVolumeExpansion: true,
9525
+ volumeBindingMode: "Immediate"
9431
9526
  };
9432
9527
  const PV_INIT_VALUE = {
9433
- "apiVersion": "v1",
9434
- "kind": "PersistentVolume",
9435
- "metadata": {
9436
- "name": "pvc-hostpath"
9528
+ apiVersion: "v1",
9529
+ kind: "PersistentVolume",
9530
+ metadata: {
9531
+ name: "pvc-hostpath"
9437
9532
  },
9438
- "spec": {
9439
- "accessModes": [
9440
- "ReadWriteOnce"
9441
- ],
9442
- "capacity": {
9443
- "storage": "10Gi"
9533
+ spec: {
9534
+ accessModes: ["ReadWriteOnce"],
9535
+ capacity: {
9536
+ storage: "10Gi"
9444
9537
  },
9445
- "hostPath": {
9446
- "type": "DirectoryOrCreate",
9447
- "path": "/root/test"
9538
+ hostPath: {
9539
+ type: "DirectoryOrCreate",
9540
+ path: "/root/test"
9448
9541
  },
9449
- "persistentVolumeReclaimPolicy": "Delete",
9450
- "volumeMode": "Filesystem"
9542
+ persistentVolumeReclaimPolicy: "Delete",
9543
+ volumeMode: "Filesystem"
9451
9544
  }
9452
9545
  };
9453
9546
  const PVC_INIT_VALUE = {
9454
- "apiVersion": "v1",
9455
- "kind": "PersistentVolumeClaim",
9456
- "metadata": {
9457
- "name": "",
9458
- "namespace": "default"
9547
+ apiVersion: "v1",
9548
+ kind: "PersistentVolumeClaim",
9549
+ metadata: {
9550
+ name: "",
9551
+ namespace: "default"
9459
9552
  },
9460
- "spec": {
9461
- "accessModes": [],
9462
- "resources": {
9463
- "requests": {
9464
- "storage": "10Gi"
9553
+ spec: {
9554
+ accessModes: [],
9555
+ resources: {
9556
+ requests: {
9557
+ storage: "10Gi"
9465
9558
  }
9466
9559
  },
9467
- "storageClassName": "",
9468
- "volumeMode": "Filesystem"
9560
+ storageClassName: "",
9561
+ volumeMode: "Filesystem"
9469
9562
  }
9470
9563
  };
9471
9564
  var ResourceState = /* @__PURE__ */ ((ResourceState2) => {
@@ -9572,6 +9665,16 @@ class WorkloadBaseModel extends ResourceModel {
9572
9665
  );
9573
9666
  return (containers == null ? void 0 : containers.map((container2) => shortenedImage(container2.image || ""))) || [];
9574
9667
  }
9668
+ async fetchRestarts(selector, namespace2) {
9669
+ const pods = await this._globalStore.get("pods", {
9670
+ resourceBasePath: "/api/v1",
9671
+ kind: "Pod"
9672
+ });
9673
+ const myPods = pods.items.filter(
9674
+ (p) => matchSelector(p, selector, namespace2)
9675
+ );
9676
+ return lodashExports.sumBy(myPods, "restarts");
9677
+ }
9575
9678
  }
9576
9679
  class JobModel extends WorkloadBaseModel {
9577
9680
  constructor(_rawYaml, _globalStore) {
@@ -9583,18 +9686,11 @@ class JobModel extends WorkloadBaseModel {
9583
9686
  await this.getRestarts();
9584
9687
  }
9585
9688
  async getRestarts() {
9586
- const pods = await this._globalStore.get("pods", {
9587
- resourceBasePath: "/api/v1",
9588
- kind: "Pod"
9589
- });
9590
- const myPods = pods.items.filter(
9591
- (p) => {
9592
- var _a;
9593
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9594
- }
9689
+ var _a;
9690
+ this.restarts = await this.fetchRestarts(
9691
+ (_a = this.spec) == null ? void 0 : _a.selector,
9692
+ this.metadata.namespace
9595
9693
  );
9596
- const result = lodashExports.sumBy(myPods, "restarts");
9597
- this.restarts = result;
9598
9694
  }
9599
9695
  get duration() {
9600
9696
  var _a, _b;
@@ -9659,18 +9755,11 @@ class WorkloadModel extends WorkloadBaseModel {
9659
9755
  await this.getIngresses();
9660
9756
  }
9661
9757
  async getRestarts() {
9662
- const pods = await this._globalStore.get("pods", {
9663
- resourceBasePath: "/api/v1",
9664
- kind: "Pod"
9665
- });
9666
- const myPods = pods.items.filter(
9667
- (p) => {
9668
- var _a;
9669
- return matchSelector(p, (_a = this.spec) == null ? void 0 : _a.selector, this.metadata.namespace);
9670
- }
9758
+ var _a;
9759
+ this.restarts = await this.fetchRestarts(
9760
+ (_a = this.spec) == null ? void 0 : _a.selector,
9761
+ this.metadata.namespace
9671
9762
  );
9672
- const result = lodashExports.sumBy(myPods, "restarts");
9673
- this.restarts = result;
9674
9763
  }
9675
9764
  async getServices() {
9676
9765
  const services = await this._globalStore.get("services", {
@@ -9687,10 +9776,10 @@ class WorkloadModel extends WorkloadBaseModel {
9687
9776
  }
9688
9777
  async getIngresses() {
9689
9778
  const allIngresses = /* @__PURE__ */ new Map();
9690
- for (const service of this.services) {
9691
- for (const ingress of service.ingresses) {
9692
- const key2 = `${ingress.namespace}-${ingress.name}`;
9693
- allIngresses.set(key2, ingress);
9779
+ for (const service2 of this.services) {
9780
+ for (const ingress2 of service2.ingresses) {
9781
+ const key2 = `${ingress2.namespace}-${ingress2.name}`;
9782
+ allIngresses.set(key2, ingress2);
9694
9783
  }
9695
9784
  }
9696
9785
  this.ingresses = Array.from(allIngresses.values());
@@ -9723,6 +9812,23 @@ class WorkloadModel extends WorkloadBaseModel {
9723
9812
  }
9724
9813
  return newOne;
9725
9814
  }
9815
+ getControllerRevisions(controllerRevisions) {
9816
+ return controllerRevisions.filter(
9817
+ (cr) => {
9818
+ var _a, _b;
9819
+ return (_b = (_a = cr.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
9820
+ (ref) => ref.kind === this.kind && ref.uid === this.metadata.uid
9821
+ );
9822
+ }
9823
+ );
9824
+ }
9825
+ getRevision(controllerRevisions) {
9826
+ const myRevisions = this.getControllerRevisions(controllerRevisions);
9827
+ return myRevisions.reduce(
9828
+ (result, cr) => Math.max(result, Number(cr.revision || 0)),
9829
+ 0
9830
+ );
9831
+ }
9726
9832
  }
9727
9833
  class PodModel extends WorkloadBaseModel {
9728
9834
  constructor(_rawYaml, _globalStore) {
@@ -9999,22 +10105,6 @@ class DaemonSetModel extends WorkloadModel {
9999
10105
  super(_rawYaml, _globalStore);
10000
10106
  this._rawYaml = _rawYaml;
10001
10107
  }
10002
- getControllerRevisions(controllerVisions) {
10003
- return controllerVisions.filter(
10004
- (controllerRevision) => {
10005
- var _a, _b;
10006
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
10007
- (ownerReference) => ownerReference.kind === "DaemonSet" && ownerReference.uid === this.metadata.uid
10008
- );
10009
- }
10010
- );
10011
- }
10012
- getRevision(controllerVisions) {
10013
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
10014
- return myControllerVisions.reduce((result, controllerRevision) => {
10015
- return Math.max(result, Number(controllerRevision.revision || 0));
10016
- }, 0);
10017
- }
10018
10108
  get stateDisplay() {
10019
10109
  var _a, _b;
10020
10110
  if (((_a = this.status) == null ? void 0 : _a.desiredNumberScheduled) !== ((_b = this.status) == null ? void 0 : _b.numberReady)) {
@@ -10034,22 +10124,6 @@ class StatefulSetModel extends WorkloadModel {
10034
10124
  super(_rawYaml, _globalStore);
10035
10125
  this._rawYaml = _rawYaml;
10036
10126
  }
10037
- getControllerRevisions(controllerVisions) {
10038
- return controllerVisions.filter(
10039
- (controllerRevision) => {
10040
- var _a, _b;
10041
- return (_b = (_a = controllerRevision.metadata) == null ? void 0 : _a.ownerReferences) == null ? void 0 : _b.some(
10042
- (ownerReference) => ownerReference.kind === "StatefulSet" && ownerReference.uid === this.metadata.uid
10043
- );
10044
- }
10045
- );
10046
- }
10047
- getRevision(controllerVisions) {
10048
- const myControllerVisions = this.getControllerRevisions(controllerVisions);
10049
- return myControllerVisions.reduce((result, controllerRevision) => {
10050
- return Math.max(result, Number(controllerRevision.revision || 0));
10051
- }, 0);
10052
- }
10053
10127
  get stateDisplay() {
10054
10128
  var _a, _b, _c;
10055
10129
  if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
@@ -10082,11 +10156,9 @@ class ServiceModel extends ResourceModel {
10082
10156
  resourceBasePath: "/apis/networking.k8s.io/v1",
10083
10157
  kind: "Ingress"
10084
10158
  });
10085
- const myIngresses = ingresses.items.filter((ingress) => {
10086
- const rules = ingress.getFlattenedRules([]);
10087
- return rules.some(
10088
- (rule2) => rule2.serviceName === this.name
10089
- );
10159
+ const myIngresses = ingresses.items.filter((ingress2) => {
10160
+ const rules = ingress2.getFlattenedRules([]);
10161
+ return rules.some((rule2) => rule2.serviceName === this.name);
10090
10162
  });
10091
10163
  this.ingresses = myIngresses;
10092
10164
  }
@@ -10278,15 +10350,15 @@ class IngressClassModel extends ResourceModel {
10278
10350
  return (_a = this.spec) == null ? void 0 : _a.controller;
10279
10351
  }
10280
10352
  }
10281
- const index_1rec449 = "";
10353
+ const index_1ndmolf = "";
10282
10354
  const ServiceInClusterAccessComponent = ({
10283
- service
10355
+ service: service2
10284
10356
  }) => {
10285
- const spec = service._rawYaml.spec;
10286
- switch (service.displayType) {
10357
+ const spec = service2._rawYaml.spec;
10358
+ switch (service2.displayType) {
10287
10359
  case ServiceTypeEnum.ExternalName:
10288
10360
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10289
- value: service.dnsRecord
10361
+ value: service2.dnsRecord
10290
10362
  });
10291
10363
  case ServiceTypeEnum.Headless:
10292
10364
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
@@ -10302,46 +10374,79 @@ const BreakLineStyle = "b1vtjd4k";
10302
10374
  const LinkStyle$2 = "luro4rx";
10303
10375
  const ShowLinkStyle = "s1gydjqf";
10304
10376
  const DashedUnderlineSpanStyle = "dvp1i89";
10377
+ const AccessAddressStyle = "azmggeh";
10378
+ const ServiceAccessAddress = ({
10379
+ children,
10380
+ copyValue
10381
+ }) => {
10382
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("span", {
10383
+ className: AccessAddressStyle,
10384
+ children: [children, /* @__PURE__ */ common.jsxRuntimeExports.jsx(CopyButton, {
10385
+ value: copyValue
10386
+ })]
10387
+ });
10388
+ };
10389
+ function renderAccessItems(items, separator) {
10390
+ if (!items.length) {
10391
+ return void 0;
10392
+ }
10393
+ const result = [];
10394
+ for (let i2 = 0; i2 < items.length; i2++) {
10395
+ result.push(/* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Fragment, {
10396
+ children: items[i2]
10397
+ }, `item-${i2}`));
10398
+ if (i2 < items.length - 1) {
10399
+ result.push(/* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Fragment, {
10400
+ children: separator
10401
+ }, `separator-${i2}`));
10402
+ }
10403
+ }
10404
+ return result;
10405
+ }
10305
10406
  const ServiceOutClusterAccessComponent = ({
10306
- service,
10407
+ service: service2,
10307
10408
  breakLine = true,
10308
10409
  clusterVip,
10309
- showDashedUnderline = true
10410
+ showDashedUnderline = true,
10411
+ showCopyButton = false
10310
10412
  }) => {
10311
- var _a, _b, _c, _d, _e;
10413
+ var _a, _b, _c, _d, _e, _f, _g, _h;
10312
10414
  const {
10313
10415
  i18n: i18n2
10314
10416
  } = common.useTranslation();
10315
- const spec = service._rawYaml.spec;
10316
- const status = service._rawYaml.status;
10417
+ const spec = service2._rawYaml.spec;
10418
+ const status = service2._rawYaml.status;
10317
10419
  let content = "-";
10318
10420
  switch (spec.type) {
10319
10421
  case ServiceTypeEnum.NodePort:
10320
10422
  if (!breakLine) {
10321
- content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p) => [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Link, {
10322
- href: `http://${clusterVip}:${p.nodePort}`,
10323
- target: "_blank",
10324
- className: common.cx_default(ShowLinkStyle, eagle.Typo.Label.l4_regular_title),
10325
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
10326
- title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10327
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
10328
- className: DashedUnderlineSpanStyle,
10329
- style: showDashedUnderline ? void 0 : {
10330
- borderBottom: "none"
10331
- },
10332
- children: `${clusterVip}:${p.nodePort}`
10423
+ content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v && v.nodePort).map((p) => {
10424
+ const address = `${clusterVip}:${p.nodePort}`;
10425
+ const link = /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Link, {
10426
+ href: `http://${address}`,
10427
+ target: "_blank",
10428
+ className: common.cx_default(ShowLinkStyle, eagle.Typo.Label.l4_regular_title),
10429
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Tooltip, {
10430
+ title: i18n2.t("dovetail.default_http_protocol_tooltip"),
10431
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
10432
+ className: DashedUnderlineSpanStyle,
10433
+ style: showDashedUnderline ? void 0 : {
10434
+ borderBottom: "none"
10435
+ },
10436
+ children: address
10437
+ })
10333
10438
  })
10334
- })
10335
- }, p.name)]);
10336
- if (content && content instanceof Array) {
10337
- const result = [];
10338
- for (let i2 = 0; i2 < content.length; i2++) {
10339
- result.push(content[i2]);
10340
- if (i2 < content.length - 1) {
10341
- result.push(", ");
10342
- }
10439
+ }, p.name || p.nodePort);
10440
+ if (!showCopyButton) {
10441
+ return link;
10343
10442
  }
10344
- content = result;
10443
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10444
+ copyValue: address,
10445
+ children: link
10446
+ }, p.name || p.nodePort);
10447
+ });
10448
+ if (content && content instanceof Array) {
10449
+ content = renderAccessItems(content, ", ");
10345
10450
  }
10346
10451
  break;
10347
10452
  }
@@ -10364,15 +10469,31 @@ const ServiceOutClusterAccessComponent = ({
10364
10469
  children: content
10365
10470
  });
10366
10471
  case ServiceTypeEnum.ExternalName:
10472
+ if (showCopyButton) {
10473
+ content = renderAccessItems(((_c = spec.externalIPs) == null ? void 0 : _c.map((ip) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10474
+ copyValue: ip,
10475
+ children: ip
10476
+ }, ip))) || [], breakLine ? "\n" : ", ");
10477
+ break;
10478
+ }
10367
10479
  content = /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10368
10480
  useOverflow: false,
10369
- value: (_c = spec.externalIPs) == null ? void 0 : _c.join(breakLine ? "\n" : ", ")
10481
+ value: (_d = spec.externalIPs) == null ? void 0 : _d.join(breakLine ? "\n" : ", ")
10370
10482
  });
10371
10483
  break;
10372
10484
  case ServiceTypeEnum.LoadBalancer:
10485
+ if (showCopyButton) {
10486
+ content = renderAccessItems(((_f = (_e = status.loadBalancer) == null ? void 0 : _e.ingress) == null ? void 0 : _f.map(({
10487
+ ip
10488
+ }) => ip).filter((ip) => !!ip).map((ip) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceAccessAddress, {
10489
+ copyValue: ip,
10490
+ children: ip
10491
+ }, ip))) || [], breakLine ? "\n" : ", ");
10492
+ break;
10493
+ }
10373
10494
  content = /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
10374
10495
  useOverflow: false,
10375
- value: (_e = (_d = status.loadBalancer) == null ? void 0 : _d.ingress) == null ? void 0 : _e.map(({
10496
+ value: (_h = (_g = status.loadBalancer) == null ? void 0 : _g.ingress) == null ? void 0 : _h.map(({
10376
10497
  ip
10377
10498
  }) => ip).join(breakLine ? "\n" : ", ")
10378
10499
  });
@@ -10399,7 +10520,7 @@ const ServiceOutClusterAccessComponent = ({
10399
10520
  children: content || "-"
10400
10521
  });
10401
10522
  };
10402
- const index_1es4s7t = "";
10523
+ const index_1l1kti4 = "";
10403
10524
  const TagWrapper = "t13a6vox";
10404
10525
  const TagStyle = "t12ikbmp";
10405
10526
  const Tags = (props) => {
@@ -10665,67 +10786,53 @@ function immutableSet(obj, path2, value2) {
10665
10786
  return lodashEs.setWith(lodashEs.clone(obj), path2, value2, lodashEs.clone);
10666
10787
  }
10667
10788
  function usePathMap(options) {
10668
- const { pathMap, transformInitValues: transformInitValuesFromOptions, transformApplyValues: transformApplyValuesFromOptions } = options;
10669
- const transformInitValues = React.useCallback((values) => {
10670
- const initValues = values._rawYaml || values;
10671
- let result = initValues;
10672
- for (const { from, to } of pathMap || []) {
10673
- result = immutableSet(initValues, to, lodashEs.get(initValues, from));
10674
- const fromPath = [...from];
10675
- const lastKey = fromPath.pop();
10676
- if (lastKey) {
10677
- const obj = lodashEs.get(result, fromPath);
10678
- if (obj && typeof obj === "object") {
10679
- delete obj[lastKey];
10680
- }
10681
- }
10682
- }
10683
- return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10684
- }, [transformInitValuesFromOptions, pathMap]);
10685
- const transformApplyValues = React.useCallback((values) => {
10686
- let result = values;
10687
- for (const { from, to } of pathMap || []) {
10688
- result = immutableSet(
10689
- values,
10690
- from,
10691
- lodashEs.get(result, to)
10692
- );
10693
- const toPath = [...to];
10694
- const lastKey = toPath.pop();
10695
- if (lastKey) {
10696
- const obj = lodashEs.get(result, toPath);
10697
- if (obj && typeof obj === "object") {
10698
- delete obj[lastKey];
10789
+ const {
10790
+ pathMap,
10791
+ transformInitValues: transformInitValuesFromOptions,
10792
+ transformApplyValues: transformApplyValuesFromOptions
10793
+ } = options;
10794
+ const transformInitValues = React.useCallback(
10795
+ (values) => {
10796
+ const initValues = values._rawYaml || values;
10797
+ let result = initValues;
10798
+ for (const { from, to } of pathMap || []) {
10799
+ result = immutableSet(initValues, to, lodashEs.get(initValues, from));
10800
+ const fromPath = [...from];
10801
+ const lastKey = fromPath.pop();
10802
+ if (lastKey) {
10803
+ const obj = lodashEs.get(result, fromPath);
10804
+ if (obj && typeof obj === "object") {
10805
+ delete obj[lastKey];
10806
+ }
10699
10807
  }
10700
10808
  }
10701
- }
10702
- return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10703
- }, [transformApplyValuesFromOptions, pathMap]);
10809
+ return (transformInitValuesFromOptions == null ? void 0 : transformInitValuesFromOptions(result)) || result;
10810
+ },
10811
+ [transformInitValuesFromOptions, pathMap]
10812
+ );
10813
+ const transformApplyValues = React.useCallback(
10814
+ (values) => {
10815
+ let result = values;
10816
+ for (const { from, to } of pathMap || []) {
10817
+ result = immutableSet(values, from, lodashEs.get(result, to));
10818
+ const toPath = [...to];
10819
+ const lastKey = toPath.pop();
10820
+ if (lastKey) {
10821
+ const obj = lodashEs.get(result, toPath);
10822
+ if (obj && typeof obj === "object") {
10823
+ delete obj[lastKey];
10824
+ }
10825
+ }
10826
+ }
10827
+ return (transformApplyValuesFromOptions == null ? void 0 : transformApplyValuesFromOptions(result)) || result;
10828
+ },
10829
+ [transformApplyValuesFromOptions, pathMap]
10830
+ );
10704
10831
  return {
10705
10832
  transformInitValues,
10706
10833
  transformApplyValues
10707
10834
  };
10708
10835
  }
10709
- const useResourceVersionCheck = ({
10710
- queryResult
10711
- }) => {
10712
- var _a, _b, _c;
10713
- const initialResourceVersionRef = React.useRef();
10714
- const [isExpired, setIsExpired] = React.useState(false);
10715
- 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;
10716
- React.useEffect(() => {
10717
- if (!currentResourceVersion)
10718
- return;
10719
- if (!initialResourceVersionRef.current) {
10720
- initialResourceVersionRef.current = currentResourceVersion;
10721
- return;
10722
- }
10723
- if (currentResourceVersion !== initialResourceVersionRef.current) {
10724
- setIsExpired(true);
10725
- }
10726
- }, [currentResourceVersion]);
10727
- return isExpired;
10728
- };
10729
10836
  function getInitialValues(resourceConfig) {
10730
10837
  return resourceConfig.initValue || {
10731
10838
  apiVersion: resourceConfig.apiVersion,
@@ -10734,42 +10841,6 @@ function getInitialValues(resourceConfig) {
10734
10841
  spec: {}
10735
10842
  };
10736
10843
  }
10737
- const button_1v659kh = "";
10738
- const WarningButtonStyle = "wwyz7ti";
10739
- const DataExpiredModal_eazxh6 = "";
10740
- const NoteStyle = "n609wlp";
10741
- function DataExpiredModal({
10742
- onAbandon
10743
- }) {
10744
- const {
10745
- t: t2
10746
- } = common.useTranslation();
10747
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.SmallDialog, {
10748
- title: t2("dovetail.data_expired"),
10749
- closable: false,
10750
- maskClosable: false,
10751
- cancelButtonProps: {
10752
- style: {
10753
- display: "none"
10754
- }
10755
- },
10756
- okText: t2("dovetail.abandon_edit"),
10757
- okButtonProps: {
10758
- className: WarningButtonStyle
10759
- },
10760
- onOk: (popModal) => {
10761
- popModal();
10762
- onAbandon();
10763
- },
10764
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
10765
- className: eagle.Typo.Label.l2_regular,
10766
- children: t2("dovetail.data_expired_body")
10767
- }), /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
10768
- className: `${eagle.Typo.Label.l2_regular} ${NoteStyle}`,
10769
- children: t2("dovetail.data_expired_note")
10770
- })]
10771
- });
10772
- }
10773
10844
  const index_az4wrx = "";
10774
10845
  const WrapperStyle$5 = "w1akirqw";
10775
10846
  const TitleStyle$2 = "t30srnq";
@@ -10809,7 +10880,7 @@ const Separator = () => {
10809
10880
  const style_1o641u6 = "";
10810
10881
  const ToolBarStyle = "t1joof7s";
10811
10882
  const ToolBarHeaderStyle = "tti58uh";
10812
- const ErrorIconStyle = "e15yt16p";
10883
+ const ErrorIconStyle$1 = "e15yt16p";
10813
10884
  const WrapperStyle$4 = "w3ccqks";
10814
10885
  const TitleStyle$1 = "t7zbd78";
10815
10886
  const IconStyle = "i1e4ouxy";
@@ -10819,278 +10890,276 @@ const ErrorWrapperStyle = "e19q2bnp";
10819
10890
  const YamlEditorStyle = "y16u5v3w";
10820
10891
  const MonacoYamlEditor$3 = React.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$1));
10821
10892
  const MonacoYamlDiffEditor$2 = React.lazy(() => Promise.resolve().then(() => MonacoYamlDiffEditor$1));
10822
- const YamlEditorComponent = React.forwardRef(
10823
- function YamlEditorComponent2(props, ref) {
10824
- const {
10825
- title,
10826
- collapsable = true,
10827
- isDefaultCollapsed,
10828
- value: value2,
10829
- defaultValue = "",
10830
- height,
10831
- readOnly,
10832
- errorMsgs = [],
10833
- schemas,
10834
- eleRef,
10835
- className,
10836
- debounceTime,
10837
- isScrollOnFocus = true,
10838
- isHideActions = false
10839
- } = props;
10840
- const { t: t2 } = common.useTranslation();
10841
- const [isCollapsed, setIsCollapsed] = React.useState(
10842
- collapsable ? isDefaultCollapsed : false
10843
- );
10844
- const [isDiff, setIsDiff] = React.useState(false);
10845
- const [_value, _setValue] = React.useState(value2 || defaultValue);
10846
- const editorInstance = React.useRef();
10847
- const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
10848
- const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
10849
- const defaultValueString = React.useMemo(() => {
10850
- if (typeof defaultValue === "string") {
10851
- return defaultValue;
10852
- }
10853
- return yaml$2.dump(defaultValue);
10854
- }, [defaultValue]);
10855
- const _valueString = React.useMemo(() => {
10856
- if (typeof _value === "string") {
10857
- return _value;
10858
- }
10859
- return yaml$2.dump(_value);
10860
- }, [_value]);
10861
- const onChange = React.useCallback(
10862
- (newVal) => {
10863
- var _a;
10864
- _setValue(newVal);
10865
- (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10866
- },
10867
- [props.onChange]
10868
- );
10869
- const finalOnChange = React.useMemo(() => {
10870
- return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
10871
- }, [onChange, debounceTime]);
10872
- const onValidate = React.useCallback(
10873
- (valid, schemaValid) => {
10874
- var _a;
10875
- (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10876
- },
10877
- [props.onValidate]
10878
- );
10879
- const onEditorCreate = React.useCallback(
10880
- (editor) => {
10881
- var _a, _b, _c;
10882
- if (editor.getValue() !== _value) {
10883
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10884
- }
10885
- (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10886
- },
10887
- [_value, props.onEditorCreate]
10888
- );
10889
- const getInstance = React.useCallback((ins) => {
10890
- editorInstance.current = ins;
10891
- }, []);
10892
- const getEditorValue = React.useCallback(() => {
10893
+ const YamlEditorComponent = React.forwardRef(function YamlEditorComponent2(props, ref) {
10894
+ const {
10895
+ title,
10896
+ collapsable = true,
10897
+ isDefaultCollapsed,
10898
+ value: value2,
10899
+ defaultValue = "",
10900
+ height,
10901
+ readOnly,
10902
+ errorMsgs = [],
10903
+ schemas,
10904
+ eleRef,
10905
+ className,
10906
+ debounceTime,
10907
+ isScrollOnFocus = true,
10908
+ isHideActions = false
10909
+ } = props;
10910
+ const { t: t2 } = common.useTranslation();
10911
+ const [isCollapsed, setIsCollapsed] = React.useState(
10912
+ collapsable ? isDefaultCollapsed : false
10913
+ );
10914
+ const [isDiff, setIsDiff] = React.useState(false);
10915
+ const [_value, _setValue] = React.useState(value2 || defaultValue);
10916
+ const editorInstance = React.useRef();
10917
+ const [copyTooltip, setCopyTooltip] = React.useState(t2("dovetail.copy"));
10918
+ const [resetTooltip, setResetTooltip] = React.useState(t2("dovetail.reset_arguments"));
10919
+ const defaultValueString = React.useMemo(() => {
10920
+ if (typeof defaultValue === "string") {
10921
+ return defaultValue;
10922
+ }
10923
+ return yaml$2.dump(defaultValue);
10924
+ }, [defaultValue]);
10925
+ const _valueString = React.useMemo(() => {
10926
+ if (typeof _value === "string") {
10927
+ return _value;
10928
+ }
10929
+ return yaml$2.dump(_value);
10930
+ }, [_value]);
10931
+ const onChange = React.useCallback(
10932
+ (newVal) => {
10893
10933
  var _a;
10894
- return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10895
- }, []);
10896
- React.useEffect(() => {
10897
- var _a, _b;
10898
- if (value2 !== void 0 && !lodashEs.isEqual(value2, _value)) {
10899
- const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10900
- _setValue(value2);
10901
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10934
+ _setValue(newVal);
10935
+ (_a = props.onChange) == null ? void 0 : _a.call(props, newVal);
10936
+ },
10937
+ [props.onChange]
10938
+ );
10939
+ const finalOnChange = React.useMemo(() => {
10940
+ return debounceTime ? lodashEs.debounce(onChange, debounceTime) : onChange;
10941
+ }, [onChange, debounceTime]);
10942
+ const onValidate = React.useCallback(
10943
+ (valid, schemaValid) => {
10944
+ var _a;
10945
+ (_a = props.onValidate) == null ? void 0 : _a.call(props, valid, schemaValid);
10946
+ },
10947
+ [props.onValidate]
10948
+ );
10949
+ const onEditorCreate = React.useCallback(
10950
+ (editor) => {
10951
+ var _a, _b, _c;
10952
+ if (editor.getValue() !== _value) {
10953
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(_valueString);
10902
10954
  }
10903
- }, [value2]);
10904
- React.useImperativeHandle(ref, () => {
10905
- return {
10906
- setValue: _setValue,
10907
- setEditorValue: (value22) => {
10908
- var _a, _b;
10909
- (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10910
- },
10911
- getEditorValue,
10912
- getEditorInstance: () => editorInstance.current || null
10913
- };
10914
- });
10915
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10916
- "div",
10917
- {
10918
- className: common.cx_default(WrapperStyle$4, className),
10919
- "data-is-error": !!errorMsgs.length,
10920
- ref: eleRef,
10921
- children: [
10922
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10923
- eagle.Space,
10924
- {
10925
- className: common.cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10926
- direction: "vertical",
10927
- size: 0,
10928
- children: [
10929
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ToolBarHeaderStyle, children: [
10930
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 8, children: [
10931
- collapsable && /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10932
- eagle.Icon,
10933
- {
10934
- src: iconsReact.HierarchyTriangleRight16GrayIcon,
10935
- hoverSrc: iconsReact.HierarchyTriangleRight16BlueIcon,
10936
- className: common.cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
10937
- iconWidth: 16,
10938
- iconHeight: 16,
10939
- onClick: () => setIsCollapsed(!isCollapsed)
10940
- }
10941
- ),
10942
- /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: common.cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
10943
- ] }),
10944
- isHideActions ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
10945
- isDiff ? void 0 : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
10946
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10947
- eagle.Tooltip,
10948
- {
10949
- title: isCollapsed ? "" : copyTooltip,
10950
- onVisibleChange: (visible) => {
10951
- if (!visible) {
10952
- setTimeout(() => {
10953
- setCopyTooltip(t2("dovetail.copy"));
10954
- }, 80);
10955
- }
10956
- },
10957
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10958
- eagle.Icon,
10959
- {
10960
- "data-disabled": isCollapsed,
10961
- src: iconsReact.ClipboardCopy16GradientGrayIcon,
10962
- hoverSrc: isCollapsed ? void 0 : iconsReact.ClipboardCopy16GradientBlueIcon,
10963
- className: IconStyle,
10964
- iconWidth: 16,
10965
- iconHeight: 16,
10966
- onClick: () => {
10967
- if (!isCollapsed) {
10968
- copyToClipboard(getEditorValue());
10969
- setCopyTooltip(t2("dovetail.copied"));
10970
- }
10971
- }
10972
- }
10973
- )
10974
- }
10975
- ),
10976
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {}),
10977
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10978
- eagle.Tooltip,
10979
- {
10980
- title: isCollapsed ? "" : resetTooltip,
10981
- onVisibleChange: (visible) => {
10982
- if (!visible) {
10983
- setTimeout(() => {
10984
- setResetTooltip(t2("dovetail.reset_arguments"));
10985
- }, 80);
10986
- }
10987
- },
10988
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
10989
- eagle.Icon,
10990
- {
10991
- "data-disabled": isCollapsed,
10992
- src: iconsReact.Retry16GradientGrayIcon,
10993
- hoverSrc: isCollapsed ? void 0 : iconsReact.Retry16GradientBlueIcon,
10994
- className: IconStyle,
10995
- iconWidth: 16,
10996
- iconHeight: 16,
10997
- onClick: () => {
10998
- var _a;
10999
- if (!isCollapsed) {
11000
- (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
11001
- setResetTooltip(t2("dovetail.already_reset"));
11002
- }
11003
- }
11004
- }
11005
- )
11006
- }
11007
- ),
11008
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {})
11009
- ] }),
10955
+ (_c = props.onEditorCreate) == null ? void 0 : _c.call(props, editor);
10956
+ },
10957
+ [_value, props.onEditorCreate]
10958
+ );
10959
+ const getInstance = React.useCallback((ins) => {
10960
+ editorInstance.current = ins;
10961
+ }, []);
10962
+ const getEditorValue = React.useCallback(() => {
10963
+ var _a;
10964
+ return ((_a = editorInstance.current) == null ? void 0 : _a.getValue()) ?? "";
10965
+ }, []);
10966
+ React.useEffect(() => {
10967
+ var _a, _b;
10968
+ if (value2 !== void 0 && !lodashEs.isEqual(value2, _value)) {
10969
+ const valueString = typeof value2 === "string" ? value2 : yaml$2.dump(value2);
10970
+ _setValue(value2);
10971
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(valueString);
10972
+ }
10973
+ }, [value2]);
10974
+ React.useImperativeHandle(ref, () => {
10975
+ return {
10976
+ setValue: _setValue,
10977
+ setEditorValue: (value22) => {
10978
+ var _a, _b;
10979
+ (_b = (_a = editorInstance.current) == null ? void 0 : _a.getModel()) == null ? void 0 : _b.setValue(value22);
10980
+ },
10981
+ getEditorValue,
10982
+ getEditorInstance: () => editorInstance.current || null
10983
+ };
10984
+ });
10985
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10986
+ "div",
10987
+ {
10988
+ className: common.cx_default(WrapperStyle$4, className),
10989
+ "data-is-error": !!errorMsgs.length,
10990
+ ref: eleRef,
10991
+ children: [
10992
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
10993
+ eagle.Space,
10994
+ {
10995
+ className: common.cx_default(ToolBarStyle, isCollapsed ? "collapsed" : ""),
10996
+ direction: "vertical",
10997
+ size: 0,
10998
+ children: [
10999
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ToolBarHeaderStyle, children: [
11000
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 8, children: [
11001
+ collapsable && /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11002
+ eagle.Icon,
11003
+ {
11004
+ src: iconsReact.HierarchyTriangleRight16GrayIcon,
11005
+ hoverSrc: iconsReact.HierarchyTriangleRight16BlueIcon,
11006
+ className: common.cx_default(IconStyle, isCollapsed ? "" : "arrow-down"),
11007
+ iconWidth: 16,
11008
+ iconHeight: 16,
11009
+ onClick: () => setIsCollapsed(!isCollapsed)
11010
+ }
11011
+ ),
11012
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { className: common.cx_default(TitleStyle$1, "yaml-editor-title"), children: title || t2("dovetail.configure_file") })
11013
+ ] }),
11014
+ isHideActions ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { size: 14, children: [
11015
+ isDiff ? void 0 : /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
11010
11016
  /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11011
11017
  eagle.Tooltip,
11012
11018
  {
11013
- title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
11014
- children: isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11019
+ title: isCollapsed ? "" : copyTooltip,
11020
+ onVisibleChange: (visible) => {
11021
+ if (!visible) {
11022
+ setTimeout(() => {
11023
+ setCopyTooltip(t2("dovetail.copy"));
11024
+ }, 80);
11025
+ }
11026
+ },
11027
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11015
11028
  eagle.Icon,
11016
11029
  {
11017
11030
  "data-disabled": isCollapsed,
11018
- src: iconsReact.EditPen16GradientGrayIcon,
11019
- hoverSrc: isCollapsed ? void 0 : iconsReact.EditPen16GradientBlueIcon,
11031
+ src: iconsReact.ClipboardCopy16GradientGrayIcon,
11032
+ hoverSrc: isCollapsed ? void 0 : iconsReact.ClipboardCopy16GradientBlueIcon,
11020
11033
  className: IconStyle,
11021
11034
  iconWidth: 16,
11022
11035
  iconHeight: 16,
11023
- onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11036
+ onClick: () => {
11037
+ if (!isCollapsed) {
11038
+ copyToClipboard(getEditorValue());
11039
+ setCopyTooltip(t2("dovetail.copied"));
11040
+ }
11041
+ }
11042
+ }
11043
+ )
11044
+ }
11045
+ ),
11046
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {}),
11047
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11048
+ eagle.Tooltip,
11049
+ {
11050
+ title: isCollapsed ? "" : resetTooltip,
11051
+ onVisibleChange: (visible) => {
11052
+ if (!visible) {
11053
+ setTimeout(() => {
11054
+ setResetTooltip(t2("dovetail.reset_arguments"));
11055
+ }, 80);
11024
11056
  }
11025
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11057
+ },
11058
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11026
11059
  eagle.Icon,
11027
11060
  {
11028
11061
  "data-disabled": isCollapsed,
11029
- src: iconsReact.Showdiff16GradientGrayIcon,
11030
- hoverSrc: isCollapsed ? void 0 : iconsReact.Showdiff16GradientBlueIcon,
11062
+ src: iconsReact.Retry16GradientGrayIcon,
11063
+ hoverSrc: isCollapsed ? void 0 : iconsReact.Retry16GradientBlueIcon,
11031
11064
  className: IconStyle,
11032
11065
  iconWidth: 16,
11033
11066
  iconHeight: 16,
11034
- onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11067
+ onClick: () => {
11068
+ var _a;
11069
+ if (!isCollapsed) {
11070
+ (_a = editorInstance.current) == null ? void 0 : _a.setValue(defaultValueString);
11071
+ setResetTooltip(t2("dovetail.already_reset"));
11072
+ }
11073
+ }
11035
11074
  }
11036
11075
  )
11037
11076
  }
11038
- )
11039
- ] })
11040
- ] }),
11041
- errorMsgs.length ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11042
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle }),
11043
- /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11044
- errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11045
- errorMsg
11046
- ] }, errorMsg)) })
11047
- ] }) : void 0
11048
- ]
11049
- }
11050
- ),
11051
- /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
11052
- "div",
11053
- {
11054
- style: {
11055
- display: isCollapsed ? "none" : "block",
11056
- width: "100%",
11057
- height: height || "500px",
11058
- zIndex: 1
11059
- },
11060
- children: [
11061
- /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11062
- MonacoYamlEditor$3,
11063
- {
11064
- id: props.id,
11065
- getInstance,
11066
- defaultValue: _value,
11067
- height,
11068
- onChange: finalOnChange,
11069
- onValidate,
11070
- onEditorCreate,
11071
- onBlur: props.onBlur,
11072
- schemas,
11073
- readOnly,
11074
- isScrollOnFocus
11075
- }
11076
- ) }) }),
11077
- isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11078
- MonacoYamlDiffEditor$2,
11079
- {
11080
- id: props.id,
11081
- origin: defaultValueString,
11082
- modified: _valueString,
11083
- height
11084
- }
11085
- ) }) : null
11086
- ]
11087
- }
11088
- )
11089
- ]
11090
- }
11091
- );
11092
- }
11093
- );
11077
+ ),
11078
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(Separator, {})
11079
+ ] }),
11080
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11081
+ eagle.Tooltip,
11082
+ {
11083
+ title: isCollapsed ? "" : isDiff ? t2("dovetail.back_to_edit") : t2("dovetail.view_changes"),
11084
+ children: isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11085
+ eagle.Icon,
11086
+ {
11087
+ "data-disabled": isCollapsed,
11088
+ src: iconsReact.EditPen16GradientGrayIcon,
11089
+ hoverSrc: isCollapsed ? void 0 : iconsReact.EditPen16GradientBlueIcon,
11090
+ className: IconStyle,
11091
+ iconWidth: 16,
11092
+ iconHeight: 16,
11093
+ onClick: () => isCollapsed ? void 0 : setIsDiff(false)
11094
+ }
11095
+ ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11096
+ eagle.Icon,
11097
+ {
11098
+ "data-disabled": isCollapsed,
11099
+ src: iconsReact.Showdiff16GradientGrayIcon,
11100
+ hoverSrc: isCollapsed ? void 0 : iconsReact.Showdiff16GradientBlueIcon,
11101
+ className: IconStyle,
11102
+ iconWidth: 16,
11103
+ iconHeight: 16,
11104
+ onClick: () => isCollapsed ? void 0 : setIsDiff(true)
11105
+ }
11106
+ )
11107
+ }
11108
+ )
11109
+ ] })
11110
+ ] }),
11111
+ errorMsgs.length ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Space, { className: ErrorWrapperStyle, size: 8, align: "start", children: [
11112
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.XmarkFailedSeriousWarningFill16RedIcon, { className: ErrorIconStyle$1 }),
11113
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsxs("pre", { className: ErrorMsgStyle, children: [
11114
+ errorMsgs.length > 1 ? `${index2 + 1}. ` : "",
11115
+ errorMsg
11116
+ ] }, errorMsg)) })
11117
+ ] }) : void 0
11118
+ ]
11119
+ }
11120
+ ),
11121
+ /* @__PURE__ */ common.jsxRuntimeExports.jsxs(
11122
+ "div",
11123
+ {
11124
+ style: {
11125
+ display: isCollapsed ? "none" : "block",
11126
+ width: "100%",
11127
+ height: height || "500px",
11128
+ zIndex: 1
11129
+ },
11130
+ children: [
11131
+ /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", { style: { display: isDiff ? "none" : "block" }, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11132
+ MonacoYamlEditor$3,
11133
+ {
11134
+ id: props.id,
11135
+ getInstance,
11136
+ defaultValue: _value,
11137
+ height,
11138
+ onChange: finalOnChange,
11139
+ onValidate,
11140
+ onEditorCreate,
11141
+ onBlur: props.onBlur,
11142
+ schemas,
11143
+ readOnly,
11144
+ isScrollOnFocus
11145
+ }
11146
+ ) }) }),
11147
+ isDiff ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(React.Suspense, { fallback: /* @__PURE__ */ common.jsxRuntimeExports.jsx("pre", { className: PlainCodeStyle, children: _valueString }), children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11148
+ MonacoYamlDiffEditor$2,
11149
+ {
11150
+ id: props.id,
11151
+ origin: defaultValueString,
11152
+ modified: _valueString,
11153
+ height
11154
+ }
11155
+ ) }) : null
11156
+ ]
11157
+ }
11158
+ )
11159
+ ]
11160
+ }
11161
+ );
11162
+ });
11094
11163
  function copyToClipboard(text) {
11095
11164
  const input = document.createElement("textarea");
11096
11165
  input.value = text;
@@ -11099,17 +11168,71 @@ function copyToClipboard(text) {
11099
11168
  document.execCommand("copy");
11100
11169
  document.body.removeChild(input);
11101
11170
  }
11171
+ const useGlobalStore = (name2 = "default") => {
11172
+ const globalStores = React.useContext(GlobalStoreContext);
11173
+ return globalStores[name2];
11174
+ };
11175
+ const ResourceVersionConflictRetryContext = React.createContext(null);
11176
+ function Retry409Provider({
11177
+ children
11178
+ }) {
11179
+ const initialResourceRef = React.useRef();
11180
+ return React.createElement(
11181
+ ResourceVersionConflictRetryContext.Provider,
11182
+ {
11183
+ value: initialResourceRef
11184
+ },
11185
+ children
11186
+ );
11187
+ }
11188
+ function use409Retry({
11189
+ action,
11190
+ dataProviderName,
11191
+ id,
11192
+ mutationMeta
11193
+ }) {
11194
+ const { t: t2 } = common.useTranslation();
11195
+ const globalStore = useGlobalStore(dataProviderName);
11196
+ const sharedInitialResourceRef = React.useContext(ResourceVersionConflictRetryContext);
11197
+ const localInitialResourceRef = React.useRef();
11198
+ const initialResourceRef = sharedInitialResourceRef || localInitialResourceRef;
11199
+ const isEditAction = action === "edit" || !!id;
11200
+ const captureInitialResource = React.useCallback((resource) => {
11201
+ var _a;
11202
+ if (!isEditAction || initialResourceRef.current || !resource) {
11203
+ return;
11204
+ }
11205
+ const rawResource = (_a = globalStore == null ? void 0 : globalStore.restoreItem) == null ? void 0 : _a.call(globalStore, resource);
11206
+ if (!rawResource) {
11207
+ return;
11208
+ }
11209
+ initialResourceRef.current = lodashEs.cloneDeep(rawResource);
11210
+ }, [globalStore, initialResourceRef, isEditAction]);
11211
+ const retryMutationMeta = React.useMemo(() => {
11212
+ const restMutationMeta = lodashEs.omit(mutationMeta, "resourceVersionConflictRetry");
11213
+ if (!isEditAction) {
11214
+ return restMutationMeta;
11215
+ }
11216
+ return {
11217
+ ...restMutationMeta,
11218
+ resourceVersionConflictRetry: {
11219
+ // refine 的 mutationMeta 在 hook 创建时就会固定;用 getter 让 provider 在保存瞬间读取最新的初始版本。
11220
+ get initialResource() {
11221
+ return initialResourceRef.current;
11222
+ },
11223
+ conflictMessage: t2("dovetail.resource_version_conflict")
11224
+ }
11225
+ };
11226
+ }, [initialResourceRef, isEditAction, mutationMeta, t2]);
11227
+ return {
11228
+ captureInitialResource,
11229
+ mutationMeta: retryMutationMeta
11230
+ };
11231
+ }
11102
11232
  function useK8sYamlEditor() {
11103
11233
  const foldSymbol = React.useCallback(function(editor, symbol) {
11104
11234
  const model = editor.getModel();
11105
- const matchs = (model == null ? void 0 : model.findMatches(
11106
- symbol,
11107
- false,
11108
- false,
11109
- false,
11110
- "",
11111
- false
11112
- ).filter((match) => match.range.startColumn === 1)) || [];
11235
+ const matchs = (model == null ? void 0 : model.findMatches(symbol, false, false, false, "", false).filter((match) => match.range.startColumn === 1)) || [];
11113
11236
  return new Promise(async (resolve, reject) => {
11114
11237
  try {
11115
11238
  for (const match of matchs) {
@@ -11123,19 +11246,22 @@ function useK8sYamlEditor() {
11123
11246
  }
11124
11247
  });
11125
11248
  }, []);
11126
- const fold2 = React.useCallback(async function(editor) {
11127
- await editor.getAction("editor.unfoldAll").run();
11128
- const symbols = [
11129
- " annotations:",
11130
- " managedFields:",
11131
- "status:",
11132
- " kubectl.kubernetes.io/last-applied-configuration:"
11133
- ];
11134
- for (const symbol of symbols) {
11135
- await foldSymbol(editor, symbol);
11136
- }
11137
- editor.setScrollPosition({ scrollTop: 0 });
11138
- }, [foldSymbol]);
11249
+ const fold2 = React.useCallback(
11250
+ async function(editor) {
11251
+ await editor.getAction("editor.unfoldAll").run();
11252
+ const symbols = [
11253
+ " annotations:",
11254
+ " managedFields:",
11255
+ "status:",
11256
+ " kubectl.kubernetes.io/last-applied-configuration:"
11257
+ ];
11258
+ for (const symbol of symbols) {
11259
+ await foldSymbol(editor, symbol);
11260
+ }
11261
+ editor.setScrollPosition({ scrollTop: 0 });
11262
+ },
11263
+ [foldSymbol]
11264
+ );
11139
11265
  return {
11140
11266
  fold: fold2
11141
11267
  };
@@ -11209,10 +11335,6 @@ function generateYamlBySchema(defaultValue, schema) {
11209
11335
  const content = yaml$2.dump(merged);
11210
11336
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
11211
11337
  }
11212
- const useGlobalStore = (name2 = "default") => {
11213
- const globalStores = React.useContext(GlobalStoreContext);
11214
- return globalStores[name2];
11215
- };
11216
11338
  const useYamlForm = ({
11217
11339
  action: actionFromProps,
11218
11340
  resource,
@@ -11250,7 +11372,7 @@ const useYamlForm = ({
11250
11372
  onSubmitAbort,
11251
11373
  rules
11252
11374
  } = {}) => {
11253
- var _a;
11375
+ var _a, _b;
11254
11376
  const editor = React.useRef(null);
11255
11377
  const { t: t2 } = common.useTranslation();
11256
11378
  const [isYamlValid, setIsYamlValid] = React.useState(true);
@@ -11261,7 +11383,17 @@ const useYamlForm = ({
11261
11383
  const [beforeSubmitErrors, setBeforeSubmitErrors] = React.useState([]);
11262
11384
  const [errorResponseBody, setErrorResponseBody] = React.useState(null);
11263
11385
  const useResourceResult = core.useResource();
11264
- const globalStore = useGlobalStore();
11386
+ const globalStore = useGlobalStore(dataProviderName);
11387
+ const action = React.useMemo(
11388
+ () => actionFromProps || useResourceResult.action,
11389
+ [actionFromProps, useResourceResult.action]
11390
+ );
11391
+ const { captureInitialResource, mutationMeta: finalMutationMeta } = use409Retry({
11392
+ action,
11393
+ dataProviderName,
11394
+ id: idFromProps,
11395
+ mutationMeta
11396
+ });
11265
11397
  const {
11266
11398
  schema,
11267
11399
  loading: isLoadingSchema,
@@ -11298,7 +11430,7 @@ const useYamlForm = ({
11298
11430
  meta: core.pickNotDeprecated(meta, metaData),
11299
11431
  metaData: core.pickNotDeprecated(meta, metaData),
11300
11432
  queryMeta,
11301
- mutationMeta,
11433
+ mutationMeta: finalMutationMeta,
11302
11434
  liveMode,
11303
11435
  liveParams,
11304
11436
  mutationMode,
@@ -11313,12 +11445,12 @@ const useYamlForm = ({
11313
11445
  overtimeOptions
11314
11446
  });
11315
11447
  const { formLoading, onFinish, queryResult } = useFormCoreResult;
11448
+ React.useEffect(() => {
11449
+ var _a2;
11450
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
11451
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
11316
11452
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
11317
11453
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
11318
- const action = React.useMemo(
11319
- () => actionFromProps || useResourceResult.action,
11320
- [actionFromProps, useResourceResult.action]
11321
- );
11322
11454
  const initialValues = React.useMemo(() => {
11323
11455
  var _a2;
11324
11456
  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) || {};
@@ -11326,7 +11458,14 @@ const useYamlForm = ({
11326
11458
  pruneBeforeEdit(initialValues2);
11327
11459
  }
11328
11460
  return (transformInitValues == null ? void 0 : transformInitValues(initialValues2)) || initialValues2;
11329
- }, [queryResult, globalStore, initialValuesForCreate, action, initialValuesForEdit, transformInitValues]);
11461
+ }, [
11462
+ queryResult,
11463
+ globalStore,
11464
+ initialValuesForCreate,
11465
+ action,
11466
+ initialValuesForEdit,
11467
+ transformInitValues
11468
+ ]);
11330
11469
  const finalErrors = React.useMemo(() => {
11331
11470
  return lodashEs.uniq([...editorErrors, ...rulesErrors]);
11332
11471
  }, [editorErrors, rulesErrors]);
@@ -11361,10 +11500,10 @@ const useYamlForm = ({
11361
11500
  }
11362
11501
  },
11363
11502
  onEditorCreate(editorInstance) {
11364
- var _a3, _b;
11503
+ var _a3, _b2;
11365
11504
  const editorValue = yaml$2.dump(initialValues);
11366
11505
  (_a3 = editor.current) == null ? void 0 : _a3.setEditorValue(editorValue);
11367
- (_b = editor.current) == null ? void 0 : _b.setValue(editorValue);
11506
+ (_b2 = editor.current) == null ? void 0 : _b2.setValue(editorValue);
11368
11507
  if (action === "edit") {
11369
11508
  fold2(editorInstance);
11370
11509
  }
@@ -11377,7 +11516,7 @@ const useYamlForm = ({
11377
11516
  initialValues,
11378
11517
  schemas,
11379
11518
  resource,
11380
- (_a = useResourceResult.resource) == null ? void 0 : _a.name,
11519
+ (_b = useResourceResult.resource) == null ? void 0 : _b.name,
11381
11520
  action,
11382
11521
  finalErrors,
11383
11522
  fold2
@@ -11417,7 +11556,7 @@ const useYamlForm = ({
11417
11556
  formProps: {
11418
11557
  ...formSF.formProps,
11419
11558
  onFinish: async (values) => {
11420
- var _a2, _b;
11559
+ var _a2, _b2;
11421
11560
  setBeforeSubmitErrors([]);
11422
11561
  onSubmitStart == null ? void 0 : onSubmitStart();
11423
11562
  const errors = [
@@ -11437,19 +11576,22 @@ const useYamlForm = ({
11437
11576
  return;
11438
11577
  }
11439
11578
  try {
11440
- const objectValues = editor.current ? yaml$2.load(((_b = editor.current) == null ? void 0 : _b.getEditorValue()) || "") : values;
11579
+ const objectValues = editor.current ? yaml$2.load(((_b2 = editor.current) == null ? void 0 : _b2.getEditorValue()) || "") : values;
11441
11580
  let finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
11442
11581
  if (beforeSubmit) {
11443
11582
  try {
11444
11583
  let hasErrors = false;
11445
11584
  setIsBeforeSubmitLoading(true);
11446
- const result = await beforeSubmit(finalValues, (errors2) => {
11447
- if (errors2 && errors2.length > 0) {
11448
- setBeforeSubmitErrors(errors2);
11449
- onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11450
- hasErrors = true;
11585
+ const result = await beforeSubmit(
11586
+ finalValues,
11587
+ (errors2) => {
11588
+ if (errors2 && errors2.length > 0) {
11589
+ setBeforeSubmitErrors(errors2);
11590
+ onBeforeSubmitError == null ? void 0 : onBeforeSubmitError(errors2);
11591
+ hasErrors = true;
11592
+ }
11451
11593
  }
11452
- });
11594
+ );
11453
11595
  if (hasErrors) {
11454
11596
  onSubmitAbort == null ? void 0 : onSubmitAbort();
11455
11597
  return;
@@ -11539,6 +11681,7 @@ function YamlForm(props) {
11539
11681
  id,
11540
11682
  action: actionFromProps,
11541
11683
  resource: resource == null ? void 0 : resource.name,
11684
+ dataProviderName: resourceConfig.dataProviderName,
11542
11685
  editorOptions: {
11543
11686
  isSkipSchema: schemaStrategy === "None"
11544
11687
  /* None */
@@ -11661,31 +11804,6 @@ function YamlFormContainer({
11661
11804
  onSaveButtonPropsChange
11662
11805
  }) {
11663
11806
  const action = id ? "edit" : "create";
11664
- const pushModal = eagle.usePushModal();
11665
- const popModal = eagle.usePopModal();
11666
- const hasShownExpiredRef = React.useRef(false);
11667
- const [isSubmitting, setIsSubmitting] = React.useState(false);
11668
- const queryResult = core.useOne({
11669
- resource: resourceConfig.name,
11670
- id,
11671
- liveMode: id ? "auto" : "off",
11672
- queryOptions: { enabled: !!id }
11673
- });
11674
- const isExpired = useResourceVersionCheck({ queryResult });
11675
- React.useEffect(() => {
11676
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
11677
- return;
11678
- }
11679
- hasShownExpiredRef.current = true;
11680
- pushModal({
11681
- component: DataExpiredModal,
11682
- props: {
11683
- onAbandon: () => {
11684
- popModal();
11685
- }
11686
- }
11687
- });
11688
- }, [isExpired, isSubmitting, pushModal, popModal]);
11689
11807
  const { transformInitValues, transformApplyValues } = usePathMap({
11690
11808
  pathMap: formConfig == null ? void 0 : formConfig.pathMap,
11691
11809
  transformInitValues: formConfig == null ? void 0 : formConfig.transformInitValues,
@@ -11705,13 +11823,7 @@ function YamlFormContainer({
11705
11823
  action,
11706
11824
  isShowLayout: false,
11707
11825
  useFormProps: {
11708
- redirect: false,
11709
- onSubmitStart: () => {
11710
- setIsSubmitting(true);
11711
- },
11712
- onSubmitAbort: () => {
11713
- setIsSubmitting(false);
11714
- }
11826
+ redirect: false
11715
11827
  },
11716
11828
  rules: void 0,
11717
11829
  onSaveButtonPropsChange,
@@ -11819,6 +11931,7 @@ function RawYamlFormModal(props) {
11819
11931
  },
11820
11932
  okText: ((_c = resourceConfig.formConfig) == null ? void 0 : _c.saveButtonText) || okText,
11821
11933
  destroyOnClose: true,
11934
+ isContentFull: true,
11822
11935
  children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
11823
11936
  className: FormDescStyle$1,
11824
11937
  children: desc
@@ -11861,8 +11974,9 @@ function useOpenForm() {
11861
11974
  if (formType === void 0 || formType === FormContainerType.MODAL) {
11862
11975
  pushModal({
11863
11976
  component: () => {
11864
- var _a2;
11865
- if (options == null ? void 0 : options.useYamlEditor) {
11977
+ var _a2, _b2, _c;
11978
+ const isYamlOnlyForm = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.formType) !== FormType.FORM && !((_b2 = resourceConfig.formConfig) == null ? void 0 : _b2.CustomFormModal);
11979
+ if ((options == null ? void 0 : options.useYamlEditor) || isYamlOnlyForm) {
11866
11980
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11867
11981
  RawYamlFormModal,
11868
11982
  {
@@ -11875,7 +11989,7 @@ function useOpenForm() {
11875
11989
  }
11876
11990
  );
11877
11991
  }
11878
- const ModalComponent = ((_a2 = resourceConfig.formConfig) == null ? void 0 : _a2.CustomFormModal) || FormModal;
11992
+ const ModalComponent = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.CustomFormModal) || FormModal;
11879
11993
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
11880
11994
  ModalComponent,
11881
11995
  {
@@ -12395,34 +12509,6 @@ function CreateButton(props) {
12395
12509
  }
12396
12510
  );
12397
12511
  }
12398
- const useDeleteManyModal = (resource, ids) => {
12399
- const { mutate } = core.useDeleteMany();
12400
- const [visible, setVisible] = React.useState(false);
12401
- const { t: t2 } = common.useTranslation();
12402
- const modalProps = {
12403
- title: t2("dovetail.delete"),
12404
- okText: t2("dovetail.delete"),
12405
- okButtonProps: {
12406
- danger: true
12407
- },
12408
- cancelText: t2("dovetail.cancel"),
12409
- children: t2("dovetail.confirm_delete_text", {
12410
- target: ids,
12411
- interpolation: { escapeValue: false }
12412
- }),
12413
- onOk() {
12414
- mutate({
12415
- resource,
12416
- ids
12417
- });
12418
- setVisible(false);
12419
- },
12420
- onCancel() {
12421
- setVisible(false);
12422
- }
12423
- };
12424
- return { modalProps, visible, setVisible };
12425
- };
12426
12512
  const DeleteManyButton = (props) => {
12427
12513
  const { resource } = core.useResource();
12428
12514
  const { t: t2 } = common.useTranslation();
@@ -12726,94 +12812,109 @@ const ResourceLink = (props) => {
12726
12812
  value: ""
12727
12813
  });
12728
12814
  };
12729
- const IngressRulesTable = ({ ingress }) => {
12730
- const { t: t2 } = common.useTranslation();
12731
- const { data: serviceData } = core.useList({
12815
+ const IngressRulesTable_1nylejt = "";
12816
+ const PathCellStyle = "pmi0ggi";
12817
+ const PathTextStyle = "p1gmjxeo";
12818
+ const PathCopyStyle = "p1379cb5";
12819
+ const IngressRulesTable = ({
12820
+ ingress: ingress2
12821
+ }) => {
12822
+ const {
12823
+ t: t2
12824
+ } = common.useTranslation();
12825
+ const {
12826
+ data: serviceData
12827
+ } = core.useList({
12732
12828
  resource: "services",
12733
12829
  meta: {
12734
12830
  kind: "Service",
12735
12831
  apiVersion: "v1"
12736
12832
  }
12737
12833
  });
12738
- const flattenedRules = React.useMemo(
12739
- () => (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [],
12740
- [serviceData == null ? void 0 : serviceData.data, ingress]
12741
- );
12834
+ const flattenedRules = React.useMemo(() => (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [], [serviceData == null ? void 0 : serviceData.data, ingress2]);
12742
12835
  const rows = React.useMemo(() => {
12743
12836
  return addId(flattenedRules || [], "fullPath");
12744
12837
  }, [flattenedRules]);
12745
12838
  const component = React.useContext(ComponentContext);
12746
12839
  const Table2 = component.Table || Table$1;
12747
12840
  const currentSize = 10;
12748
- const columns = [
12749
- {
12750
- key: "pathType",
12751
- display: true,
12752
- dataIndex: "pathType",
12753
- title: t2("dovetail.path_type"),
12754
- width: 160,
12755
- sortable: true
12756
- },
12757
- {
12758
- key: "fullPath",
12759
- display: true,
12760
- dataIndex: "fullPath",
12761
- title: t2("dovetail.path"),
12762
- width: 478,
12763
- sortable: true,
12764
- render(value2) {
12765
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(LinkFallback, { fullPath: value2 });
12766
- }
12767
- },
12768
- {
12769
- key: "serviceName",
12770
- display: true,
12771
- dataIndex: "serviceName",
12772
- title: t2("dovetail.target_service"),
12773
- sortable: true,
12774
- width: 160,
12775
- render: (serviceName, record) => {
12776
- return record.serviceName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12777
- ResourceLink,
12778
- {
12779
- resourceName: "services",
12780
- namespace: ingress.metadata.namespace || "default",
12781
- name: serviceName
12782
- }
12783
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12841
+ const columns = [{
12842
+ key: "pathType",
12843
+ display: true,
12844
+ dataIndex: "pathType",
12845
+ title: t2("dovetail.path_type"),
12846
+ width: 160,
12847
+ sortable: true
12848
+ }, {
12849
+ key: "fullPath",
12850
+ display: true,
12851
+ dataIndex: "fullPath",
12852
+ title: t2("dovetail.path"),
12853
+ width: 478,
12854
+ sortable: true,
12855
+ render(value2) {
12856
+ if (!value2) {
12857
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12858
+ value: ""
12859
+ });
12784
12860
  }
12785
- },
12786
- {
12787
- key: "servicePort",
12788
- display: true,
12789
- dataIndex: "servicePort",
12790
- title: t2("dovetail.target_service_port"),
12791
- width: 120,
12792
- sortable: true
12793
- },
12794
- {
12795
- key: "secret",
12796
- display: true,
12797
- dataIndex: "host",
12798
- title: t2("dovetail.cert"),
12799
- width: 160,
12800
- render(host2) {
12801
- var _a, _b;
12802
- const secretName = (_b = (_a = ingress._rawYaml.spec.tls) == null ? void 0 : _a.find(
12803
- ({ hosts }) => hosts == null ? void 0 : hosts.includes(host2)
12804
- )) == null ? void 0 : _b.secretName;
12805
- return secretName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12806
- ResourceLink,
12807
- {
12808
- resourceName: "secrets",
12809
- namespace: ingress.metadata.namespace || "default",
12810
- name: secretName
12811
- }
12812
- ) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
12813
- },
12814
- sortable: true
12861
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
12862
+ className: PathCellStyle,
12863
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
12864
+ className: PathTextStyle,
12865
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(LinkFallback, {
12866
+ fullPath: value2
12867
+ })
12868
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(CopyButton, {
12869
+ value: value2,
12870
+ className: PathCopyStyle
12871
+ })]
12872
+ });
12873
+ }
12874
+ }, {
12875
+ key: "serviceName",
12876
+ display: true,
12877
+ dataIndex: "serviceName",
12878
+ title: t2("dovetail.target_service"),
12879
+ sortable: true,
12880
+ width: 160,
12881
+ render: (serviceName, record) => {
12882
+ return record.serviceName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceLink, {
12883
+ resourceName: "services",
12884
+ namespace: ingress2.metadata.namespace || "default",
12885
+ name: serviceName
12886
+ }) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12887
+ value: ""
12888
+ });
12815
12889
  }
12816
- ];
12890
+ }, {
12891
+ key: "servicePort",
12892
+ display: true,
12893
+ dataIndex: "servicePort",
12894
+ title: t2("dovetail.target_service_port"),
12895
+ width: 120,
12896
+ sortable: true
12897
+ }, {
12898
+ key: "secret",
12899
+ display: true,
12900
+ dataIndex: "host",
12901
+ title: t2("dovetail.cert"),
12902
+ width: 160,
12903
+ render(host2) {
12904
+ var _a, _b;
12905
+ const secretName = (_b = (_a = ingress2._rawYaml.spec.tls) == null ? void 0 : _a.find(({
12906
+ hosts
12907
+ }) => hosts == null ? void 0 : hosts.includes(host2))) == null ? void 0 : _b.secretName;
12908
+ return secretName ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(ResourceLink, {
12909
+ resourceName: "secrets",
12910
+ namespace: ingress2.metadata.namespace || "default",
12911
+ name: secretName
12912
+ }) : /* @__PURE__ */ common.jsxRuntimeExports.jsx(ValueDisplay, {
12913
+ value: ""
12914
+ });
12915
+ },
12916
+ sortable: true
12917
+ }];
12817
12918
  const {
12818
12919
  data: finalData,
12819
12920
  currentPage,
@@ -12824,31 +12925,27 @@ const IngressRulesTable = ({ ingress }) => {
12824
12925
  data: rows
12825
12926
  });
12826
12927
  if ((rows == null ? void 0 : rows.length) === 0) {
12827
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12828
- WidgetErrorContent,
12829
- {
12830
- errorText: t2("dovetail.no_resource", { kind: t2("dovetail.rule") }),
12831
- type: ErrorContentType.List
12832
- }
12833
- );
12928
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(WidgetErrorContent, {
12929
+ errorText: t2("dovetail.no_resource", {
12930
+ kind: t2("dovetail.rule")
12931
+ }),
12932
+ type: ErrorContentType.List
12933
+ });
12834
12934
  }
12835
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
12836
- Table2,
12837
- {
12838
- tableKey: "ingressRules",
12839
- loading: false,
12840
- data: finalData,
12841
- total: rows.length,
12842
- columns: addDefaultRenderToColumns(columns),
12843
- rowKey: "pathType",
12844
- empty: t2("dovetail.empty"),
12845
- defaultSize: currentSize,
12846
- currentPage,
12847
- onPageChange,
12848
- onSorterChange,
12849
- showMenuColumn: false
12850
- }
12851
- );
12935
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(Table2, {
12936
+ tableKey: "ingressRules",
12937
+ loading: false,
12938
+ data: finalData,
12939
+ total: rows.length,
12940
+ columns: addDefaultRenderToColumns(columns),
12941
+ rowKey: "pathType",
12942
+ empty: t2("dovetail.empty"),
12943
+ defaultSize: currentSize,
12944
+ currentPage,
12945
+ onPageChange,
12946
+ onSorterChange,
12947
+ showMenuColumn: false
12948
+ });
12852
12949
  };
12853
12950
  const KeyValue_1qasuz9 = "";
12854
12951
  const ContentBlockStyle = "c8jy7dc";
@@ -12977,9 +13074,7 @@ function readFileAsBase64(file) {
12977
13074
  if (isUtf8(arrayBuffer)) {
12978
13075
  resolve(await file.text());
12979
13076
  } else {
12980
- const base64String = btoa(
12981
- String.fromCharCode(...new Uint8Array(arrayBuffer))
12982
- );
13077
+ const base64String = btoa(String.fromCharCode(...new Uint8Array(arrayBuffer)));
12983
13078
  resolve(base64String);
12984
13079
  }
12985
13080
  return;
@@ -12990,31 +13085,63 @@ function readFileAsBase64(file) {
12990
13085
  reader.readAsArrayBuffer(file);
12991
13086
  });
12992
13087
  }
12993
- const LabelFormatPopover_piveun = "";
12994
- const PodLabelFormatRulePopoverStyle = "p5jt6nm";
12995
- const LabelFormatPopover = ({
12996
- noValueValidation
12997
- }) => {
12998
- const {
12999
- t: t2
13000
- } = common.useTranslation();
13001
- const data2 = [{
13002
- object: t2("dovetail.key"),
13003
- contains: t2("dovetail.prefix"),
13004
- optional: t2("dovetail.no"),
13005
- rule: [t2("dovetail.prefix_format_rule_1"), t2("dovetail.prefix_format_rule_2"), t2("dovetail.prefix_format_rule_3")]
13006
- }, {
13007
- object: t2("dovetail.key"),
13008
- contains: t2("dovetail.name"),
13009
- optional: t2("dovetail.yes"),
13010
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
13011
- }];
13088
+ const FormatRulePopover_1b8vyke = "";
13089
+ const FormatRulePopoverStyle = "f1eyh8ow";
13090
+ const FormatRulePopover = ({
13091
+ buttonText,
13092
+ columns,
13093
+ dataSource
13094
+ }) => /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Popover, {
13095
+ trigger: "click",
13096
+ overlayClassName: FormatRulePopoverStyle,
13097
+ placement: "bottomRight",
13098
+ content: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.AntdTable, {
13099
+ bordered: true,
13100
+ dataSource,
13101
+ columns,
13102
+ pagination: false,
13103
+ rowKey: (_, index2) => String(index2)
13104
+ }),
13105
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13106
+ size: "small",
13107
+ type: "link",
13108
+ children: buttonText
13109
+ })
13110
+ });
13111
+ const LabelFormatPopover = ({ noValueValidation }) => {
13112
+ const { t: t2 } = common.useTranslation();
13113
+ const data2 = [
13114
+ {
13115
+ object: t2("dovetail.key"),
13116
+ contains: t2("dovetail.prefix"),
13117
+ optional: t2("dovetail.no"),
13118
+ rule: [
13119
+ t2("dovetail.prefix_format_rule_1"),
13120
+ t2("dovetail.prefix_format_rule_2"),
13121
+ t2("dovetail.prefix_format_rule_3")
13122
+ ]
13123
+ },
13124
+ {
13125
+ object: t2("dovetail.key"),
13126
+ contains: t2("dovetail.name"),
13127
+ optional: t2("dovetail.yes"),
13128
+ rule: [
13129
+ t2("dovetail.name_format_rule_1"),
13130
+ t2("dovetail.name_format_rule_2"),
13131
+ t2("dovetail.name_format_rule_3")
13132
+ ]
13133
+ }
13134
+ ];
13012
13135
  if (!noValueValidation) {
13013
13136
  data2.push({
13014
13137
  object: t2("dovetail.value"),
13015
13138
  contains: t2("dovetail.name"),
13016
13139
  optional: t2("dovetail.no"),
13017
- rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
13140
+ rule: [
13141
+ t2("dovetail.name_format_rule_1"),
13142
+ t2("dovetail.name_format_rule_2"),
13143
+ t2("dovetail.name_format_rule_3")
13144
+ ]
13018
13145
  });
13019
13146
  } else {
13020
13147
  data2.push({
@@ -13024,57 +13151,42 @@ const LabelFormatPopover = ({
13024
13151
  rule: [t2("dovetail.no_limitation_rule")]
13025
13152
  });
13026
13153
  }
13027
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Popover, {
13028
- trigger: "click",
13029
- overlayClassName: PodLabelFormatRulePopoverStyle,
13030
- placement: "bottomRight",
13031
- content: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.AntdTable, {
13032
- bordered: true,
13154
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
13155
+ FormatRulePopover,
13156
+ {
13157
+ buttonText: t2("dovetail.look_format_requirement"),
13033
13158
  dataSource: data2,
13034
- columns: [{
13035
- key: "object",
13036
- title: t2("dovetail.object"),
13037
- dataIndex: "object",
13038
- render: (cell, record, index2) => {
13039
- return {
13040
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
13041
- className: eagle.Typo.Label.l4_bold,
13042
- children: cell
13043
- }),
13159
+ columns: [
13160
+ {
13161
+ key: "object",
13162
+ title: t2("dovetail.object"),
13163
+ dataIndex: "object",
13164
+ render: (cell, _record, index2) => ({
13165
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", { className: eagle.Typo.Label.l4_bold, children: cell }),
13044
13166
  props: {
13045
13167
  rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
13046
13168
  }
13047
- };
13048
- }
13049
- }, {
13050
- key: "contains",
13051
- title: t2("dovetail.contains"),
13052
- dataIndex: "contains"
13053
- }, {
13054
- key: "optional",
13055
- title: t2("dovetail.optional"),
13056
- dataIndex: "optional"
13057
- }, {
13058
- key: "rule",
13059
- title: t2("dovetail.format_requirements"),
13060
- dataIndex: "rule",
13061
- render: (cell) => {
13062
- return /* @__PURE__ */ common.jsxRuntimeExports.jsx("ul", {
13063
- className: "rule-list",
13064
- children: cell.map((rule2, index2) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("li", {
13065
- children: rule2
13066
- }, index2))
13067
- });
13169
+ })
13170
+ },
13171
+ {
13172
+ key: "contains",
13173
+ title: t2("dovetail.contains"),
13174
+ dataIndex: "contains"
13175
+ },
13176
+ {
13177
+ key: "optional",
13178
+ title: t2("dovetail.optional"),
13179
+ dataIndex: "optional"
13180
+ },
13181
+ {
13182
+ key: "rule",
13183
+ title: t2("dovetail.format_requirements"),
13184
+ dataIndex: "rule",
13185
+ render: (cell) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("ul", { style: { listStyle: "disc", listStylePosition: "inside" }, children: cell.map((rule2, i2) => /* @__PURE__ */ common.jsxRuntimeExports.jsx("li", { style: { textIndent: 8 }, children: rule2 }, i2)) })
13068
13186
  }
13069
- }],
13070
- pagination: false
13071
- }),
13072
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
13073
- size: "small",
13074
- type: "link",
13075
- children: t2("dovetail.look_format_requirement")
13076
- })
13077
- });
13187
+ ]
13188
+ }
13189
+ );
13078
13190
  };
13079
13191
  const index_t3zi07 = "";
13080
13192
  function _KeyValueTableForm(props, ref) {
@@ -13095,7 +13207,8 @@ function _KeyValueTableForm(props, ref) {
13095
13207
  validateKey,
13096
13208
  validateValue,
13097
13209
  onSubmit,
13098
- keyTitle
13210
+ keyTitle,
13211
+ formatPopover
13099
13212
  } = props;
13100
13213
  const {
13101
13214
  t: t2,
@@ -13279,7 +13392,7 @@ function _KeyValueTableForm(props, ref) {
13279
13392
  validateTriggerType: eagle.ValidateTriggerType.Aggressive,
13280
13393
  disableBatchFilling: true,
13281
13394
  hideEmptyTable: true
13282
- }), isHideLabelFormatPopover || _value.length === 0 ? null : /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
13395
+ }), isHideLabelFormatPopover || _value.length === 0 ? null : formatPopover ?? /* @__PURE__ */ common.jsxRuntimeExports.jsx(LabelFormatPopover, {
13283
13396
  noValueValidation
13284
13397
  })]
13285
13398
  });
@@ -13718,7 +13831,7 @@ const StateTag = (props) => {
13718
13831
  }
13719
13832
  );
13720
13833
  };
13721
- const WorkloadPodsTable_975j2t = "";
13834
+ const WorkloadPodsTable_a750q3 = "";
13722
13835
  const WorkloadPodsTable = ({
13723
13836
  namespace: namespace2,
13724
13837
  selector,
@@ -13754,14 +13867,16 @@ const WorkloadPodsTable = ({
13754
13867
  kind: "Pod"
13755
13868
  },
13756
13869
  filters: {
13757
- permanent: [{
13758
- field: "",
13759
- value: "",
13760
- fn(item) {
13761
- return filter ? filter(item) : matchSelector(item, selector, namespace2);
13870
+ permanent: [
13871
+ {
13872
+ field: "",
13873
+ value: "",
13874
+ fn(item) {
13875
+ return filter ? filter(item) : matchSelector(item, selector, namespace2);
13876
+ }
13762
13877
  }
13763
13878
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
13764
- }]
13879
+ ]
13765
13880
  }
13766
13881
  }
13767
13882
  });
@@ -14237,7 +14352,8 @@ const ServiceOutClusterAccessField = (clusterVip) => ({
14237
14352
  service: record,
14238
14353
  breakLine: false,
14239
14354
  clusterVip,
14240
- showDashedUnderline: false
14355
+ showDashedUnderline: false,
14356
+ showCopyButton: true
14241
14357
  });
14242
14358
  }
14243
14359
  });
@@ -14255,14 +14371,14 @@ const PodSelectorField = () => ({
14255
14371
  const PortsTableField = () => ({
14256
14372
  key: "ports",
14257
14373
  path: [],
14258
- renderContent: (_, service) => {
14374
+ renderContent: (_, service2) => {
14259
14375
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
14260
14376
  style: {
14261
14377
  padding: "0 24px",
14262
14378
  height: "100%"
14263
14379
  },
14264
14380
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(PortsTable, {
14265
- service
14381
+ service: service2
14266
14382
  })
14267
14383
  });
14268
14384
  }
@@ -14959,11 +15075,11 @@ const NetworkPolicyIngressRulesTab = ({
14959
15075
  fields: [{
14960
15076
  key: "Ingress",
14961
15077
  path: ["spec", "ingress"],
14962
- render: (ingress) => {
15078
+ render: (ingress2) => {
14963
15079
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
14964
15080
  className: NetworkPolicyRulesViewerStyle,
14965
15081
  children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(NetworkPolicyRulesViewer, {
14966
- ingressOrEgress: ingress
15082
+ ingressOrEgress: ingress2
14967
15083
  })
14968
15084
  });
14969
15085
  }
@@ -15038,7 +15154,9 @@ const PodContainersTable = ({
15038
15154
  const isInit = initContainerStatuses.some(
15039
15155
  (c2) => c2.containerID === record.containerID
15040
15156
  );
15041
- return i18n2.t(isInit ? "dovetail.init_container" : "dovetail.regular_container");
15157
+ return i18n2.t(
15158
+ isInit ? "dovetail.init_container" : "dovetail.regular_container"
15159
+ );
15042
15160
  }
15043
15161
  },
15044
15162
  {
@@ -15068,10 +15186,12 @@ const PodContainersTable = ({
15068
15186
  [i18n2, initContainerStatuses]
15069
15187
  );
15070
15188
  const dataSource = React.useMemo(
15071
- () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map((container2) => ({
15072
- ...container2,
15073
- startedAt: lodashEs.get(container2, ["state", "running", "startedAt"]) || lodashEs.get(container2, ["state", "terminated", "startedAt"])
15074
- })),
15189
+ () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map(
15190
+ (container2) => ({
15191
+ ...container2,
15192
+ startedAt: lodashEs.get(container2, ["state", "running", "startedAt"]) || lodashEs.get(container2, ["state", "terminated", "startedAt"])
15193
+ })
15194
+ ),
15075
15195
  [containerStatuses, initContainerStatuses]
15076
15196
  );
15077
15197
  const {
@@ -15082,10 +15202,12 @@ const PodContainersTable = ({
15082
15202
  } = useTableData({
15083
15203
  data: dataSource,
15084
15204
  columns,
15085
- defaultSorters: [{
15086
- field: "startedAt",
15087
- order: "desc"
15088
- }]
15205
+ defaultSorters: [
15206
+ {
15207
+ field: "startedAt",
15208
+ order: "desc"
15209
+ }
15210
+ ]
15089
15211
  });
15090
15212
  if (dataSource.length === 0) {
15091
15213
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
@@ -15103,7 +15225,9 @@ const PodContainersTable = ({
15103
15225
  loading: false,
15104
15226
  data: finalData,
15105
15227
  total: dataSource.length,
15106
- columns: addDefaultRenderToColumns(columns),
15228
+ columns: addDefaultRenderToColumns(
15229
+ columns
15230
+ ),
15107
15231
  rowKey: "containerID",
15108
15232
  error: false,
15109
15233
  defaultSize: currentSize,
@@ -15226,11 +15350,11 @@ const NetworkPolicyIngressRulesGroup = (i18n2) => ({
15226
15350
  {
15227
15351
  key: "Ingress",
15228
15352
  path: ["spec", "ingress"],
15229
- renderContent: (ingress) => {
15353
+ renderContent: (ingress2) => {
15230
15354
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(
15231
15355
  NetworkPolicyRulesViewer,
15232
15356
  {
15233
- ingressOrEgress: ingress,
15357
+ ingressOrEgress: ingress2,
15234
15358
  kind: ` ${i18n2.t("dovetail.ingress_rule")}`
15235
15359
  }
15236
15360
  );
@@ -15284,7 +15408,7 @@ function Tabs(props) {
15284
15408
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
15285
15409
  }) });
15286
15410
  }
15287
- const ShowContentView_11vyp5a = "";
15411
+ const ShowContentView_szlndu = "";
15288
15412
  const ShowContentWrapperStyle = "soapvs9";
15289
15413
  const BackButton = "b13d603q";
15290
15414
  const ToolBarWrapper = "tm8eaia";
@@ -15728,7 +15852,7 @@ function ReplicasDropdown(props) {
15728
15852
  ] });
15729
15853
  }
15730
15854
  const PodShell = React.lazy(
15731
- () => Promise.resolve().then(() => require("./PodShell-43c7028e.cjs")).then((module2) => ({ default: module2.PodShell }))
15855
+ () => Promise.resolve().then(() => require("./PodShell-a335b2b2.cjs")).then((module2) => ({ default: module2.PodShell }))
15732
15856
  );
15733
15857
  function PodShellModal(props) {
15734
15858
  const { pod: pod2 } = props;
@@ -16075,8 +16199,121 @@ function ResourceShow(props) {
16075
16199
  }
16076
16200
  );
16077
16201
  }
16078
- const modal_1eijuvm = "";
16202
+ const button_a1727f = "";
16203
+ const WarningButtonStyle = "wwyz7ti";
16204
+ const modal_1muog24 = "";
16079
16205
  const SmallModalStyle = "s1nc293e";
16206
+ const ExtraSubmitFooter_15u4r8u = "";
16207
+ const FooterStyle = "f16wn4bu";
16208
+ const FooterLeftStyle = "fk5l2b4";
16209
+ const FooterRightStyle = "f1r3vl4u";
16210
+ const ErrorStyle = "e1y8i1r4";
16211
+ const ErrorIconStyle = "e16fn5cj";
16212
+ const PrevIconStyle = "prji3wx";
16213
+ function useExtraSubmitFooter({
16214
+ action,
16215
+ cancelText,
16216
+ defaultSubmitText,
16217
+ errorText,
16218
+ extraSubmitButton,
16219
+ fallbackFooter,
16220
+ isYamlMode,
16221
+ nextStepText,
16222
+ prevStepText,
16223
+ saveButtonProps,
16224
+ step,
16225
+ stepCount,
16226
+ onCancel,
16227
+ onNextStep,
16228
+ onPrevStep,
16229
+ onSubmit
16230
+ }) {
16231
+ const shouldShowExtraSubmitButton = React.useMemo(() => {
16232
+ if (!extraSubmitButton || isYamlMode) {
16233
+ return false;
16234
+ }
16235
+ if (extraSubmitButton.action && extraSubmitButton.action !== action) {
16236
+ return false;
16237
+ }
16238
+ if (extraSubmitButton.step !== step) {
16239
+ return false;
16240
+ }
16241
+ return step < stepCount - 1;
16242
+ }, [action, extraSubmitButton, isYamlMode, step, stepCount]);
16243
+ return React.useMemo(() => {
16244
+ if (!shouldShowExtraSubmitButton) {
16245
+ return fallbackFooter;
16246
+ }
16247
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(ExtraSubmitFooter, {
16248
+ cancelText,
16249
+ errorText,
16250
+ extraSubmitText: (extraSubmitButton == null ? void 0 : extraSubmitButton.text) || defaultSubmitText,
16251
+ nextStepText,
16252
+ prevText: prevStepText,
16253
+ saveButtonProps,
16254
+ showPrevButton: step > 0,
16255
+ onCancel,
16256
+ onNextStep,
16257
+ onPrevStep,
16258
+ onSubmit
16259
+ });
16260
+ }, [cancelText, defaultSubmitText, errorText, extraSubmitButton == null ? void 0 : extraSubmitButton.text, fallbackFooter, onCancel, onNextStep, onPrevStep, onSubmit, nextStepText, prevStepText, saveButtonProps, shouldShowExtraSubmitButton, step]);
16261
+ }
16262
+ const ExtraSubmitFooter = ({
16263
+ cancelText,
16264
+ errorText,
16265
+ extraSubmitText,
16266
+ nextStepText,
16267
+ prevText,
16268
+ saveButtonProps,
16269
+ showPrevButton,
16270
+ onCancel,
16271
+ onNextStep,
16272
+ onPrevStep,
16273
+ onSubmit
16274
+ }) => {
16275
+ const finalSaveButtonProps = lodashEs.omit(saveButtonProps, "onClick");
16276
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16277
+ className: FooterStyle,
16278
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16279
+ className: FooterLeftStyle,
16280
+ children: [showPrevButton ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.Button, {
16281
+ type: "link",
16282
+ onClick: onPrevStep,
16283
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.ArrowChevronLeft16BoldBlueIcon, {
16284
+ className: PrevIconStyle
16285
+ }), prevText]
16286
+ }) : null, errorText ? /* @__PURE__ */ common.jsxRuntimeExports.jsxs("span", {
16287
+ className: common.cx_default(ErrorStyle, eagle.Typo.Label.l2_regular),
16288
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(iconsReact.ExclamationErrorCircleFill16RedIcon, {
16289
+ className: ErrorIconStyle
16290
+ }), errorText]
16291
+ }) : null]
16292
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
16293
+ className: FooterRightStyle,
16294
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16295
+ type: "quiet",
16296
+ size: "large",
16297
+ onClick: onCancel,
16298
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
16299
+ className: eagle.Typo.Label.l1_bold_title,
16300
+ children: cancelText
16301
+ })
16302
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16303
+ size: "large",
16304
+ type: "secondary",
16305
+ onClick: onNextStep,
16306
+ children: nextStepText
16307
+ }), /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Button, {
16308
+ ...finalSaveButtonProps,
16309
+ size: "large",
16310
+ type: "primary",
16311
+ onClick: onSubmit,
16312
+ children: extraSubmitText
16313
+ })]
16314
+ })]
16315
+ });
16316
+ };
16080
16317
  function FormModeSegmentControl({
16081
16318
  formConfig,
16082
16319
  mode,
@@ -16910,9 +17147,16 @@ const useForm = ({
16910
17147
  onSubmitAbort,
16911
17148
  ...rest
16912
17149
  } = {}) => {
17150
+ var _a;
16913
17151
  const { options } = core.useRefineContext();
16914
17152
  const disableServerSideValidation = (options == null ? void 0 : options.disableServerSideValidation) || disableServerSideValidationProp;
16915
17153
  const translate = core.useTranslate();
17154
+ const { captureInitialResource, mutationMeta } = use409Retry({
17155
+ action: refineCoreProps == null ? void 0 : refineCoreProps.action,
17156
+ dataProviderName: refineCoreProps == null ? void 0 : refineCoreProps.dataProviderName,
17157
+ id: refineCoreProps == null ? void 0 : refineCoreProps.id,
17158
+ mutationMeta: refineCoreProps == null ? void 0 : refineCoreProps.mutationMeta
17159
+ });
16916
17160
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
16917
17161
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
16918
17162
  const useHookFormResult = reactHookForm.useForm({
@@ -16922,6 +17166,7 @@ const useForm = ({
16922
17166
  const [transformedInitValues, setTransformedInitValues] = React.useState(useHookFormResult.getValues());
16923
17167
  const [beforeSubmitErrors, setBeforeSubmitErrors] = React.useState([]);
16924
17168
  const [isBeforeSubmitLoading, setIsBeforeSubmitLoading] = React.useState(false);
17169
+ const hasAppliedInitialDataRef = React.useRef(false);
16925
17170
  const {
16926
17171
  watch,
16927
17172
  setValue,
@@ -16932,10 +17177,11 @@ const useForm = ({
16932
17177
  } = useHookFormResult;
16933
17178
  const useFormCoreResult = core.useForm({
16934
17179
  ...refineCoreProps,
17180
+ mutationMeta,
16935
17181
  onMutationError: (error, _variables, _context) => {
16936
- var _a, _b;
17182
+ var _a2, _b;
16937
17183
  if (disableServerSideValidation) {
16938
- (_a = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a.call(refineCoreProps, error, _variables, _context);
17184
+ (_a2 = refineCoreProps == null ? void 0 : refineCoreProps.onMutationError) == null ? void 0 : _a2.call(refineCoreProps, error, _variables, _context);
16939
17185
  return;
16940
17186
  }
16941
17187
  const errors = error == null ? void 0 : error.errors;
@@ -16968,10 +17214,14 @@ const useForm = ({
16968
17214
  });
16969
17215
  const { queryResult, onFinish, formLoading, onFinishAutoSave } = useFormCoreResult;
16970
17216
  React.useEffect(() => {
16971
- var _a;
16972
- if (formState.isDirty)
17217
+ var _a2;
17218
+ captureInitialResource((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data);
17219
+ }, [captureInitialResource, (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data]);
17220
+ React.useEffect(() => {
17221
+ var _a2;
17222
+ if (hasAppliedInitialDataRef.current || formState.isDirty)
16973
17223
  return;
16974
- const data2 = (_a = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a.data;
17224
+ const data2 = (_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data;
16975
17225
  if (!data2)
16976
17226
  return;
16977
17227
  const transformedData = transformInitValues ? transformInitValues(data2) : data2;
@@ -16987,6 +17237,7 @@ const useForm = ({
16987
17237
  });
16988
17238
  }
16989
17239
  });
17240
+ hasAppliedInitialDataRef.current = true;
16990
17241
  setTransformedInitValues(getValues());
16991
17242
  }, [queryResult == null ? void 0 : queryResult.data, setValue, transformInitValues, formState.isDirty, getValues]);
16992
17243
  React.useEffect(() => {
@@ -16999,13 +17250,13 @@ const useForm = ({
16999
17250
  }, [watch]);
17000
17251
  const onValuesChange = React.useCallback(
17001
17252
  (changeValues) => {
17002
- var _a;
17253
+ var _a2;
17003
17254
  if (warnWhenUnsavedChanges) {
17004
17255
  setWarnWhen(true);
17005
17256
  }
17006
17257
  if (refineCoreProps == null ? void 0 : refineCoreProps.autoSave) {
17007
17258
  setWarnWhen(false);
17008
- const onFinishProps = (_a = refineCoreProps.autoSave) == null ? void 0 : _a.onFinish;
17259
+ const onFinishProps = (_a2 = refineCoreProps.autoSave) == null ? void 0 : _a2.onFinish;
17009
17260
  if (onFinishProps) {
17010
17261
  return onFinishAutoSave(onFinishProps(changeValues));
17011
17262
  }
@@ -17102,6 +17353,10 @@ const useRefineForm = (props) => {
17102
17353
  errorNotification: false,
17103
17354
  successNotification: () => {
17104
17355
  var _a;
17356
+ if (formConfig == null ? void 0 : formConfig.successMessage) {
17357
+ const msg = typeof formConfig.successMessage === "function" ? formConfig.successMessage(id ? "edit" : "create") : formConfig.successMessage;
17358
+ return { message: msg, description: "Success", type: "success" };
17359
+ }
17105
17360
  const formValue = result.getValues();
17106
17361
  return {
17107
17362
  message: i18n2.t(id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast", {
@@ -17119,6 +17374,7 @@ const useRefineForm = (props) => {
17119
17374
  resource: resourceConfig.name,
17120
17375
  action: id ? "edit" : "create",
17121
17376
  id,
17377
+ dataProviderName: resourceConfig.dataProviderName,
17122
17378
  liveMode: id ? "auto" : "off",
17123
17379
  ...refineProps
17124
17380
  },
@@ -17132,10 +17388,11 @@ const useRefineForm = (props) => {
17132
17388
  ...formConfig == null ? void 0 : formConfig.useFormProps
17133
17389
  });
17134
17390
  React.useEffect(() => {
17135
- var _a, _b;
17391
+ var _a, _b, _c;
17136
17392
  const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
17393
+ const message2 = (_b = result.refineCore.mutationResult.error) == null ? void 0 : _b.message;
17137
17394
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
17138
- (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
17395
+ (_c = response.json) == null ? void 0 : _c.call(response).then((body) => {
17139
17396
  var _a2;
17140
17397
  setResponseErrorMsgs(
17141
17398
  [].concat(
@@ -17143,8 +17400,10 @@ const useRefineForm = (props) => {
17143
17400
  )
17144
17401
  );
17145
17402
  });
17403
+ } else if (message2 && responseErrorMsgs[0] !== message2) {
17404
+ setResponseErrorMsgs([message2]);
17146
17405
  }
17147
- }, [formConfig, result, i18n2]);
17406
+ }, [formConfig, result, i18n2, responseErrorMsgs]);
17148
17407
  return {
17149
17408
  formResult: result,
17150
17409
  responseErrorMsgs,
@@ -17165,10 +17424,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17165
17424
  }, ref) {
17166
17425
  var _a, _b;
17167
17426
  const action = id ? "edit" : "create";
17168
- const pushModal = eagle.usePushModal();
17169
- const popModal = eagle.usePopModal();
17170
- const hasShownExpiredRef = React.useRef(false);
17171
- const [isSubmitting, setIsSubmitting] = React.useState(false);
17172
17427
  const refineFormResult = useRefineForm({
17173
17428
  resourceConfig,
17174
17429
  id,
@@ -17177,7 +17432,6 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17177
17432
  onSuccess == null ? void 0 : onSuccess(data2);
17178
17433
  },
17179
17434
  onMutationError() {
17180
- setIsSubmitting(false);
17181
17435
  onError == null ? void 0 : onError();
17182
17436
  },
17183
17437
  redirect: false,
@@ -17191,35 +17445,11 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17191
17445
  ...options,
17192
17446
  onBeforeSubmitError: (errors) => {
17193
17447
  if (errors.length) {
17194
- setIsSubmitting(false);
17195
17448
  onError == null ? void 0 : onError();
17196
17449
  }
17197
- },
17198
- onSubmitStart: () => {
17199
- setIsSubmitting(true);
17200
- },
17201
- onSubmitAbort: () => {
17202
- setIsSubmitting(false);
17203
17450
  }
17204
17451
  }
17205
17452
  });
17206
- const isExpired = useResourceVersionCheck({
17207
- queryResult: refineFormResult.formResult.refineCore.queryResult
17208
- });
17209
- React.useEffect(() => {
17210
- if (!isExpired || isSubmitting || hasShownExpiredRef.current) {
17211
- return;
17212
- }
17213
- hasShownExpiredRef.current = true;
17214
- pushModal({
17215
- component: DataExpiredModal,
17216
- props: {
17217
- onAbandon: () => {
17218
- popModal();
17219
- }
17220
- }
17221
- });
17222
- }, [isExpired, isSubmitting, pushModal, popModal]);
17223
17453
  const fieldsConfig = useFieldsConfig(
17224
17454
  resourceConfig,
17225
17455
  { fields: formConfig == null ? void 0 : formConfig.fields },
@@ -17234,6 +17464,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17234
17464
  transformApplyValues: (formConfig == null ? void 0 : formConfig.transformApplyValues) || ((v) => v)
17235
17465
  });
17236
17466
  const yamlFormProps = React.useMemo(() => {
17467
+ var _a2;
17237
17468
  if (isYamlMode) {
17238
17469
  return {
17239
17470
  ...customYamlFormProps,
@@ -17252,12 +17483,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17252
17483
  isShowLayout: false,
17253
17484
  useFormProps: {
17254
17485
  redirect: false,
17255
- onSubmitStart: () => {
17256
- setIsSubmitting(true);
17257
- },
17258
- onSubmitAbort: () => {
17259
- setIsSubmitting(false);
17260
- }
17486
+ mutationMeta: (_a2 = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a2.mutationMeta
17261
17487
  },
17262
17488
  rules: fieldsConfig == null ? void 0 : fieldsConfig.filter(
17263
17489
  (config) => "isSkipValidationInYaml" in config && !config.isSkipValidationInYaml
@@ -17287,6 +17513,7 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17287
17513
  id,
17288
17514
  refineFormResult,
17289
17515
  formConfig == null ? void 0 : formConfig.beforeSubmit,
17516
+ (_a = formConfig == null ? void 0 : formConfig.refineCoreProps) == null ? void 0 : _a.mutationMeta,
17290
17517
  transformApplyValues,
17291
17518
  onSaveButtonPropsChange,
17292
17519
  onSuccess,
@@ -17306,18 +17533,20 @@ const RefineFormContainer = React.forwardRef(function RefineFormContainer2({
17306
17533
  }),
17307
17534
  [refineFormResult.formResult]
17308
17535
  );
17309
- if (action === "edit" && !((_b = (_a = refineFormResult.formResult.getValues()) == null ? void 0 : _a.metadata) == null ? void 0 : _b.name)) {
17536
+ const currentFormValues = refineFormResult.formResult.getValues();
17537
+ const isReady = (formConfig == null ? void 0 : formConfig.isDataReady) ? formConfig.isDataReady(currentFormValues) : !!((_b = currentFormValues == null ? void 0 : currentFormValues.metadata) == null ? void 0 : _b.name);
17538
+ if (action === "edit" && !isReady) {
17310
17539
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Loading, {});
17311
17540
  }
17312
17541
  if (isYamlMode) {
17313
17542
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(YamlForm, { ...yamlFormProps });
17314
17543
  }
17315
17544
  return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(common.jsxRuntimeExports.Fragment, { children: [
17316
- !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17545
+ !(formConfig == null ? void 0 : formConfig.isDisabledChangeMode) && (formConfig == null ? void 0 : formConfig.changeModeAlert) !== false ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17317
17546
  eagle.Alert,
17318
17547
  {
17319
17548
  type: "warning",
17320
- message: i18n.t("dovetail.change_form_mode_alert"),
17549
+ message: (formConfig == null ? void 0 : formConfig.changeModeAlert) ?? i18n.t("dovetail.change_form_mode_alert"),
17321
17550
  style: { marginBottom: "16px" }
17322
17551
  }
17323
17552
  ) : void 0,
@@ -17371,7 +17600,7 @@ function ConfirmModal({
17371
17600
  });
17372
17601
  }
17373
17602
  function FormModal(props) {
17374
- var _a, _b, _c, _d, _e;
17603
+ var _a, _b, _c, _d, _e, _f;
17375
17604
  const {
17376
17605
  id,
17377
17606
  yamlFormProps: customYamlFormProps,
@@ -17509,37 +17738,59 @@ function FormModal(props) {
17509
17738
  setStep(nextStep);
17510
17739
  }
17511
17740
  }, [step]);
17512
- return /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.WizardDialog, {
17513
- style: {
17514
- "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17515
- },
17516
- title: /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
17517
- className: TitleWrapperStyle,
17518
- children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
17519
- children: title
17520
- }), ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
17521
- formConfig: resourceConfig.formConfig,
17522
- mode,
17523
- onChangeMode
17524
- }) : null]
17525
- }),
17526
- error: errorText,
17527
- steps,
17741
+ const extraSubmitButton = ((_c = resourceConfig.formConfig) == null ? void 0 : _c.formType) === FormType.FORM ? resourceConfig.formConfig.extraSubmitButton : void 0;
17742
+ const footer = useExtraSubmitFooter({
17743
+ action,
17744
+ cancelText: (modalProps == null ? void 0 : modalProps.cancelText) || i18n2.t("dovetail.cancel"),
17745
+ defaultSubmitText: okText,
17746
+ errorText,
17747
+ extraSubmitButton,
17748
+ fallbackFooter: modalProps == null ? void 0 : modalProps.footer,
17749
+ isYamlMode,
17750
+ nextStepText: (modalProps == null ? void 0 : modalProps.nextText) || i18n2.t("dovetail.next_step"),
17751
+ prevStepText: (modalProps == null ? void 0 : modalProps.prevText) || i18n2.t("dovetail.prev_step"),
17752
+ saveButtonProps,
17528
17753
  step,
17529
- onStepChange: handleStepChange,
17530
- onOk,
17531
- okButtonProps: {
17532
- ...lodashEs.omit(saveButtonProps, "onClick"),
17533
- children: (_d = resourceConfig.formConfig) == null ? void 0 : _d.saveButtonText
17534
- },
17535
- okText: ((_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText) || okText,
17536
- destroyOnClose: true,
17537
- destroyOtherStep: true,
17538
- ...modalProps,
17539
- children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
17540
- className: FormDescStyle,
17541
- children: desc
17542
- }) : void 0, formEle]
17754
+ stepCount: (steps == null ? void 0 : steps.length) || 0,
17755
+ onCancel: popModal,
17756
+ onNextStep: () => handleStepChange(step + 1),
17757
+ onPrevStep: () => handleStepChange(step - 1),
17758
+ onSubmit: onOk
17759
+ });
17760
+ return /* @__PURE__ */ common.jsxRuntimeExports.jsx(Retry409Provider, {
17761
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsxs(eagle.WizardDialog, {
17762
+ style: {
17763
+ "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
17764
+ },
17765
+ title: /* @__PURE__ */ common.jsxRuntimeExports.jsxs("div", {
17766
+ className: TitleWrapperStyle,
17767
+ children: [/* @__PURE__ */ common.jsxRuntimeExports.jsx("span", {
17768
+ children: title
17769
+ }), ((_d = resourceConfig.formConfig) == null ? void 0 : _d.formType) === FormType.FORM ? /* @__PURE__ */ common.jsxRuntimeExports.jsx(FormModeSegmentControl, {
17770
+ formConfig: resourceConfig.formConfig,
17771
+ mode,
17772
+ onChangeMode
17773
+ }) : null]
17774
+ }),
17775
+ error: errorText,
17776
+ steps,
17777
+ step,
17778
+ onStepChange: handleStepChange,
17779
+ onOk,
17780
+ okButtonProps: {
17781
+ ...lodashEs.omit(saveButtonProps, "onClick"),
17782
+ children: (_e = resourceConfig.formConfig) == null ? void 0 : _e.saveButtonText
17783
+ },
17784
+ okText: ((_f = resourceConfig.formConfig) == null ? void 0 : _f.saveButtonText) || okText,
17785
+ footer,
17786
+ destroyOnClose: true,
17787
+ destroyOtherStep: true,
17788
+ ...modalProps,
17789
+ children: [desc ? /* @__PURE__ */ common.jsxRuntimeExports.jsx("div", {
17790
+ className: FormDescStyle,
17791
+ children: desc
17792
+ }) : void 0, formEle]
17793
+ })
17543
17794
  });
17544
17795
  }
17545
17796
  const RefineFormPage_1v0fhor = "";
@@ -17645,31 +17896,43 @@ function CronJobDropdown(props) {
17645
17896
  values: v,
17646
17897
  successNotification() {
17647
17898
  return {
17648
- message: t2(suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast", {
17649
- kind: record.kind,
17650
- name: id,
17651
- interpolation: {
17652
- escapeValue: false
17899
+ message: t2(
17900
+ suspended ? "dovetail.resume_success_toast" : "dovetail.pause_success_toast",
17901
+ {
17902
+ kind: record.kind,
17903
+ name: id,
17904
+ interpolation: {
17905
+ escapeValue: false
17906
+ }
17653
17907
  }
17654
- }),
17908
+ ),
17655
17909
  type: "success"
17656
17910
  };
17657
17911
  },
17658
17912
  errorNotification() {
17659
17913
  return {
17660
- message: t2(suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast", {
17661
- kind: record.kind,
17662
- name: id,
17663
- interpolation: {
17664
- escapeValue: false
17914
+ message: t2(
17915
+ suspended ? "dovetail.resume_failed_toast" : "dovetail.pause_failed_toast",
17916
+ {
17917
+ kind: record.kind,
17918
+ name: id,
17919
+ interpolation: {
17920
+ escapeValue: false
17921
+ }
17665
17922
  }
17666
- }),
17923
+ ),
17667
17924
  type: "error"
17668
17925
  };
17669
17926
  }
17670
17927
  });
17671
17928
  },
17672
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(eagle.Icon, { src: suspended ? iconsReact.RecoverContinue16GradientBlueIcon : iconsReact.Pause16GradientBlueIcon, children: t2(suspended ? "dovetail.resume" : "dovetail.suspend") })
17929
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
17930
+ eagle.Icon,
17931
+ {
17932
+ src: suspended ? iconsReact.RecoverContinue16GradientBlueIcon : iconsReact.Pause16GradientBlueIcon,
17933
+ children: t2(suspended ? "dovetail.resume" : "dovetail.suspend")
17934
+ }
17935
+ )
17673
17936
  }
17674
17937
  ) : null });
17675
17938
  }
@@ -18186,7 +18449,9 @@ const DeleteButton = () => {
18186
18449
  const { resource } = core.useResource();
18187
18450
  const { id } = core.useParsed();
18188
18451
  const { t: t2 } = common.useTranslation();
18189
- const { openDeleteConfirmModal } = useDeleteModal({ resourceName: (resource == null ? void 0 : resource.name) || "" });
18452
+ const { openDeleteConfirmModal } = useDeleteModal({
18453
+ resourceName: (resource == null ? void 0 : resource.name) || ""
18454
+ });
18190
18455
  return /* @__PURE__ */ common.jsxRuntimeExports.jsx(common.jsxRuntimeExports.Fragment, { children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
18191
18456
  eagle.Button,
18192
18457
  {
@@ -18197,7 +18462,7 @@ const DeleteButton = () => {
18197
18462
  }
18198
18463
  ) });
18199
18464
  };
18200
- const index_1tehui8 = "";
18465
+ const index_e6cgji = "";
18201
18466
  const MenuStyle = "mdppgn0";
18202
18467
  const Menu = () => {
18203
18468
  const {
@@ -19334,9 +19599,9 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19334
19599
  });
19335
19600
  const nodePortsFromOtherServices = React.useMemo(() => {
19336
19601
  var _a;
19337
- return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service) => service.id !== serviceId).map((service) => {
19602
+ return ((_a = services == null ? void 0 : services.data) == null ? void 0 : _a.filter((service2) => service2.id !== serviceId).map((service2) => {
19338
19603
  var _a2, _b;
19339
- return (_b = (_a2 = service == null ? void 0 : service.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19604
+ return (_b = (_a2 = service2 == null ? void 0 : service2.spec) == null ? void 0 : _a2.ports) == null ? void 0 : _b.map((port2) => port2.nodePort);
19340
19605
  }).flat().filter((port2) => port2 !== void 0)) || [];
19341
19606
  }, [services, serviceId]);
19342
19607
  const columns = React.useMemo(() => {
@@ -19529,7 +19794,7 @@ const PortsConfigForm = React.forwardRef(function PortsConfigForm2({ value: valu
19529
19794
  }
19530
19795
  );
19531
19796
  });
19532
- const IngressRulesComponent = ({ ingress, noLink }) => {
19797
+ const IngressRulesComponent = ({ ingress: ingress2, noLink }) => {
19533
19798
  const { data: serviceData } = core.useList({
19534
19799
  resource: "services",
19535
19800
  meta: {
@@ -19537,12 +19802,12 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19537
19802
  apiVersion: "v1"
19538
19803
  }
19539
19804
  });
19540
- const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19805
+ const flattenedRules = (serviceData == null ? void 0 : serviceData.data) ? ingress2.getFlattenedRules(serviceData == null ? void 0 : serviceData.data) : [];
19541
19806
  const result = flattenedRules.map((r2) => {
19542
19807
  var _a, _b;
19543
19808
  const arrow = " → ";
19544
19809
  const divider = " | ";
19545
- const secretName = (_b = (_a = ingress.spec.tls) == null ? void 0 : _a.find(
19810
+ const secretName = (_b = (_a = ingress2.spec.tls) == null ? void 0 : _a.find(
19546
19811
  ({ hosts }) => hosts == null ? void 0 : hosts.includes(r2.host || "")
19547
19812
  )) == null ? void 0 : _b.secretName;
19548
19813
  let tooltip = r2.fullPath;
@@ -19563,7 +19828,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19563
19828
  ResourceLink,
19564
19829
  {
19565
19830
  resourceName: "services",
19566
- namespace: ingress.metadata.namespace || "default",
19831
+ namespace: ingress2.metadata.namespace || "default",
19567
19832
  name: r2.serviceName
19568
19833
  }
19569
19834
  ),
@@ -19578,7 +19843,7 @@ const IngressRulesComponent = ({ ingress, noLink }) => {
19578
19843
  ResourceLink,
19579
19844
  {
19580
19845
  resourceName: "secrets",
19581
- namespace: ingress.metadata.namespace || "default",
19846
+ namespace: ingress2.metadata.namespace || "default",
19582
19847
  name: secretName
19583
19848
  }
19584
19849
  )
@@ -19947,7 +20212,10 @@ function ServiceOutClusterAccessTitle() {
19947
20212
  })
19948
20213
  });
19949
20214
  }
19950
- const ServiceOutClusterAccessColumnRenderer = (clusterVip) => {
20215
+ const ServiceOutClusterAccessColumnRenderer = (_i18n, options) => {
20216
+ const {
20217
+ clusterVip
20218
+ } = options;
19951
20219
  return {
19952
20220
  key: "outClusterAccess",
19953
20221
  title: /* @__PURE__ */ common.jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
@@ -19987,10 +20255,8 @@ const PodWorkloadColumnRenderer = (i18n2) => {
19987
20255
  }
19988
20256
  };
19989
20257
  };
19990
- const IngressRulesColumnRenderer = ({
19991
- i18n: i18n2,
19992
- noLink
19993
- }) => {
20258
+ const IngressRulesColumnRenderer = (i18n2, options) => {
20259
+ const noLink = options == null ? void 0 : options.noLink;
19994
20260
  const dataIndex = ["spec", "rules"];
19995
20261
  return {
19996
20262
  key: "type",
@@ -20451,39 +20717,45 @@ const Dovetail = (props) => {
20451
20717
  antd4Configs: {
20452
20718
  getPopupContainer: antdGetPopupContainer || (() => document.body)
20453
20719
  },
20454
- children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: globalStoreMap, children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20455
- core.Refine,
20720
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20721
+ GlobalStoreContext.Provider,
20456
20722
  {
20457
- dataProvider: k8sApiProvider.dataProvider(globalStoreMap.default),
20458
- liveProvider: k8sApiProvider.liveProvider(globalStoreMap.default),
20459
- routerProvider,
20460
- notificationProvider,
20461
- options: {
20462
- warnWhenUnsavedChanges: true,
20463
- liveMode: "auto",
20464
- disableTelemetry: true
20465
- },
20466
- accessControlProvider,
20467
- resources: resourcesConfig.map((c2) => {
20468
- return {
20469
- name: c2.name,
20470
- meta: {
20471
- dataProviderName: c2.dataProviderName,
20472
- resourceBasePath: c2.basePath,
20473
- kind: c2.kind,
20474
- parent: c2.parent,
20475
- label: `${c2.kind}s`
20723
+ value: globalStoreMap,
20724
+ children: /* @__PURE__ */ common.jsxRuntimeExports.jsx(
20725
+ core.Refine,
20726
+ {
20727
+ dataProvider: k8sApiProvider.dataProvider(globalStoreMap.default),
20728
+ liveProvider: k8sApiProvider.liveProvider(globalStoreMap.default),
20729
+ routerProvider,
20730
+ notificationProvider,
20731
+ options: {
20732
+ warnWhenUnsavedChanges: true,
20733
+ liveMode: "auto",
20734
+ disableTelemetry: true
20476
20735
  },
20477
- list: `${urlPrefix}/${c2.name}`,
20478
- show: `${urlPrefix}/${c2.name}/show`,
20479
- create: `${urlPrefix}/${c2.name}/create`,
20480
- edit: `${urlPrefix}/${c2.name}/edit`
20481
- };
20482
- }),
20483
- ...props,
20484
- children: content
20736
+ accessControlProvider,
20737
+ resources: resourcesConfig.map((c2) => {
20738
+ return {
20739
+ name: c2.name,
20740
+ meta: {
20741
+ dataProviderName: c2.dataProviderName,
20742
+ resourceBasePath: c2.basePath,
20743
+ kind: c2.kind,
20744
+ parent: c2.parent,
20745
+ label: `${c2.kind}s`
20746
+ },
20747
+ list: `${urlPrefix}/${c2.name}`,
20748
+ show: `${urlPrefix}/${c2.name}/show`,
20749
+ create: `${urlPrefix}/${c2.name}/create`,
20750
+ edit: `${urlPrefix}/${c2.name}/edit`
20751
+ };
20752
+ }),
20753
+ ...props,
20754
+ children: content
20755
+ }
20756
+ )
20485
20757
  }
20486
- ) })
20758
+ )
20487
20759
  }
20488
20760
  ) }) }) }) });
20489
20761
  };
@@ -20544,8 +20816,8 @@ class ModelPlugin {
20544
20816
  restoreItem(item) {
20545
20817
  return item._rawYaml;
20546
20818
  }
20547
- setModelMap(key2, model) {
20548
- this.ModelMap.set(key2, model);
20819
+ setModelMap(key2, ModelClass) {
20820
+ this.ModelMap.set(key2, ModelClass);
20549
20821
  }
20550
20822
  }
20551
20823
  const modelPlugin = new ModelPlugin();
@@ -20650,12 +20922,14 @@ exports.ClusterIpField = ClusterIpField;
20650
20922
  exports.ColumnKeys = ColumnKeys;
20651
20923
  exports.CommonSorter = CommonSorter;
20652
20924
  exports.ComponentContext = ComponentContext;
20925
+ exports.ComponentContextProvider = ComponentContextProvider;
20653
20926
  exports.ConditionsField = ConditionsField;
20654
20927
  exports.ConditionsGroup = ConditionsGroup;
20655
20928
  exports.ConditionsTab = ConditionsTab;
20656
20929
  exports.ConditionsTable = ConditionsTable;
20657
20930
  exports.ConfigsContext = ConfigsContext;
20658
20931
  exports.ControllerRevisionModel = ControllerRevisionModel;
20932
+ exports.CopyButton = CopyButton;
20659
20933
  exports.CreateButton = CreateButton;
20660
20934
  exports.CronJobDropdown = CronJobDropdown;
20661
20935
  exports.CronJobModel = CronJobModel;
@@ -20683,7 +20957,7 @@ exports.EditLabelDropdownMenuItem = EditLabelDropdownMenuItem;
20683
20957
  exports.EditLabelForm = EditLabelForm;
20684
20958
  exports.EditNodeTaintDropdownMenuItem = EditNodeTaintDropdownMenuItem;
20685
20959
  exports.EditNodeTaintForm = EditNodeTaintForm;
20686
- exports.ErrorContent = WidgetErrorContent;
20960
+ exports.ErrorContent = ErrorContent;
20687
20961
  exports.ErrorContentType = ErrorContentType;
20688
20962
  exports.ErrorWrapper = ErrorWrapper;
20689
20963
  exports.EventModel = EventModel;
@@ -20696,6 +20970,7 @@ exports.FormItemLayout = FormItemLayout;
20696
20970
  exports.FormModal = FormModal;
20697
20971
  exports.FormMode = FormMode;
20698
20972
  exports.FormType = FormType;
20973
+ exports.FormatRulePopover = FormatRulePopover;
20699
20974
  exports.GlobalStoreContext = GlobalStoreContext;
20700
20975
  exports.INGRESS_INIT_VALUE = INGRESS_INIT_VALUE;
20701
20976
  exports.ImageField = ImageField;
@@ -20891,6 +21166,7 @@ exports.TextTags = TextTags;
20891
21166
  exports.Time = Time;
20892
21167
  exports.ValidateRfc1035Name = ValidateRfc1035Name;
20893
21168
  exports.ValueDisplay = index;
21169
+ exports.WidgetErrorContent = WidgetErrorContent;
20894
21170
  exports.WorkloadBaseModel = WorkloadBaseModel;
20895
21171
  exports.WorkloadDropdown = WorkloadDropdown;
20896
21172
  exports.WorkloadImageColumnRenderer = WorkloadImageColumnRenderer;
@@ -20901,7 +21177,6 @@ exports.WorkloadReplicasForm = WorkloadReplicasForm;
20901
21177
  exports.YamlEditorComponent = YamlEditorComponent;
20902
21178
  exports.YamlForm = YamlForm;
20903
21179
  exports.addDefaultRenderToColumns = addDefaultRenderToColumns;
20904
- exports.dnsSubDomainRules = dnsSubDomainRules;
20905
21180
  exports.dovetailRefineI18n = dovetailRefineI18n;
20906
21181
  exports.generateSchemaTypeValue = generateSchemaTypeValue;
20907
21182
  exports.generateValueFromSchema = generateValueFromSchema;
@@ -20915,12 +21190,11 @@ exports.pruneBeforeEdit = pruneBeforeEdit;
20915
21190
  exports.relationPlugin = relationPlugin;
20916
21191
  exports.renderCommonFormFiled = renderCommonFormFiled;
20917
21192
  exports.resolveRef = resolveRef;
20918
- exports.rfc1035LabelRules = rfc1035LabelRules;
20919
- exports.rfc1123LabelRules = rfc1123LabelRules;
20920
21193
  exports.routerProvider = routerProvider;
20921
21194
  exports.shortenedImage = shortenedImage;
20922
21195
  exports.transformResourceKindInSentence = transformResourceKindInSentence;
20923
21196
  exports.useApiGroupSchema = useApiGroupSchema;
21197
+ exports.useDeleteManyModal = useDeleteManyModal;
20924
21198
  exports.useDeleteModal = useDeleteModal;
20925
21199
  exports.useDeleteModalOnly = useDeleteModalOnly;
20926
21200
  exports.useDownloadYAML = useDownloadYAML;