@dovetail-v2/refine 0.1.5 → 0.1.7

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 (223) hide show
  1. package/dist/{MonacoYamlDiffEditor-c2239ccf.js → MonacoYamlDiffEditor-1593cfad.js} +1 -1
  2. package/dist/{index-bac1b88c.js → index-45031697.js} +938 -545
  3. package/dist/refine.js +189 -188
  4. package/dist/refine.umd.cjs +747 -354
  5. package/dist/style.css +2795 -124
  6. package/lib/{src/Dovetail.d.ts → Dovetail.d.ts} +2 -0
  7. package/lib/components/DropdownMenuItems/EditAnnotationDropdownMenuItem.d.ts +10 -0
  8. package/lib/components/DropdownMenuItems/EditLabelDropdownMenuItem.d.ts +10 -0
  9. package/lib/components/DropdownMenuItems/index.d.ts +2 -0
  10. package/lib/{src/components → components}/EditField/index.d.ts +2 -1
  11. package/lib/components/EditMetadataForm/EditAnnotationForm.d.ts +10 -0
  12. package/lib/components/EditMetadataForm/EditLabelForm.d.ts +10 -0
  13. package/lib/components/EditMetadataForm/index.d.ts +2 -0
  14. package/lib/{src/components → components}/Form/FormModal.d.ts +3 -0
  15. package/lib/{src/components → components}/Form/RefineFormContent.d.ts +2 -2
  16. package/lib/{src/components → components}/Form/YamlForm.d.ts +4 -1
  17. package/lib/components/Form/useFieldsConfig.d.ts +4 -0
  18. package/lib/{src/components → components}/Form/useYamlForm.d.ts +8 -1
  19. package/lib/{src/components → components}/FormErrorAlert/index.d.ts +1 -0
  20. package/lib/{src/components → components}/Shell/index.d.ts +1 -0
  21. package/lib/{src/components → components}/index.d.ts +1 -0
  22. package/lib/{src/constants → constants}/k8s.d.ts +1 -1
  23. package/lib/contexts/constants.d.ts +6 -0
  24. package/lib/{src/hooks → hooks}/useDeleteModal/useDeleteModal.d.ts +0 -1
  25. package/lib/{src/hooks → hooks}/useSchema.d.ts +1 -1
  26. package/lib/{src/i18n.d.ts → i18n.d.ts} +9 -0
  27. package/lib/{src/locales → locales}/en-US/index.d.ts +1 -0
  28. package/lib/{src/locales → locales}/zh-CN/index.d.ts +8 -0
  29. package/lib/{src/models → models}/resource-model.d.ts +2 -0
  30. package/lib/{src/pages → pages}/storageclasses/index.d.ts +2 -1
  31. package/lib/styles/button.d.ts +1 -0
  32. package/lib/{src/styles → styles}/modal.d.ts +1 -0
  33. package/lib/{src/types → types}/resource.d.ts +2 -1
  34. package/lib/{src/utils → utils}/openapi.d.ts +2 -1
  35. package/package.json +6 -1
  36. package/lib/vite.config.d.ts +0 -2
  37. /package/lib/{src/App.d.ts → App.d.ts} +0 -0
  38. /package/lib/{src/components → components}/Breadcrumb/index.d.ts +0 -0
  39. /package/lib/{src/components → components}/ConditionsTable/ConditionsTable.d.ts +0 -0
  40. /package/lib/{src/components → components}/ConditionsTable/index.d.ts +0 -0
  41. /package/lib/{src/components → components}/CreateButton/index.d.ts +0 -0
  42. /package/lib/{src/components → components}/CronJobDropdown/index.d.ts +0 -0
  43. /package/lib/{src/components → components}/CronjobJobsTable/index.d.ts +0 -0
  44. /package/lib/{src/components → components}/DeleteButton/index.d.ts +0 -0
  45. /package/lib/{src/components → components}/DeleteManyButton/index.d.ts +0 -0
  46. /package/lib/{src/components → components}/DrawerShow/DrawerShow.d.ts +0 -0
  47. /package/lib/{src/components → components}/DrawerShow/index.d.ts +0 -0
  48. /package/lib/{src/components → components}/DurationTime/index.d.ts +0 -0
  49. /package/lib/{src/components → components}/EditButton/index.d.ts +0 -0
  50. /package/lib/{src/components → components}/ErrorContent/index.d.ts +0 -0
  51. /package/lib/{src/components → components}/EventsTable/EventsTable.d.ts +0 -0
  52. /package/lib/{src/components → components}/EventsTable/index.d.ts +0 -0
  53. /package/lib/{src/components → components}/Form/RefineFormPage.d.ts +0 -0
  54. /package/lib/{src/components → components}/Form/index.d.ts +0 -0
  55. /package/lib/{src/components → components}/Form/type.d.ts +0 -0
  56. /package/lib/{src/components → components}/Form/useReactHookForm.d.ts +0 -0
  57. /package/lib/{src/components → components}/Form/useRefineForm.d.ts +0 -0
  58. /package/lib/{src/components → components}/FormLayout/index.d.ts +0 -0
  59. /package/lib/{src/components → components}/FormWidgets/KeyValueListWidget.d.ts +0 -0
  60. /package/lib/{src/components → components}/FormWidgets/MetadataForm.d.ts +0 -0
  61. /package/lib/{src/components → components}/FormWidgets/NameInputWidget.d.ts +0 -0
  62. /package/lib/{src/components → components}/FormWidgets/NamespaceSelectWidget.d.ts +0 -0
  63. /package/lib/{src/components → components}/FormWidgets/index.d.ts +0 -0
  64. /package/lib/{src/components → components}/FormWidgets/widget.d.ts +0 -0
  65. /package/lib/{src/components → components}/ImageNames/index.d.ts +0 -0
  66. /package/lib/{src/components → components}/IngressRulesComponent/index.d.ts +0 -0
  67. /package/lib/{src/components → components}/IngressRulesTable/IngressRulesTable.d.ts +0 -0
  68. /package/lib/{src/components → components}/IngressRulesTable/index.d.ts +0 -0
  69. /package/lib/{src/components → components}/K8sDropdown/index.d.ts +0 -0
  70. /package/lib/{src/components → components}/KeyValue/KeyValue.d.ts +0 -0
  71. /package/lib/{src/components → components}/KeyValue/KeyValueAnnotation.d.ts +0 -0
  72. /package/lib/{src/components → components}/KeyValue/KeyValueSecret.d.ts +0 -0
  73. /package/lib/{src/components → components}/KeyValue/index.d.ts +0 -0
  74. /package/lib/{src/components → components}/Layout/index.d.ts +0 -0
  75. /package/lib/{src/components → components}/LinkFallback/index.d.ts +0 -0
  76. /package/lib/{src/components → components}/ListPage/index.d.ts +0 -0
  77. /package/lib/{src/components → components}/Menu/index.d.ts +0 -0
  78. /package/lib/{src/components → components}/NamespacesFilter/index.d.ts +0 -0
  79. /package/lib/{src/components → components}/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +0 -0
  80. /package/lib/{src/components → components}/NetworkPolicyRulesViewer/index.d.ts +0 -0
  81. /package/lib/{src/components → components}/PageShow/PageShow.d.ts +0 -0
  82. /package/lib/{src/components → components}/PageShow/index.d.ts +0 -0
  83. /package/lib/{src/components → components}/PodContainersTable/PodContainersTable.d.ts +0 -0
  84. /package/lib/{src/components → components}/PodContainersTable/index.d.ts +0 -0
  85. /package/lib/{src/components → components}/PodDropdown/index.d.ts +0 -0
  86. /package/lib/{src/components → components}/PodLog/index.d.ts +0 -0
  87. /package/lib/{src/components → components}/PodSelectorTable/index.d.ts +0 -0
  88. /package/lib/{src/components → components}/PodShellModal/PodShell.d.ts +0 -0
  89. /package/lib/{src/components → components}/PodShellModal/index.d.ts +0 -0
  90. /package/lib/{src/components → components}/PortsTable/index.d.ts +0 -0
  91. /package/lib/{src/components → components}/ReferenceLink/index.d.ts +0 -0
  92. /package/lib/{src/components → components}/ReplicasDropdown/index.d.ts +0 -0
  93. /package/lib/{src/components → components}/ResourceCRUD/ResourceCRUD.d.ts +0 -0
  94. /package/lib/{src/components → components}/ResourceCRUD/create/index.d.ts +0 -0
  95. /package/lib/{src/components → components}/ResourceCRUD/index.d.ts +0 -0
  96. /package/lib/{src/components → components}/ResourceCRUD/list/index.d.ts +0 -0
  97. /package/lib/{src/components → components}/ResourceCRUD/show/index.d.ts +0 -0
  98. /package/lib/{src/components → components}/ResourceFiledDisplays.d.ts +0 -0
  99. /package/lib/{src/components → components}/ResourceLink/index.d.ts +0 -0
  100. /package/lib/{src/components → components}/ResourceSelect/index.d.ts +0 -0
  101. /package/lib/{src/components → components}/ResourceUsageBar/index.d.ts +0 -0
  102. /package/lib/{src/components → components}/Separator/index.d.ts +0 -0
  103. /package/lib/{src/components → components}/ServiceComponents/index.d.ts +0 -0
  104. /package/lib/{src/components → components}/Shell/ShellToolbar.d.ts +0 -0
  105. /package/lib/{src/components → components}/ShowContent/ShowContent.d.ts +0 -0
  106. /package/lib/{src/components → components}/ShowContent/fields.d.ts +0 -0
  107. /package/lib/{src/components → components}/ShowContent/groups.d.ts +0 -0
  108. /package/lib/{src/components → components}/ShowContent/index.d.ts +0 -0
  109. /package/lib/{src/components → components}/ShowContent/tabs.d.ts +0 -0
  110. /package/lib/{src/components → components}/StateTag/StateTag.d.ts +0 -0
  111. /package/lib/{src/components → components}/StateTag/index.d.ts +0 -0
  112. /package/lib/{src/components → components}/Table/TableToolBar.d.ts +0 -0
  113. /package/lib/{src/components → components}/Table/TableWidgets.d.ts +0 -0
  114. /package/lib/{src/components → components}/Table/index.d.ts +0 -0
  115. /package/lib/{src/components → components}/Tabs/index.d.ts +0 -0
  116. /package/lib/{src/components → components}/Tags/index.d.ts +0 -0
  117. /package/lib/{src/components → components}/TextTags/index.d.ts +0 -0
  118. /package/lib/{src/components → components}/Time/index.d.ts +0 -0
  119. /package/lib/{src/components → components}/ValueDisplay/index.d.ts +0 -0
  120. /package/lib/{src/components → components}/WorkloadDropdown/index.d.ts +0 -0
  121. /package/lib/{src/components → components}/WorkloadPodsTable/WorkloadPodsTable.d.ts +0 -0
  122. /package/lib/{src/components → components}/WorkloadPodsTable/index.d.ts +0 -0
  123. /package/lib/{src/components → components}/WorkloadReplicas/index.d.ts +0 -0
  124. /package/lib/{src/components → components}/YamlEditor/MonacoYamlDiffEditor.d.ts +0 -0
  125. /package/lib/{src/components → components}/YamlEditor/MonacoYamlEditor.d.ts +0 -0
  126. /package/lib/{src/components → components}/YamlEditor/YamlEditorComponent.d.ts +0 -0
  127. /package/lib/{src/components → components}/YamlEditor/index.d.ts +0 -0
  128. /package/lib/{src/components → components}/YamlEditor/style.d.ts +0 -0
  129. /package/lib/{src/components → components}/YamlEditor/yaml.worker.d.ts +0 -0
  130. /package/lib/{src/constants → constants}/auth.d.ts +0 -0
  131. /package/lib/{src/constants → constants}/index.d.ts +0 -0
  132. /package/lib/{src/constants → constants}/state.d.ts +0 -0
  133. /package/lib/{src/contexts → contexts}/component.d.ts +0 -0
  134. /package/lib/{src/contexts → contexts}/configs.d.ts +0 -0
  135. /package/lib/{src/contexts → contexts}/global-store.d.ts +0 -0
  136. /package/lib/{src/contexts → contexts}/index.d.ts +0 -0
  137. /package/lib/{src/hooks → hooks}/index.d.ts +0 -0
  138. /package/lib/{src/hooks → hooks}/useDeleteModal/index.d.ts +0 -0
  139. /package/lib/{src/hooks → hooks}/useDeleteModal/useDeleteManyModal.d.ts +0 -0
  140. /package/lib/{src/hooks → hooks}/useDownloadYAML.d.ts +0 -0
  141. /package/lib/{src/hooks → hooks}/useEagleTable/columns.d.ts +0 -0
  142. /package/lib/{src/hooks → hooks}/useEagleTable/index.d.ts +0 -0
  143. /package/lib/{src/hooks → hooks}/useEagleTable/useEagleTable.d.ts +0 -0
  144. /package/lib/{src/hooks → hooks}/useEdit.d.ts +0 -0
  145. /package/lib/{src/hooks → hooks}/useGlobalStore.d.ts +0 -0
  146. /package/lib/{src/hooks → hooks}/useK8sYamlEditor.d.ts +0 -0
  147. /package/lib/{src/hooks → hooks}/useNamespaceRefineFilter.d.ts +0 -0
  148. /package/lib/{src/hooks → hooks}/useOpenForm.d.ts +0 -0
  149. /package/lib/{src/hooks → hooks}/useSubmitForm.d.ts +0 -0
  150. /package/lib/{src/hooks → hooks}/useTableData.d.ts +0 -0
  151. /package/lib/{src/index.d.ts → index.d.ts} +0 -0
  152. /package/lib/{src/locales → locales}/index.d.ts +0 -0
  153. /package/lib/{src/main.d.ts → main.d.ts} +0 -0
  154. /package/lib/{src/models → models}/cronjob-model.d.ts +0 -0
  155. /package/lib/{src/models → models}/daemonset-model.d.ts +0 -0
  156. /package/lib/{src/models → models}/deployment-model.d.ts +0 -0
  157. /package/lib/{src/models → models}/event-model.d.ts +0 -0
  158. /package/lib/{src/models → models}/index.d.ts +0 -0
  159. /package/lib/{src/models → models}/ingress-model.d.ts +0 -0
  160. /package/lib/{src/models → models}/job-model.d.ts +0 -0
  161. /package/lib/{src/models → models}/network-policy-model.d.ts +0 -0
  162. /package/lib/{src/models → models}/node-model.d.ts +0 -0
  163. /package/lib/{src/models → models}/persistent-volume-claim.d.ts +0 -0
  164. /package/lib/{src/models → models}/persistent-volume.d.ts +0 -0
  165. /package/lib/{src/models → models}/pod-metrics-model.d.ts +0 -0
  166. /package/lib/{src/models → models}/pod-model.d.ts +0 -0
  167. /package/lib/{src/models → models}/service-model.d.ts +0 -0
  168. /package/lib/{src/models → models}/statefulset-model.d.ts +0 -0
  169. /package/lib/{src/models → models}/storage-class.d.ts +0 -0
  170. /package/lib/{src/models → models}/types/index.d.ts +0 -0
  171. /package/lib/{src/models → models}/types/metric.d.ts +0 -0
  172. /package/lib/{src/models → models}/workload-base-model.d.ts +0 -0
  173. /package/lib/{src/models → models}/workload-model.d.ts +0 -0
  174. /package/lib/{src/pages → pages}/configmaps/index.d.ts +0 -0
  175. /package/lib/{src/pages → pages}/cronjobs/create/index.d.ts +0 -0
  176. /package/lib/{src/pages → pages}/cronjobs/index.d.ts +0 -0
  177. /package/lib/{src/pages → pages}/cronjobs/list/index.d.ts +0 -0
  178. /package/lib/{src/pages → pages}/cronjobs/show/index.d.ts +0 -0
  179. /package/lib/{src/pages → pages}/daemonsets/create/index.d.ts +0 -0
  180. /package/lib/{src/pages → pages}/daemonsets/index.d.ts +0 -0
  181. /package/lib/{src/pages → pages}/daemonsets/list/index.d.ts +0 -0
  182. /package/lib/{src/pages → pages}/daemonsets/show/index.d.ts +0 -0
  183. /package/lib/{src/pages → pages}/deployments/index.d.ts +0 -0
  184. /package/lib/{src/pages → pages}/deployments/list/index.d.ts +0 -0
  185. /package/lib/{src/pages → pages}/deployments/show/index.d.ts +0 -0
  186. /package/lib/{src/pages → pages}/ingresses/index.d.ts +0 -0
  187. /package/lib/{src/pages → pages}/jobs/index.d.ts +0 -0
  188. /package/lib/{src/pages → pages}/networkPolicies/index.d.ts +0 -0
  189. /package/lib/{src/pages → pages}/nodes/index.d.ts +0 -0
  190. /package/lib/{src/pages → pages}/nodes/list/index.d.ts +0 -0
  191. /package/lib/{src/pages → pages}/nodes/show/index.d.ts +0 -0
  192. /package/lib/{src/pages → pages}/persistentvolumeclaims/index.d.ts +0 -0
  193. /package/lib/{src/pages → pages}/persistentvolumes/index.d.ts +0 -0
  194. /package/lib/{src/pages → pages}/pods/create/index.d.ts +0 -0
  195. /package/lib/{src/pages → pages}/pods/index.d.ts +0 -0
  196. /package/lib/{src/pages → pages}/pods/list/index.d.ts +0 -0
  197. /package/lib/{src/pages → pages}/pods/show/index.d.ts +0 -0
  198. /package/lib/{src/pages → pages}/secrets/index.d.ts +0 -0
  199. /package/lib/{src/pages → pages}/services/index.d.ts +0 -0
  200. /package/lib/{src/pages → pages}/statefulsets/index.d.ts +0 -0
  201. /package/lib/{src/pages → pages}/storageclasses/form/index.d.ts +0 -0
  202. /package/lib/{src/plugins → plugins}/index.d.ts +0 -0
  203. /package/lib/{src/plugins → plugins}/model-plugin.d.ts +0 -0
  204. /package/lib/{src/plugins → plugins}/relation-plugin.d.ts +0 -0
  205. /package/lib/{src/plugins → plugins}/type.d.ts +0 -0
  206. /package/lib/{src/providers → providers}/index.d.ts +0 -0
  207. /package/lib/{src/providers → providers}/router-provider/index.d.ts +0 -0
  208. /package/lib/{src/types → types}/index.d.ts +0 -0
  209. /package/lib/{src/utils → utils}/addId.d.ts +0 -0
  210. /package/lib/{src/utils → utils}/download.d.ts +0 -0
  211. /package/lib/{src/utils → utils}/error.d.ts +0 -0
  212. /package/lib/{src/utils → utils}/form.d.ts +0 -0
  213. /package/lib/{src/utils → utils}/index.d.ts +0 -0
  214. /package/lib/{src/utils → utils}/k8s.d.ts +0 -0
  215. /package/lib/{src/utils → utils}/labels.d.ts +0 -0
  216. /package/lib/{src/utils → utils}/match-selector.d.ts +0 -0
  217. /package/lib/{src/utils → utils}/schema.d.ts +0 -0
  218. /package/lib/{src/utils → utils}/selector.d.ts +0 -0
  219. /package/lib/{src/utils → utils}/shell.d.ts +0 -0
  220. /package/lib/{src/utils → utils}/string.d.ts +0 -0
  221. /package/lib/{src/utils → utils}/time.d.ts +0 -0
  222. /package/lib/{src/utils → utils}/unit.d.ts +0 -0
  223. /package/lib/{src/utils → utils}/yaml.d.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("k8s-api-provider"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "@cloudtower/icons-react", "lodash-es", "js-yaml", "k8s-api-provider", "monaco-editor", "monaco-yaml", "react-dom", "sunflower-antd", "antd"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.iconsReact, global2.lodashEs, global2.yaml, global2.k8sApiProvider, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.sunflowerAntd, global2.antd));
