@dovetail-v2/refine 0.1.6 → 0.1.8

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-2612b8d0.js → MonacoYamlDiffEditor-1593cfad.js} +1 -1
  2. package/dist/{index-69d5e3e9.js → index-45031697.js} +1218 -838
  3. package/dist/refine.js +189 -188
  4. package/dist/refine.umd.cjs +1027 -647
  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}/index.d.ts +1 -0
  20. package/lib/{src/constants → constants}/k8s.d.ts +1 -1
  21. package/lib/contexts/constants.d.ts +6 -0
  22. package/lib/{src/hooks → hooks}/useDeleteModal/useDeleteModal.d.ts +0 -1
  23. package/lib/{src/hooks → hooks}/useSchema.d.ts +1 -1
  24. package/lib/{src/i18n.d.ts → i18n.d.ts} +9 -0
  25. package/lib/{src/locales → locales}/en-US/index.d.ts +1 -0
  26. package/lib/{src/locales → locales}/zh-CN/index.d.ts +8 -0
  27. package/lib/{src/models → models}/resource-model.d.ts +2 -0
  28. package/lib/{src/pages → pages}/storageclasses/index.d.ts +2 -1
  29. package/lib/styles/button.d.ts +1 -0
  30. package/lib/{src/styles → styles}/modal.d.ts +1 -0
  31. package/lib/{src/types → types}/resource.d.ts +2 -1
  32. package/lib/{src/utils → utils}/openapi.d.ts +2 -1
  33. package/package.json +7 -2
  34. package/lib/vite.config.d.ts +0 -2
  35. /package/lib/{src/App.d.ts → App.d.ts} +0 -0
  36. /package/lib/{src/components → components}/Breadcrumb/index.d.ts +0 -0
  37. /package/lib/{src/components → components}/ConditionsTable/ConditionsTable.d.ts +0 -0
  38. /package/lib/{src/components → components}/ConditionsTable/index.d.ts +0 -0
  39. /package/lib/{src/components → components}/CreateButton/index.d.ts +0 -0
  40. /package/lib/{src/components → components}/CronJobDropdown/index.d.ts +0 -0
  41. /package/lib/{src/components → components}/CronjobJobsTable/index.d.ts +0 -0
  42. /package/lib/{src/components → components}/DeleteButton/index.d.ts +0 -0
  43. /package/lib/{src/components → components}/DeleteManyButton/index.d.ts +0 -0
  44. /package/lib/{src/components → components}/DrawerShow/DrawerShow.d.ts +0 -0
  45. /package/lib/{src/components → components}/DrawerShow/index.d.ts +0 -0
  46. /package/lib/{src/components → components}/DurationTime/index.d.ts +0 -0
  47. /package/lib/{src/components → components}/EditButton/index.d.ts +0 -0
  48. /package/lib/{src/components → components}/ErrorContent/index.d.ts +0 -0
  49. /package/lib/{src/components → components}/EventsTable/EventsTable.d.ts +0 -0
  50. /package/lib/{src/components → components}/EventsTable/index.d.ts +0 -0
  51. /package/lib/{src/components → components}/Form/RefineFormPage.d.ts +0 -0
  52. /package/lib/{src/components → components}/Form/index.d.ts +0 -0
  53. /package/lib/{src/components → components}/Form/type.d.ts +0 -0
  54. /package/lib/{src/components → components}/Form/useReactHookForm.d.ts +0 -0
  55. /package/lib/{src/components → components}/Form/useRefineForm.d.ts +0 -0
  56. /package/lib/{src/components → components}/FormErrorAlert/index.d.ts +0 -0
  57. /package/lib/{src/components → components}/FormLayout/index.d.ts +0 -0
  58. /package/lib/{src/components → components}/FormWidgets/KeyValueListWidget.d.ts +0 -0
  59. /package/lib/{src/components → components}/FormWidgets/MetadataForm.d.ts +0 -0
  60. /package/lib/{src/components → components}/FormWidgets/NameInputWidget.d.ts +0 -0
  61. /package/lib/{src/components → components}/FormWidgets/NamespaceSelectWidget.d.ts +0 -0
  62. /package/lib/{src/components → components}/FormWidgets/index.d.ts +0 -0
  63. /package/lib/{src/components → components}/FormWidgets/widget.d.ts +0 -0
  64. /package/lib/{src/components → components}/ImageNames/index.d.ts +0 -0
  65. /package/lib/{src/components → components}/IngressRulesComponent/index.d.ts +0 -0
  66. /package/lib/{src/components → components}/IngressRulesTable/IngressRulesTable.d.ts +0 -0
  67. /package/lib/{src/components → components}/IngressRulesTable/index.d.ts +0 -0
  68. /package/lib/{src/components → components}/K8sDropdown/index.d.ts +0 -0
  69. /package/lib/{src/components → components}/KeyValue/KeyValue.d.ts +0 -0
  70. /package/lib/{src/components → components}/KeyValue/KeyValueAnnotation.d.ts +0 -0
  71. /package/lib/{src/components → components}/KeyValue/KeyValueSecret.d.ts +0 -0
  72. /package/lib/{src/components → components}/KeyValue/index.d.ts +0 -0
  73. /package/lib/{src/components → components}/Layout/index.d.ts +0 -0
  74. /package/lib/{src/components → components}/LinkFallback/index.d.ts +0 -0
  75. /package/lib/{src/components → components}/ListPage/index.d.ts +0 -0
  76. /package/lib/{src/components → components}/Menu/index.d.ts +0 -0
  77. /package/lib/{src/components → components}/NamespacesFilter/index.d.ts +0 -0
  78. /package/lib/{src/components → components}/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +0 -0
  79. /package/lib/{src/components → components}/NetworkPolicyRulesViewer/index.d.ts +0 -0
  80. /package/lib/{src/components → components}/PageShow/PageShow.d.ts +0 -0
  81. /package/lib/{src/components → components}/PageShow/index.d.ts +0 -0
  82. /package/lib/{src/components → components}/PodContainersTable/PodContainersTable.d.ts +0 -0
  83. /package/lib/{src/components → components}/PodContainersTable/index.d.ts +0 -0
  84. /package/lib/{src/components → components}/PodDropdown/index.d.ts +0 -0
  85. /package/lib/{src/components → components}/PodLog/index.d.ts +0 -0
  86. /package/lib/{src/components → components}/PodSelectorTable/index.d.ts +0 -0
  87. /package/lib/{src/components → components}/PodShellModal/PodShell.d.ts +0 -0
  88. /package/lib/{src/components → components}/PodShellModal/index.d.ts +0 -0
  89. /package/lib/{src/components → components}/PortsTable/index.d.ts +0 -0
  90. /package/lib/{src/components → components}/ReferenceLink/index.d.ts +0 -0
  91. /package/lib/{src/components → components}/ReplicasDropdown/index.d.ts +0 -0
  92. /package/lib/{src/components → components}/ResourceCRUD/ResourceCRUD.d.ts +0 -0
  93. /package/lib/{src/components → components}/ResourceCRUD/create/index.d.ts +0 -0
  94. /package/lib/{src/components → components}/ResourceCRUD/index.d.ts +0 -0
  95. /package/lib/{src/components → components}/ResourceCRUD/list/index.d.ts +0 -0
  96. /package/lib/{src/components → components}/ResourceCRUD/show/index.d.ts +0 -0
  97. /package/lib/{src/components → components}/ResourceFiledDisplays.d.ts +0 -0
  98. /package/lib/{src/components → components}/ResourceLink/index.d.ts +0 -0
  99. /package/lib/{src/components → components}/ResourceSelect/index.d.ts +0 -0
  100. /package/lib/{src/components → components}/ResourceUsageBar/index.d.ts +0 -0
  101. /package/lib/{src/components → components}/Separator/index.d.ts +0 -0
  102. /package/lib/{src/components → components}/ServiceComponents/index.d.ts +0 -0
  103. /package/lib/{src/components → components}/Shell/ShellToolbar.d.ts +0 -0
  104. /package/lib/{src/components → components}/Shell/index.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) => {
@@ -31,308 +31,301 @@ var __publicField = (obj, key, value) => {
31
31
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
32
32
  }
33
33
  var dayjs_min = { exports: {} };
34
- var hasRequiredDayjs_min;
35
- function requireDayjs_min() {
36
- if (hasRequiredDayjs_min)
37
- return dayjs_min.exports;
38
- hasRequiredDayjs_min = 1;
39
- (function(module2, exports3) {
40
- !function(t2, e2) {
41
- module2.exports = e2();
42
- }(commonjsGlobal, function() {
43
- var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u = "hour", a2 = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
44
- var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
45
- return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
46
- } }, m = function(t3, e3, n3) {
47
- var r3 = String(t3);
48
- return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
49
- }, v = { s: m, z: function(t3) {
50
- var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
51
- return (e3 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i3, 2, "0");
52
- }, m: function t3(e3, n3) {
53
- if (e3.date() < n3.date())
54
- return -t3(n3, e3);
55
- var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u2 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
56
- return +(-(r3 + (n3 - i3) / (s3 ? i3 - u2 : u2 - i3)) || 0);
57
- }, a: function(t3) {
58
- return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
59
- }, p: function(t3) {
60
- return { M: c2, y: h, w: o, d: a2, D: d, h: u, m: s2, s: i2, ms: r2, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
61
- }, u: function(t3) {
62
- return void 0 === t3;
63
- } }, g = "en", D = {};
64
- D[g] = M;
65
- var p = "$isDayjsObject", S = function(t3) {
66
- return t3 instanceof _ || !(!t3 || !t3[p]);
67
- }, w = function t3(e3, n3, r3) {
68
- var i3;
69
- if (!e3)
70
- return g;
71
- if ("string" == typeof e3) {
72
- var s3 = e3.toLowerCase();
73
- D[s3] && (i3 = s3), n3 && (D[s3] = n3, i3 = s3);
74
- var u2 = e3.split("-");
75
- if (!i3 && u2.length > 1)
76
- return t3(u2[0]);
77
- } else {
78
- var a3 = e3.name;
79
- D[a3] = e3, i3 = a3;
80
- }
81
- return !r3 && i3 && (g = i3), i3 || !r3 && g;
82
- }, O = function(t3, e3) {
83
- if (S(t3))
84
- return t3.clone();
85
- var n3 = "object" == typeof e3 ? e3 : {};
86
- return n3.date = t3, n3.args = arguments, new _(n3);
87
- }, b = v;
88
- b.l = w, b.i = S, b.w = function(t3, e3) {
89
- return O(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
90
- };
91
- var _ = function() {
92
- function M2(t3) {
93
- this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
94
- }
95
- var m2 = M2.prototype;
96
- return m2.parse = function(t3) {
97
- this.$d = function(t4) {
98
- var e3 = t4.date, n3 = t4.utc;
99
- if (null === e3)
100
- return /* @__PURE__ */ new Date(NaN);
101
- if (b.u(e3))
102
- return /* @__PURE__ */ new Date();
103
- if (e3 instanceof Date)
104
- return new Date(e3);
105
- if ("string" == typeof e3 && !/Z$/i.test(e3)) {
106
- var r3 = e3.match($);
107
- if (r3) {
108
- var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
109
- return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
110
- }
111
- }
34
+ (function(module2, exports3) {
35
+ !function(t2, e2) {
36
+ module2.exports = e2();
37
+ }(commonjsGlobal, function() {
38
+ var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u = "hour", a2 = "day", o = "week", c2 = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) {
39
+ var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100;
40
+ return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]";
41
+ } }, m = function(t3, e3, n3) {
42
+ var r3 = String(t3);
43
+ return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3;
44
+ }, v = { s: m, z: function(t3) {
45
+ var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60;
46
+ return (e3 <= 0 ? "+" : "-") + m(r3, 2, "0") + ":" + m(i3, 2, "0");
47
+ }, m: function t3(e3, n3) {
48
+ if (e3.date() < n3.date())
49
+ return -t3(n3, e3);
50
+ var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u2 = e3.clone().add(r3 + (s3 ? -1 : 1), c2);
51
+ return +(-(r3 + (n3 - i3) / (s3 ? i3 - u2 : u2 - i3)) || 0);
52
+ }, a: function(t3) {
53
+ return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3);
54
+ }, p: function(t3) {
55
+ return { M: c2, y: h, w: o, d: a2, D: d, h: u, m: s2, s: i2, ms: r2, Q: f }[t3] || String(t3 || "").toLowerCase().replace(/s$/, "");
56
+ }, u: function(t3) {
57
+ return void 0 === t3;
58
+ } }, g = "en", D = {};
59
+ D[g] = M;
60
+ var p = "$isDayjsObject", S = function(t3) {
61
+ return t3 instanceof _ || !(!t3 || !t3[p]);
62
+ }, w = function t3(e3, n3, r3) {
63
+ var i3;
64
+ if (!e3)
65
+ return g;
66
+ if ("string" == typeof e3) {
67
+ var s3 = e3.toLowerCase();
68
+ D[s3] && (i3 = s3), n3 && (D[s3] = n3, i3 = s3);
69
+ var u2 = e3.split("-");
70
+ if (!i3 && u2.length > 1)
71
+ return t3(u2[0]);
72
+ } else {
73
+ var a3 = e3.name;
74
+ D[a3] = e3, i3 = a3;
75
+ }
76
+ return !r3 && i3 && (g = i3), i3 || !r3 && g;
77
+ }, O = function(t3, e3) {
78
+ if (S(t3))
79
+ return t3.clone();
80
+ var n3 = "object" == typeof e3 ? e3 : {};
81
+ return n3.date = t3, n3.args = arguments, new _(n3);
82
+ }, b = v;
83
+ b.l = w, b.i = S, b.w = function(t3, e3) {
84
+ return O(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset });
85
+ };
86
+ var _ = function() {
87
+ function M2(t3) {
88
+ this.$L = w(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p] = true;
89
+ }
90
+ var m2 = M2.prototype;
91
+ return m2.parse = function(t3) {
92
+ this.$d = function(t4) {
93
+ var e3 = t4.date, n3 = t4.utc;
94
+ if (null === e3)
95
+ return /* @__PURE__ */ new Date(NaN);
96
+ if (b.u(e3))
97
+ return /* @__PURE__ */ new Date();
98
+ if (e3 instanceof Date)
112
99
  return new Date(e3);
113
- }(t3), this.init();
114
- }, m2.init = function() {
115
- var t3 = this.$d;
116
- this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
117
- }, m2.$utils = function() {
118
- return b;
119
- }, m2.isValid = function() {
120
- return !(this.$d.toString() === l);
121
- }, m2.isSame = function(t3, e3) {
122
- var n3 = O(t3);
123
- return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
124
- }, m2.isAfter = function(t3, e3) {
125
- return O(t3) < this.startOf(e3);
126
- }, m2.isBefore = function(t3, e3) {
127
- return this.endOf(e3) < O(t3);
128
- }, m2.$g = function(t3, e3, n3) {
129
- return b.u(t3) ? this[e3] : this.set(n3, t3);
130
- }, m2.unix = function() {
131
- return Math.floor(this.valueOf() / 1e3);
132
- }, m2.valueOf = function() {
133
- return this.$d.getTime();
134
- }, m2.startOf = function(t3, e3) {
135
- var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
136
- var i3 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
137
- return r3 ? i3 : i3.endOf(a2);
138
- }, $2 = function(t4, e4) {
139
- return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
140
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
141
- switch (f2) {
142
- case h:
143
- return r3 ? l2(1, 0) : l2(31, 11);
144
- case c2:
145
- return r3 ? l2(1, M3) : l2(0, M3 + 1);
146
- case o:
147
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
148
- return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
149
- case a2:
150
- case d:
151
- return $2(v2 + "Hours", 0);
152
- case u:
153
- return $2(v2 + "Minutes", 1);
154
- case s2:
155
- return $2(v2 + "Seconds", 2);
156
- case i2:
157
- return $2(v2 + "Milliseconds", 3);
158
- default:
159
- return this.clone();
160
- }
161
- }, m2.endOf = function(t3) {
162
- return this.startOf(t3, false);
163
- }, m2.$set = function(t3, e3) {
164
- var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i2] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
165
- if (o2 === c2 || o2 === h) {
166
- var y2 = this.clone().set(d, 1);
167
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
168
- } else
169
- l2 && this.$d[l2]($2);
170
- return this.init(), this;
171
- }, m2.set = function(t3, e3) {
172
- return this.clone().$set(t3, e3);
173
- }, m2.get = function(t3) {
174
- return this[b.p(t3)]();
175
- }, m2.add = function(r3, f2) {
176
- var d2, l2 = this;
177
- r3 = Number(r3);
178
- var $2 = b.p(f2), y2 = function(t3) {
179
- var e3 = O(l2);
180
- return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
181
- };
182
- if ($2 === c2)
183
- return this.set(c2, this.$M + r3);
184
- if ($2 === h)
185
- return this.set(h, this.$y + r3);
186
- if ($2 === a2)
187
- return y2(1);
188
- if ($2 === o)
189
- return y2(7);
190
- var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i2] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
191
- return b.w(m3, this);
192
- }, m2.subtract = function(t3, e3) {
193
- return this.add(-1 * t3, e3);
194
- }, m2.format = function(t3) {
195
- var e3 = this, n3 = this.$locale();
196
- if (!this.isValid())
197
- return n3.invalidDate || l;
198
- var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i4, s4) {
199
- return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
200
- }, d2 = function(t4) {
201
- return b.s(s3 % 12 || 12, t4, "0");
202
- }, $2 = f2 || function(t4, e4, n4) {
203
- var r4 = t4 < 12 ? "AM" : "PM";
204
- return n4 ? r4.toLowerCase() : r4;
205
- };
206
- return r3.replace(y, function(t4, r4) {
207
- return r4 || function(t5) {
208
- switch (t5) {
209
- case "YY":
210
- return String(e3.$y).slice(-2);
211
- case "YYYY":
212
- return b.s(e3.$y, 4, "0");
213
- case "M":
214
- return a3 + 1;
215
- case "MM":
216
- return b.s(a3 + 1, 2, "0");
217
- case "MMM":
218
- return h2(n3.monthsShort, a3, c3, 3);
219
- case "MMMM":
220
- return h2(c3, a3);
221
- case "D":
222
- return e3.$D;
223
- case "DD":
224
- return b.s(e3.$D, 2, "0");
225
- case "d":
226
- return String(e3.$W);
227
- case "dd":
228
- return h2(n3.weekdaysMin, e3.$W, o2, 2);
229
- case "ddd":
230
- return h2(n3.weekdaysShort, e3.$W, o2, 3);
231
- case "dddd":
232
- return o2[e3.$W];
233
- case "H":
234
- return String(s3);
235
- case "HH":
236
- return b.s(s3, 2, "0");
237
- case "h":
238
- return d2(1);
239
- case "hh":
240
- return d2(2);
241
- case "a":
242
- return $2(s3, u2, true);
243
- case "A":
244
- return $2(s3, u2, false);
245
- case "m":
246
- return String(u2);
247
- case "mm":
248
- return b.s(u2, 2, "0");
249
- case "s":
250
- return String(e3.$s);
251
- case "ss":
252
- return b.s(e3.$s, 2, "0");
253
- case "SSS":
254
- return b.s(e3.$ms, 3, "0");
255
- case "Z":
256
- return i3;
257
- }
258
- return null;
259
- }(t4) || i3.replace(":", "");
260
- });
261
- }, m2.utcOffset = function() {
262
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
263
- }, m2.diff = function(r3, d2, l2) {
264
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
265
- return b.m(y2, m3);
266
- };
267
- switch (M3) {
268
- case h:
269
- $2 = D2() / 12;
270
- break;
271
- case c2:
272
- $2 = D2();
273
- break;
274
- case f:
275
- $2 = D2() / 3;
276
- break;
277
- case o:
278
- $2 = (g2 - v2) / 6048e5;
279
- break;
280
- case a2:
281
- $2 = (g2 - v2) / 864e5;
282
- break;
283
- case u:
284
- $2 = g2 / n2;
285
- break;
286
- case s2:
287
- $2 = g2 / e2;
288
- break;
289
- case i2:
290
- $2 = g2 / t2;
291
- break;
292
- default:
293
- $2 = g2;
294
- }
295
- return l2 ? $2 : b.a($2);
296
- }, m2.daysInMonth = function() {
297
- return this.endOf(c2).$D;
298
- }, m2.$locale = function() {
299
- return D[this.$L];
300
- }, m2.locale = function(t3, e3) {
301
- if (!t3)
302
- return this.$L;
303
- var n3 = this.clone(), r3 = w(t3, e3, true);
304
- return r3 && (n3.$L = r3), n3;
305
- }, m2.clone = function() {
306
- return b.w(this.$d, this);
307
- }, m2.toDate = function() {
308
- return new Date(this.valueOf());
309
- }, m2.toJSON = function() {
310
- return this.isValid() ? this.toISOString() : null;
311
- }, m2.toISOString = function() {
312
- return this.$d.toISOString();
313
- }, m2.toString = function() {
314
- return this.$d.toUTCString();
315
- }, M2;
316
- }(), k = _.prototype;
317
- return O.prototype = k, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
318
- k[t3[1]] = function(e3) {
319
- return this.$g(e3, t3[0], t3[1]);
100
+ if ("string" == typeof e3 && !/Z$/i.test(e3)) {
101
+ var r3 = e3.match($);
102
+ if (r3) {
103
+ var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3);
104
+ return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3);
105
+ }
106
+ }
107
+ return new Date(e3);
108
+ }(t3), this.init();
109
+ }, m2.init = function() {
110
+ var t3 = this.$d;
111
+ this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds();
112
+ }, m2.$utils = function() {
113
+ return b;
114
+ }, m2.isValid = function() {
115
+ return !(this.$d.toString() === l);
116
+ }, m2.isSame = function(t3, e3) {
117
+ var n3 = O(t3);
118
+ return this.startOf(e3) <= n3 && n3 <= this.endOf(e3);
119
+ }, m2.isAfter = function(t3, e3) {
120
+ return O(t3) < this.startOf(e3);
121
+ }, m2.isBefore = function(t3, e3) {
122
+ return this.endOf(e3) < O(t3);
123
+ }, m2.$g = function(t3, e3, n3) {
124
+ return b.u(t3) ? this[e3] : this.set(n3, t3);
125
+ }, m2.unix = function() {
126
+ return Math.floor(this.valueOf() / 1e3);
127
+ }, m2.valueOf = function() {
128
+ return this.$d.getTime();
129
+ }, m2.startOf = function(t3, e3) {
130
+ var n3 = this, r3 = !!b.u(e3) || e3, f2 = b.p(t3), l2 = function(t4, e4) {
131
+ var i3 = b.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3);
132
+ return r3 ? i3 : i3.endOf(a2);
133
+ }, $2 = function(t4, e4) {
134
+ return b.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3);
135
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
136
+ switch (f2) {
137
+ case h:
138
+ return r3 ? l2(1, 0) : l2(31, 11);
139
+ case c2:
140
+ return r3 ? l2(1, M3) : l2(0, M3 + 1);
141
+ case o:
142
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
143
+ return l2(r3 ? m3 - D2 : m3 + (6 - D2), M3);
144
+ case a2:
145
+ case d:
146
+ return $2(v2 + "Hours", 0);
147
+ case u:
148
+ return $2(v2 + "Minutes", 1);
149
+ case s2:
150
+ return $2(v2 + "Seconds", 2);
151
+ case i2:
152
+ return $2(v2 + "Milliseconds", 3);
153
+ default:
154
+ return this.clone();
155
+ }
156
+ }, m2.endOf = function(t3) {
157
+ return this.startOf(t3, false);
158
+ }, m2.$set = function(t3, e3) {
159
+ var n3, o2 = b.p(t3), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n3 = {}, n3[a2] = f2 + "Date", n3[d] = f2 + "Date", n3[c2] = f2 + "Month", n3[h] = f2 + "FullYear", n3[u] = f2 + "Hours", n3[s2] = f2 + "Minutes", n3[i2] = f2 + "Seconds", n3[r2] = f2 + "Milliseconds", n3)[o2], $2 = o2 === a2 ? this.$D + (e3 - this.$W) : e3;
160
+ if (o2 === c2 || o2 === h) {
161
+ var y2 = this.clone().set(d, 1);
162
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
163
+ } else
164
+ l2 && this.$d[l2]($2);
165
+ return this.init(), this;
166
+ }, m2.set = function(t3, e3) {
167
+ return this.clone().$set(t3, e3);
168
+ }, m2.get = function(t3) {
169
+ return this[b.p(t3)]();
170
+ }, m2.add = function(r3, f2) {
171
+ var d2, l2 = this;
172
+ r3 = Number(r3);
173
+ var $2 = b.p(f2), y2 = function(t3) {
174
+ var e3 = O(l2);
175
+ return b.w(e3.date(e3.date() + Math.round(t3 * r3)), l2);
320
176
  };
321
- }), O.extend = function(t3, e3) {
322
- return t3.$i || (t3(e3, _, O), t3.$i = true), O;
323
- }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
324
- return O(1e3 * t3);
325
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
326
- });
327
- })(dayjs_min);
328
- return dayjs_min.exports;
329
- }
330
- var dayjs_minExports = requireDayjs_min();
177
+ if ($2 === c2)
178
+ return this.set(c2, this.$M + r3);
179
+ if ($2 === h)
180
+ return this.set(h, this.$y + r3);
181
+ if ($2 === a2)
182
+ return y2(1);
183
+ if ($2 === o)
184
+ return y2(7);
185
+ var M3 = (d2 = {}, d2[s2] = e2, d2[u] = n2, d2[i2] = t2, d2)[$2] || 1, m3 = this.$d.getTime() + r3 * M3;
186
+ return b.w(m3, this);
187
+ }, m2.subtract = function(t3, e3) {
188
+ return this.add(-1 * t3, e3);
189
+ }, m2.format = function(t3) {
190
+ var e3 = this, n3 = this.$locale();
191
+ if (!this.isValid())
192
+ return n3.invalidDate || l;
193
+ var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b.z(this), s3 = this.$H, u2 = this.$m, a3 = this.$M, o2 = n3.weekdays, c3 = n3.months, f2 = n3.meridiem, h2 = function(t4, n4, i4, s4) {
194
+ return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4);
195
+ }, d2 = function(t4) {
196
+ return b.s(s3 % 12 || 12, t4, "0");
197
+ }, $2 = f2 || function(t4, e4, n4) {
198
+ var r4 = t4 < 12 ? "AM" : "PM";
199
+ return n4 ? r4.toLowerCase() : r4;
200
+ };
201
+ return r3.replace(y, function(t4, r4) {
202
+ return r4 || function(t5) {
203
+ switch (t5) {
204
+ case "YY":
205
+ return String(e3.$y).slice(-2);
206
+ case "YYYY":
207
+ return b.s(e3.$y, 4, "0");
208
+ case "M":
209
+ return a3 + 1;
210
+ case "MM":
211
+ return b.s(a3 + 1, 2, "0");
212
+ case "MMM":
213
+ return h2(n3.monthsShort, a3, c3, 3);
214
+ case "MMMM":
215
+ return h2(c3, a3);
216
+ case "D":
217
+ return e3.$D;
218
+ case "DD":
219
+ return b.s(e3.$D, 2, "0");
220
+ case "d":
221
+ return String(e3.$W);
222
+ case "dd":
223
+ return h2(n3.weekdaysMin, e3.$W, o2, 2);
224
+ case "ddd":
225
+ return h2(n3.weekdaysShort, e3.$W, o2, 3);
226
+ case "dddd":
227
+ return o2[e3.$W];
228
+ case "H":
229
+ return String(s3);
230
+ case "HH":
231
+ return b.s(s3, 2, "0");
232
+ case "h":
233
+ return d2(1);
234
+ case "hh":
235
+ return d2(2);
236
+ case "a":
237
+ return $2(s3, u2, true);
238
+ case "A":
239
+ return $2(s3, u2, false);
240
+ case "m":
241
+ return String(u2);
242
+ case "mm":
243
+ return b.s(u2, 2, "0");
244
+ case "s":
245
+ return String(e3.$s);
246
+ case "ss":
247
+ return b.s(e3.$s, 2, "0");
248
+ case "SSS":
249
+ return b.s(e3.$ms, 3, "0");
250
+ case "Z":
251
+ return i3;
252
+ }
253
+ return null;
254
+ }(t4) || i3.replace(":", "");
255
+ });
256
+ }, m2.utcOffset = function() {
257
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
258
+ }, m2.diff = function(r3, d2, l2) {
259
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r3), v2 = (m3.utcOffset() - this.utcOffset()) * e2, g2 = this - m3, D2 = function() {
260
+ return b.m(y2, m3);
261
+ };
262
+ switch (M3) {
263
+ case h:
264
+ $2 = D2() / 12;
265
+ break;
266
+ case c2:
267
+ $2 = D2();
268
+ break;
269
+ case f:
270
+ $2 = D2() / 3;
271
+ break;
272
+ case o:
273
+ $2 = (g2 - v2) / 6048e5;
274
+ break;
275
+ case a2:
276
+ $2 = (g2 - v2) / 864e5;
277
+ break;
278
+ case u:
279
+ $2 = g2 / n2;
280
+ break;
281
+ case s2:
282
+ $2 = g2 / e2;
283
+ break;
284
+ case i2:
285
+ $2 = g2 / t2;
286
+ break;
287
+ default:
288
+ $2 = g2;
289
+ }
290
+ return l2 ? $2 : b.a($2);
291
+ }, m2.daysInMonth = function() {
292
+ return this.endOf(c2).$D;
293
+ }, m2.$locale = function() {
294
+ return D[this.$L];
295
+ }, m2.locale = function(t3, e3) {
296
+ if (!t3)
297
+ return this.$L;
298
+ var n3 = this.clone(), r3 = w(t3, e3, true);
299
+ return r3 && (n3.$L = r3), n3;
300
+ }, m2.clone = function() {
301
+ return b.w(this.$d, this);
302
+ }, m2.toDate = function() {
303
+ return new Date(this.valueOf());
304
+ }, m2.toJSON = function() {
305
+ return this.isValid() ? this.toISOString() : null;
306
+ }, m2.toISOString = function() {
307
+ return this.$d.toISOString();
308
+ }, m2.toString = function() {
309
+ return this.$d.toUTCString();
310
+ }, M2;
311
+ }(), k = _.prototype;
312
+ return O.prototype = k, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u], ["$W", a2], ["$M", c2], ["$y", h], ["$D", d]].forEach(function(t3) {
313
+ k[t3[1]] = function(e3) {
314
+ return this.$g(e3, t3[0], t3[1]);
315
+ };
316
+ }), O.extend = function(t3, e3) {
317
+ return t3.$i || (t3(e3, _, O), t3.$i = true), O;
318
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t3) {
319
+ return O(1e3 * t3);
320
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
321
+ });
322
+ })(dayjs_min);
323
+ var dayjs_minExports = dayjs_min.exports;
331
324
  const dayjs = /* @__PURE__ */ getDefaultExportFromCjs(dayjs_minExports);
