@dovetail-v2/refine 0.1.11-alpha.2 → 0.1.11

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 (233) hide show
  1. package/dist/{MonacoYamlDiffEditor-42ab72d2.js → MonacoYamlDiffEditor-10d71161.js} +1 -1
  2. package/dist/{index-8ae38abf.js → index-bf5bacd7.js} +324 -121
  3. package/dist/refine.js +3 -1
  4. package/dist/refine.umd.cjs +322 -119
  5. package/dist/style.css +135 -0
  6. package/lib/components/EditField/index.d.ts +3 -0
  7. package/lib/components/EditMetadataForm/KeyValueTableForm.d.ts +15 -0
  8. package/lib/components/EditMetadataForm/LabelFormatPopover.d.ts +3 -0
  9. package/lib/i18n.d.ts +20 -0
  10. package/lib/locales/zh-CN/index.d.ts +20 -0
  11. package/lib/utils/index.d.ts +1 -0
  12. package/lib/utils/validation.d.ts +8 -0
  13. package/package.json +6 -6
  14. package/lib/components/CronJobDropdown/index.d.ts +0 -9
  15. package/lib/components/K8sDropdown/index.d.ts +0 -9
  16. package/lib/components/PodDropdown/index.d.ts +0 -9
  17. package/lib/components/ReplicasDropdown/index.d.ts +0 -9
  18. package/lib/components/Table/TableToolBar.d.ts +0 -9
  19. package/lib/components/Table/TableWidgets.d.ts +0 -6
  20. package/lib/components/WorkloadDropdown/index.d.ts +0 -9
  21. package/lib/src/App.d.ts +0 -3
  22. package/lib/src/Dovetail.d.ts +0 -18
  23. package/lib/src/components/Breadcrumb/index.d.ts +0 -6
  24. package/lib/src/components/ConditionsTable/ConditionsTable.d.ts +0 -7
  25. package/lib/src/components/ConditionsTable/index.d.ts +0 -1
  26. package/lib/src/components/CreateButton/index.d.ts +0 -2
  27. package/lib/src/components/CronJobDropdown/index.d.ts +0 -9
  28. package/lib/src/components/CronjobJobsTable/index.d.ts +0 -8
  29. package/lib/src/components/DeleteButton/index.d.ts +0 -2
  30. package/lib/src/components/DeleteManyButton/index.d.ts +0 -4
  31. package/lib/src/components/DrawerShow/DrawerShow.d.ts +0 -9
  32. package/lib/src/components/DrawerShow/index.d.ts +0 -1
  33. package/lib/src/components/DurationTime/index.d.ts +0 -6
  34. package/lib/src/components/EditButton/index.d.ts +0 -2
  35. package/lib/src/components/EditField/index.d.ts +0 -15
  36. package/lib/src/components/ErrorContent/index.d.ts +0 -17
  37. package/lib/src/components/EventsTable/EventsTable.d.ts +0 -6
  38. package/lib/src/components/EventsTable/index.d.ts +0 -1
  39. package/lib/src/components/Form/FormModal.d.ts +0 -9
  40. package/lib/src/components/Form/RefineFormContent.d.ts +0 -12
  41. package/lib/src/components/Form/RefineFormPage.d.ts +0 -7
  42. package/lib/src/components/Form/YamlForm.d.ts +0 -29
  43. package/lib/src/components/Form/index.d.ts +0 -7
  44. package/lib/src/components/Form/type.d.ts +0 -17
  45. package/lib/src/components/Form/useFieldsConfig.d.ts +0 -4
  46. package/lib/src/components/Form/useReactHookForm.d.ts +0 -30
  47. package/lib/src/components/Form/useRefineForm.d.ts +0 -13
  48. package/lib/src/components/Form/useYamlForm.d.ts +0 -50
  49. package/lib/src/components/FormErrorAlert/index.d.ts +0 -9
  50. package/lib/src/components/FormLayout/index.d.ts +0 -7
  51. package/lib/src/components/FormWidgets/KeyValueListWidget.d.ts +0 -6
  52. package/lib/src/components/FormWidgets/MetadataForm.d.ts +0 -2
  53. package/lib/src/components/FormWidgets/NameInputWidget.d.ts +0 -51
  54. package/lib/src/components/FormWidgets/NamespaceSelectWidget.d.ts +0 -9
  55. package/lib/src/components/FormWidgets/index.d.ts +0 -4
  56. package/lib/src/components/FormWidgets/widget.d.ts +0 -5
  57. package/lib/src/components/ImageNames/index.d.ts +0 -5
  58. package/lib/src/components/IngressRulesComponent/index.d.ts +0 -5
  59. package/lib/src/components/IngressRulesTable/IngressRulesTable.d.ts +0 -7
  60. package/lib/src/components/IngressRulesTable/index.d.ts +0 -1
  61. package/lib/src/components/K8sDropdown/index.d.ts +0 -9
  62. package/lib/src/components/KeyValue/KeyValue.d.ts +0 -7
  63. package/lib/src/components/KeyValue/KeyValueAnnotation.d.ts +0 -6
  64. package/lib/src/components/KeyValue/KeyValueSecret.d.ts +0 -5
  65. package/lib/src/components/KeyValue/index.d.ts +0 -3
  66. package/lib/src/components/Layout/index.d.ts +0 -3
  67. package/lib/src/components/LinkFallback/index.d.ts +0 -4
  68. package/lib/src/components/ListPage/index.d.ts +0 -10
  69. package/lib/src/components/Menu/index.d.ts +0 -2
  70. package/lib/src/components/NamespacesFilter/index.d.ts +0 -11
  71. package/lib/src/components/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +0 -8
  72. package/lib/src/components/NetworkPolicyRulesViewer/index.d.ts +0 -1
  73. package/lib/src/components/PVCDistributeStorage/index.d.ts +0 -16
  74. package/lib/src/components/PageShow/PageShow.d.ts +0 -12
  75. package/lib/src/components/PageShow/index.d.ts +0 -1
  76. package/lib/src/components/PodContainersTable/PodContainersTable.d.ts +0 -8
  77. package/lib/src/components/PodContainersTable/index.d.ts +0 -1
  78. package/lib/src/components/PodDropdown/index.d.ts +0 -9
  79. package/lib/src/components/PodLog/index.d.ts +0 -6
  80. package/lib/src/components/PodSelectorTable/index.d.ts +0 -6
  81. package/lib/src/components/PodShellModal/PodShell.d.ts +0 -18
  82. package/lib/src/components/PodShellModal/index.d.ts +0 -10
  83. package/lib/src/components/PortsTable/index.d.ts +0 -7
  84. package/lib/src/components/ReferenceLink/index.d.ts +0 -8
  85. package/lib/src/components/ReplicasDropdown/index.d.ts +0 -9
  86. package/lib/src/components/ResourceCRUD/ResourceCRUD.d.ts +0 -8
  87. package/lib/src/components/ResourceCRUD/create/index.d.ts +0 -8
  88. package/lib/src/components/ResourceCRUD/index.d.ts +0 -4
  89. package/lib/src/components/ResourceCRUD/list/index.d.ts +0 -9
  90. package/lib/src/components/ResourceCRUD/show/index.d.ts +0 -9
  91. package/lib/src/components/ResourceFiledDisplays.d.ts +0 -7
  92. package/lib/src/components/ResourceLink/index.d.ts +0 -8
  93. package/lib/src/components/ResourceSelect/index.d.ts +0 -12
  94. package/lib/src/components/ResourceTable/index.d.ts +0 -9
  95. package/lib/src/components/ResourceUsageBar/index.d.ts +0 -8
  96. package/lib/src/components/Separator/index.d.ts +0 -2
  97. package/lib/src/components/ServiceComponents/index.d.ts +0 -10
  98. package/lib/src/components/Shell/ShellToolbar.d.ts +0 -16
  99. package/lib/src/components/Shell/index.d.ts +0 -74
  100. package/lib/src/components/ShowContent/ShowContent.d.ts +0 -18
  101. package/lib/src/components/ShowContent/fields.d.ts +0 -76
  102. package/lib/src/components/ShowContent/groups.d.ts +0 -24
  103. package/lib/src/components/ShowContent/index.d.ts +0 -4
  104. package/lib/src/components/ShowContent/tabs.d.ts +0 -5
  105. package/lib/src/components/StateTag/StateTag.d.ts +0 -10
  106. package/lib/src/components/StateTag/index.d.ts +0 -1
  107. package/lib/src/components/Table/TableToolBar.d.ts +0 -8
  108. package/lib/src/components/Table/TableWidgets.d.ts +0 -6
  109. package/lib/src/components/Table/index.d.ts +0 -43
  110. package/lib/src/components/Tabs/index.d.ts +0 -10
  111. package/lib/src/components/Tags/index.d.ts +0 -6
  112. package/lib/src/components/TextTags/index.d.ts +0 -6
  113. package/lib/src/components/Time/index.d.ts +0 -8
  114. package/lib/src/components/ValueDisplay/index.d.ts +0 -9
  115. package/lib/src/components/WorkloadDropdown/index.d.ts +0 -9
  116. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +0 -9
  117. package/lib/src/components/WorkloadPodsTable/index.d.ts +0 -1
  118. package/lib/src/components/WorkloadReplicas/index.d.ts +0 -17
  119. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.d.ts +0 -9
  120. package/lib/src/components/YamlEditor/MonacoYamlEditor.d.ts +0 -19
  121. package/lib/src/components/YamlEditor/YamlEditorComponent.d.ts +0 -27
  122. package/lib/src/components/YamlEditor/index.d.ts +0 -1
  123. package/lib/src/components/YamlEditor/style.d.ts +0 -11
  124. package/lib/src/components/YamlEditor/yaml.worker.d.ts +0 -1
  125. package/lib/src/components/index.d.ts +0 -49
  126. package/lib/src/constants/auth.d.ts +0 -5
  127. package/lib/src/constants/index.d.ts +0 -3
  128. package/lib/src/constants/k8s.d.ts +0 -522
  129. package/lib/src/constants/state.d.ts +0 -15
  130. package/lib/src/contexts/component.d.ts +0 -8
  131. package/lib/src/contexts/configs.d.ts +0 -4
  132. package/lib/src/contexts/global-store.d.ts +0 -6
  133. package/lib/src/contexts/index.d.ts +0 -3
  134. package/lib/src/hooks/index.d.ts +0 -8
  135. package/lib/src/hooks/useDeleteModal/index.d.ts +0 -1
  136. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.d.ts +0 -8
  137. package/lib/src/hooks/useDeleteModal/useDeleteModal.d.ts +0 -7
  138. package/lib/src/hooks/useDownloadYAML.d.ts +0 -7
  139. package/lib/src/hooks/useEagleTable/columns.d.ts +0 -47
  140. package/lib/src/hooks/useEagleTable/index.d.ts +0 -2
  141. package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +0 -56
  142. package/lib/src/hooks/useEdit.d.ts +0 -4
  143. package/lib/src/hooks/useGlobalStore.d.ts +0 -3
  144. package/lib/src/hooks/useK8sYamlEditor.d.ts +0 -5
  145. package/lib/src/hooks/useNamespaceRefineFilter.d.ts +0 -5
  146. package/lib/src/hooks/useOpenForm.d.ts +0 -8
  147. package/lib/src/hooks/useSchema.d.ts +0 -21
  148. package/lib/src/hooks/useSubmitForm.d.ts +0 -14
  149. package/lib/src/hooks/useTableData.d.ts +0 -20
  150. package/lib/src/i18n.d.ts +0 -371
  151. package/lib/src/index.d.ts +0 -12
  152. package/lib/src/locales/en-US/index.d.ts +0 -175
  153. package/lib/src/locales/index.d.ts +0 -2
  154. package/lib/src/locales/zh-CN/index.d.ts +0 -193
  155. package/lib/src/main.d.ts +0 -3
  156. package/lib/src/models/cronjob-model.d.ts +0 -15
  157. package/lib/src/models/daemonset-model.d.ts +0 -15
  158. package/lib/src/models/deployment-model.d.ts +0 -13
  159. package/lib/src/models/event-model.d.ts +0 -7
  160. package/lib/src/models/index.d.ts +0 -19
  161. package/lib/src/models/ingress-model.d.ts +0 -20
  162. package/lib/src/models/job-model.d.ts +0 -20
  163. package/lib/src/models/network-policy-model.d.ts +0 -9
  164. package/lib/src/models/node-model.d.ts +0 -17
  165. package/lib/src/models/persistent-volume-claim.d.ts +0 -13
  166. package/lib/src/models/persistent-volume.d.ts +0 -13
  167. package/lib/src/models/pod-metrics-model.d.ts +0 -8
  168. package/lib/src/models/pod-model.d.ts +0 -20
  169. package/lib/src/models/resource-model.d.ts +0 -21
  170. package/lib/src/models/service-model.d.ts +0 -24
  171. package/lib/src/models/statefulset-model.d.ts +0 -13
  172. package/lib/src/models/storage-class.d.ts +0 -16
  173. package/lib/src/models/types/index.d.ts +0 -1
  174. package/lib/src/models/types/metric.d.ts +0 -25
  175. package/lib/src/models/workload-base-model.d.ts +0 -12
  176. package/lib/src/models/workload-model.d.ts +0 -18
  177. package/lib/src/pages/configmaps/index.d.ts +0 -4
  178. package/lib/src/pages/cronjobs/create/index.d.ts +0 -3
  179. package/lib/src/pages/cronjobs/index.d.ts +0 -3
  180. package/lib/src/pages/cronjobs/list/index.d.ts +0 -3
  181. package/lib/src/pages/cronjobs/show/index.d.ts +0 -3
  182. package/lib/src/pages/daemonsets/create/index.d.ts +0 -3
  183. package/lib/src/pages/daemonsets/index.d.ts +0 -3
  184. package/lib/src/pages/daemonsets/list/index.d.ts +0 -3
  185. package/lib/src/pages/daemonsets/show/index.d.ts +0 -3
  186. package/lib/src/pages/deployments/index.d.ts +0 -2
  187. package/lib/src/pages/deployments/list/index.d.ts +0 -3
  188. package/lib/src/pages/deployments/show/index.d.ts +0 -3
  189. package/lib/src/pages/ingresses/index.d.ts +0 -4
  190. package/lib/src/pages/jobs/index.d.ts +0 -4
  191. package/lib/src/pages/networkPolicies/index.d.ts +0 -4
  192. package/lib/src/pages/nodes/index.d.ts +0 -2
  193. package/lib/src/pages/nodes/list/index.d.ts +0 -3
  194. package/lib/src/pages/nodes/show/index.d.ts +0 -3
  195. package/lib/src/pages/persistentvolumeclaims/index.d.ts +0 -4
  196. package/lib/src/pages/persistentvolumes/index.d.ts +0 -4
  197. package/lib/src/pages/pods/create/index.d.ts +0 -3
  198. package/lib/src/pages/pods/index.d.ts +0 -3
  199. package/lib/src/pages/pods/list/index.d.ts +0 -3
  200. package/lib/src/pages/pods/show/index.d.ts +0 -3
  201. package/lib/src/pages/secrets/index.d.ts +0 -4
  202. package/lib/src/pages/services/index.d.ts +0 -4
  203. package/lib/src/pages/statefulsets/index.d.ts +0 -4
  204. package/lib/src/pages/storageclasses/form/index.d.ts +0 -9
  205. package/lib/src/pages/storageclasses/index.d.ts +0 -48
  206. package/lib/src/plugins/index.d.ts +0 -4
  207. package/lib/src/plugins/model-plugin.d.ts +0 -13
  208. package/lib/src/plugins/relation-plugin.d.ts +0 -26
  209. package/lib/src/plugins/type.d.ts +0 -8
  210. package/lib/src/providers/index.d.ts +0 -1
  211. package/lib/src/providers/router-provider/index.d.ts +0 -21
  212. package/lib/src/styles/button.d.ts +0 -1
  213. package/lib/src/styles/modal.d.ts +0 -1
  214. package/lib/src/types/index.d.ts +0 -1
  215. package/lib/src/types/resource.d.ts +0 -62
  216. package/lib/src/utils/addId.d.ts +0 -3
  217. package/lib/src/utils/download.d.ts +0 -1
  218. package/lib/src/utils/error.d.ts +0 -20
  219. package/lib/src/utils/form.d.ts +0 -3
  220. package/lib/src/utils/index.d.ts +0 -1
  221. package/lib/src/utils/k8s.d.ts +0 -3
  222. package/lib/src/utils/labels.d.ts +0 -9
  223. package/lib/src/utils/match-selector.d.ts +0 -3
  224. package/lib/src/utils/openapi.d.ts +0 -40
  225. package/lib/src/utils/schema.d.ts +0 -18
  226. package/lib/src/utils/selector.d.ts +0 -3
  227. package/lib/src/utils/shell.d.ts +0 -16
  228. package/lib/src/utils/storage.d.ts +0 -13
  229. package/lib/src/utils/string.d.ts +0 -1
  230. package/lib/src/utils/time.d.ts +0 -13
  231. package/lib/src/utils/unit.d.ts +0 -12
  232. package/lib/src/utils/yaml.d.ts +0 -2
  233. package/lib/vite.config.d.ts +0 -2