3
- })(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml, k8sApiProvider, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("k8s-api-provider"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "@cloudtower/icons-react", "lodash-es", "js-yaml", "k8s-api-provider", "monaco-editor", "monaco-yaml", "react-dom", "sunflower-antd", "antd"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.iconsReact, global2.lodashEs, global2.yaml$1, global2.k8sApiProvider, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.sunflowerAntd, global2.antd));
3
+ })(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml$1, k8sApiProvider, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -1175,6 +1175,7 @@ var __publicField = (obj, key, value) => {
1175
1175
  const pv_phase_pending$1 = "Pending";
1176
1176
  const exec_pod = "Execute shell";
1177
1177
  const search$1 = "Search";
1178
+ const edit_label$1 = "Edit label";
1178
1179
  const dovetail$1 = {
1179
1180
  copy: copy$2,
1180
1181
  reset_arguments: reset_arguments$1,
@@ -1346,7 +1347,8 @@ var __publicField = (obj, key, value) => {
1346
1347
  pv_phase_failed: pv_phase_failed$1,
1347
1348
  pv_phase_pending: pv_phase_pending$1,
1348
1349
  exec_pod,
1349
- search: search$1
1350
+ search: search$1,
1351
+ edit_label: edit_label$1
1350
1352
  };
1351
1353
  const EN = {
1352
1354
  dovetail: dovetail$1
@@ -1525,6 +1527,14 @@ var __publicField = (obj, key, value) => {
1525
1527
  const connecting = "正在连接...";
1526
1528
  const reconnect = "重新连接";
1527
1529
  const search = "搜索";
1530
+ const edit_form = "编辑表单";
1531
+ const exit_yaml_tip = "返回编辑表单,不会保留对 YAML 文件做出的所有更改。";
1532
+ const form = "表单";
1533
+ const yaml = "YAML";
1534
+ const edit_label = "编辑标签";
1535
+ const edit_label_success_toast = "编辑资源 {{name}} 的标签成功";
1536
+ const edit_annotation = "编辑注解";
1537
+ const edit_annotation_success_toast = "编辑资源 {{name}} 的注解成功";
1528
1538
  const dovetail = {
1529
1539
  copy: copy$1,
1530
1540
  reset_arguments,
@@ -1702,7 +1712,15 @@ var __publicField = (obj, key, value) => {
1702
1712
  disconnected,
1703
1713
  connecting,
1704
1714
  reconnect,
1705
- search
1715
+ search,
1716
+ edit_form,
1717
+ exit_yaml_tip,
1718
+ form,
1719
+ yaml,
1720
+ edit_label,
1721
+ edit_label_success_toast,
1722
+ edit_annotation,
1723
+ edit_annotation_success_toast
1706
1724
  };
1707
1725
  const ZH = {
1708
1726
  dovetail
@@ -8085,18 +8103,19 @@ var __publicField = (obj, key, value) => {
8085
8103
  return schema;
8086
8104
  }
8087
8105
  class K8sOpenAPI {
8088
- constructor(resourceBasePath) {
8106
+ constructor(resourceBasePath, pathPrefix) {
8089
8107
  // private response: OpenAPIResponse | null = null;
8090
8108
  __publicField(this, "apiVersion");
8091
8109
  __publicField(this, "schemas", null);
8092
8110
  this.resourceBasePath = resourceBasePath;
8111
+ this.pathPrefix = pathPrefix;
8093
8112
  this.apiVersion = getApiVersion(resourceBasePath);
8094
8113
  }
8095
8114
  // Fetch and process OpenAPI schemas
8096
8115
  async fetch() {
8097
8116
  try {
8098
8117
  const response = await fetch(
8099
- `/api/sks/api/v1/clusters/sks-mgmt/proxy/openapi/v3${this.resourceBasePath}`
8118
+ `${this.pathPrefix}${this.resourceBasePath}`
8100
8119
  );
8101
8120
  const result = await response.json();
8102
8121
  this.schemas = Object.values(result.components.schemas);
@@ -8141,6 +8160,9 @@ var __publicField = (obj, key, value) => {
8141
8160
  });
8142
8161
  }
8143
8162
  }
8163
+ const ConstantsContext = React.createContext({
8164
+ schemaUrlPrefix: ""
8165
+ });
8144
8166
  function useApiGroupSchema() {
8145
8167
  const [state2, setState] = React.useState({
8146
8168
  schemas: null,
@@ -8148,7 +8170,7 @@ var __publicField = (obj, key, value) => {
8148
8170
  loading: false,
8149
8171
  error: null
8150
8172
  });
8151
- const fetchSchema = React.useCallback(async (apiGroups) => {
8173
+ const fetchSchema = React.useCallback(async (apiGroups, schemaUrlPrefix) => {
8152
8174
  setState((prev) => ({ ...prev, loading: true, error: null }));
8153
8175
  try {
8154
8176
  const results = await Promise.all(
@@ -8156,7 +8178,7 @@ var __publicField = (obj, key, value) => {
8156
8178
  if (state2.schemasMap[apiGroup]) {
8157
8179
  return { apiGroup, schemas: state2.schemasMap[apiGroup] };
8158
8180
  }
8159
- const openapi = new K8sOpenAPI(apiGroup);
8181
+ const openapi = new K8sOpenAPI(apiGroup, schemaUrlPrefix);
8160
8182
  const groupSchemas = await openapi.fetch();
8161
8183
  return { apiGroup, schemas: groupSchemas || [] };
8162
8184
  })
@@ -8179,18 +8201,19 @@ var __publicField = (obj, key, value) => {
8179
8201
  return { ...state2, fetchSchema };
8180
8202
  }
8181
8203
  function useSchema(options) {
8182
- var _a;
8204
+ var _a, _b;
8183
8205
  const [schema, setSchema] = React.useState(null);
8184
8206
  const [loading, setLoading] = React.useState(false);
8185
8207
  const [error, setError] = React.useState(null);
8186
8208
  const useResourceResult = core.useResource();
8187
8209
  const resource = (options == null ? void 0 : options.resource) || useResourceResult.resource;
8210
+ const { schemaUrlPrefix } = React.useContext(ConstantsContext);
8188
8211
  const openapi = React.useMemo(
8189
8212
  () => {
8190
8213
  var _a2;
8191
- return new K8sOpenAPI((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath);
8214
+ return new K8sOpenAPI((_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.resourceBasePath, schemaUrlPrefix);
8192
8215
  },
8193
- [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.resourceBasePath]
8216
+ [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.resourceBasePath, schemaUrlPrefix]
8194
8217
  );
8195
8218
  const fetchSchema = React.useCallback(async () => {
8196
8219
  var _a2;
@@ -8206,7 +8229,7 @@ var __publicField = (obj, key, value) => {
8206
8229
  } finally {
8207
8230
  setLoading(false);
8208
8231
  }
8209
- }, [resource, openapi]);
8232
+ }, [(_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.kind, openapi]);
8210
8233
  React.useEffect(() => {
8211
8234
  if (options == null ? void 0 : options.skip)
8212
8235
  return;
@@ -8245,11 +8268,13 @@ var __publicField = (obj, key, value) => {
8245
8268
  };
8246
8269
  var cx_default = cx;
8247
8270
  const ConfigsContext = React.createContext({});
8248
- const useDeleteModal_vv2pzj = "";
8271
+ const modal_1eijuvm = "";
8272
+ const FullscreenModalStyle = "fq4465w";
8273
+ const SmallModalStyle = "s1nc293e";
8274
+ const useDeleteModal_mi8he5 = "";
8249
8275
  const TextStyle = "t1vq0ett";
8250
8276
  const TipStyle = "t139onst";
8251
8277
  const NameStyle$1 = "n18lzor8";
8252
- const ModalStyle = "mvvgkkc";
8253
8278
  const useDeleteModal = (resource) => {
8254
8279
  const configs = React.useContext(ConfigsContext);
8255
8280
  const config = configs[resource];
@@ -8264,7 +8289,7 @@ var __publicField = (obj, key, value) => {
8264
8289
  t: t2
8265
8290
  } = useTranslation();
8266
8291
  const modalProps = {
8267
- className: ModalStyle,
8292
+ className: SmallModalStyle,
8268
8293
  title: t2("dovetail.delete_resource", {
8269
8294
  resource: config.kind
8270
8295
  }),
@@ -8345,7 +8370,7 @@ var __publicField = (obj, key, value) => {
8345
8370
  openDeleteConfirmModal
8346
8371
  };
8347
8372
  };
8348
- const index_wrn16i = "";
8373
+ const index_18b69qa = "";
8349
8374
  const EMPTY_VALUES = [void 0, null, "", "-"];
8350
8375
  const EmptyStyle = "e5223w8";
8351
8376
  const ContentStyle$2 = "cdjsw14";
@@ -8357,7 +8382,7 @@ var __publicField = (obj, key, value) => {
8357
8382
  style
8358
8383
  } = props;
8359
8384
  return EMPTY_VALUES.includes(value2) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8360
- className: cx_default(EmptyStyle, className),
8385
+ className: cx_default(EmptyStyle, "empty-text", className),
8361
8386
  style,
8362
8387
  children: "-"
8363
8388
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -8429,7 +8454,7 @@ var __publicField = (obj, key, value) => {
8429
8454
  };
8430
8455
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: elapsedTime(value2, i18nMap).label || /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" }) });
8431
8456
  }
8432
- const index_hex8jv = "";
8457
+ const index_1xaw1mq = "";
8433
8458
  const BreadcrumbStyle = "b142d7q8";
8434
8459
  function Breadcrumb(props) {
8435
8460
  const {
@@ -8737,7 +8762,7 @@ var __publicField = (obj, key, value) => {
8737
8762
  return o(prop);
8738
8763
  }
8739
8764
  }) : styled;
8740
- const index_cp12i5 = "";
8765
+ const index_1q7r2i0 = "";
8741
8766
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
8742
8767
  name: "ErrorWrapper",
8743
8768
  class: "egn3dbn",
@@ -8798,13 +8823,13 @@ var __publicField = (obj, key, value) => {
8798
8823
  })
8799
8824
  });
8800
8825
  };
8801
- const TableWidgets_ny30pi = "";
8826
+ const TableWidgets_sc2nyo = "";
8802
8827
  const AuxiliaryLine = /* @__PURE__ */ styled_default("div")({
8803
8828
  name: "AuxiliaryLine",
8804
8829
  class: "ax1qopv",
8805
8830
  propsAsIs: false
8806
8831
  });
8807
- const index_dmbxj3 = "";
8832
+ const index_dp43sd = "";
8808
8833
  const TableContainerStyle = "t1upn1sz";
8809
8834
  function Table(props) {
8810
8835
  const {
@@ -9117,6 +9142,16 @@ var __publicField = (obj, key, value) => {
9117
9142
  restore() {
9118
9143
  return this._rawYaml;
9119
9144
  }
9145
+ updateLabel(labels) {
9146
+ const newYaml = this._globalStore.restoreItem(this);
9147
+ newYaml.metadata.labels = labels;
9148
+ return newYaml;
9149
+ }
9150
+ updateAnnotation(annotations) {
9151
+ const newYaml = this._globalStore.restoreItem(this);
9152
+ newYaml.metadata.annotations = annotations;
9153
+ return newYaml;
9154
+ }
9120
9155
  }
9121
9156
  class IngressModel extends ResourceModel {
9122
9157
  constructor(_rawYaml, _globalStore) {
@@ -9613,7 +9648,7 @@ var __publicField = (obj, key, value) => {
9613
9648
  }
9614
9649
  }
9615
9650
  };
9616
- const TIMESTAMP_LABEL = "sks.user.kubesmart.smtx.io/timestamp";
9651
+ const REDEPLOY_TIMESTAMP_KEY = "kubectl.kubernetes.io/restartedAt";
9617
9652
  const SECRET_OPAQUE_INIT_VALUE = {
9618
9653
  "apiVersion": "v1",
9619
9654
  "kind": "Secret",
@@ -9862,7 +9897,7 @@ var __publicField = (obj, key, value) => {
9862
9897
  const annotations = lodashExports.get(newOne, path2, {});
9863
9898
  lodashExports.set(newOne, path2, {
9864
9899
  ...annotations,
9865
- [TIMESTAMP_LABEL]: (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z")
9900
+ [REDEPLOY_TIMESTAMP_KEY]: (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z")
9866
9901
  });
9867
9902
  return newOne;
9868
9903
  }
@@ -10238,7 +10273,7 @@ var __publicField = (obj, key, value) => {
10238
10273
  this._rawYaml = _rawYaml;
10239
10274
  }
10240
10275
  }
10241
- const index_1lzkrja = "";
10276
+ const index_1iq0dq9 = "";
10242
10277
  const ServiceInClusterAccessComponent = ({
10243
10278
  service
10244
10279
  }) => {
@@ -10317,7 +10352,7 @@ var __publicField = (obj, key, value) => {
10317
10352
  children: content || "-"
10318
10353
  });
10319
10354
  };
10320
- const index_10ylmu3 = "";
10355
+ const index_1sc40y3 = "";
10321
10356
  const TagWrapper = "t13a6vox";
10322
10357
  const TagStyle = "t12ikbmp";
10323
10358
  const Tags = (props) => {
@@ -10344,7 +10379,7 @@ var __publicField = (obj, key, value) => {
10344
10379
  children: tags
10345
10380
  });
10346
10381
  };
10347
- const StateTag_1wmvw42 = "";
10382
+ const StateTag_1o2atxo = "";
10348
10383
  const StateTagStyle = "s8qkbck";
10349
10384
  const StateTag = ({
10350
10385
  state: state2 = WorkloadState.UPDATING,
@@ -10429,7 +10464,7 @@ var __publicField = (obj, key, value) => {
10429
10464
  })(relativeTime$1);
10430
10465
  var relativeTimeExports = relativeTime$1.exports;
10431
10466
  const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
10432
- const index_1779z85 = "";
10467
+ const index_1jgp4p8 = "";
10433
10468
  dayjs.extend(relativeTime, {
10434
10469
  thresholds: [{
10435
10470
  l: "s",
@@ -10601,7 +10636,7 @@ var __publicField = (obj, key, value) => {
10601
10636
  function useDownloadYAML() {
10602
10637
  return function(options) {
10603
10638
  const { name: name2, item } = options;
10604
- const content = yaml.dump(item);
10639
+ const content = yaml$1.dump(item);
10605
10640
  download(`${name2}.yaml`, content);
10606
10641
  };
10607
10642
  }
@@ -10686,6 +10721,410 @@ var __publicField = (obj, key, value) => {
10686
10721
  }
10687
10722
  };
10688
10723
  }
10724
+ function FormErrorAlert(props) {
10725
+ const { title, errorMsgs, style, className, isEdit } = props;
10726
+ const { i18n: i18n2 } = useTranslation();
10727
+ return errorMsgs.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10728
+ eagle.Alert,
10729
+ {
10730
+ message: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10731
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: title || i18n2.t(isEdit ? "dovetail.save_failed_tip" : "dovetail.create_failed_tip") }),
10732
+ errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
10733
+ index2 + 1 + ". ",
10734
+ " ",
10735
+ errorMsg
10736
+ ] }, errorMsg)) }) : lodashEs.first(errorMsgs)
10737
+ ] }),
10738
+ type: "error",
10739
+ style,
10740
+ className
10741
+ }
10742
+ ) : null;
10743
+ }
10744
+ function getCommonErrors(responseBody, i18n2) {
10745
+ var _a;
10746
+ if (!((responseBody == null ? void 0 : responseBody.message) || (responseBody == null ? void 0 : responseBody.code) || (responseBody == null ? void 0 : responseBody.reason) || (responseBody == null ? void 0 : responseBody.details) || (responseBody == null ? void 0 : responseBody.graphQLErrors))) {
10747
+ return [];
10748
+ }
10749
+ const causes = ((_a = responseBody.details) == null ? void 0 : _a.causes) || responseBody.graphQLErrors || [];
10750
+ if (causes.length) {
10751
+ return causes.map((cause) => {
10752
+ let params = {};
10753
+ let message2 = cause.message;
10754
+ try {
10755
+ const info = JSON.parse(cause.message);
10756
+ params = info.params;
10757
+ message2 = info.message;
10758
+ } catch {
10759
+ return i18n2.t(
10760
+ [
10761
+ `error.${cause.reason}`,
10762
+ `error.${cause.code}`,
10763
+ `${cause.field ? `${cause.field}: ` : ""}${message2}`
10764
+ ],
10765
+ {
10766
+ ...params,
10767
+ fallbackLng: ""
10768
+ }
10769
+ );
10770
+ }
10771
+ return i18n2.t(
10772
+ [
10773
+ `error.${cause.reason}`,
10774
+ `error.${cause.code}`,
10775
+ `${cause.field ? `${cause.field}: ` : ""}${message2}`
10776
+ ],
10777
+ {
10778
+ ...params,
10779
+ fallbackLng: ""
10780
+ }
10781
+ );
10782
+ });
10783
+ }
10784
+ return [
10785
+ i18n2.t(
10786
+ [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
10787
+ { fallbackLng: "" }
10788
+ )
10789
+ ];
10790
+ }
10791
+ function useSubmitForm(options) {
10792
+ const { formRef, onSubmitSuccess } = options;
10793
+ const { i18n: i18n2 } = useTranslation();
10794
+ const [submitting, setSubmitting] = React.useState(false);
10795
+ const [errorMsgs, setErrorMsgs] = React.useState([]);
10796
+ const reset = React.useCallback(() => {
10797
+ setSubmitting(false);
10798
+ setErrorMsgs([]);
10799
+ }, []);
10800
+ const onSubmit = React.useCallback(async () => {
10801
+ var _a;
10802
+ try {
10803
+ setSubmitting(true);
10804
+ await ((_a = formRef.current) == null ? void 0 : _a.submit());
10805
+ onSubmitSuccess == null ? void 0 : onSubmitSuccess();
10806
+ reset();
10807
+ } catch (error) {
10808
+ if (error instanceof Object) {
10809
+ if ("response" in error && error.response instanceof Response) {
10810
+ const response = error.response;
10811
+ const body = await response.json();
10812
+ setErrorMsgs(getCommonErrors(body, i18n2));
10813
+ } else if ("message" in error && typeof error.message === "string") {
10814
+ setErrorMsgs([error.message]);
10815
+ }
10816
+ }
10817
+ } finally {
10818
+ setSubmitting(false);
10819
+ }
10820
+ }, [formRef, i18n2, reset, onSubmitSuccess]);
10821
+ return {
10822
+ submitting,
10823
+ errorMsgs,
10824
+ reset,
10825
+ onSubmit
10826
+ };
10827
+ }
10828
+ const index_130sdg8 = "";
10829
+ const EditButtonStyle = "esoz3jw";
10830
+ function EditFieldModal(props) {
10831
+ const {
10832
+ title,
10833
+ formRef: form2,
10834
+ renderContent,
10835
+ fullscreen
10836
+ } = props;
10837
+ const {
10838
+ i18n: i18n2
10839
+ } = useTranslation();
10840
+ const popModal = eagle.usePopModal();
10841
+ const {
10842
+ submitting,
10843
+ errorMsgs,
10844
+ reset,
10845
+ onSubmit
10846
+ } = useSubmitForm({
10847
+ formRef: form2,
10848
+ onSubmitSuccess: () => {
10849
+ popModal();
10850
+ }
10851
+ });
10852
+ const close = React.useCallback(() => {
10853
+ popModal();
10854
+ reset();
10855
+ }, [reset]);
10856
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
10857
+ className: fullscreen ? FullscreenModalStyle : SmallModalStyle,
10858
+ title: title || i18n2.t("dovetail.edit"),
10859
+ confirmLoading: submitting,
10860
+ onOk: onSubmit,
10861
+ onCancel: close,
10862
+ okText: i18n2.t("dovetail.save"),
10863
+ normal: true,
10864
+ destroyOnClose: true,
10865
+ fullscreen,
10866
+ children: [renderContent(), /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
10867
+ style: {
10868
+ marginTop: 16
10869
+ },
10870
+ errorMsgs,
10871
+ isEdit: true
10872
+ })]
10873
+ });
10874
+ }
10875
+ function EditField(props) {
10876
+ const {
10877
+ modalProps
10878
+ } = props;
10879
+ const {
10880
+ i18n: i18n2
10881
+ } = useTranslation();
10882
+ const {
10883
+ resource
10884
+ } = core.useResource();
10885
+ const pushModal = eagle.usePushModal();
10886
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
10887
+ resource: resource == null ? void 0 : resource.name,
10888
+ action: AccessControlAuth.Edit,
10889
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
10890
+ className: EditButtonStyle,
10891
+ type: "link",
10892
+ onClick: () => {
10893
+ pushModal({
10894
+ component: EditFieldModal,
10895
+ props: modalProps
10896
+ });
10897
+ },
10898
+ children: i18n2.t("dovetail.edit")
10899
+ })
10900
+ });
10901
+ }
10902
+ const EditLabelForm = React.forwardRef(
10903
+ function EditLabelForm2(props, ref) {
10904
+ var _a;
10905
+ const { resourceModel } = props;
10906
+ const { mutateAsync } = core.useUpdate();
10907
+ const { t: t2 } = useTranslation();
10908
+ const [value2, setValue] = React.useState([]);
10909
+ const defaultValue = React.useMemo(() => {
10910
+ var _a2;
10911
+ return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.labels) || {}).map((key2) => {
10912
+ var _a3, _b;
10913
+ return { key: key2, value: (_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.labels) == null ? void 0 : _b[key2] };
10914
+ });
10915
+ }, [(_a = resourceModel.metadata) == null ? void 0 : _a.labels]);
10916
+ const submit = React.useCallback(() => {
10917
+ const newLabels = {};
10918
+ value2.forEach(({ key: key2, value: value22 }) => {
10919
+ newLabels[key2] = value22;
10920
+ });
10921
+ const newYaml = resourceModel.updateLabel(newLabels);
10922
+ pruneBeforeEdit(newYaml);
10923
+ return mutateAsync({
10924
+ id: resourceModel.id,
10925
+ resource: resourceModel.name || "",
10926
+ values: newYaml,
10927
+ meta: {
10928
+ resourceBasePath: resourceModel.apiVersion,
10929
+ kind: resourceModel.kind
10930
+ },
10931
+ successNotification() {
10932
+ return {
10933
+ message: t2("dovetail.edit_label_success_toast", {
10934
+ kind: resourceModel.kind,
10935
+ name: resourceModel.metadata.name,
10936
+ interpolation: {
10937
+ escapeValue: false
10938
+ }
10939
+ }),
10940
+ type: "success"
10941
+ };
10942
+ },
10943
+ errorNotification: false
10944
+ });
10945
+ }, [value2, resourceModel, mutateAsync, t2]);
10946
+ React.useImperativeHandle(
10947
+ ref,
10948
+ () => ({
10949
+ submit
10950
+ }),
10951
+ [submit]
10952
+ );
10953
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10954
+ eagle.TableForm,
10955
+ {
10956
+ onBodyChange: (value22) => {
10957
+ setValue(value22);
10958
+ },
10959
+ columns: [
10960
+ {
10961
+ key: "key",
10962
+ title: "Key",
10963
+ type: "input"
10964
+ },
10965
+ {
10966
+ key: "value",
10967
+ title: "Value",
10968
+ type: "input"
10969
+ }
10970
+ ],
10971
+ disableBatchFilling: true,
10972
+ rowAddConfig: {
10973
+ addible: true
10974
+ },
10975
+ defaultData: defaultValue,
10976
+ row: {
10977
+ deletable: true
10978
+ }
10979
+ }
10980
+ );
10981
+ }
10982
+ );
10983
+ function EditLabelDropdownMenuItem(props) {
10984
+ const { formRef, resourceModel } = props;
10985
+ const { t: t2 } = useTranslation();
10986
+ const pushModal = eagle.usePushModal();
10987
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10988
+ eagle.Menu.Item,
10989
+ {
10990
+ className: "ant-dropdown-menu-item",
10991
+ onClick: () => {
10992
+ const modalProps = {
10993
+ formRef,
10994
+ title: t2("dovetail.edit_label"),
10995
+ fullscreen: true,
10996
+ renderContent() {
10997
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10998
+ EditLabelForm,
10999
+ {
11000
+ ref: formRef,
11001
+ resourceModel
11002
+ }
11003
+ );
11004
+ }
11005
+ };
11006
+ pushModal({
11007
+ component: EditFieldModal,
11008
+ props: modalProps
11009
+ });
11010
+ },
11011
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16BlueIcon, children: t2("dovetail.edit_label") })
11012
+ }
11013
+ );
11014
+ }
11015
+ const EditAnnotationForm = React.forwardRef(
11016
+ function EditAnnotationForm2(props, ref) {
11017
+ var _a;
11018
+ const { resourceModel } = props;
11019
+ const { mutateAsync } = core.useUpdate();
11020
+ const { t: t2 } = useTranslation();
11021
+ const [value2, setValue] = React.useState([]);
11022
+ const defaultValue = React.useMemo(() => {
11023
+ var _a2;
11024
+ return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.annotations) || {}).map((key2) => {
11025
+ var _a3, _b;
11026
+ return { key: key2, value: (_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.annotations) == null ? void 0 : _b[key2] };
11027
+ });
11028
+ }, [(_a = resourceModel.metadata) == null ? void 0 : _a.annotations]);
11029
+ const submit = React.useCallback(() => {
11030
+ const newAnnotations = {};
11031
+ value2.forEach(({ key: key2, value: value22 }) => {
11032
+ newAnnotations[key2] = value22;
11033
+ });
11034
+ const newYaml = resourceModel.updateLabel(newAnnotations);
11035
+ pruneBeforeEdit(newYaml);
11036
+ return mutateAsync({
11037
+ id: resourceModel.id,
11038
+ resource: resourceModel.name || "",
11039
+ values: newYaml,
11040
+ meta: {
11041
+ resourceBasePath: resourceModel.apiVersion,
11042
+ kind: resourceModel.kind
11043
+ },
11044
+ successNotification() {
11045
+ return {
11046
+ message: t2("dovetail.edit_annotation_success_toast", {
11047
+ kind: resourceModel.kind,
11048
+ name: resourceModel.metadata.name,
11049
+ interpolation: {
11050
+ escapeValue: false
11051
+ }
11052
+ }),
11053
+ type: "success"
11054
+ };
11055
+ },
11056
+ errorNotification: false
11057
+ });
11058
+ }, [value2, resourceModel, mutateAsync, t2]);
11059
+ React.useImperativeHandle(
11060
+ ref,
11061
+ () => ({
11062
+ submit
11063
+ }),
11064
+ [submit]
11065
+ );
11066
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11067
+ eagle.TableForm,
11068
+ {
11069
+ onBodyChange: (value22) => {
11070
+ setValue(value22);
11071
+ },
11072
+ columns: [
11073
+ {
11074
+ key: "key",
11075
+ title: "Key",
11076
+ type: "input"
11077
+ },
11078
+ {
11079
+ key: "value",
11080
+ title: "Value",
11081
+ type: "input"
11082
+ }
11083
+ ],
11084
+ disableBatchFilling: true,
11085
+ rowAddConfig: {
11086
+ addible: true
11087
+ },
11088
+ defaultData: defaultValue,
11089
+ row: {
11090
+ deletable: true
11091
+ }
11092
+ }
11093
+ );
11094
+ }
11095
+ );
11096
+ function EditAnnotationDropdownMenuItem(props) {
11097
+ const { formRef, resourceModel } = props;
11098
+ const { t: t2 } = useTranslation();
11099
+ const pushModal = eagle.usePushModal();
11100
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11101
+ eagle.Menu.Item,
11102
+ {
11103
+ className: "ant-dropdown-menu-item",
11104
+ onClick: () => {
11105
+ const modalProps = {
11106
+ formRef,
11107
+ title: t2("dovetail.edit_annotation"),
11108
+ fullscreen: true,
11109
+ renderContent() {
11110
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11111
+ EditAnnotationForm,
11112
+ {
11113
+ ref: formRef,
11114
+ resourceModel
11115
+ }
11116
+ );
11117
+ }
11118
+ };
11119
+ pushModal({
11120
+ component: EditFieldModal,
11121
+ props: modalProps
11122
+ });
11123
+ },
11124
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16BlueIcon, children: t2("dovetail.edit_annotation") })
11125
+ }
11126
+ );
11127
+ }
10689
11128
  function K8sDropdown(props) {
10690
11129
  const { record, size = "normal" } = props;
10691
11130
  const { globalStore } = useGlobalStore();
@@ -10706,18 +11145,15 @@ var __publicField = (obj, key, value) => {
10706
11145
  resource: resource == null ? void 0 : resource.name,
10707
11146
  action: AccessControlAuth.Delete
10708
11147
  });