332
325
  var zh = { exports: {} };
333
326
  (function(module2, exports3) {
334
327
  !function(e2, _) {
335
- module2.exports = _(requireDayjs_min());
328
+ module2.exports = _(dayjs_minExports);
336
329
  }(commonjsGlobal, function(e2) {
337
330
  function _(e3) {
338
331
  return e3 && "object" == typeof e3 && "default" in e3 ? e3 : { default: e3 };
@@ -1182,6 +1175,7 @@ var __publicField = (obj, key, value) => {
1182
1175
  const pv_phase_pending$1 = "Pending";
1183
1176
  const exec_pod = "Execute shell";
1184
1177
  const search$1 = "Search";
1178
+ const edit_label$1 = "Edit label";
1185
1179
  const dovetail$1 = {
1186
1180
  copy: copy$2,
1187
1181
  reset_arguments: reset_arguments$1,
@@ -1353,7 +1347,8 @@ var __publicField = (obj, key, value) => {
1353
1347
  pv_phase_failed: pv_phase_failed$1,
1354
1348
  pv_phase_pending: pv_phase_pending$1,
1355
1349
  exec_pod,
1356
- search: search$1
1350
+ search: search$1,
1351
+ edit_label: edit_label$1
1357
1352
  };
1358
1353
  const EN = {
1359
1354
  dovetail: dovetail$1
@@ -1532,6 +1527,14 @@ var __publicField = (obj, key, value) => {
1532
1527
  const connecting = "正在连接...";
1533
1528
  const reconnect = "重新连接";
1534
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}} 的注解成功";
1535
1538
  const dovetail = {
1536
1539
  copy: copy$1,
1537
1540
  reset_arguments,
@@ -1709,7 +1712,15 @@ var __publicField = (obj, key, value) => {
1709
1712
  disconnected,
1710
1713
  connecting,
1711
1714
  reconnect,
1712
- 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
1713
1724
  };
1714
1725
  const ZH = {
1715
1726
  dovetail
@@ -8092,18 +8103,19 @@ var __publicField = (obj, key, value) => {
8092
8103
  return schema;
8093
8104
  }
8094
8105
  class K8sOpenAPI {
8095
- constructor(resourceBasePath) {
8106
+ constructor(resourceBasePath, pathPrefix) {
8096
8107
  // private response: OpenAPIResponse | null = null;
8097
8108
  __publicField(this, "apiVersion");
8098
8109
  __publicField(this, "schemas", null);
8099
8110
  this.resourceBasePath = resourceBasePath;
8111
+ this.pathPrefix = pathPrefix;
8100
8112
  this.apiVersion = getApiVersion(resourceBasePath);
8101
8113
  }
8102
8114
  // Fetch and process OpenAPI schemas
8103
8115
  async fetch() {
8104
8116
  try {
8105
8117
  const response = await fetch(
8106
- `/api/sks/api/v1/clusters/sks-mgmt/proxy/openapi/v3${this.resourceBasePath}`
8118
+ `${this.pathPrefix}${this.resourceBasePath}`
8107
8119
  );
8108
8120
  const result = await response.json();
8109
8121
  this.schemas = Object.values(result.components.schemas);
@@ -8148,6 +8160,9 @@ var __publicField = (obj, key, value) => {
8148
8160
  });
8149
8161
  }
8150
8162
  }
8163
+ const ConstantsContext = React.createContext({
8164
+ schemaUrlPrefix: ""
8165
+ });
8151
8166
  function useApiGroupSchema() {
8152
8167
  const [state2, setState] = React.useState({
8153
8168
  schemas: null,
@@ -8155,7 +8170,7 @@ var __publicField = (obj, key, value) => {
8155
8170
  loading: false,
8156
8171
  error: null
8157
8172
  });
8158
- const fetchSchema = React.useCallback(async (apiGroups) => {
8173
+ const fetchSchema = React.useCallback(async (apiGroups, schemaUrlPrefix) => {
8159
8174
  setState((prev) => ({ ...prev, loading: true, error: null }));
8160
8175
  try {
8161
8176
  const results = await Promise.all(
@@ -8163,7 +8178,7 @@ var __publicField = (obj, key, value) => {
8163
8178
  if (state2.schemasMap[apiGroup]) {
8164
8179
  return { apiGroup, schemas: state2.schemasMap[apiGroup] };
8165
8180
  }
8166
- const openapi = new K8sOpenAPI(apiGroup);
8181
+ const openapi = new K8sOpenAPI(apiGroup, schemaUrlPrefix);
8167
8182
  const groupSchemas = await openapi.fetch();
8168
8183
  return { apiGroup, schemas: groupSchemas || [] };
8169
8184
  })
@@ -8186,18 +8201,19 @@ var __publicField = (obj, key, value) => {
8186
8201
  return { ...state2, fetchSchema };
8187
8202
  }
8188
8203
  function useSchema(options) {
8189
- var _a;
8204
+ var _a, _b;
8190
8205
  const [schema, setSchema] = React.useState(null);
8191
8206
  const [loading, setLoading] = React.useState(false);
8192
8207
  const [error, setError] = React.useState(null);
8193
8208
  const useResourceResult = core.useResource();
8194
8209
  const resource = (options == null ? void 0 : options.resource) || useResourceResult.resource;
8210
+ const { schemaUrlPrefix } = React.useContext(ConstantsContext);
8195
8211
  const openapi = React.useMemo(
8196
8212
  () => {
8197
8213
  var _a2;
8198
- 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);
8199
8215
  },
8200
- [(_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]
8201
8217
  );
8202
8218
  const fetchSchema = React.useCallback(async () => {
8203
8219
  var _a2;
@@ -8213,7 +8229,7 @@ var __publicField = (obj, key, value) => {
8213
8229
  } finally {
8214
8230
  setLoading(false);
8215
8231
  }
8216
- }, [resource, openapi]);
8232
+ }, [(_b = resource == null ? void 0 : resource.meta) == null ? void 0 : _b.kind, openapi]);
8217
8233
  React.useEffect(() => {
8218
8234
  if (options == null ? void 0 : options.skip)
8219
8235
  return;
@@ -8252,11 +8268,13 @@ var __publicField = (obj, key, value) => {
8252
8268
  };
8253
8269
  var cx_default = cx;
8254
8270
  const ConfigsContext = React.createContext({});
8255
- const useDeleteModal_vv2pzj = "";
8271
+ const modal_1eijuvm = "";
8272
+ const FullscreenModalStyle = "fq4465w";
8273
+ const SmallModalStyle = "s1nc293e";
8274
+ const useDeleteModal_mi8he5 = "";
8256
8275
  const TextStyle = "t1vq0ett";
8257
8276
  const TipStyle = "t139onst";
8258
8277
  const NameStyle$1 = "n18lzor8";
8259
- const ModalStyle = "mvvgkkc";
8260
8278
  const useDeleteModal = (resource) => {
8261
8279
  const configs = React.useContext(ConfigsContext);
8262
8280
  const config = configs[resource];
@@ -8271,7 +8289,7 @@ var __publicField = (obj, key, value) => {
8271
8289
  t: t2
8272
8290
  } = useTranslation();
8273
8291
  const modalProps = {
8274
- className: ModalStyle,
8292
+ className: SmallModalStyle,
8275
8293
  title: t2("dovetail.delete_resource", {
8276
8294
  resource: config.kind
8277
8295
  }),
@@ -8352,7 +8370,7 @@ var __publicField = (obj, key, value) => {
8352
8370
  openDeleteConfirmModal
8353
8371
  };
8354
8372
  };
8355
- const index_wrn16i = "";
8373
+ const index_18b69qa = "";
8356
8374
  const EMPTY_VALUES = [void 0, null, "", "-"];
8357
8375
  const EmptyStyle = "e5223w8";
8358
8376
  const ContentStyle$2 = "cdjsw14";
@@ -8364,7 +8382,7 @@ var __publicField = (obj, key, value) => {
8364
8382
  style
8365
8383
  } = props;
8366
8384
  return EMPTY_VALUES.includes(value2) ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
8367
- className: cx_default(EmptyStyle, className),
8385
+ className: cx_default(EmptyStyle, "empty-text", className),
8368
8386
  style,
8369
8387
  children: "-"
8370
8388
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -8436,7 +8454,7 @@ var __publicField = (obj, key, value) => {
8436
8454
  };
8437
8455
  return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: elapsedTime(value2, i18nMap).label || /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" }) });
8438
8456
  }
8439
- const index_hex8jv = "";
8457
+ const index_1xaw1mq = "";
8440
8458
  const BreadcrumbStyle = "b142d7q8";
8441
8459
  function Breadcrumb(props) {
8442
8460
  const {
@@ -8744,7 +8762,7 @@ var __publicField = (obj, key, value) => {
8744
8762
  return o(prop);
8745
8763
  }
8746
8764
  }) : styled;
8747
- const index_cp12i5 = "";
8765
+ const index_1q7r2i0 = "";
8748
8766
  const ErrorWrapper = /* @__PURE__ */ styled_default("div")({
8749
8767
  name: "ErrorWrapper",
8750
8768
  class: "egn3dbn",
@@ -8805,13 +8823,13 @@ var __publicField = (obj, key, value) => {
8805
8823
  })
8806
8824
  });
8807
8825
  };
8808
- const TableWidgets_ny30pi = "";
8826
+ const TableWidgets_sc2nyo = "";
8809
8827
  const AuxiliaryLine = /* @__PURE__ */ styled_default("div")({
8810
8828
  name: "AuxiliaryLine",
8811
8829
  class: "ax1qopv",
8812
8830
  propsAsIs: false
8813
8831
  });
8814
- const index_dmbxj3 = "";
8832
+ const index_dp43sd = "";
8815
8833
  const TableContainerStyle = "t1upn1sz";
8816
8834
  function Table(props) {
8817
8835
  const {
@@ -9124,6 +9142,16 @@ var __publicField = (obj, key, value) => {
9124
9142
  restore() {
9125
9143
  return this._rawYaml;
9126
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
+ }
9127
9155
  }
9128
9156
  class IngressModel extends ResourceModel {
9129
9157
  constructor(_rawYaml, _globalStore) {
@@ -9620,7 +9648,7 @@ var __publicField = (obj, key, value) => {
9620
9648
  }
9621
9649
  }
9622
9650
  };
9623
- const TIMESTAMP_LABEL = "sks.user.kubesmart.smtx.io/timestamp";
9651
+ const REDEPLOY_TIMESTAMP_KEY = "kubectl.kubernetes.io/restartedAt";
9624
9652
  const SECRET_OPAQUE_INIT_VALUE = {
9625
9653
  "apiVersion": "v1",
9626
9654
  "kind": "Secret",
@@ -9869,7 +9897,7 @@ var __publicField = (obj, key, value) => {
9869
9897
  const annotations = lodashExports.get(newOne, path2, {});
9870
9898
  lodashExports.set(newOne, path2, {
9871
9899
  ...annotations,
9872
- [TIMESTAMP_LABEL]: (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z")
9900
+ [REDEPLOY_TIMESTAMP_KEY]: (/* @__PURE__ */ new Date()).toISOString().replace(/\.\d+Z$/, "Z")
9873
9901
  });
9874
9902
  return newOne;
9875
9903
  }
@@ -10245,7 +10273,7 @@ var __publicField = (obj, key, value) => {
10245
10273
  this._rawYaml = _rawYaml;
10246
10274
  }
10247
10275
  }
10248
- const index_1lzkrja = "";
10276
+ const index_1iq0dq9 = "";
10249
10277
  const ServiceInClusterAccessComponent = ({
10250
10278
  service
10251
10279
  }) => {
@@ -10324,7 +10352,7 @@ var __publicField = (obj, key, value) => {
10324
10352
  children: content || "-"
10325
10353
  });
10326
10354
  };
10327
- const index_10ylmu3 = "";
10355
+ const index_1sc40y3 = "";
10328
10356
  const TagWrapper = "t13a6vox";
10329
10357
  const TagStyle = "t12ikbmp";
10330
10358
  const Tags = (props) => {
@@ -10351,7 +10379,7 @@ var __publicField = (obj, key, value) => {
10351
10379
  children: tags
10352
10380
  });
10353
10381
  };
10354
- const StateTag_1wmvw42 = "";
10382
+ const StateTag_1o2atxo = "";
10355
10383
  const StateTagStyle = "s8qkbck";
10356
10384
  const StateTag = ({
10357
10385
  state: state2 = WorkloadState.UPDATING,
@@ -10436,7 +10464,7 @@ var __publicField = (obj, key, value) => {
10436
10464
  })(relativeTime$1);
10437
10465
  var relativeTimeExports = relativeTime$1.exports;
10438
10466
  const relativeTime = /* @__PURE__ */ getDefaultExportFromCjs(relativeTimeExports);
10439
- const index_1779z85 = "";
10467
+ const index_1jgp4p8 = "";
10440
10468
  dayjs.extend(relativeTime, {
10441
10469
  thresholds: [{
10442
10470
  l: "s",
@@ -10608,7 +10636,7 @@ var __publicField = (obj, key, value) => {
10608
10636
  function useDownloadYAML() {
10609
10637
  return function(options) {
10610
10638
  const { name: name2, item } = options;
10611
- const content = yaml.dump(item);
10639
+ const content = yaml$1.dump(item);
10612
10640
  download(`${name2}.yaml`, content);
10613
10641
  };
10614
10642
  }
@@ -10693,6 +10721,410 @@ var __publicField = (obj, key, value) => {
10693
10721
  }
10694
10722
  };
10695
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
+ }
10696
11128
  function K8sDropdown(props) {
10697
11129
  const { record, size = "normal" } = props;
10698
11130
  const { globalStore } = useGlobalStore();
@@ -10713,18 +11145,15 @@ var __publicField = (obj, key, value) => {
10713
11145
  resource: resource == null ? void 0 : resource.name,
10714
11146
  action: AccessControlAuth.Delete
10715
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;
10716
11151
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10717
11152
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10718
11153
  eagle.Dropdown,
10719
11154
  {
10720
11155
  overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Menu, { children: [
10721
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10722
- eagle.Menu.Item,
10723
- {
10724
- onClick: openForm,
10725
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10726
- }
10727
- ),
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") }) }),
10728
11157
  /* @__PURE__ */ jsxRuntimeExports.jsx(
10729
11158
  eagle.Menu.Item,
10730
11159
  {
@@ -10740,6 +11169,8 @@ var __publicField = (obj, key, value) => {
10740
11169
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10741
11170
  }
10742
11171
  ),
11172
+ editLabelMenuItem,
11173
+ editAnnotationMenuItem,
10743
11174
  props.children,
10744
11175
  (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Divider, { style: { margin: 0 } }) : null,
10745
11176
  (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
@@ -10926,7 +11357,7 @@ var __publicField = (obj, key, value) => {
10926
11357
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
10927
11358
  ] });
10928
11359
  };
10929
- const TableToolBar_4s5vf2 = "";
11360
+ const TableToolBar_nvjftd = "";
10930
11361
  const ToolbarWrapperStyle = "t1v3ienx";
10931
11362
  const ToolbarStyle$3 = "tgejfwe";
10932
11363
  const TitleStyle$2 = "tq6dc79";
@@ -10962,7 +11393,7 @@ var __publicField = (obj, key, value) => {
10962
11393
  }) : null]
10963
11394
  });
10964
11395
  };
10965
- const index_6qzjtx = "";
11396
+ const index_dyz3nd = "";
10966
11397
  const WrapperStyle$5 = "w16agr8o";
10967
11398
  function matchOwner(job, owner) {
10968
11399
  var _a;
@@ -11117,7 +11548,7 @@ var __publicField = (obj, key, value) => {
11117
11548
  }
11118
11549
  );
11119
11550
  };
11120
- const index_218swh = "";
11551
+ const index_mvy4dx = "";
11121
11552
  const ImageWrapperStyle = "i1u1f5zp";
11122
11553
  const ImageNames = ({
11123
11554
  value: value2,
@@ -11131,7 +11562,7 @@ var __publicField = (obj, key, value) => {
11131
11562
  }, `${image2}-${index2}`)) : value2.join(", ")
11132
11563
  });
11133
11564
  };
11134
- const index_1m8lip = "";
11565
+ const index_14bl0m = "";
11135
11566
  const LinkStyle$1 = "lmmrm55";
11136
11567
  function LinkFallback({
11137
11568
  fullPath
@@ -11148,7 +11579,7 @@ var __publicField = (obj, key, value) => {
11148
11579
  children: fullPath
11149
11580
  });
11150
11581
  }
11151
- const index_cbhkdt = "";
11582
+ const index_x36tts = "";
11152
11583
  const LinkStyle = "l1vnw9x0";
11153
11584
  const ResourceLink = (props) => {
11154
11585
  const {
@@ -11287,7 +11718,7 @@ var __publicField = (obj, key, value) => {
11287
11718
  }
11288
11719
  );
11289
11720
  };
11290
- const KeyValue_q4vd5r = "";
11721
+ const KeyValue_18l1y97 = "";
11291
11722
  const ContentBlockStyle = "c8jy7dc";
11292
11723
  const KeyStyle = "k2sddxl";
11293
11724
  const ValueStyle$2 = "v16vicsr";
@@ -11323,7 +11754,7 @@ var __publicField = (obj, key, value) => {
11323
11754
  function toAsterisk(str) {
11324
11755
  return Array(str.length).join("*");
11325
11756
  }
11326
- const KeyValueAnnotation_1inegjq = "";
11757
+ const KeyValueAnnotation_ug7k2g = "";
11327
11758
  const WrapperStyle$4 = "w14056kz";
11328
11759
  const HeaderStyle$1 = "hisq2gt";
11329
11760
  const HeaderItemStyle = "h11urhaw";
@@ -11367,7 +11798,7 @@ var __publicField = (obj, key, value) => {
11367
11798
  return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.TabsTabPane, { tab: tab.title, children: tab.children }, tab.title);
11368
11799
  }) });
11369
11800
  }
11370
- const ShowContent_1u0cbxv = "";
11801
+ const ShowContent_11g4jr2 = "";
11371
11802
  const ShowContentWrapperStyle = "s9agep2";
11372
11803
  const BackButton = "bo89gfi";
11373
11804
  const ToolBarWrapper = "t1ohe42f";
@@ -11578,7 +12009,7 @@ var __publicField = (obj, key, value) => {
11578
12009
  }), tabs]
11579
12010
  });
11580
12011
  };
11581
- const KeyValueSecret_1ibo68a = "";
12012
+ const KeyValueSecret_c3ji18 = "";
11582
12013
  const ButtonStyle = "b11tbgf7";
11583
12014
  const GroupStyle = "gtbyh5g";
11584
12015
  function KeyValueSecret(props) {
@@ -11633,7 +12064,7 @@ var __publicField = (obj, key, value) => {
11633
12064
  };
11634
12065
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: map[value2] || value2 });
11635
12066
  }
11636
- const WorkloadPodsTable_1giuese = "";
12067
+ const WorkloadPodsTable_975j2t = "";
11637
12068
  const WorkloadPodsTable = ({
11638
12069
  namespace: namespace2,
11639
12070
  selector,
@@ -11702,183 +12133,7 @@ var __publicField = (obj, key, value) => {
11702
12133
  })]
11703
12134
  });
11704
12135
  };
11705
- function FormErrorAlert(props) {
11706
- const { title, errorMsgs, style, className, isEdit } = props;
11707
- const { i18n: i18n2 } = useTranslation();
11708
- return errorMsgs.length ? /* @__PURE__ */ jsxRuntimeExports.jsx(
11709
- eagle.Alert,
11710
- {
11711
- message: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
11712
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: title || i18n2.t(isEdit ? "dovetail.save_failed_tip" : "dovetail.create_failed_tip") }),
11713
- errorMsgs.length > 1 ? /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: errorMsgs.map((errorMsg, index2) => /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
11714
- index2 + 1 + ". ",
11715
- " ",
11716
- errorMsg
11717
- ] }, errorMsg)) }) : lodashEs.first(errorMsgs)
11718
- ] }),
11719
- type: "error",
11720
- style,
11721
- className
11722
- }
11723
- ) : null;
11724
- }
11725
- function getCommonErrors(responseBody, i18n2) {
11726
- var _a;
11727
- 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))) {
11728
- return [];
11729
- }
11730
- const causes = ((_a = responseBody.details) == null ? void 0 : _a.causes) || responseBody.graphQLErrors || [];
11731
- if (causes.length) {
11732
- return causes.map((cause) => {
11733
- let params = {};
11734
- let message2 = cause.message;
11735
- try {
11736
- const info = JSON.parse(cause.message);
11737
- params = info.params;
11738
- message2 = info.message;
11739
- } catch {
11740
- return i18n2.t(
11741
- [
11742
- `error.${cause.reason}`,
11743
- `error.${cause.code}`,
11744
- `${cause.field ? `${cause.field}: ` : ""}${message2}`
11745
- ],
11746
- {
11747
- ...params,
11748
- fallbackLng: ""
11749
- }
11750
- );
11751
- }
11752
- return i18n2.t(
11753
- [
11754
- `error.${cause.reason}`,
11755
- `error.${cause.code}`,
11756
- `${cause.field ? `${cause.field}: ` : ""}${message2}`
11757
- ],
11758
- {
11759
- ...params,
11760
- fallbackLng: ""
11761
- }
11762
- );
11763
- });
11764
- }
11765
- return [
11766
- i18n2.t(
11767
- [`error.${responseBody.code}`, `error.${responseBody.reason}`, responseBody.message || ""],
11768
- { fallbackLng: "" }
11769
- )
11770
- ];
11771
- }
11772
- function useSubmitForm(options) {
11773
- const { formRef, onSubmitSuccess } = options;
11774
- const { i18n: i18n2 } = useTranslation();
11775
- const [submitting, setSubmitting] = React.useState(false);
11776
- const [errorMsgs, setErrorMsgs] = React.useState([]);
11777
- const reset = React.useCallback(() => {
11778
- setSubmitting(false);
11779
- setErrorMsgs([]);
11780
- }, []);
11781
- const onSubmit = React.useCallback(async () => {
11782
- var _a;
11783
- try {
11784
- setSubmitting(true);
11785
- await ((_a = formRef.current) == null ? void 0 : _a.submit());
11786
- onSubmitSuccess == null ? void 0 : onSubmitSuccess();
11787
- reset();
11788
- } catch (error) {
11789
- if (error instanceof Object) {
11790
- if ("response" in error && error.response instanceof Response) {
11791
- const response = error.response;
11792
- const body = await response.json();
11793
- setErrorMsgs(getCommonErrors(body, i18n2));
11794
- } else if ("message" in error && typeof error.message === "string") {
11795
- setErrorMsgs([error.message]);
11796
- }
11797
- }
11798
- } finally {
11799
- setSubmitting(false);
11800
- }
11801
- }, [formRef, i18n2, reset, onSubmitSuccess]);
11802
- return {
11803
- submitting,
11804
- errorMsgs,
11805
- reset,
11806
- onSubmit
11807
- };
11808
- }
11809
- const index_1twfoei = "";
11810
- const EditButtonStyle = "esoz3jw";
11811
- function EditFieldModal(props) {
11812
- const {
11813
- title,
11814
- formRef: form,
11815
- renderContent
11816
- } = props;
11817
- const {
11818
- i18n: i18n2
11819
- } = useTranslation();
11820
- const popModal = eagle.usePopModal();
11821
- const {
11822
- submitting,
11823
- errorMsgs,
11824
- reset,
11825
- onSubmit
11826
- } = useSubmitForm({
11827
- formRef: form,
11828
- onSubmitSuccess: () => {
11829
- popModal();
11830
- }
11831
- });
11832
- const close = React.useCallback(() => {
11833
- popModal();
11834
- reset();
11835
- }, [reset]);
11836
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
11837
- className: ModalStyle,
11838
- title: title || i18n2.t("dovetail.edit"),
11839
- confirmLoading: submitting,
11840
- onOk: onSubmit,
11841
- onCancel: close,
11842
- okText: i18n2.t("dovetail.save"),
11843
- normal: true,
11844
- destroyOnClose: true,
11845
- children: [renderContent(), /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
11846
- style: {
11847
- marginTop: 16
11848
- },
11849
- errorMsgs,
11850
- isEdit: true
11851
- })]
11852
- });
11853
- }
11854
- function EditField(props) {
11855
- const {
11856
- modalProps
11857
- } = props;
11858
- const {
11859
- i18n: i18n2
11860
- } = useTranslation();
11861
- const {
11862
- resource
11863
- } = core.useResource();
11864
- const pushModal = eagle.usePushModal();
11865
- return /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
11866
- resource: resource == null ? void 0 : resource.name,
11867
- action: AccessControlAuth.Edit,
11868
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
11869
- className: EditButtonStyle,
11870
- type: "link",
11871
- onClick: () => {
11872
- pushModal({
11873
- component: EditFieldModal,
11874
- props: modalProps
11875
- });
11876
- },
11877
- children: i18n2.t("dovetail.edit")
11878
- })
11879
- });
11880
- }
11881
- const index_c9frt4 = "";
12136
+ const index_p1cude = "";
11882
12137
  const WorkloadReplicasWrapperStyle = "w8ychfk";