@@ -1455,6 +1455,7 @@ var __publicField = (obj, key, value) => {
1455
1455
  const protocol = "协议";
1456
1456
  const key = "键";
1457
1457
  const value = "值";
1458
+ const value_optional = "值(选填)";
1458
1459
  const effect = "效果";
1459
1460
  const show_data_value = "显示数值";
1460
1461
  const hide_data_value = "隐藏数值";
@@ -1555,6 +1556,25 @@ var __publicField = (obj, key, value) => {
1555
1556
  const pvc_storage_required = "请填写分配量。";
1556
1557
  const pvc_storage_min = "请输入正整数。";
1557
1558
  const pvc_storage_reduce_limit = "输入值不得小于当前数值。";
1559
+ const key_empty_text = "请填写键。";
1560
+ const format_error = "格式错误。";
1561
+ const taint_effect_empty_text = "请选择效果。";
1562
+ const add_label = "添加标签";
1563
+ const add_annotation = "添加注解";
1564
+ const add_taint = "添加污点";
1565
+ const look_format_requirement = "查看格式要求";
1566
+ const yes = "是";
1567
+ const no = "否";
1568
+ const contains = "包含";
1569
+ const optional = "是否必填";
1570
+ const format_requirements = "格式要求";
1571
+ const suffix = "前缀";
1572
+ const suffix_format_rule_1 = "DNS 子域:由点 (.) 分隔的一系列 DNS 标签";
1573
+ const suffix_format_rule_2 = "不超过 253 个字符";
1574
+ const suffix_format_rule_3 = "后跟斜杠 (/),即第一个 (/) 前的内容是前缀。如有 (/) ,前缀不可为空";
1575
+ const name_format_rule_1 = "由字母、数字、连字符 (-)、下划线(_) 或点 (.) 组成";
1576
+ const name_format_rule_2 = "以字母或数字开头和结尾";
1577
+ const name_format_rule_3 = "不超过 63 个字符";
1558
1578
  const dovetail = {
1559
1579
  copy: copy$1,
1560
1580
  reset_arguments,
@@ -1661,6 +1681,7 @@ var __publicField = (obj, key, value) => {
1661
1681
  protocol,
1662
1682
  key,
1663
1683
  value,
1684
+ value_optional,
1664
1685
  effect,
1665
1686
  show_data_value,
1666
1687
  hide_data_value,
@@ -1762,7 +1783,26 @@ var __publicField = (obj, key, value) => {
1762
1783
  change_form_mode_alert,
1763
1784
  pvc_storage_required,
1764
1785
  pvc_storage_min,
1765
- pvc_storage_reduce_limit
1786
+ pvc_storage_reduce_limit,
1787
+ key_empty_text,
1788
+ format_error,
1789
+ taint_effect_empty_text,
1790
+ add_label,
1791
+ add_annotation,
1792
+ add_taint,
1793
+ look_format_requirement,
1794
+ yes,
1795
+ no,
1796
+ contains,
1797
+ optional,
1798
+ format_requirements,
1799
+ suffix,
1800
+ suffix_format_rule_1,
1801
+ suffix_format_rule_2,
1802
+ suffix_format_rule_3,
1803
+ name_format_rule_1,
1804
+ name_format_rule_2,
1805
+ name_format_rule_3
1766
1806
  };
1767
1807
  const ZH = {
1768
1808
  dovetail
@@ -9362,7 +9402,7 @@ var __publicField = (obj, key, value) => {
9362
9402
  function formatSi(inValue, options) {
9363
9403
  const {
9364
9404
  increment = 1e3,
9365
- suffix = null,
9405
+ suffix: suffix2 = null,
9366
9406
  firstSuffix = null,
9367
9407
  startingExponent = 0,
9368
9408
  minExponent = 0,
@@ -9390,7 +9430,7 @@ var __publicField = (obj, key, value) => {
9390
9430
  if (exp === 0 && firstSuffix !== null) {
9391
9431
  outStr += `${firstSuffix}`;
9392
9432
  } else {
9393
- outStr += `${UNITS[exp]}${suffix}` || "";
9433
+ outStr += `${UNITS[exp]}${suffix2}` || "";
9394
9434
  }
9395
9435
  return outStr;
9396
9436
  }
@@ -35484,7 +35524,6 @@ WARNING: This link could potentially be dangerous`)) {
35484
35524
  tableProps,
35485
35525
  contentClassName
35486
35526
  } = props;
35487
- useTranslation();
35488
35527
  const {
35489
35528
  resource
35490
35529
  } = core.useResource();
@@ -39023,83 +39062,271 @@ WARNING: This link could potentially be dangerous`)) {
39023
39062
  }
39024
39063
  ) : null });
39025
39064
  }
39065
+ function validateLabelKey(key2) {
39066
+ const labelPrefixRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.]*[a-zA-Z0-9]$)/;
39067
+ const labelNameRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
39068
+ let prefix, name2;
39069
+ const splitResult = key2.split("/");
39070
+ if (splitResult.length === 1) {
39071
+ name2 = splitResult[0];
39072
+ } else {
39073
+ prefix = splitResult[0];
39074
+ name2 = splitResult[1];
39075
+ }
39076
+ if (prefix === "") {
39077
+ return { isValid: false, errorMessage: "EMPTY_PREFIX" };
39078
+ }
39079
+ if (prefix && !labelPrefixRegex.test(prefix)) {
39080
+ return { isValid: false, errorMessage: "INVALID_PREFIX" };
39081
+ }
39082
+ if (!labelNameRegex.test(name2)) {
39083
+ return { isValid: false, errorMessage: "INVALID_NAME" };
39084
+ }
39085
+ if (prefix && prefix.length > 253) {
39086
+ return { isValid: false, errorMessage: "MAX_253" };
39087
+ }
39088
+ if (name2 && name2.length > 63) {
39089
+ return { isValid: false, errorMessage: "MAX_63" };
39090
+ }
39091
+ return { isValid: true };
39092
+ }
39093
+ function validateLabelValue(value2) {
39094
+ const labelValueRegex = /(^[a-zA-Z0-9]$)|(^[a-zA-Z0-9][a-zA-Z0-9\.\-]*[a-zA-Z0-9]$)/;
39095
+ if (value2 === "") {
39096
+ return { isValid: true };
39097
+ }
39098
+ if (value2.length > 63) {
39099
+ return { isValid: false, errorMessage: "MAX_63" };
39100
+ }
39101
+ if (!labelValueRegex.test(value2)) {
39102
+ return { isValid: false, errorMessage: "INVALID_VALUE" };
39103
+ }
39104
+ return { isValid: true };
39105
+ }
39106
+ const LabelFormatPopover_105yfzn = "";
39107
+ const PodLabelFormatRulePopoverStyle = "p5jt6nm";
39108
+ const LabelFormatPopover = () => {
39109
+ const {
39110
+ t: t2
39111
+ } = useTranslation();
39112
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Popover, {
39113
+ overlayClassName: PodLabelFormatRulePopoverStyle,
39114
+ placement: "bottomRight",
39115
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.AntdTable, {
39116
+ bordered: true,
39117
+ dataSource: [{
39118
+ object: t2("dovetail.key"),
39119
+ contains: t2("dovetail.suffix"),
39120
+ optional: t2("dovetail.no"),
39121
+ rule: [t2("dovetail.suffix_format_rule_1"), t2("dovetail.suffix_format_rule_2"), t2("dovetail.suffix_format_rule_3")]
39122
+ }, {
39123
+ object: t2("dovetail.key"),
39124
+ contains: t2("dovetail.name"),
39125
+ optional: t2("dovetail.yes"),
39126
+ rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
39127
+ }, {
39128
+ object: t2("dovetail.value"),
39129
+ contains: t2("dovetail.name"),
39130
+ optional: t2("dovetail.no"),
39131
+ rule: [t2("dovetail.name_format_rule_1"), t2("dovetail.name_format_rule_2"), t2("dovetail.name_format_rule_3")]
39132
+ }],
39133
+ columns: [{
39134
+ key: "object",
39135
+ title: t2("dovetail.object"),
39136
+ dataIndex: "object",
39137
+ render: (cell, record, index2) => {
39138
+ return {
39139
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
39140
+ className: eagle.Typo.Label.l4_bold,
39141
+ children: cell
39142
+ }),
39143
+ props: {
39144
+ rowSpan: index2 === 0 ? 2 : index2 === 1 ? 0 : 1
39145
+ }
39146
+ };
39147
+ }
39148
+ }, {
39149
+ key: "contains",
39150
+ title: t2("dovetail.contains"),
39151
+ dataIndex: "contains"
39152
+ }, {
39153
+ key: "optional",
39154
+ title: t2("dovetail.optional"),
39155
+ dataIndex: "optional"
39156
+ }, {
39157
+ key: "rule",
39158
+ title: t2("dovetail.format_requirements"),
39159
+ dataIndex: "rule",
39160
+ render: (cell) => {
39161
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
39162
+ className: "rule-list",
39163
+ children: cell.map((rule2, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx("li", {
39164
+ children: rule2
39165
+ }, index2))
39166
+ });
39167
+ }
39168
+ }],
39169
+ pagination: false
39170
+ }),
39171
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
39172
+ size: "small",
39173
+ type: "link",
39174
+ children: t2("dovetail.look_format_requirement")
39175
+ })
39176
+ });
39177
+ };
39178
+ const KeyValueTableForm_1eydq7y = "";
39179
+ function _KeyValueTableFormForm(props, ref) {
39180
+ const {
39181
+ defaultValue,
39182
+ onSubmit,
39183
+ extraColumns,
39184
+ addButtonText
39185
+ } = props;
39186
+ const {
39187
+ t: t2
39188
+ } = useTranslation();
39189
+ const [value2, setValue] = React.useState([]);
39190
+ const tableFormRef = React.useRef(null);
39191
+ React.useImperativeHandle(ref, () => ({
39192
+ submit: () => {
39193
+ return new Promise((res, rej) => {
39194
+ var _a;
39195
+ (_a = tableFormRef.current) == null ? void 0 : _a.validateWholeFields();
39196
+ setTimeout(() => {
39197
+ var _a2;
39198
+ const isValid = (_a2 = tableFormRef.current) == null ? void 0 : _a2.isValid();
39199
+ if (isValid) {
39200
+ res(onSubmit(value2));
39201
+ } else {
39202
+ rej();
39203
+ }
39204
+ }, 0);
39205
+ });
39206
+ }
39207
+ }), [onSubmit, value2]);
39208
+ const renderTextAreaFunc = ({
39209
+ value: value22,
39210
+ onChange
39211
+ }) => {
39212
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.TextArea, {
39213
+ autoSize: true,
39214
+ className: "clsjtk2",
39215
+ size: "small",
39216
+ value: value22,
39217
+ onChange: (e2) => {
39218
+ onChange(e2.target.value);
39219
+ }
39220
+ });
39221
+ };
39222
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
39223
+ size: 8,
39224
+ direction: "vertical",
39225
+ className: "cq3mbby",
39226
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(eagle.TableForm, {
39227
+ ref: tableFormRef,
39228
+ onBodyChange: (value22) => {
39229
+ setValue(value22);
39230
+ },
39231
+ columns: [{
39232
+ key: "key",
39233
+ title: t2("dovetail.key"),
39234
+ type: "input",
39235
+ validator: ({
39236
+ value: value22
39237
+ }) => {
39238
+ if (!value22)
39239
+ return t2("dovetail.key_empty_text");
39240
+ const {
39241
+ isValid,
39242
+ errorMessage
39243
+ } = validateLabelKey(value22 || "");
39244
+ if (!isValid)
39245
+ return t2("dovetail.format_error");
39246
+ },
39247
+ render: renderTextAreaFunc
39248
+ }, {
39249
+ key: "value",
39250
+ title: t2("dovetail.value_optional"),
39251
+ type: "input",
39252
+ validator: ({
39253
+ value: value22
39254
+ }) => {
39255
+ const {
39256
+ isValid
39257
+ } = validateLabelValue(value22 || "");
39258
+ if (!isValid)
39259
+ return t2("dovetail.format_error");
39260
+ },
39261
+ render: renderTextAreaFunc
39262
+ }, ...extraColumns || []],
39263
+ disableBatchFilling: true,
39264
+ hideEmptyTable: true,
39265
+ rowAddConfig: {
39266
+ addible: true,
39267
+ text: () => addButtonText
39268
+ },
39269
+ defaultData: defaultValue,
39270
+ row: {
39271
+ deletable: true
39272
+ }
39273
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(LabelFormatPopover, {})]
39274
+ });
39275
+ }
39276
+ const KeyValueTableFormForm = React.forwardRef(_KeyValueTableFormForm);
39026
39277
  const EditLabelForm = React.forwardRef(
39027
39278
  function EditLabelForm2(props, ref) {
39028
39279
  var _a;
39029
39280
  const { resourceModel } = props;
39030
39281
  const { mutateAsync } = core.useUpdate();
39031
39282
  const { t: t2 } = useTranslation();
39032
- const [value2, setValue] = React.useState([]);
39033
39283
  const defaultValue = React.useMemo(() => {
39034
39284
  var _a2;
39035
39285
  return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.labels) || {}).map((key2) => {
39036
39286
  var _a3, _b;
39037
- return { key: key2, value: (_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.labels) == null ? void 0 : _b[key2] };
39287
+ return { key: key2, value: ((_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.labels) == null ? void 0 : _b[key2]) || "" };
39038
39288
  });
39039
39289
  }, [(_a = resourceModel.metadata) == null ? void 0 : _a.labels]);