11148
+ const formRef = React.useRef(null);
11149
+ const editLabelMenuItem = (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(EditLabelDropdownMenuItem, { formRef, resourceModel: record }) : null;
11150
+ const editAnnotationMenuItem = (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(EditAnnotationDropdownMenuItem, { formRef, resourceModel: record }) : null;
10709
11151
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10710
11152
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10711
11153
  eagle.Dropdown,
10712
11154
  {
10713
11155
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Menu, { children: [
10714
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10715
- eagle.Menu.Item,
10716
- {
10717
- onClick: openForm,
10718
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10719
- }
10720
- ),
11156
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Menu.Item, { onClick: openForm, children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") }) }),
10721
11157
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10722
11158
  eagle.Menu.Item,
10723
11159
  {
@@ -10733,6 +11169,8 @@ var __publicField = (obj, key, value) => {
10733
11169
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10734
11170
  }
10735
11171
  ),
11172
+ editLabelMenuItem,
11173
+ editAnnotationMenuItem,
10736
11174
  props.children,
10737
11175
  (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Divider, { style: { margin: 0 } }) : null,
10738
11176
  (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -10919,7 +11357,7 @@ var __publicField = (obj, key, value) => {
10919
11357
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
10920
11358
  ] });
10921
11359
  };
10922
- const TableToolBar_4s5vf2 = "";
11360
+ const TableToolBar_nvjftd = "";
10923
11361
  const ToolbarWrapperStyle = "t1v3ienx";
10924
11362
  const ToolbarStyle$3 = "tgejfwe";
10925
11363
  const TitleStyle$2 = "tq6dc79";
@@ -10955,7 +11393,7 @@ var __publicField = (obj, key, value) => {
10955
11393
  }) : null]
10956
11394
  });