11883
12138
  const DonutChartWrapperStyle = "d1o004do";
11884
12139
  const DonutChartStyle = "dfo80qq";
@@ -17962,7 +18217,7 @@ var __publicField = (obj, key, value) => {
17962
18217
  const LogViewer = React.forwardRef((props, ref) => React.createElement(LogViewerBase, Object.assign({ innerRef: ref }, props)));
17963
18218
  LogViewer.displayName = "LogViewer";
17964
18219
  const baseNoReset = "";
17965
- const index_jv52b6 = "";
18220
+ const index_v855ki = "";
17966
18221
  const WrapperStyle$3 = "wve7dfm";
17967
18222
  const ToolbarStyle$2 = "t9oeh3c";
17968
18223
  const ToolbarAreaStyle$1 = "t1u2zqn6";
@@ -18197,7 +18452,7 @@ var __publicField = (obj, key, value) => {
18197
18452
  }
18198
18453
  ]
18199
18454
  });
18200
- const style_inzxm5 = "";
18455
+ const style_h6krld = "";
18201
18456
  const ToolBarStyle = "t1joof7s";
18202
18457
  const ToolBarHeaderStyle = "tti58uh";
18203
18458
  const ErrorIconStyle = "e15yt16p";
@@ -18371,7 +18626,7 @@ var __publicField = (obj, key, value) => {
18371
18626
  __proto__: null,
18372
18627
  default: MonacoYamlEditor$1
18373
18628
  }, Symbol.toStringTag, { value: "Module" }));