39040
- const submit = React.useCallback(() => {
39041
- const newLabels = {};
39042
- value2.forEach(({ key: key2, value: value22 }) => {
39043
- newLabels[key2] = value22;
39044
- });
39045
- const newYaml = resourceModel.updateLabel(newLabels);
39046
- pruneBeforeEdit(newYaml);
39047
- return mutateAsync({
39048
- id: resourceModel.id,
39049
- resource: resourceModel.name || "",
39050
- values: newYaml,
39051
- meta: {
39052
- resourceBasePath: resourceModel.apiVersion,
39053
- kind: resourceModel.kind
39054
- },
39055
- successNotification() {
39056
- return {
39057
- message: t2("dovetail.edit_label_success_toast", {
39058
- kind: resourceModel.kind,
39059
- name: resourceModel.metadata.name,
39060
- interpolation: {
39061
- escapeValue: false
39062
- }
39063
- }),
39064
- type: "success"
39065
- };
39066
- },
39067
- errorNotification: false
39068
- });
39069
- }, [value2, resourceModel, mutateAsync, t2]);
39070
- React.useImperativeHandle(
39071
- ref,
39072
- () => ({
39073
- submit
39074
- }),
39075
- [submit]
39290
+ const onSubmit = React.useCallback(
39291
+ (value2) => {
39292
+ const newLabels = {};
39293
+ value2.forEach(({ key: key2, value: value22 }) => {
39294
+ newLabels[key2] = value22 || "";
39295
+ });
39296
+ const newYaml = resourceModel.updateLabel(newLabels);
39297
+ pruneBeforeEdit(newYaml);
39298
+ return mutateAsync({
39299
+ id: resourceModel.id,
39300
+ resource: resourceModel.name || "",
39301
+ values: newYaml,
39302
+ meta: {
39303
+ resourceBasePath: resourceModel.apiVersion,
39304
+ kind: resourceModel.kind
39305
+ },
39306
+ successNotification() {
39307
+ return {
39308
+ message: t2("dovetail.edit_label_success_toast", {
39309
+ kind: resourceModel.kind,
39310
+ name: resourceModel.metadata.name,
39311
+ interpolation: {
39312
+ escapeValue: false
39313
+ }
39314
+ }),
39315
+ type: "success"
39316
+ };
39317
+ },
39318
+ errorNotification: false
39319
+ });
39320
+ },
39321
+ [resourceModel, mutateAsync, t2]
39076
39322
  );
39077
39323
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
39078
- eagle.TableForm,
39324
+ KeyValueTableFormForm,
39079
39325
  {
39080
- onBodyChange: (value22) => {
39081
- setValue(value22);
39082
- },
39083
- columns: [
39084
- {
39085
- key: "key",
39086
- title: t2("dovetail.key"),
39087
- type: "input"
39088
- },
39089
- {
39090
- key: "value",
39091
- title: t2("dovetail.value"),
39092
- type: "input"
39093
- }
39094
- ],
39095
- disableBatchFilling: true,
39096
- rowAddConfig: {
39097
- addible: true
39098
- },
39099
- defaultData: defaultValue,
39100
- row: {
39101
- deletable: true
39102
- }
39326
+ ref,
39327
+ defaultValue,
39328
+ onSubmit,
39329
+ addButtonText: t2("dovetail.add_label")
39103
39330
  }
39104
39331
  );