10957
11395
  };
10958
- const index_6qzjtx = "";
11396
+ const index_dyz3nd = "";
10959
11397
  const WrapperStyle$5 = "w16agr8o";
10960
11398
  function matchOwner(job, owner) {
10961
11399
  var _a;
@@ -11110,7 +11548,7 @@ var __publicField = (obj, key, value) => {
11110
11548
  }
11111
11549
  );
11112
11550
  };
11113
- const index_218swh = "";
11551
+ const index_mvy4dx = "";
11114
11552
  const ImageWrapperStyle = "i1u1f5zp";
11115
11553
  const ImageNames = ({
11116
11554
  value: value2,
@@ -11124,7 +11562,7 @@ var __publicField = (obj, key, value) => {
11124
11562
  }, `${image2}-${index2}`)) : value2.join(", ")
11125
11563
  });
11126
11564
  };
11127
- const index_1m8lip = "";
11565
+ const index_14bl0m = "";
11128
11566
  const LinkStyle$1 = "lmmrm55";
11129
11567
  function LinkFallback({
11130
11568
  fullPath
@@ -11141,7 +11579,7 @@ var __publicField = (obj, key, value) => {
11141
11579
  children: fullPath
11142
11580
  });
11143
11581
  }
11144
- const index_cbhkdt = "";
11582
+ const index_x36tts = "";
11145
11583
  const LinkStyle = "l1vnw9x0";