18374
- const NetworkPolicyRulesViewer_13asgaq = "";
18629
+ const NetworkPolicyRulesViewer_6z3c00 = "";
18375
18630
  const EditorStyle$1 = "e1cjl2b8";
18376
18631
  const NetworkPolicyRulesViewer = ({
18377
18632
  ingressOrEgress,
@@ -18393,7 +18648,7 @@ var __publicField = (obj, key, value) => {
18393
18648
  }
18394
18649
  return /* @__PURE__ */ jsxRuntimeExports.jsx(MonacoYamlEditor$1, {
18395
18650
  schemas: [],
18396
- defaultValue: yaml.dump(ingressOrEgress),
18651
+ defaultValue: yaml$1.dump(ingressOrEgress),
18397
18652
  height: "300px",
18398
18653
  className: EditorStyle$1,
18399
18654
  readOnly: true,
@@ -18717,7 +18972,7 @@ var __publicField = (obj, key, value) => {
18717
18972
  }, [isError, nav, resource]);
18718
18973
  return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
18719
18974
  };
18720
- const index_17v8shn = "";
18975
+ const index_az4wrx = "";
18721
18976
  const WrapperStyle$1 = "w1akirqw";
18722
18977
  const TitleStyle = "t30srnq";
18723
18978
  function FormLayout(props) {
@@ -31926,7 +32181,7 @@ WARNING: This link could potentially be dangerous`)) {
31926
32181
  }
31927
32182
  var copyToClipboard$1 = copy;
31928
32183
  const copyToClipboard$2 = /* @__PURE__ */ getDefaultExportFromCjs(copyToClipboard$1);
31929
- const ShellToolbar_ox6trc = "";
32184
+ const ShellToolbar_ihg418 = "";
31930
32185
  const ToolbarStyle$1 = "tzxa6d";
31931
32186
  const ToolbarAreaStyle = "t1sxu3rr";
31932
32187
  const IconWrapperStyle = "ix8ych8";
@@ -32035,7 +32290,7 @@ WARNING: This link could potentially be dangerous`)) {
32035
32290
  });