39105
39332
  }
@@ -39136,24 +39363,23 @@ WARNING: This link could potentially be dangerous`)) {
39136
39363
  }
39137
39364
  );
39138
39365
  }
39139
- const EditAnnotationForm = React.forwardRef(
39140
- function EditAnnotationForm2(props, ref) {
39141
- var _a;
39142
- const { resourceModel } = props;
39143
- const { mutateAsync } = core.useUpdate();
39144
- const { t: t2 } = useTranslation();
39145
- const [value2, setValue] = React.useState([]);
39146
- const defaultValue = React.useMemo(() => {
39147
- var _a2;
39148
- return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.annotations) || {}).map((key2) => {
39149
- var _a3, _b;
39150
- return { key: key2, value: (_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.annotations) == null ? void 0 : _b[key2] };
39151
- });
39152
- }, [(_a = resourceModel.metadata) == null ? void 0 : _a.annotations]);
39153
- const submit = React.useCallback(() => {
39366
+ const EditAnnotationForm = React.forwardRef(function EditAnnotationForm2(props, ref) {
39367
+ var _a;
39368
+ const { resourceModel } = props;
39369
+ const { mutateAsync } = core.useUpdate();
39370
+ const { t: t2 } = useTranslation();
39371
+ const defaultValue = React.useMemo(() => {
39372
+ var _a2;
39373
+ return Object.keys(((_a2 = resourceModel.metadata) == null ? void 0 : _a2.annotations) || {}).map((key2) => {
39374
+ var _a3, _b;
39375
+ return { key: key2, value: ((_b = (_a3 = resourceModel.metadata) == null ? void 0 : _a3.annotations) == null ? void 0 : _b[key2]) || "" };
39376
+ });
39377
+ }, [(_a = resourceModel.metadata) == null ? void 0 : _a.annotations]);
39378
+ const onSubmit = React.useCallback(
39379
+ (value2) => {
39154
39380
  const newAnnotations = {};
39155
39381
  value2.forEach(({ key: key2, value: value22 }) => {
39156
- newAnnotations[key2] = value22;
39382
+ newAnnotations[key2] = value22 || "";
39157
39383
  });
39158
39384
  const newYaml = resourceModel.updateAnnotation(newAnnotations);
39159
39385
  pruneBeforeEdit(newYaml);
@@ -39179,44 +39405,19 @@ WARNING: This link could potentially be dangerous`)) {
39179
39405
  },