11146
11584
  const ResourceLink = (props) => {
11147
11585
  const {
@@ -11280,7 +11718,7 @@ var __publicField = (obj, key, value) => {
11280
11718
  }
11281
11719
  );
11282
11720
  };
11283
- const KeyValue_q4vd5r = "";
11721
+ const KeyValue_18l1y97 = "";
11284
11722
  const ContentBlockStyle = "c8jy7dc";
11285
11723
  const KeyStyle = "k2sddxl";
11286
11724
  const ValueStyle$2 = "v16vicsr";
@@ -11316,7 +11754,7 @@ var __publicField = (obj, key, value) => {
11316
11754
  function toAsterisk(str) {
11317
11755
  return Array(str.length).join("*");
11318
11756
  }
11319
- const KeyValueAnnotation_1inegjq = "";
11757
+ const KeyValueAnnotation_ug7k2g = "";
11320
11758
  const WrapperStyle$4 = "w14056kz";
11321
11759
  const HeaderStyle$1 = "hisq2gt";
11322
11760
  const HeaderItemStyle = "h11urhaw";
@@ -11360,7 +11798,7 @@ var __publicField = (obj, key, value) => {
11360
11798
  return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
11361
11799
  }) });
11362
11800
  }
11363
- const ShowContent_1u0cbxv = "";
11801
+ const ShowContent_11g4jr2 = "";
11364
11802
  const ShowContentWrapperStyle = "s9agep2";
11365
11803
  const BackButton = "bo89gfi";
11366
11804
  const ToolBarWrapper = "t1ohe42f";
@@ -11571,7 +12009,7 @@ var __publicField = (obj, key, value) => {
11571
12009
  }), tabs]
11572
12010
  });
11573
12011
  };
11574
- const KeyValueSecret_1ibo68a = "";
12012
+ const KeyValueSecret_c3ji18 = "";
11575
12013
  const ButtonStyle = "b11tbgf7";
11576
12014
  const GroupStyle = "gtbyh5g";
11577
12015
  function KeyValueSecret(props) {
@@ -11626,7 +12064,7 @@ var __publicField = (obj, key, value) => {
11626
12064
  };
11627
12065
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: map[value2] || value2 });
11628
12066
  }
11629
- const WorkloadPodsTable_1giuese = "";
12067
+ const WorkloadPodsTable_975j2t = "";
11630
12068
  const WorkloadPodsTable = ({
11631
12069
  namespace: namespace2,
11632
12070
  selector,
@@ -11695,183 +12133,7 @@ var __publicField = (obj, key, value) => {
11695
12133
  })]
11696
12134
  });
11697
12135
  };
11698
- function FormErrorAlert(props) {
11699
- const { errorMsgs, style, className, isEdit } = props;
11700
- const { i18n: i18n2 } = useTranslation();
11701
- return errorMsgs.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11702
- eagle.Alert,
11703
- {
11704
- message: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11705
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: i18n2.t(isEdit ? "dovetail.save_failed_tip" : "dovetail.create_failed_tip") }),
11706
- errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
11707
- index2 + 1 + ". ",
11708
- " ",
11709
- errorMsg
11710
- ] }, errorMsg)) }) : lodashEs.first(errorMsgs)
11711
- ] }),
11712
- type: "error",
11713
- style,
11714
- className
11715
- }
11716
- ) : null;
11717
- }
11718
- function getCommonErrors(responseBody, i18n2) {
11719
- var _a;
11720
- if (!((responseBody == null ? void 0 : responseBody.message) || (responseBody == null ? void 0 : responseBody.code) || (responseBody == null ? void 0 : responseBody.reason) || (responseBody == null ? void 0 : responseBody.details) || (responseBody == null ? void 0 : responseBody.graphQLErrors))) {
11721
- return [];
11722
- }
11723
- const causes = ((_a = responseBody.details) == null ? void 0 : _a.causes) || responseBody.graphQLErrors || [];
11724
- if (causes.length) {
11725
- return causes.map((cause) => {
11726
- let params = {};
11727
- let message2 = cause.message;
11728
- try {
11729
- const info = JSON.parse(cause.message);
11730
- params = info.params;
11731
- message2 = info.message;
11732
- } catch {
11733
- return i18n2.t(
11734
- [
11735
- `error.${cause.reason}`,
11736
- `error.${cause.code}`,
11737
- `${cause.field ? `${cause.field}: ` : ""}${message2}`
11738
- ],
11739
- {
11740
- ...params,
11741
- fallbackLng: ""
11742
- }
11743
- );
11744
- }
11745
- return i18n2.t(
11746
- [
11747
- `error.${cause.reason}`,
11748
- `error.${cause.code}`,
11749
- `${cause.field ? `${cause.field}: ` : ""}${message2}`
11750
- ],
11751
- {
11752
- ...params,
11753
- fallbackLng: ""
11754
- }
11755
- );
11756
- });
11757
- }
11758
- return [
11759
- i18n2.t(
11760
- [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
11761
- { fallbackLng: "" }
11762
- )
11763
- ];
11764
- }
11765
- function useSubmitForm(options) {
11766
- const { formRef, onSubmitSuccess } = options;
11767
- const { i18n: i18n2 } = useTranslation();
11768
- const [submitting, setSubmitting] = React.useState(false);
11769
- const [errorMsgs, setErrorMsgs] = React.useState([]);
11770
- const reset = React.useCallback(() => {
11771
- setSubmitting(false);
11772
- setErrorMsgs([]);
11773
- }, []);
11774
- const onSubmit = React.useCallback(async () => {
11775
- var _a;
11776
- try {
11777
- setSubmitting(true);
11778
- await ((_a = formRef.current) == null ? void 0 : _a.submit());
11779
- onSubmitSuccess == null ? void 0 : onSubmitSuccess();
11780
- reset();
11781
- } catch (error) {
11782
- if (error instanceof Object) {
11783
- if ("response" in error && error.response instanceof Response) {
11784
- const response = error.response;
11785
- const body = await response.json();
11786
- setErrorMsgs(getCommonErrors(body, i18n2));
11787
- } else if ("message" in error && typeof error.message === "string") {
11788
- setErrorMsgs([error.message]);
11789
- }
11790
- }
11791
- } finally {
11792
- setSubmitting(false);
11793
- }
11794
- }, [formRef, i18n2, reset, onSubmitSuccess]);
11795
- return {
11796
- submitting,
11797
- errorMsgs,
11798
- reset,
11799
- onSubmit
11800
- };
11801
- }
11802
- const index_1twfoei = "";
11803
- const EditButtonStyle = "esoz3jw";
11804
- function EditFieldModal(props) {
11805
- const {
11806
- title,
11807
- formRef: form,
11808
- renderContent
11809
- } = props;
11810
- const {
11811
- i18n: i18n2
11812
- } = useTranslation();
11813
- const popModal = eagle.usePopModal();
11814
- const {
11815
- submitting,
11816
- errorMsgs,
11817
- reset,
11818
- onSubmit
11819
- } = useSubmitForm({
11820
- formRef: form,
11821
- onSubmitSuccess: () => {
11822
- popModal();
11823
- }
11824
- });
11825
- const close = React.useCallback(() => {
11826
- popModal();
11827
- reset();
11828
- }, [reset]);
11829
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
11830
- className: ModalStyle,
11831
- title: title || i18n2.t("dovetail.edit"),
11832
- confirmLoading: submitting,
11833
- onOk: onSubmit,
11834
- onCancel: close,
11835
- okText: i18n2.t("dovetail.save"),
11836
- normal: true,
11837
- destroyOnClose: true,
11838
- children: [renderContent(), /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
11839
- style: {
11840
- marginTop: 16
11841
- },
11842
- errorMsgs,
11843
- isEdit: true
11844
- })]
11845
- });
11846
- }
11847
- function EditField(props) {
11848
- const {
11849
- modalProps
11850
- } = props;
11851
- const {
11852
- i18n: i18n2
11853
- } = useTranslation();
11854
- const {
11855
- resource
11856
- } = core.useResource();
11857
- const pushModal = eagle.usePushModal();
11858
- return /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
11859
- resource: resource == null ? void 0 : resource.name,
11860
- action: AccessControlAuth.Edit,
11861
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
11862
- className: EditButtonStyle,
11863
- type: "link",
11864
- onClick: () => {
11865
- pushModal({
11866
- component: EditFieldModal,
11867
- props: modalProps
11868
- });
11869
- },
11870
- children: i18n2.t("dovetail.edit")
11871
- })
11872
- });
11873
- }
11874
- const index_c9frt4 = "";
12136
+ const index_p1cude = "";
11875
12137
  const WorkloadReplicasWrapperStyle = "w8ychfk";
11876
12138
  const DonutChartWrapperStyle = "d1o004do";
11877
12139
  const DonutChartStyle = "dfo80qq";
@@ -17955,7 +18217,7 @@ var __publicField = (obj, key, value) => {
17955
18217
  const LogViewer = React.forwardRef((props, ref) => React.createElement(LogViewerBase, Object.assign({ innerRef: ref }, props)));
17956
18218
  LogViewer.displayName = "LogViewer";
17957
18219
  const baseNoReset = "";
17958
- const index_jv52b6 = "";
18220
+ const index_v855ki = "";
17959
18221
  const WrapperStyle$3 = "wve7dfm";
17960
18222
  const ToolbarStyle$2 = "t9oeh3c";
17961
18223
  const ToolbarAreaStyle$1 = "t1u2zqn6";
@@ -18190,7 +18452,7 @@ var __publicField = (obj, key, value) => {
18190
18452
  }
18191
18453
  ]
18192
18454
  });
18193
- const style_inzxm5 = "";
18455
+ const style_h6krld = "";
18194
18456
  const ToolBarStyle = "t1joof7s";
18195
18457
  const ToolBarHeaderStyle = "tti58uh";
18196
18458
  const ErrorIconStyle = "e15yt16p";
@@ -18248,6 +18510,7 @@ var __publicField = (obj, key, value) => {
18248
18510
  // https://github.com/microsoft/monaco-editor/issues/2007
18249
18511
  },
18250
18512
  tabSize: 2,
18513
+ lineNumbersMinChars: 7,
18251
18514
  readOnly,
18252
18515
  autoIndent: {}.VITE_IS_TEST ? "none" : "advanced"
18253
18516
  });
@@ -18363,7 +18626,7 @@ var __publicField = (obj, key, value) => {
18363
18626
  __proto__: null,
18364
18627
  default: MonacoYamlEditor$1
18365
18628
  }, Symbol.toStringTag, { value: "Module" }));
18366
- const NetworkPolicyRulesViewer_13asgaq = "";
18629
+ const NetworkPolicyRulesViewer_6z3c00 = "";
18367
18630
  const EditorStyle$1 = "e1cjl2b8";