32036
32291
  }
32037
32292
  const xterm = "";
32038
- const index_z4cp87 = "";
32293
+ const index_1bj2t02 = "";
32039
32294
  const ContainerStyle = "c1q5a2qi";
32040
32295
  const ShellStyle = "sdz5fm1";
32041
32296
  const LoadingStyle = "lbp0h2e";
@@ -32415,8 +32670,6 @@ WARNING: This link could potentially be dangerous`)) {
32415
32670
  });
32416
32671
  });
32417
32672
  const GlobalStoreContext = React.createContext({});
32418
- const modal_7iwhwk = "";
32419
- const FullscreenModalStyle = "fq4465w";
32420
32673
  var buffer = {};
32421
32674
  var base64Js = {};
32422
32675
  base64Js.byteLength = byteLength;
@@ -34656,7 +34909,7 @@ WARNING: This link could potentially be dangerous`)) {
34656
34909
  return void 0;
34657
34910
  }
34658
34911
  }
34659
- const index_1xad2h9 = "";
34912
+ const index_1jqojte = "";
34660
34913
  const SelectStyle = "sj0ggy";
34661
34914
  const DropdownStyle = "d1eo8uqs";
34662
34915
  const SearchInputStyle = "s64gojc";
@@ -34862,7 +35115,7 @@ WARNING: This link could potentially be dangerous`)) {
34862
35115
  }), [nsFilters]);
34863
35116
  return filters;
34864
35117
  }
34865
- const index_hp158y = "";
35118
+ const index_1l2xllo = "";
34866
35119
  const ListPageStyle = "laykzsq";
34867
35120
  const ListContentStyle = "l1ng0psc";
34868
35121
  const TableStyle = "tj6zpn4";
@@ -34956,6 +35209,8 @@ WARNING: This link could potentially be dangerous`)) {
34956
35209
  }