39180
39406
  errorNotification: false
39181
39407
  });
39182
- }, [value2, resourceModel, mutateAsync, t2]);
39183
- React.useImperativeHandle(
39408
+ },
39409
+ [resourceModel, mutateAsync, t2]
39410
+ );
39411
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
39412
+ KeyValueTableFormForm,
39413
+ {
39184
39414
  ref,
39185
- () => ({
39186
- submit
39187
- }),
39188
- [submit]
39189
- );
39190
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
39191
- eagle.TableForm,
39192
- {
39193
- onBodyChange: (value22) => {
39194
- setValue(value22);
39195
- },
39196
- columns: [
39197
- {
39198
- key: "key",
39199
- title: t2("dovetail.key"),
39200
- type: "input"
39201
- },
39202
- {
39203
- key: "value",
39204
- title: t2("dovetail.value"),
39205
- type: "input"
39206
- }
39207
- ],
39208
- disableBatchFilling: true,
39209
- rowAddConfig: {
39210
- addible: true
39211
- },
39212
- defaultData: defaultValue,
39213
- row: {
39214
- deletable: true
39215
- }
39216
- }
39217
- );
39218
- }
39219
- );
39415
+ defaultValue,
39416
+ onSubmit,
39417
+ addButtonText: t2("dovetail.add_annotation")
39418
+ }
39419
+ );
39420
+ });
39220
39421
  function EditAnnotationDropdownMenuItem(props) {
39221
39422
  const { formRef, resourceModel } = props;
39222
39423
  const { t: t2 } = useTranslation();
@@ -40733,8 +40934,10 @@ WARNING: This link could potentially be dangerous`)) {
40733
40934
  exports2.dovetailRefineI18n = dovetailRefineI18n;
40734
40935
  exports2.generateSchemaTypeValue = generateSchemaTypeValue;
40735
40936
  exports2.generateValueFromSchema = generateValueFromSchema;
40937
+ exports2.getApiVersion = getApiVersion;
40736
40938
  exports2.modelPlugin = modelPlugin;
40737
40939
  exports2.namespaceRules = namespaceRules;
40940
+ exports2.pruneBeforeEdit = pruneBeforeEdit;
40738
40941
  exports2.relationPlugin = relationPlugin;
40739
40942
  exports2.resolveRef = resolveRef;
40740
40943
  exports2.rfc1035LabelRules = rfc1035LabelRules;
package/dist/style.css CHANGED
@@ -4200,6 +4200,141 @@
4200
4200
  /* box shadow */
4201
4201
  /* fisheye */
4202
4202
  /* z-index */
4203
+ .p5jt6nm .ant-popover-inner {
4204
+ border-radius: 8px;
4205
+ }
4206
+ .p5jt6nm .ant-popover-innerntent {
4207
+ padding: 12px;
4208
+ }
4209
+ .p5jt6nm .ant-popover-content > .ant-popover-arrow {
4210
+ display: none;
4211
+ }
4212
+ .p5jt6nm td.ant-table-cell {
4213
+ vertical-align: middle;
4214
+ }
4215
+ .p5jt6nm .rule-list {
4216
+ list-style: disc;
4217
+ list-style-position: inside;
4218
+ }
4219
+ .p5jt6nm .ant-table {
4220
+ font-size: 12px;
4221
+ line-height: 18px;
4222
+ }
4223
+ .p5jt6nm .ant-table .ant-table-container {
4224
+ border: none !important;
4225
+ }
4226
+ .p5jt6nm .ant-table .ant-table-thead {
4227
+ font-weight: 700;
4228
+ }
4229
+ .p5jt6nm .ant-table .ant-table-thead > tr > th {
4230
+ background: #fff;
4231
+ }
4232
+ .p5jt6nm .ant-table thead > tr > th:last-child,
4233
+ .p5jt6nm .ant-table tbody > tr > td:last-child {
4234
+ border-right: none !important;
4235
+ }
4236
+ .p5jt6nm .ant-table tbody > tr:last-child > td {
4237
+ border-bottom: none;
4238
+ }/* // basic */
4239
+ /* FishEye Color Variables and Functions */
4240
+ /*
4241
+ --------------------------- Primary Color ---------------------------
4242
+ */
4243
+ /*
4244
+ ---------------------------When necessary to add at any time---------------------------
4245
+ */
4246
+ /* computed */
4247
+ /* blue */
4248
+ /* green */
4249
+ /* yellow */
4250
+ /* red */
4251
+ /* purple */
4252
+ /* palette global token*/
4253
+ /* color opaque */
4254
+ /* color transparent */
4255
+ /* blue transparent */
4256
+ /* green transparent */
4257
+ /* yellow transparent */
4258
+ /* red transparent */
4259
+ /* gray transparent */
4260
+ /* white transparent */
4261
+ /* gradient opaque */
4262
+ /* blue radial gradient */
4263
+ /* blue linear gradient */
4264
+ /* green radial gradient */
4265
+ /* yellow radial gradient */
4266
+ /* red radial gradient */
4267
+ /* gray radial gradient */
4268
+ /* white to gray radial gradient */
4269
+ /* white to gray linear gradient */
4270
+ /* gradient transparent */
4271
+ /* secondary palette */
4272
+ /* purple radial gradient */
4273
+ /* refine alias color */
4274
+ /* text */
4275
+ /* link */
4276
+ /* fill */
4277
+ /* fill element */
4278
+ /* fill interaction */
4279
+ /* stroke */
4280
+ /* background */
4281
+ /* dim */
4282
+ /* box shadow */
4283
+ /* fisheye */
4284
+ /* z-index */
4285
+ .clsjtk2 {
4286
+ min-height: 24px !important;
4287
+ }
4288
+
4289
+ .cq3mbby {
4290
+ width: 100%;
4291
+ }/* // basic */
4292
+ /* FishEye Color Variables and Functions */
4293
+ /*
4294
+ --------------------------- Primary Color ---------------------------
4295
+ */
4296
+ /*
4297
+ ---------------------------When necessary to add at any time---------------------------
4298
+ */
4299
+ /* computed */
4300
+ /* blue */
4301
+ /* green */
4302
+ /* yellow */
4303
+ /* red */
4304
+ /* purple */
4305
+ /* palette global token*/
4306
+ /* color opaque */
4307
+ /* color transparent */
4308
+ /* blue transparent */
4309
+ /* green transparent */
4310
+ /* yellow transparent */
4311
+ /* red transparent */
4312
+ /* gray transparent */
4313
+ /* white transparent */
4314
+ /* gradient opaque */
4315
+ /* blue radial gradient */
4316
+ /* blue linear gradient */
4317
+ /* green radial gradient */
4318
+ /* yellow radial gradient */
4319
+ /* red radial gradient */
4320
+ /* gray radial gradient */
4321
+ /* white to gray radial gradient */
4322
+ /* white to gray linear gradient */
4323
+ /* gradient transparent */
4324
+ /* secondary palette */
4325
+ /* purple radial gradient */
4326
+ /* refine alias color */
4327
+ /* text */
4328
+ /* link */
4329
+ /* fill */
4330
+ /* fill element */
4331
+ /* fill interaction */
4332
+ /* stroke */
4333
+ /* background */
4334
+ /* dim */
4335
+ /* box shadow */
4336
+ /* fisheye */
4337
+ /* z-index */
4203
4338
  .wfg6u6g {
4204
4339
  display: flex;
4205
4340
  align-items: center;
@@ -1,4 +1,7 @@
1
1
  import React from 'react';
2
+ export interface EditFieldFormHandler {
3
+ submit: () => Promise<unknown> | undefined;
4
+ }
2
5
  export interface EditFieldModalProps {
3
6
  title?: string;
4
7
  submitting?: boolean;