18368
18631
  const NetworkPolicyRulesViewer = ({
18369
18632
  ingressOrEgress,
@@ -18385,7 +18648,7 @@ var __publicField = (obj, key, value) => {
18385
18648
  }
18386
18649
  return /* @__PURE__ */ jsxRuntimeExports.jsx(MonacoYamlEditor$1, {
18387
18650
  schemas: [],
18388
- defaultValue: yaml.dump(ingressOrEgress),
18651
+ defaultValue: yaml$1.dump(ingressOrEgress),
18389
18652
  height: "300px",
18390
18653
  className: EditorStyle$1,
18391
18654
  readOnly: true,
@@ -18709,7 +18972,7 @@ var __publicField = (obj, key, value) => {
18709
18972
  }, [isError, nav, resource]);
18710
18973
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
18711
18974
  };
18712
- const index_17v8shn = "";
18975
+ const index_az4wrx = "";
18713
18976
  const WrapperStyle$1 = "w1akirqw";
18714
18977
  const TitleStyle = "t30srnq";
18715
18978
  function FormLayout(props) {
@@ -31918,7 +32181,7 @@ WARNING: This link could potentially be dangerous`)) {
31918
32181
  }
31919
32182
  var copyToClipboard$1 = copy;
31920
32183
  const copyToClipboard$2 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboard$1);
31921
- const ShellToolbar_ox6trc = "";
32184
+ const ShellToolbar_ihg418 = "";
31922
32185
  const ToolbarStyle$1 = "tzxa6d";
31923
32186
  const ToolbarAreaStyle = "t1sxu3rr";
31924
32187
  const IconWrapperStyle = "ix8ych8";
@@ -32027,7 +32290,7 @@ WARNING: This link could potentially be dangerous`)) {
32027
32290
  });
32028
32291
  }
32029
32292
  const xterm = "";
32030
- const index_z4cp87 = "";
32293
+ const index_1bj2t02 = "";
32031
32294
  const ContainerStyle = "c1q5a2qi";
32032
32295
  const ShellStyle = "sdz5fm1";
32033
32296
  const LoadingStyle = "lbp0h2e";
@@ -32115,7 +32378,7 @@ WARNING: This link could potentially be dangerous`)) {
32115
32378
  });
32116
32379
  }
32117
32380
  }, [encode, send, props.fit]);
32118
- const debouncedFit = lodashEs.debounce(fit, 200);
32381
+ const debouncedFit = React.useCallback(() => lodashEs.debounce(fit, 200), [fit]);
32119
32382
  const flush = React.useCallback(() => {
32120
32383
  const backlog = backlogRef.current.slice();
32121
32384
  backlogRef.current = [];
@@ -32302,6 +32565,10 @@ WARNING: This link could potentially be dangerous`)) {
32302
32565
  });
32303
32566
  fit();
32304
32567
  }, [fit]);
32568
+ const writeln = React.useCallback((data2) => {
32569
+ var _a;
32570
+ (_a = termInstanceRef.current) == null ? void 0 : _a.writeln(data2);
32571
+ }, []);
32305
32572
  React.useEffect(() => {
32306
32573
  const destroy = setupTerminal();
32307
32574
  return () => {
@@ -32337,8 +32604,9 @@ WARNING: This link could potentially be dangerous`)) {
32337
32604
  getAllTerminalContents,
32338
32605
  setOptions,
32339
32606
  setLoading,
32340
- setError
32341
- }), [send, searchNext, searchPrevious, getAllTerminalContents, fit, clear, connect, setOptions]);
32607
+ setError,
32608
+ writeln
32609
+ }), [send, searchNext, searchPrevious, getAllTerminalContents, fit, clear, connect, setOptions, writeln]);
32342
32610
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
32343
32611
  ref: containerRef,
32344
32612
  className: ContainerStyle,
@@ -32402,8 +32670,6 @@ WARNING: This link could potentially be dangerous`)) {
32402
32670
  });
32403
32671
  });
32404
32672
  const GlobalStoreContext = React.createContext({});
32405
- const modal_7iwhwk = "";
32406
- const FullscreenModalStyle = "fq4465w";
32407
32673
  var buffer = {};
32408
32674
  var base64Js = {};
32409
32675
  base64Js.byteLength = byteLength;
@@ -34643,7 +34909,7 @@ WARNING: This link could potentially be dangerous`)) {
34643
34909
  return void 0;
34644
34910
  }
34645
34911
  }
34646
- const index_1xad2h9 = "";
34912
+ const index_1jqojte = "";
34647
34913
  const SelectStyle = "sj0ggy";
34648
34914
  const DropdownStyle = "d1eo8uqs";
34649
34915
  const SearchInputStyle = "s64gojc";
@@ -34849,7 +35115,7 @@ WARNING: This link could potentially be dangerous`)) {
34849
35115
  }), [nsFilters]);
34850
35116
  return filters;
34851
35117
  }
34852
- const index_hp158y = "";
35118
+ const index_1l2xllo = "";
34853
35119
  const ListPageStyle = "laykzsq";
34854
35120
  const ListContentStyle = "l1ng0psc";
34855
35121
  const TableStyle = "tj6zpn4";
@@ -34943,6 +35209,8 @@ WARNING: This link could potentially be dangerous`)) {
34943
35209
  }
34944
35210
  );
34945
35211
  }
35212
+ const button_1uhn9v1 = "";
35213
+ const WarningButtonStyle = "wwyz7ti";
34946
35214
  var isCheckBoxInput = (element) => element.type === "checkbox";
34947
35215
  var isDateObject = (value2) => value2 instanceof Date;
34948
35216
  var isNullOrUndefined = (value2) => value2 == null;
@@ -36303,9 +36571,9 @@ WARNING: This link could potentially be dangerous`)) {
36303
36571
  if (field && field._f) {
36304
36572
  const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
36305
36573
  if (isHTMLElement(fieldReference)) {
36306
- const form = fieldReference.closest("form");
36307
- if (form) {
36308
- form.reset();
36574
+ const form2 = fieldReference.closest("form");
36575
+ if (form2) {
36576
+ form2.reset();
36309
36577
  break;
36310
36578
  }
36311
36579
  }
@@ -36520,43 +36788,41 @@ WARNING: This link could potentially be dangerous`)) {
36520
36788
  _formControl.current.formState = getProxyFormState(formState, control);
36521
36789
  return _formControl.current;
36522
36790
  }
36523
- const RefineFormContent_1jki0fx = "";
36524
- const RefineFormContent = (props) => {
36791
+ function useFieldsConfig(config, resourceId) {
36525
36792
  var _a, _b, _c, _d;
36526
- const {
36527
- config,
36528
- formResult,
36529
- resourceId,
36530
- errorMsg
36531
- } = props;
36532
- const {
36533
- control,
36534
- getValues
36535
- } = formResult;
36536
36793
  const action = resourceId ? "edit" : "create";
36537
36794
  const listQuery = core.useList({
36538
36795
  resource: config == null ? void 0 : config.name,
36539
- meta: {
36540
- resourceBasePath: config == null ? void 0 : config.basePath,
36541
- kind: config == null ? void 0 : config.kind
36542
- },
36796
+ meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
36543
36797
  pagination: {
36544
36798
  mode: "off"
36545
36799
  }
36546
36800
  });
36547
36801
  const showQuery = core.useShow({
36548
36802
  resource: config == null ? void 0 : config.name,
36549
- meta: {
36550
- resourceBasePath: config == null ? void 0 : config.basePath,
36551
- kind: config == null ? void 0 : config.kind
36552
- },
36803
+ meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
36553
36804
  id: resourceId
36554
36805
  });
36555
- const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
36806
+ return (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
36556
36807
  record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
36557
36808
  records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
36558
36809
  action
36559
36810
  });
36811
+ }
36812
+ const RefineFormContent_7gh3uw = "";
36813
+ const RefineFormContent = (props) => {
36814
+ const {
36815
+ config,
36816
+ formResult,
36817
+ resourceId,
36818
+ errorMsg
36819
+ } = props;
36820
+ const {
36821
+ control,
36822
+ getValues
36823
+ } = formResult;
36824
+ const action = resourceId ? "edit" : "create";
36825
+ const formFieldsConfig = useFieldsConfig(config, resourceId);
36560
36826
  const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
36561
36827
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
36562
36828
  control,
@@ -36586,7 +36852,7 @@ WARNING: This link could potentially be dangerous`)) {
36586
36852
  },
36587
36853
  fieldState
36588
36854
  }) => {
36589
- var _a2;
36855
+ var _a;
36590
36856
  const formValue = getValues();
36591
36857
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
36592
36858
  placeholder: c2.placeholder,
@@ -36639,7 +36905,7 @@ WARNING: This link could potentially be dangerous`)) {
36639
36905
  labelCol: {
36640
36906
  flex: "0 0 216px"
36641
36907
  },
36642
- help: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
36908
+ help: (_a = fieldState.error) == null ? void 0 : _a.message,
36643
36909
  validateStatus: fieldState.invalid ? "error" : void 0,
36644
36910
  children: ele
36645
36911
  }, c2.key);
@@ -37334,7 +37600,7 @@ WARNING: This link could potentially be dangerous`)) {
37334
37600
  }, [config.formConfig, result]);
37335
37601
  return { formResult: result, responseErrorMsg };
37336
37602
  };
37337
- const index_12sfrn = "";
37603
+ const index_2ivb33 = "";
37338
37604
  const Style = "s1bsn3us";
37339
37605
  const Separator = () => {
37340
37606
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -37674,7 +37940,7 @@ WARNING: This link could potentially be dangerous`)) {
37674
37940
  return merged2;
37675
37941
  }
37676
37942
  const merged = merge(defaultValue, typeObject);
37677
- const content = yaml.dump(merged);
37943
+ const content = yaml$1.dump(merged);
37678
37944
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
37679
37945
  }
37680
37946
  const useGlobalStore = () => {
@@ -37708,8 +37974,10 @@ WARNING: This link could potentially be dangerous`)) {
37708
37974
  overtimeOptions,
37709
37975
  editorOptions,
37710
37976
  initialValuesForCreate,
37977
+ initialValuesForEdit,
37711
37978
  transformInitValues,
37712
- transformApplyValues
37979
+ transformApplyValues,
37980
+ rules
37713
37981
  } = {}) => {
37714
37982
  var _a;
37715
37983
  const editor = React.useRef(null);
@@ -37718,6 +37986,7 @@ WARNING: This link could potentially be dangerous`)) {
37718
37986
  const [isYamlValid, setIsYamlValid] = React.useState(true);
37719
37987
  const [isSchemaValid, setIsSchemaValid] = React.useState(true);
37720
37988
  const [editorErrors, setEditorErrors] = React.useState([]);
37989
+ const [rulesErrors, setRulesErrors] = React.useState([]);
37721
37990
  const [errorResponseBody, setErrorResponseBody] = React.useState(null);
37722
37991
  const useResourceResult = core.useResource();
37723
37992
  const { globalStore } = useGlobalStore();
@@ -37733,11 +38002,20 @@ WARNING: This link could potentially be dangerous`)) {
37733
38002
  const formSF = sunflowerAntd.useForm({
37734
38003
  form: formAnt
37735
38004
  });
37736
- const { form } = formSF;
38005
+ const { form: form2 } = formSF;
37737
38006
  const { fold: fold2 } = useK8sYamlEditor();
37738
38007
  const useFormCoreResult = core.useForm({
37739
38008
  onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
37740
- onMutationError,
38009
+ onMutationError: (error, ...restParams) => {
38010
+ var _a2;
38011
+ const response = error.response;
38012
+ if (response && !(response == null ? void 0 : response.bodyUsed)) {
38013
+ (_a2 = response.json) == null ? void 0 : _a2.call(response).then((body) => {
38014
+ setErrorResponseBody(body);
38015
+ });
38016
+ }
38017
+ onMutationError == null ? void 0 : onMutationError(error, ...restParams);
38018
+ },
37741
38019
  redirect,
37742
38020
  action: actionFromProps,
37743
38021
  resource,
@@ -37763,30 +38041,24 @@ WARNING: This link could potentially be dangerous`)) {
37763
38041
  const { formLoading, onFinish, queryResult } = useFormCoreResult;
37764
38042
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
37765
38043
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
38044
+ const action = React.useMemo(
38045
+ () => actionFromProps || useResourceResult.action,
38046
+ [actionFromProps, useResourceResult.action]
38047
+ );
37766
38048
  const initialValues = React.useMemo(() => {
37767
38049
  var _a2;
37768
- const initialValues2 = (((_a2 = queryResult == null ? void 0 : queryResult.data) == null ? void 0 : _a2.data) ? globalStore == null ? void 0 : globalStore.restoreItem(queryResult.data.data) : initialValuesForCreate) || {};
38050
+ 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) || {};
37769
38051
  if (initialValues2) {
37770
38052
  pruneBeforeEdit(initialValues2);
37771
38053
  }
37772
38054
  return (transformInitValues == null ? void 0 : transformInitValues(initialValues2)) || initialValues2;
37773
38055
  }, [queryResult, globalStore, initialValuesForCreate, transformInitValues]);
37774
- const action = React.useMemo(
37775
- () => actionFromProps || useResourceResult.action,
37776
- [actionFromProps, useResourceResult.action]
37777
- );
37778
- React.useEffect(() => {
37779
- var _a2, _b;
37780
- const response = (_a2 = useFormCoreResult.mutationResult.error) == null ? void 0 : _a2.response;
37781
- if (response && !(response == null ? void 0 : response.bodyUsed)) {
37782
- (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
37783
- setErrorResponseBody(body);
37784
- });
37785
- }
37786
- }, [useFormCoreResult.mutationResult]);
38056
+ const finalErrors = React.useMemo(() => {
38057
+ return lodashEs.uniq([...editorErrors, ...rulesErrors]);
38058
+ }, [editorErrors, rulesErrors]);
37787
38059
  const onKeyUp = (event2) => {
37788
38060
  if (submitOnEnter && event2.key === "Enter") {
37789
- form.submit();
38061
+ form2.submit();
37790
38062
  }
37791
38063
  };
37792
38064
  const onValuesChange = (changeValues) => {
@@ -37795,14 +38067,33 @@ WARNING: This link could potentially be dangerous`)) {
37795
38067
  }
37796
38068
  return changeValues;
37797
38069
  };