34957
35210
  );
34958
35211
  }
35212
+ const button_1uhn9v1 = "";
35213
+ const WarningButtonStyle = "wwyz7ti";
34959
35214
  var isCheckBoxInput = (element) => element.type === "checkbox";
34960
35215
  var isDateObject = (value2) => value2 instanceof Date;
34961
35216
  var isNullOrUndefined = (value2) => value2 == null;
@@ -36316,9 +36571,9 @@ WARNING: This link could potentially be dangerous`)) {
36316
36571
  if (field && field._f) {
36317
36572
  const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
36318
36573
  if (isHTMLElement(fieldReference)) {
36319
- const form = fieldReference.closest("form");
36320
- if (form) {
36321
- form.reset();
36574
+ const form2 = fieldReference.closest("form");
36575
+ if (form2) {
36576
+ form2.reset();
36322
36577
  break;
36323
36578
  }
36324
36579
  }
@@ -36533,43 +36788,41 @@ WARNING: This link could potentially be dangerous`)) {
36533
36788
  _formControl.current.formState = getProxyFormState(formState, control);
36534
36789
  return _formControl.current;
36535
36790
  }
36536
- const RefineFormContent_1jki0fx = "";
36537
- const RefineFormContent = (props) => {
36791
+ function useFieldsConfig(config, resourceId) {
36538
36792
  var _a, _b, _c, _d;
36539
- const {
36540
- config,
36541
- formResult,
36542
- resourceId,
36543
- errorMsg
36544
- } = props;
36545
- const {
36546
- control,
36547
- getValues
36548
- } = formResult;
36549
36793
  const action = resourceId ? "edit" : "create";
36550
36794
  const listQuery = core.useList({
36551
36795
  resource: config == null ? void 0 : config.name,
36552
- meta: {
36553
- resourceBasePath: config == null ? void 0 : config.basePath,
36554
- kind: config == null ? void 0 : config.kind
36555
- },
36796
+ meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
36556
36797
  pagination: {
36557
36798
  mode: "off"
36558
36799
  }
36559
36800
  });
36560
36801
  const showQuery = core.useShow({
36561
36802
  resource: config == null ? void 0 : config.name,
36562
- meta: {
36563
- resourceBasePath: config == null ? void 0 : config.basePath,
36564
- kind: config == null ? void 0 : config.kind
36565
- },
36803
+ meta: { resourceBasePath: config == null ? void 0 : config.basePath, kind: config == null ? void 0 : config.kind },
36566
36804
  id: resourceId
36567
36805
  });
36568
- 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, {
36569
36807
  record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
36570
36808
  records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
36571
36809
  action
36572
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);
36573
36826
  const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
36574
36827
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
36575
36828
  control,
@@ -36599,7 +36852,7 @@ WARNING: This link could potentially be dangerous`)) {
36599
36852
  },
36600
36853
  fieldState
36601
36854
  }) => {
36602
- var _a2;
36855
+ var _a;
36603
36856
  const formValue = getValues();
36604
36857
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
36605
36858
  placeholder: c2.placeholder,
@@ -36652,7 +36905,7 @@ WARNING: This link could potentially be dangerous`)) {
36652
36905
  labelCol: {
36653
36906
  flex: "0 0 216px"
36654
36907
  },
36655
- help: (_a2 = fieldState.error) == null ? void 0 : _a2.message,
36908
+ help: (_a = fieldState.error) == null ? void 0 : _a.message,
36656
36909
  validateStatus: fieldState.invalid ? "error" : void 0,
36657
36910
  children: ele
36658
36911
  }, c2.key);
@@ -37347,7 +37600,7 @@ WARNING: This link could potentially be dangerous`)) {
37347
37600
  }, [config.formConfig, result]);
37348
37601
  return { formResult: result, responseErrorMsg };
37349
37602
  };
37350
- const index_12sfrn = "";
37603
+ const index_2ivb33 = "";
37351
37604
  const Style = "s1bsn3us";
37352
37605
  const Separator = () => {
37353
37606
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
@@ -37687,7 +37940,7 @@ WARNING: This link could potentially be dangerous`)) {
37687
37940
  return merged2;
37688
37941
  }