38070
+ const validateYaml = (yamlValue) => {
38071
+ const errorMap = {};
38072
+ if (rules && isYamlValid && isSchemaValid) {
38073
+ const formValue = yaml$1.load(yamlValue || "");
38074
+ rules.forEach((rule2) => {
38075
+ const { path: path2, validators } = rule2;
38076
+ const value2 = lodashEs.get(formValue, path2);
38077
+ for (const validator of validators || []) {
38078
+ const { isValid, errorMsg } = validator(value2, formValue);
38079
+ if (!isValid) {
38080
+ errorMap[path2.join(".")] = `${errorMsg}(${path2.join(".")})`;
38081
+ break;
38082
+ }
38083
+ }
38084
+ });
38085
+ }
38086
+ setRulesErrors(lodashEs.uniq(Object.values(errorMap)));
38087
+ return errorMap;
38088
+ };
37798
38089
  const saveButtonProps = React.useMemo(
37799
38090
  () => ({
37800
38091
  loading: formLoading,
37801
38092
  onClick: () => {
37802
- form.submit();
38093
+ form2.submit();
37803
38094
  }
37804
38095
  }),
37805
- [formLoading, form]
38096
+ [formLoading, form2]
37806
38097
  );
37807
38098
  const schemas = React.useMemo(() => {
37808
38099
  return schema ? [schema] : [];
@@ -37811,10 +38102,10 @@ WARNING: This link could potentially be dangerous`)) {
37811
38102
  var _a2;
37812
38103
  return {
37813
38104
  ref: editor,
37814
- defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml.dump(initialValues),
38105
+ defaultValue: schema && (editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations) ? generateYamlBySchema(initialValues || {}, schema) : yaml$1.dump(initialValues),
37815
38106
  schemas,
37816
38107
  id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
37817
- errorMsgs: editorErrors,
38108
+ errorMsgs: finalErrors,
37818
38109
  onValidate(yamlValid, schemaValid) {
37819
38110
  setIsYamlValid(yamlValid);
37820
38111
  setIsSchemaValid(schemaValid);
@@ -37824,7 +38115,7 @@ WARNING: This link could potentially be dangerous`)) {
37824
38115
  },
37825
38116
  onEditorCreate(editorInstance) {
37826
38117
  var _a3, _b;
37827
- const editorValue = yaml.dump(initialValues);
38118
+ const editorValue = yaml$1.dump(initialValues);
37828
38119
  (_a3 = editor.current) == null ? void 0 : _a3.setEditorValue(editorValue);
37829
38120
  (_b = editor.current) == null ? void 0 : _b.setValue(editorValue);
37830
38121
  if (action === "edit") {
@@ -37832,13 +38123,13 @@ WARNING: This link could potentially be dangerous`)) {
37832
38123
  }
37833
38124
  }
37834
38125
  };
37835
- }, [schema, editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations, initialValues, schemas, (_a = useResourceResult.resource) == null ? void 0 : _a.name, editorErrors, action, fold2]);
38126
+ }, [schema, editorOptions == null ? void 0 : editorOptions.isGenerateAnnotations, initialValues, schemas, (_a = useResourceResult.resource) == null ? void 0 : _a.name, editorErrors, action, finalErrors, fold2]);
37836
38127
  return {
37837
38128
  form: formSF.form,
37838
38129
  formProps: {
37839
38130
  ...formSF.formProps,
37840
38131
  onFinish: (values) => {
37841
- var _a2;
38132
+ var _a2, _b;
37842
38133
  const errors = [
37843
38134
  !isYamlValid ? t2("dovetail.yaml_format_wrong") : "",
37844
38135
  !isSchemaValid ? t2("dovetail.yaml_value_wrong") : ""
@@ -37847,8 +38138,13 @@ WARNING: This link could potentially be dangerous`)) {
37847
38138
  setEditorErrors(errors);
37848
38139
  return;
37849
38140
  }
38141
+ const rulesErrors2 = validateYaml(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "");
38142
+ if (Object.keys(rulesErrors2).length) {
38143
+ setRulesErrors(Object.values(rulesErrors2));
38144
+ return;
38145
+ }
37850
38146
  try {
37851
- const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
38147
+ const objectValues = editor.current ? yaml$1.load(((_b = editor.current) == null ? void 0 : _b.getEditorValue()) || "") : values;
37852
38148
  const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
37853
38149
  return onFinish(finalValues);
37854
38150
  } catch (error) {
@@ -37878,19 +38174,19 @@ WARNING: This link could potentially be dangerous`)) {
37878
38174
  switchEditor() {
37879
38175
  var _a2, _b;
37880
38176
  if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
37881
- const value2 = yaml.load((_b = editor.current) == null ? void 0 : _b.getEditorValue());
37882
- form == null ? void 0 : form.setFieldsValue(value2);
38177
+ const value2 = yaml$1.load((_b = editor.current) == null ? void 0 : _b.getEditorValue());
38178
+ form2 == null ? void 0 : form2.setFieldsValue(value2);
37883
38179
  }
37884
38180
  setEnableEditor(!enableEditor);
37885
38181
  },
37886
38182
  onFinish: async (values) => {
37887
38183
  var _a2;
37888
- const finalValues = enableEditor ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
38184
+ const finalValues = enableEditor ? yaml$1.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values ?? formSF.form.getFieldsValue(true);
37889
38185
  return await onFinish(finalValues);
37890
38186
  }
37891
38187
  };
37892
38188
  };
37893
- const YamlForm_1u3sf7g = "";
38189
+ const YamlForm_1lo4xcc = "";
37894
38190
  const FormStyle = "f1aiwt90";
37895
38191
  const EditorStyle = "e1guqlj2";
37896
38192
  var SchemaStrategy = /* @__PURE__ */ ((SchemaStrategy2) => {
@@ -37909,7 +38205,8 @@ WARNING: This link could potentially be dangerous`)) {
37909
38205
  transformInitValues,
37910
38206
  transformApplyValues,
37911
38207
  onSaveButtonPropsChange,
37912
- onErrorsChange
38208
+ onErrorsChange,
38209
+ rules
37913
38210
  } = props;
37914
38211
  const {
37915
38212
  action: actionFromResource,
@@ -37933,7 +38230,9 @@ WARNING: This link could potentially be dangerous`)) {
37933
38230
  /* None */
37934
38231
  },
37935
38232
  liveMode: "off",
37936
- initialValuesForCreate: props.initialValues ?? BASE_INIT_VALUE,
38233
+ initialValuesForCreate: props.initialValuesForCreate ?? BASE_INIT_VALUE,
38234
+ initialValuesForEdit: props.initialValuesForEdit,
38235
+ rules,
37937
38236
  successNotification(data2) {
37938
38237
  var _a;
37939
38238
  return {
@@ -38028,12 +38327,39 @@ WARNING: This link could potentially be dangerous`)) {
38028
38327
  })
38029
38328
  });
38030
38329
  }
38031
- const FormModal_bppzr9 = "";
38330
+ const FormModal_64brhp = "";
38032
38331
  const FormDescStyle = "f1nltbcu";
38033
- const MaxWidthModalStyle = "m1qgcca6";
38034
- const ErrorStyle = "e1tl3wq2";
38332
+ const ErrorStyle = "e1qgcca6";
38333
+ const TitleWrapperStyle = "t1tl3wq2";
38334
+ function ConfirmModal({
38335
+ onOk
38336
+ }) {
38337
+ const {
38338
+ t: t2
38339
+ } = useTranslation();
38340
+ const popModal = eagle.usePopModal();
38341
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, {
38342
+ className: SmallModalStyle,
38343
+ width: "414px",
38344
+ title: t2("dovetail.edit_form"),
38345
+ okButtonProps: {
38346
+ type: "primary",
38347
+ className: WarningButtonStyle
38348
+ },
38349
+ onOk: () => {
38350
+ onOk == null ? void 0 : onOk();
38351
+ popModal();
38352
+ },
38353
+ onCancel: popModal,
38354
+ destroyOnClose: true,
38355
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
38356
+ className: eagle.Typo.Label.l2_regular,
38357
+ children: t2("dovetail.exit_yaml_tip")
38358
+ })
38359
+ });
38360
+ }
38035
38361
  function FormModal(props) {
38036
- var _a, _b, _c, _d, _e;
38362
+ var _a, _b, _c, _d, _e, _f;
38037
38363
  const {
38038
38364
  resource: resourceFromProps,
38039
38365
  id,
@@ -38048,47 +38374,60 @@ WARNING: This link could potentially be dangerous`)) {
38048
38374
  const configs = React.useContext(ConfigsContext);
38049
38375
  const [yamlSaveButtonProps, setYamlSaveButtonProps] = React.useState({});
38050
38376
  const [isError, setIsError] = React.useState(false);
38377
+ const [mode, setMode] = React.useState(
38378
+ "form"
38379
+ /* Form */
38380
+ );
38381
+ const isYamlMode = mode === "yaml";
38051
38382
  const popModal = eagle.usePopModal();
38383
+ const pushModal = eagle.usePushModal();
38052
38384
  const config = configs[resourceFromProps || (resource == null ? void 0 : resource.name) || ""];
38385
+ const isDisabledChangeMode = (_a = config.formConfig) == null ? void 0 : _a.isDisabledChangeMode;
38053
38386
  const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
38054
38387
  const action = id ? "edit" : "create";
38388
+ const fieldsConfig = useFieldsConfig(config, id);
38389
+ const refineFormResult = useRefineForm({
38390
+ config,
38391
+ id,
38392
+ refineProps: {
38393
+ onMutationSuccess: () => {
38394
+ popModal();
38395
+ },
38396
+ redirect: false,
38397
+ ...(_b = config.formConfig) == null ? void 0 : _b.refineCoreProps
38398
+ }
38399
+ });
38055
38400
  const yamlFormProps = React.useMemo(() => {
38056
38401
  var _a2, _b2, _c2;
38057
38402
  return {
38058
38403
  ...props.formProps,
38059
38404
  transformInitValues: (_a2 = config.formConfig) == null ? void 0 : _a2.transformInitValues,
38060
38405
  transformApplyValues: (_b2 = config.formConfig) == null ? void 0 : _b2.transformApplyValues,
38061
- initialValues: ((_c2 = props.formProps) == null ? void 0 : _c2.initialValues) || (config == null ? void 0 : config.initValue),
38406
+ initialValuesForCreate: isYamlMode ? refineFormResult.formResult.getValues() : ((_c2 = props.formProps) == null ? void 0 : _c2.initialValuesForCreate) || (config == null ? void 0 : config.initValue),
38407
+ initialValuesForEdit: isYamlMode ? refineFormResult.formResult.getValues() : void 0,
38062
38408
  id,
38063
38409
  action,
38064
38410
  isShowLayout: false,
38065
38411
  useFormProps: {
38066
38412
  redirect: false
38067
38413
  },
38414
+ rules: isYamlMode ? fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
38415
+ path: config2.path,
38416
+ validators: config2.validators
38417
+ })) : void 0,
38068
38418
  onSaveButtonPropsChange: setYamlSaveButtonProps,
38069
38419
  onErrorsChange(errors) {
38070
38420
  setIsError(!!errors.length);
38071
38421
  },
38072
38422
  onFinish: popModal
38073
38423
  };
38074
- }, [props.formProps, (_a = config.formConfig) == null ? void 0 : _a.transformInitValues, (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues, config == null ? void 0 : config.initValue, id, action, popModal]);
38075
- const refineFormResult = useRefineForm({
38076
- config,
38077
- id,
38078
- refineProps: {
38079
- onMutationSuccess: () => {
38080
- popModal();
38081
- },
38082
- redirect: false,
38083
- ...(_c = config.formConfig) == null ? void 0 : _c.refineCoreProps
38084
- }
38085
- });
38086
- const isYamlForm = !((_d = config.formConfig) == null ? void 0 : _d.fields);
38424
+ }, [props.formProps, (_c = config.formConfig) == null ? void 0 : _c.transformInitValues, (_d = config.formConfig) == null ? void 0 : _d.transformApplyValues, config == null ? void 0 : config.initValue, id, action, refineFormResult.formResult, isYamlMode, fieldsConfig, popModal]);
38425
+ const isYamlForm = !((_e = config.formConfig) == null ? void 0 : _e.fields);
38087
38426
  const formEle = (() => {
38088
38427
  if (renderForm) {
38089
38428
  return renderForm(yamlFormProps);
38090
38429
  }
38091
- if (isYamlForm)
38430
+ if (isYamlForm || isYamlMode)
38092
38431
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, {
38093
38432
  ...yamlFormProps
38094
38433
  });
@@ -38099,7 +38438,7 @@ WARNING: This link could potentially be dangerous`)) {
38099
38438
  resourceId: id
38100
38439
  });
38101
38440
  })();
38102
- const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
38441
+ const saveButtonProps = isYamlForm || isYamlMode ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
38103
38442
  const onCancel = React.useCallback(() => {
38104
38443
  popModal();
38105
38444
  }, [popModal]);
@@ -38108,6 +38447,23 @@ WARNING: This link could potentially be dangerous`)) {
38108
38447
  setIsError(false);
38109
38448
  (_a2 = saveButtonProps.onClick) == null ? void 0 : _a2.call(saveButtonProps, e2);
38110
38449
  }, [saveButtonProps]);
38450
+ const onChangeMode = React.useCallback((value2) => {
38451
+ if (value2 === "form") {
38452
+ pushModal({
38453
+ component: ConfirmModal,
38454
+ props: {
38455
+ onOk: () => {
38456
+ setMode(
38457
+ "form"
38458
+ /* Form */
38459
+ );
38460
+ }
38461
+ }
38462
+ });
38463
+ } else {
38464
+ setMode(value2);
38465
+ }
38466
+ }, [pushModal]);
38111
38467
  const errorText = (() => {
38112
38468
  if (!!refineFormResult.responseErrorMsg || isError) {
38113
38469
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
@@ -38134,16 +38490,36 @@ WARNING: This link could potentially be dangerous`)) {
38134
38490
  return "";
38135
38491
  }, [action, config.formConfig]);
38136
38492
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
38137
- className: cx_default(FullscreenModalStyle, isYamlForm ? "" : MaxWidthModalStyle),
38493
+ className: cx_default(FullscreenModalStyle),
38494
+ style: {
38495
+ "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
38496
+ },
38138
38497
  width: "calc(100vw - 16px)",
38139
- title,
38498
+ title: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
38499
+ className: TitleWrapperStyle,
38500
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
38501
+ children: title
38502
+ }), !(isYamlForm || isDisabledChangeMode) ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.SegmentControl, {
38503
+ value: mode,
38504
+ options: [{
38505
+ value: "form",
38506
+ label: i18n2.t("dovetail.form")
38507
+ }, {
38508
+ value: "yaml",
38509
+ label: i18n2.t("dovetail.yaml")
38510
+ }],
38511
+ onChange: (val) => {
38512
+ onChangeMode(val);
38513
+ }
38514
+ }) : null]
38515
+ }),
38140
38516
  error: errorText ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
38141
38517
  className: ErrorStyle,
38142
38518
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.ExclamationErrorCircleFill16RedIcon, {}), " ", errorText]
38143
38519
  }) : "",
38144
38520
  okButtonProps: {
38145
38521
  ...saveButtonProps,
38146
- children: (_e = config.formConfig) == null ? void 0 : _e.saveButtonText,
38522
+ children: (_f = config.formConfig) == null ? void 0 : _f.saveButtonText,
38147
38523
  onClick: onOk
38148
38524
  },
38149
38525
  closeIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseCircleFilled$1, {}),
@@ -38157,7 +38533,7 @@ WARNING: This link could potentially be dangerous`)) {
38157
38533
  }) : void 0, formEle]
38158
38534
  });
38159
38535
  }
38160
- const RefineFormPage_aqoiay = "";
38536
+ const RefineFormPage_1v0fhor = "";
38161
38537
  const RefineFormPage = (props) => {
38162
38538
  const {
38163
38539
  config
@@ -38283,7 +38659,7 @@ WARNING: This link could potentially be dangerous`)) {
38283
38659
  }
38284
38660
  ) : null });
38285
38661
  }
38286
- const index_1wzdp7m = "";
38662
+ const index_sazpyf = "";
38287
38663
  const WrapperStyle = "wfg6u6g";
38288
38664
  const InnerBar = ({
38289
38665
  usage: usage2,
@@ -38358,7 +38734,7 @@ WARNING: This link could potentially be dangerous`)) {
38358
38734
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
38359
38735
  ] });
38360
38736
  };
38361
- const index_1wt5px2 = "";
38737
+ const index_1tehui8 = "";
38362
38738
  const MenuStyle = "mdppgn0";
38363
38739
  const Menu = () => {
38364
38740
  const {
@@ -38383,7 +38759,7 @@ WARNING: This link could potentially be dangerous`)) {
38383
38759
  children: renderMenuItems(menuItems)
38384
38760
  });
38385
38761
  };
38386
- const index_1qxsm42 = "";
38762
+ const index_1po979g = "";
38387
38763
  const HeaderStyle = "h16z07g";
38388
38764
  const ContentLayoutStyle = "c1i80kj";
38389
38765
  const SiderStyle = "s18sezq1";
@@ -38539,7 +38915,7 @@ WARNING: This link could potentially be dangerous`)) {
38539
38915
  });
38540
38916
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: result });
38541
38917
  };
38542
- const columns_1h38dp = "";
38918
+ const columns_irlsbh = "";
38543
38919
  const DashedTitleStyle = "dh5j833";
38544
38920
  const ServiceClusterTooltipStyle = "s1fcgan";
38545
38921
  const NameLink = (props) => {
@@ -39170,13 +39546,18 @@ WARNING: This link could potentially be dangerous`)) {
39170
39546
  const {
39171
39547
  resourcesConfig,
39172
39548
  urlPrefix = "",
39549
+ schemaUrlPrefix,
39173
39550
  Layout: Layout2,
39174
39551
  history,
39175
39552
  globalStore,
39176
39553
  accessControlProvider,
39177
- routerProvider: customRouterProvider
39554
+ routerProvider: customRouterProvider,
39555
+ antdGetPopupContainer
39178
39556
  } = props;
39179
39557
  const msg = eagle.useMessage();
39558
+ React.useEffect(() => {
39559
+ msg.config({ getContainer: antdGetPopupContainer });
39560
+ }, [msg, antdGetPopupContainer]);
39180
39561
  const notCustomResources = React.useMemo(() => {
39181
39562
  return resourcesConfig.filter((c2) => !c2.isCustom);
39182
39563
  }, [resourcesConfig]);
@@ -39208,37 +39589,48 @@ WARNING: This link could potentially be dangerous`)) {
39208
39589
  };
39209
39590
  return provider;
39210
39591
  }, [msg]);
39211
- return /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Router, { history, children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.KitStoreProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(ConfigsContext.Provider, { value: lodashEs.keyBy(resourcesConfig, "name"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(
39212
- core.Refine,
39592
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(reactRouterDom.Router, { history, children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.KitStoreProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(ConfigsContext.Provider, { value: lodashEs.keyBy(resourcesConfig, "name"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ConstantsContext.Provider, { value: { schemaUrlPrefix }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
39593
+ eagle.ConfigProvider,
39213
39594
  {
39214
- dataProvider: {
39215
- default: k8sApiProvider.dataProvider(globalStore)
39595
+ antd5Configs: {
39596
+ getPopupContainer: antdGetPopupContainer || (() => document.body)
39216
39597
  },
39217
- routerProvider: customRouterProvider || routerProvider,
39218
- liveProvider: k8sApiProvider.liveProvider(globalStore),
39219
- notificationProvider,
39220
- options: {
39221
- warnWhenUnsavedChanges: true,
39222
- liveMode: "auto",
39223
- disableTelemetry: true
39598
+ antd4Configs: {
39599
+ getPopupContainer: antdGetPopupContainer || (() => document.body)
39224
39600
  },
39225
- accessControlProvider,
39226
- resources: resourcesConfig.map((c2) => {
39227
- return {
39228
- name: c2.name,
39229
- meta: {
39230
- resourceBasePath: c2.basePath,
39231
- kind: c2.kind,
39232
- parent: c2.parent,
39233
- label: `${c2.kind}s`
39601
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
39602
+ core.Refine,
39603
+ {
39604
+ dataProvider: {
39605
+ default: k8sApiProvider.dataProvider(globalStore)
39234
39606
  },
39235
- list: `${urlPrefix}/${c2.name}`,
39236
- show: `${urlPrefix}/${c2.name}/show`,
39237
- create: `${urlPrefix}/${c2.name}/create`,
39238
- edit: `${urlPrefix}/${c2.name}/edit`
39239
- };
39240
- }),
39241
- children: content
39607
+ routerProvider: customRouterProvider || routerProvider,
39608
+ liveProvider: k8sApiProvider.liveProvider(globalStore),
39609
+ notificationProvider,
39610
+ options: {
39611
+ warnWhenUnsavedChanges: true,
39612
+ liveMode: "auto",
39613
+ disableTelemetry: true
39614
+ },
39615
+ accessControlProvider,
39616
+ resources: resourcesConfig.map((c2) => {
39617
+ return {
39618
+ name: c2.name,
39619
+ meta: {
39620
+ resourceBasePath: c2.basePath,
39621
+ kind: c2.kind,
39622
+ parent: c2.parent,
39623
+ label: `${c2.kind}s`
39624
+ },
39625
+ list: `${urlPrefix}/${c2.name}`,
39626
+ show: `${urlPrefix}/${c2.name}/show`,
39627
+ create: `${urlPrefix}/${c2.name}/create`,
39628
+ edit: `${urlPrefix}/${c2.name}/edit`
39629
+ };
39630
+ }),
39631
+ children: content
39632
+ }
39633
+ ) })
39242
39634
  }
39243
39635
  ) }) }) }) });
39244
39636
  };
@@ -39463,7 +39855,9 @@ WARNING: This link could potentially be dangerous`)) {
39463
39855
  exports2.DrawerShow = DrawerShow;
39464
39856
  exports2.DurationColumnRenderer = DurationColumnRenderer;
39465
39857
  exports2.DurationField = DurationField;
39858
+ exports2.EditAnnotationDropdownMenuItem = EditAnnotationDropdownMenuItem;
39466
39859
  exports2.EditButton = EditButton;
39860
+ exports2.EditLabelDropdownMenuItem = EditLabelDropdownMenuItem;
39467
39861
  exports2.EventModel = EventModel;
39468
39862
  exports2.EventsTab = EventsTab;
39469
39863
  exports2.EventsTableTabField = EventsTableTabField;
@@ -39495,7 +39889,6 @@ WARNING: This link could potentially be dangerous`)) {
39495
39889
  exports2.ListPage = ListPage;
39496
39890
  exports2.Menu = Menu;
39497
39891
  exports2.MetadataForm = MetadataForm;
39498
- exports2.ModalStyle = ModalStyle;
39499
39892
  exports2.ModelPlugin = ModelPlugin;
39500
39893
  exports2.NETWORK_POLICY_INIT_VALUE = NETWORK_POLICY_INIT_VALUE;
39501
39894
  exports2.NODE_INIT_VALUE = NODE_INIT_VALUE;
@@ -39552,6 +39945,7 @@ WARNING: This link could potentially be dangerous`)) {
39552
39945
  exports2.PortsTableField = PortsTableField;
39553
39946
  exports2.ProviderPlugins = ProviderPlugins;
39554
39947
  exports2.ProvisionerColumnRenderer = ProvisionerColumnRenderer;
39948
+ exports2.REDEPLOY_TIMESTAMP_KEY = REDEPLOY_TIMESTAMP_KEY;
39555
39949
  exports2.RESOURCE_GROUP = RESOURCE_GROUP;
39556
39950
  exports2.ReferenceLink = ReferenceLink;
39557
39951
  exports2.RefineFormContent = RefineFormContent;
@@ -39615,7 +40009,6 @@ WARNING: This link could potentially be dangerous`)) {
39615
40009
  exports2.StorageClassProvisionerField = StorageClassProvisionerField;
39616
40010
  exports2.StorageClassPvField = StorageClassPvField;
39617
40011
  exports2.StorageClassPvGroup = StorageClassPvGroup;
39618
- exports2.TIMESTAMP_LABEL = TIMESTAMP_LABEL;
39619
40012
  exports2.Tabs = Tabs;
39620
40013
  exports2.Tags = Tags;
39621
40014
  exports2.TextTags = TextTags;