37689
37942
  const merged = merge(defaultValue, typeObject);
37690
- const content = yaml.dump(merged);
37943
+ const content = yaml$1.dump(merged);
37691
37944
  return content.replace(/(')(#.+?)(')/g, "$2").replace(/( +)(#)/g, "$2$1");
37692
37945
  }
37693
37946
  const useGlobalStore = () => {
@@ -37721,8 +37974,10 @@ WARNING: This link could potentially be dangerous`)) {
37721
37974
  overtimeOptions,
37722
37975
  editorOptions,
37723
37976
  initialValuesForCreate,
37977
+ initialValuesForEdit,
37724
37978
  transformInitValues,
37725
- transformApplyValues
37979
+ transformApplyValues,
37980
+ rules
37726
37981
  } = {}) => {
37727
37982
  var _a;
37728
37983
  const editor = React.useRef(null);
@@ -37731,6 +37986,7 @@ WARNING: This link could potentially be dangerous`)) {
37731
37986
  const [isYamlValid, setIsYamlValid] = React.useState(true);
37732
37987
  const [isSchemaValid, setIsSchemaValid] = React.useState(true);
37733
37988
  const [editorErrors, setEditorErrors] = React.useState([]);
37989
+ const [rulesErrors, setRulesErrors] = React.useState([]);
37734
37990
  const [errorResponseBody, setErrorResponseBody] = React.useState(null);
37735
37991
  const useResourceResult = core.useResource();
37736
37992
  const { globalStore } = useGlobalStore();
@@ -37746,11 +38002,20 @@ WARNING: This link could potentially be dangerous`)) {
37746
38002
  const formSF = sunflowerAntd.useForm({
37747
38003
  form: formAnt
37748
38004
  });
37749
- const { form } = formSF;
38005
+ const { form: form2 } = formSF;
37750
38006
  const { fold: fold2 } = useK8sYamlEditor();
37751
38007
  const useFormCoreResult = core.useForm({
37752
38008
  onMutationSuccess: onMutationSuccessProp ? onMutationSuccessProp : void 0,
37753
- 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
+ },
37754
38019
  redirect,
37755
38020
  action: actionFromProps,
37756
38021
  resource,
@@ -37776,30 +38041,24 @@ WARNING: This link could potentially be dangerous`)) {
37776
38041
  const { formLoading, onFinish, queryResult } = useFormCoreResult;
37777
38042
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
37778
38043
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
38044
+ const action = React.useMemo(
38045
+ () => actionFromProps || useResourceResult.action,
38046
+ [actionFromProps, useResourceResult.action]
38047
+ );
37779
38048
  const initialValues = React.useMemo(() => {
37780
38049
  var _a2;
37781
- 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) || {};
37782
38051
  if (initialValues2) {
37783
38052
  pruneBeforeEdit(initialValues2);
37784
38053
  }
37785
38054
  return (transformInitValues == null ? void 0 : transformInitValues(initialValues2)) || initialValues2;
37786
38055
  }, [queryResult, globalStore, initialValuesForCreate, transformInitValues]);
37787
- const action = React.useMemo(
37788
- () => actionFromProps || useResourceResult.action,
37789
- [actionFromProps, useResourceResult.action]
37790
- );
37791
- React.useEffect(() => {
37792
- var _a2, _b;
37793
- const response = (_a2 = useFormCoreResult.mutationResult.error) == null ? void 0 : _a2.response;
37794
- if (response && !(response == null ? void 0 : response.bodyUsed)) {
37795
- (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
37796
- setErrorResponseBody(body);
37797
- });
37798
- }
37799
- }, [useFormCoreResult.mutationResult]);
38056
+ const finalErrors = React.useMemo(() => {
38057
+ return lodashEs.uniq([...editorErrors, ...rulesErrors]);
38058
+ }, [editorErrors, rulesErrors]);
37800
38059
  const onKeyUp = (event2) => {
37801
38060
  if (submitOnEnter && event2.key === "Enter") {
37802
- form.submit();
38061
+ form2.submit();
37803
38062
  }
37804
38063
  };
37805
38064
  const onValuesChange = (changeValues) => {
@@ -37808,14 +38067,33 @@ WARNING: This link could potentially be dangerous`)) {
37808
38067
  }
37809
38068
  return changeValues;
37810
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
+ };
37811
38089
  const saveButtonProps = React.useMemo(
37812
38090
  () => ({
37813
38091
  loading: formLoading,
37814
38092
  onClick: () => {
37815
- form.submit();
38093
+ form2.submit();
37816
38094
  }
37817
38095
  }),
37818
- [formLoading, form]
38096
+ [formLoading, form2]
37819
38097
  );
37820
38098
  const schemas = React.useMemo(() => {
37821
38099
  return schema ? [schema] : [];
@@ -37824,10 +38102,10 @@ WARNING: This link could potentially be dangerous`)) {
37824
38102
  var _a2;
37825
38103
  return {
37826
38104
  ref: editor,
37827
- 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),
37828
38106
  schemas,
37829
38107
  id: ((_a2 = useResourceResult.resource) == null ? void 0 : _a2.name) || "",
37830
- errorMsgs: editorErrors,
38108
+ errorMsgs: finalErrors,
37831
38109
  onValidate(yamlValid, schemaValid) {
37832
38110
  setIsYamlValid(yamlValid);
37833
38111
  setIsSchemaValid(schemaValid);
@@ -37837,7 +38115,7 @@ WARNING: This link could potentially be dangerous`)) {
37837
38115
  },
37838
38116
  onEditorCreate(editorInstance) {
37839
38117
  var _a3, _b;
37840
- const editorValue = yaml.dump(initialValues);
38118
+ const editorValue = yaml$1.dump(initialValues);
37841
38119
  (_a3 = editor.current) == null ? void 0 : _a3.setEditorValue(editorValue);
37842
38120
  (_b = editor.current) == null ? void 0 : _b.setValue(editorValue);
37843
38121
  if (action === "edit") {
@@ -37845,13 +38123,13 @@ WARNING: This link could potentially be dangerous`)) {
37845
38123
  }
37846
38124
  }
37847
38125
  };
37848
- }, [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]);
37849
38127
  return {
37850
38128
  form: formSF.form,
37851
38129
  formProps: {
37852
38130
  ...formSF.formProps,
37853
38131
  onFinish: (values) => {
37854
- var _a2;
38132
+ var _a2, _b;
37855
38133
  const errors = [
37856
38134
  !isYamlValid ? t2("dovetail.yaml_format_wrong") : "",
37857
38135
  !isSchemaValid ? t2("dovetail.yaml_value_wrong") : ""
@@ -37860,8 +38138,13 @@ WARNING: This link could potentially be dangerous`)) {
37860
38138
  setEditorErrors(errors);
37861
38139
  return;
37862
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
+ }
37863
38146
  try {
37864
- 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;
37865
38148
  const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
37866
38149
  return onFinish(finalValues);
37867
38150
  } catch (error) {
@@ -37891,19 +38174,19 @@ WARNING: This link could potentially be dangerous`)) {
37891
38174
  switchEditor() {
37892
38175
  var _a2, _b;
37893
38176
  if (enableEditor && ((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue())) {
37894
- const value2 = yaml.load((_b = editor.current) == null ? void 0 : _b.getEditorValue());
37895
- 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);
37896
38179
  }
37897
38180
  setEnableEditor(!enableEditor);
37898
38181
  },
37899
38182
  onFinish: async (values) => {
37900
38183
  var _a2;
37901
- 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);
37902
38185
  return await onFinish(finalValues);
37903
38186
  }
37904
38187
  };
37905
38188
  };
37906
- const YamlForm_1u3sf7g = "";
38189
+ const YamlForm_1lo4xcc = "";
37907
38190
  const FormStyle = "f1aiwt90";
37908
38191
  const EditorStyle = "e1guqlj2";
37909
38192
  var SchemaStrategy = /* @__PURE__ */ ((SchemaStrategy2) => {
@@ -37922,7 +38205,8 @@ WARNING: This link could potentially be dangerous`)) {
37922
38205
  transformInitValues,
37923
38206
  transformApplyValues,
37924
38207
  onSaveButtonPropsChange,
37925
- onErrorsChange
38208
+ onErrorsChange,
38209
+ rules
37926
38210
  } = props;
37927
38211
  const {
37928
38212
  action: actionFromResource,
@@ -37946,7 +38230,9 @@ WARNING: This link could potentially be dangerous`)) {
37946
38230
  /* None */
37947
38231
  },
37948
38232
  liveMode: "off",
37949
- initialValuesForCreate: props.initialValues ?? BASE_INIT_VALUE,
38233
+ initialValuesForCreate: props.initialValuesForCreate ?? BASE_INIT_VALUE,
38234
+ initialValuesForEdit: props.initialValuesForEdit,
38235
+ rules,
37950
38236
  successNotification(data2) {
37951
38237
  var _a;
37952
38238
  return {
@@ -38041,12 +38327,39 @@ WARNING: This link could potentially be dangerous`)) {
38041
38327
  })
38042
38328
  });
38043
38329
  }
38044
- const FormModal_bppzr9 = "";
38330
+ const FormModal_64brhp = "";
38045
38331
  const FormDescStyle = "f1nltbcu";
38046
- const MaxWidthModalStyle = "m1qgcca6";
38047
- 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
+ }
38048
38361
  function FormModal(props) {
38049
- var _a, _b, _c, _d, _e;
38362
+ var _a, _b, _c, _d, _e, _f;
38050
38363
  const {
38051
38364
  resource: resourceFromProps,
38052
38365
  id,
@@ -38061,47 +38374,60 @@ WARNING: This link could potentially be dangerous`)) {
38061
38374
  const configs = React.useContext(ConfigsContext);
38062
38375
  const [yamlSaveButtonProps, setYamlSaveButtonProps] = React.useState({});
38063
38376
  const [isError, setIsError] = React.useState(false);
38377
+ const [mode, setMode] = React.useState(
38378
+ "form"
38379
+ /* Form */
38380
+ );
38381
+ const isYamlMode = mode === "yaml";
38064
38382
  const popModal = eagle.usePopModal();
38383
+ const pushModal = eagle.usePushModal();
38065
38384
  const config = configs[resourceFromProps || (resource == null ? void 0 : resource.name) || ""];
38385
+ const isDisabledChangeMode = (_a = config.formConfig) == null ? void 0 : _a.isDisabledChangeMode;
38066
38386
  const okText = i18n2.t(id ? "dovetail.save" : "dovetail.create");
38067
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
+ });
38068
38400
  const yamlFormProps = React.useMemo(() => {
38069
38401
  var _a2, _b2, _c2;
38070
38402
  return {
38071
38403
  ...props.formProps,
38072
38404
  transformInitValues: (_a2 = config.formConfig) == null ? void 0 : _a2.transformInitValues,
38073
38405
  transformApplyValues: (_b2 = config.formConfig) == null ? void 0 : _b2.transformApplyValues,
38074
- 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,
38075
38408
  id,
38076
38409
  action,
38077
38410
  isShowLayout: false,
38078
38411
  useFormProps: {
38079
38412
  redirect: false
38080
38413
  },
38414
+ rules: isYamlMode ? fieldsConfig == null ? void 0 : fieldsConfig.map((config2) => ({
38415
+ path: config2.path,
38416
+ validators: config2.validators
38417
+ })) : void 0,
38081
38418
  onSaveButtonPropsChange: setYamlSaveButtonProps,
38082
38419
  onErrorsChange(errors) {
38083
38420
  setIsError(!!errors.length);
38084
38421
  },
38085
38422
  onFinish: popModal
38086
38423
  };
38087
- }, [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]);
38088
- const refineFormResult = useRefineForm({
38089
- config,
38090
- id,
38091
- refineProps: {
38092
- onMutationSuccess: () => {
38093
- popModal();
38094
- },
38095
- redirect: false,
38096
- ...(_c = config.formConfig) == null ? void 0 : _c.refineCoreProps
38097
- }
38098
- });
38099
- 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);
38100
38426
  const formEle = (() => {
38101
38427
  if (renderForm) {
38102
38428
  return renderForm(yamlFormProps);
38103
38429
  }
38104
- if (isYamlForm)
38430
+ if (isYamlForm || isYamlMode)
38105
38431
  return /* @__PURE__ */ jsxRuntimeExports.jsx(YamlForm, {
38106
38432
  ...yamlFormProps
38107
38433
  });
@@ -38112,7 +38438,7 @@ WARNING: This link could potentially be dangerous`)) {
38112
38438
  resourceId: id
38113
38439
  });
38114
38440
  })();
38115
- const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
38441
+ const saveButtonProps = isYamlForm || isYamlMode ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
38116
38442
  const onCancel = React.useCallback(() => {
38117
38443
  popModal();
38118
38444
  }, [popModal]);
@@ -38121,6 +38447,23 @@ WARNING: This link could potentially be dangerous`)) {
38121
38447
  setIsError(false);
38122
38448
  (_a2 = saveButtonProps.onClick) == null ? void 0 : _a2.call(saveButtonProps, e2);
38123
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]);
38124
38467
  const errorText = (() => {
38125
38468
  if (!!refineFormResult.responseErrorMsg || isError) {
38126
38469
  return i18n2.t(id ? "dovetail.save_failed" : "dovetail.create_failed");
@@ -38147,16 +38490,36 @@ WARNING: This link could potentially be dangerous`)) {
38147
38490
  return "";
38148
38491
  }, [action, config.formConfig]);
38149
38492
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Modal, {
38150
- className: cx_default(FullscreenModalStyle, isYamlForm ? "" : MaxWidthModalStyle),
38493
+ className: cx_default(FullscreenModalStyle),
38494
+ style: {
38495
+ "--max-modal-width": isYamlForm || !isDisabledChangeMode ? "1024px" : "648px"
38496
+ },
38151
38497
  width: "calc(100vw - 16px)",
38152
- 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
+ }),
38153
38516
  error: errorText ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
38154
38517
  className: ErrorStyle,
38155
38518
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.ExclamationErrorCircleFill16RedIcon, {}), " ", errorText]
38156
38519
  }) : "",
38157
38520
  okButtonProps: {
38158
38521
  ...saveButtonProps,
38159
- children: (_e = config.formConfig) == null ? void 0 : _e.saveButtonText,
38522
+ children: (_f = config.formConfig) == null ? void 0 : _f.saveButtonText,
38160
38523
  onClick: onOk
38161
38524
  },
38162
38525
  closeIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseCircleFilled$1, {}),
@@ -38170,7 +38533,7 @@ WARNING: This link could potentially be dangerous`)) {
38170
38533
  }) : void 0, formEle]
38171
38534
  });
38172
38535
  }
38173
- const RefineFormPage_aqoiay = "";
38536
+ const RefineFormPage_1v0fhor = "";
38174
38537
  const RefineFormPage = (props) => {
38175
38538
  const {
38176
38539
  config
@@ -38296,7 +38659,7 @@ WARNING: This link could potentially be dangerous`)) {
38296
38659
  }
38297
38660
  ) : null });
38298
38661
  }
38299
- const index_1wzdp7m = "";
38662
+ const index_sazpyf = "";
38300
38663
  const WrapperStyle = "wfg6u6g";
38301
38664
  const InnerBar = ({
38302
38665
  usage: usage2,
@@ -38371,7 +38734,7 @@ WARNING: This link could potentially be dangerous`)) {
38371
38734
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Modal, { ...modalProps }) : null
38372
38735
  ] });
38373
38736
  };
38374
- const index_1wt5px2 = "";
38737
+ const index_1tehui8 = "";
38375
38738
  const MenuStyle = "mdppgn0";
38376
38739
  const Menu = () => {
38377
38740
  const {
@@ -38396,7 +38759,7 @@ WARNING: This link could potentially be dangerous`)) {
38396
38759
  children: renderMenuItems(menuItems)
38397
38760
  });
38398
38761
  };
38399
- const index_1qxsm42 = "";
38762
+ const index_1po979g = "";
38400
38763
  const HeaderStyle = "h16z07g";
38401
38764
  const ContentLayoutStyle = "c1i80kj";
38402
38765
  const SiderStyle = "s18sezq1";
@@ -38552,7 +38915,7 @@ WARNING: This link could potentially be dangerous`)) {
38552
38915
  });
38553
38916
  return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: result });
38554
38917
  };
38555
- const columns_1h38dp = "";
38918
+ const columns_irlsbh = "";
38556
38919
  const DashedTitleStyle = "dh5j833";
38557
38920
  const ServiceClusterTooltipStyle = "s1fcgan";
38558
38921
  const NameLink = (props) => {
@@ -39183,13 +39546,18 @@ WARNING: This link could potentially be dangerous`)) {
39183
39546
  const {
39184
39547
  resourcesConfig,
39185
39548
  urlPrefix = "",
39549
+ schemaUrlPrefix,
39186
39550
  Layout: Layout2,
39187
39551
  history,
39188
39552
  globalStore,
39189
39553
  accessControlProvider,
39190
- routerProvider: customRouterProvider
39554
+ routerProvider: customRouterProvider,
39555
+ antdGetPopupContainer
39191
39556
  } = props;
39192
39557
  const msg = eagle.useMessage();
39558
+ React.useEffect(() => {
39559
+ msg.config({ getContainer: antdGetPopupContainer });
39560
+ }, [msg, antdGetPopupContainer]);
39193
39561
  const notCustomResources = React.useMemo(() => {
39194
39562
  return resourcesConfig.filter((c2) => !c2.isCustom);
39195
39563
  }, [resourcesConfig]);
@@ -39221,37 +39589,48 @@ WARNING: This link could potentially be dangerous`)) {
39221
39589
  };
39222
39590
  return provider;
39223
39591
  }, [msg]);
39224
- 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(
39225
- 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,
39226
39594
  {
39227
- dataProvider: {
39228
- default: k8sApiProvider.dataProvider(globalStore)
39595
+ antd5Configs: {
39596
+ getPopupContainer: antdGetPopupContainer || (() => document.body)
39229
39597
  },
39230
- routerProvider: customRouterProvider || routerProvider,
39231
- liveProvider: k8sApiProvider.liveProvider(globalStore),
39232
- notificationProvider,
39233
- options: {
39234
- warnWhenUnsavedChanges: true,
39235
- liveMode: "auto",
39236
- disableTelemetry: true
39598
+ antd4Configs: {
39599
+ getPopupContainer: antdGetPopupContainer || (() => document.body)
39237
39600
  },
39238
- accessControlProvider,
39239
- resources: resourcesConfig.map((c2) => {
39240
- return {
39241
- name: c2.name,
39242
- meta: {
39243
- resourceBasePath: c2.basePath,
39244
- kind: c2.kind,
39245
- parent: c2.parent,
39246
- 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)
39247
39606
  },
39248
- list: `${urlPrefix}/${c2.name}`,
39249
- show: `${urlPrefix}/${c2.name}/show`,
39250
- create: `${urlPrefix}/${c2.name}/create`,
39251
- edit: `${urlPrefix}/${c2.name}/edit`
39252
- };
39253
- }),
39254
- 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
+ ) })
39255
39634
  }
39256
39635
  ) }) }) }) });
39257
39636
  };
@@ -39476,7 +39855,9 @@ WARNING: This link could potentially be dangerous`)) {
39476
39855
  exports2.DrawerShow = DrawerShow;
39477
39856
  exports2.DurationColumnRenderer = DurationColumnRenderer;
39478
39857
  exports2.DurationField = DurationField;
39858
+ exports2.EditAnnotationDropdownMenuItem = EditAnnotationDropdownMenuItem;
39479
39859
  exports2.EditButton = EditButton;
39860
+ exports2.EditLabelDropdownMenuItem = EditLabelDropdownMenuItem;
39480
39861
  exports2.EventModel = EventModel;
39481
39862
  exports2.EventsTab = EventsTab;
39482
39863
  exports2.EventsTableTabField = EventsTableTabField;
@@ -39508,7 +39889,6 @@ WARNING: This link could potentially be dangerous`)) {
39508
39889
  exports2.ListPage = ListPage;
39509
39890
  exports2.Menu = Menu;
39510
39891
  exports2.MetadataForm = MetadataForm;
39511
- exports2.ModalStyle = ModalStyle;
39512
39892
  exports2.ModelPlugin = ModelPlugin;
39513
39893
  exports2.NETWORK_POLICY_INIT_VALUE = NETWORK_POLICY_INIT_VALUE;
39514
39894
  exports2.NODE_INIT_VALUE = NODE_INIT_VALUE;
@@ -39565,6 +39945,7 @@ WARNING: This link could potentially be dangerous`)) {
39565
39945
  exports2.PortsTableField = PortsTableField;
39566
39946
  exports2.ProviderPlugins = ProviderPlugins;
39567
39947
  exports2.ProvisionerColumnRenderer = ProvisionerColumnRenderer;
39948
+ exports2.REDEPLOY_TIMESTAMP_KEY = REDEPLOY_TIMESTAMP_KEY;
39568
39949
  exports2.RESOURCE_GROUP = RESOURCE_GROUP;
39569
39950
  exports2.ReferenceLink = ReferenceLink;
39570
39951
  exports2.RefineFormContent = RefineFormContent;
@@ -39628,7 +40009,6 @@ WARNING: This link could potentially be dangerous`)) {
39628
40009
  exports2.StorageClassProvisionerField = StorageClassProvisionerField;
39629
40010
  exports2.StorageClassPvField = StorageClassPvField;
39630
40011
  exports2.StorageClassPvGroup = StorageClassPvGroup;
39631
- exports2.TIMESTAMP_LABEL = TIMESTAMP_LABEL;
39632
40012
  exports2.Tabs = Tabs;
39633
40013
  exports2.Tags = Tags;
39634
40014
  exports2.TextTags = TextTags;