@dovetail-v2/refine 0.1.14-alpha.2 → 0.1.14-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/{MonacoYamlDiffEditor-b8dc52f9.js → MonacoYamlDiffEditor-2636b66c.js} +1 -1
  2. package/dist/{index-5616d403.js → index-45c3dd0a.js} +55 -39
  3. package/dist/refine.js +1 -1
  4. package/dist/refine.umd.cjs +54 -38
  5. package/lib/components/CronJobDropdown/index.d.ts +9 -0
  6. package/lib/components/Form/useReactHookForm.d.ts +3 -1
  7. package/lib/components/K8sDropdown/index.d.ts +9 -0
  8. package/lib/components/PodDropdown/index.d.ts +9 -0
  9. package/lib/components/ReplicasDropdown/index.d.ts +9 -0
  10. package/lib/components/Table/TableToolBar.d.ts +9 -0
  11. package/lib/components/Table/TableWidgets.d.ts +6 -0
  12. package/lib/components/WorkloadDropdown/index.d.ts +9 -0
  13. package/lib/constants/k8s.d.ts +4 -2
  14. package/lib/pages/storageclasses/index.d.ts +3 -1
  15. package/lib/src/App.d.ts +3 -0
  16. package/lib/src/Dovetail.d.ts +18 -0
  17. package/lib/src/components/Breadcrumb/index.d.ts +6 -0
  18. package/lib/src/components/ConditionsTable/ConditionsTable.d.ts +7 -0
  19. package/lib/src/components/ConditionsTable/index.d.ts +1 -0
  20. package/lib/src/components/CreateButton/index.d.ts +2 -0
  21. package/lib/src/components/CronJobDropdown/index.d.ts +9 -0
  22. package/lib/src/components/CronjobJobsTable/index.d.ts +8 -0
  23. package/lib/src/components/DeleteButton/index.d.ts +2 -0
  24. package/lib/src/components/DeleteManyButton/index.d.ts +4 -0
  25. package/lib/src/components/DrawerShow/DrawerShow.d.ts +9 -0
  26. package/lib/src/components/DrawerShow/index.d.ts +1 -0
  27. package/lib/src/components/DurationTime/index.d.ts +6 -0
  28. package/lib/src/components/EditButton/index.d.ts +2 -0
  29. package/lib/src/components/EditField/index.d.ts +15 -0
  30. package/lib/src/components/ErrorContent/index.d.ts +17 -0
  31. package/lib/src/components/EventsTable/EventsTable.d.ts +6 -0
  32. package/lib/src/components/EventsTable/index.d.ts +1 -0
  33. package/lib/src/components/Form/FormModal.d.ts +9 -0
  34. package/lib/src/components/Form/RefineFormContent.d.ts +12 -0
  35. package/lib/src/components/Form/RefineFormPage.d.ts +7 -0
  36. package/lib/src/components/Form/YamlForm.d.ts +29 -0
  37. package/lib/src/components/Form/index.d.ts +7 -0
  38. package/lib/src/components/Form/type.d.ts +17 -0
  39. package/lib/src/components/Form/useFieldsConfig.d.ts +4 -0
  40. package/lib/src/components/Form/useReactHookForm.d.ts +30 -0
  41. package/lib/src/components/Form/useRefineForm.d.ts +13 -0
  42. package/lib/src/components/Form/useYamlForm.d.ts +50 -0
  43. package/lib/src/components/FormErrorAlert/index.d.ts +9 -0
  44. package/lib/src/components/FormLayout/index.d.ts +7 -0
  45. package/lib/src/components/FormWidgets/KeyValueListWidget.d.ts +6 -0
  46. package/lib/src/components/FormWidgets/MetadataForm.d.ts +2 -0
  47. package/lib/src/components/FormWidgets/NameInputWidget.d.ts +51 -0
  48. package/lib/src/components/FormWidgets/NamespaceSelectWidget.d.ts +9 -0
  49. package/lib/src/components/FormWidgets/index.d.ts +4 -0
  50. package/lib/src/components/FormWidgets/widget.d.ts +5 -0
  51. package/lib/src/components/ImageNames/index.d.ts +5 -0
  52. package/lib/src/components/IngressRulesComponent/index.d.ts +5 -0
  53. package/lib/src/components/IngressRulesTable/IngressRulesTable.d.ts +7 -0
  54. package/lib/src/components/IngressRulesTable/index.d.ts +1 -0
  55. package/lib/src/components/K8sDropdown/index.d.ts +9 -0
  56. package/lib/src/components/KeyValue/KeyValue.d.ts +7 -0
  57. package/lib/src/components/KeyValue/KeyValueAnnotation.d.ts +6 -0
  58. package/lib/src/components/KeyValue/KeyValueSecret.d.ts +5 -0
  59. package/lib/src/components/KeyValue/index.d.ts +3 -0
  60. package/lib/src/components/Layout/index.d.ts +3 -0
  61. package/lib/src/components/LinkFallback/index.d.ts +4 -0
  62. package/lib/src/components/ListPage/index.d.ts +10 -0
  63. package/lib/src/components/Menu/index.d.ts +2 -0
  64. package/lib/src/components/NamespacesFilter/index.d.ts +11 -0
  65. package/lib/src/components/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +8 -0
  66. package/lib/src/components/NetworkPolicyRulesViewer/index.d.ts +1 -0
  67. package/lib/src/components/PVCDistributeStorage/index.d.ts +16 -0
  68. package/lib/src/components/PageShow/PageShow.d.ts +12 -0
  69. package/lib/src/components/PageShow/index.d.ts +1 -0
  70. package/lib/src/components/PodContainersTable/PodContainersTable.d.ts +8 -0
  71. package/lib/src/components/PodContainersTable/index.d.ts +1 -0
  72. package/lib/src/components/PodDropdown/index.d.ts +9 -0
  73. package/lib/src/components/PodLog/index.d.ts +6 -0
  74. package/lib/src/components/PodSelectorTable/index.d.ts +6 -0
  75. package/lib/src/components/PodShellModal/PodShell.d.ts +18 -0
  76. package/lib/src/components/PodShellModal/index.d.ts +10 -0
  77. package/lib/src/components/PortsTable/index.d.ts +7 -0
  78. package/lib/src/components/ReferenceLink/index.d.ts +8 -0
  79. package/lib/src/components/ReplicasDropdown/index.d.ts +9 -0
  80. package/lib/src/components/ResourceCRUD/ResourceCRUD.d.ts +8 -0
  81. package/lib/src/components/ResourceCRUD/create/index.d.ts +8 -0
  82. package/lib/src/components/ResourceCRUD/index.d.ts +4 -0
  83. package/lib/src/components/ResourceCRUD/list/index.d.ts +9 -0
  84. package/lib/src/components/ResourceCRUD/show/index.d.ts +9 -0
  85. package/lib/src/components/ResourceFiledDisplays.d.ts +7 -0
  86. package/lib/src/components/ResourceLink/index.d.ts +8 -0
  87. package/lib/src/components/ResourceSelect/index.d.ts +12 -0
  88. package/lib/src/components/ResourceTable/index.d.ts +9 -0
  89. package/lib/src/components/ResourceUsageBar/index.d.ts +8 -0
  90. package/lib/src/components/Separator/index.d.ts +2 -0
  91. package/lib/src/components/ServiceComponents/index.d.ts +10 -0
  92. package/lib/src/components/Shell/ShellToolbar.d.ts +16 -0
  93. package/lib/src/components/Shell/index.d.ts +74 -0
  94. package/lib/src/components/ShowContent/ShowContent.d.ts +18 -0
  95. package/lib/src/components/ShowContent/fields.d.ts +76 -0
  96. package/lib/src/components/ShowContent/groups.d.ts +24 -0
  97. package/lib/src/components/ShowContent/index.d.ts +4 -0
  98. package/lib/src/components/ShowContent/tabs.d.ts +5 -0
  99. package/lib/src/components/StateTag/StateTag.d.ts +10 -0
  100. package/lib/src/components/StateTag/index.d.ts +1 -0
  101. package/lib/src/components/Table/TableToolBar.d.ts +8 -0
  102. package/lib/src/components/Table/TableWidgets.d.ts +6 -0
  103. package/lib/src/components/Table/index.d.ts +43 -0
  104. package/lib/src/components/Tabs/index.d.ts +10 -0
  105. package/lib/src/components/Tags/index.d.ts +6 -0
  106. package/lib/src/components/TextTags/index.d.ts +6 -0
  107. package/lib/src/components/Time/index.d.ts +8 -0
  108. package/lib/src/components/ValueDisplay/index.d.ts +9 -0
  109. package/lib/src/components/WorkloadDropdown/index.d.ts +9 -0
  110. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +9 -0
  111. package/lib/src/components/WorkloadPodsTable/index.d.ts +1 -0
  112. package/lib/src/components/WorkloadReplicas/index.d.ts +17 -0
  113. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.d.ts +9 -0
  114. package/lib/src/components/YamlEditor/MonacoYamlEditor.d.ts +19 -0
  115. package/lib/src/components/YamlEditor/YamlEditorComponent.d.ts +27 -0
  116. package/lib/src/components/YamlEditor/index.d.ts +1 -0
  117. package/lib/src/components/YamlEditor/style.d.ts +11 -0
  118. package/lib/src/components/YamlEditor/yaml.worker.d.ts +1 -0
  119. package/lib/src/components/index.d.ts +49 -0
  120. package/lib/src/constants/auth.d.ts +5 -0
  121. package/lib/src/constants/index.d.ts +3 -0
  122. package/lib/src/constants/k8s.d.ts +522 -0
  123. package/lib/src/constants/state.d.ts +15 -0
  124. package/lib/src/contexts/component.d.ts +8 -0
  125. package/lib/src/contexts/configs.d.ts +4 -0
  126. package/lib/src/contexts/global-store.d.ts +6 -0
  127. package/lib/src/contexts/index.d.ts +3 -0
  128. package/lib/src/hooks/index.d.ts +8 -0
  129. package/lib/src/hooks/useDeleteModal/index.d.ts +1 -0
  130. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.d.ts +8 -0
  131. package/lib/src/hooks/useDeleteModal/useDeleteModal.d.ts +7 -0
  132. package/lib/src/hooks/useDownloadYAML.d.ts +7 -0
  133. package/lib/src/hooks/useEagleTable/columns.d.ts +47 -0
  134. package/lib/src/hooks/useEagleTable/index.d.ts +2 -0
  135. package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +56 -0
  136. package/lib/src/hooks/useEdit.d.ts +4 -0
  137. package/lib/src/hooks/useGlobalStore.d.ts +3 -0
  138. package/lib/src/hooks/useK8sYamlEditor.d.ts +5 -0
  139. package/lib/src/hooks/useNamespaceRefineFilter.d.ts +5 -0
  140. package/lib/src/hooks/useOpenForm.d.ts +8 -0
  141. package/lib/src/hooks/useSchema.d.ts +21 -0
  142. package/lib/src/hooks/useSubmitForm.d.ts +14 -0
  143. package/lib/src/hooks/useTableData.d.ts +20 -0
  144. package/lib/src/i18n.d.ts +371 -0
  145. package/lib/src/index.d.ts +12 -0
  146. package/lib/src/locales/en-US/index.d.ts +175 -0
  147. package/lib/src/locales/index.d.ts +2 -0
  148. package/lib/src/locales/zh-CN/index.d.ts +193 -0
  149. package/lib/src/main.d.ts +3 -0
  150. package/lib/src/models/cronjob-model.d.ts +15 -0
  151. package/lib/src/models/daemonset-model.d.ts +15 -0
  152. package/lib/src/models/deployment-model.d.ts +13 -0
  153. package/lib/src/models/event-model.d.ts +7 -0
  154. package/lib/src/models/index.d.ts +19 -0
  155. package/lib/src/models/ingress-model.d.ts +20 -0
  156. package/lib/src/models/job-model.d.ts +20 -0
  157. package/lib/src/models/network-policy-model.d.ts +9 -0
  158. package/lib/src/models/node-model.d.ts +17 -0
  159. package/lib/src/models/persistent-volume-claim.d.ts +13 -0
  160. package/lib/src/models/persistent-volume.d.ts +13 -0
  161. package/lib/src/models/pod-metrics-model.d.ts +8 -0
  162. package/lib/src/models/pod-model.d.ts +20 -0
  163. package/lib/src/models/resource-model.d.ts +21 -0
  164. package/lib/src/models/service-model.d.ts +24 -0
  165. package/lib/src/models/statefulset-model.d.ts +13 -0
  166. package/lib/src/models/storage-class.d.ts +16 -0
  167. package/lib/src/models/types/index.d.ts +1 -0
  168. package/lib/src/models/types/metric.d.ts +25 -0
  169. package/lib/src/models/workload-base-model.d.ts +12 -0
  170. package/lib/src/models/workload-model.d.ts +18 -0
  171. package/lib/src/pages/configmaps/index.d.ts +4 -0
  172. package/lib/src/pages/cronjobs/create/index.d.ts +3 -0
  173. package/lib/src/pages/cronjobs/index.d.ts +3 -0
  174. package/lib/src/pages/cronjobs/list/index.d.ts +3 -0
  175. package/lib/src/pages/cronjobs/show/index.d.ts +3 -0
  176. package/lib/src/pages/daemonsets/create/index.d.ts +3 -0
  177. package/lib/src/pages/daemonsets/index.d.ts +3 -0
  178. package/lib/src/pages/daemonsets/list/index.d.ts +3 -0
  179. package/lib/src/pages/daemonsets/show/index.d.ts +3 -0
  180. package/lib/src/pages/deployments/index.d.ts +2 -0
  181. package/lib/src/pages/deployments/list/index.d.ts +3 -0
  182. package/lib/src/pages/deployments/show/index.d.ts +3 -0
  183. package/lib/src/pages/ingresses/index.d.ts +4 -0
  184. package/lib/src/pages/jobs/index.d.ts +4 -0
  185. package/lib/src/pages/networkPolicies/index.d.ts +4 -0
  186. package/lib/src/pages/nodes/index.d.ts +2 -0
  187. package/lib/src/pages/nodes/list/index.d.ts +3 -0
  188. package/lib/src/pages/nodes/show/index.d.ts +3 -0
  189. package/lib/src/pages/persistentvolumeclaims/index.d.ts +4 -0
  190. package/lib/src/pages/persistentvolumes/index.d.ts +4 -0
  191. package/lib/src/pages/pods/create/index.d.ts +3 -0
  192. package/lib/src/pages/pods/index.d.ts +3 -0
  193. package/lib/src/pages/pods/list/index.d.ts +3 -0
  194. package/lib/src/pages/pods/show/index.d.ts +3 -0
  195. package/lib/src/pages/secrets/index.d.ts +4 -0
  196. package/lib/src/pages/services/index.d.ts +4 -0
  197. package/lib/src/pages/statefulsets/index.d.ts +4 -0
  198. package/lib/src/pages/storageclasses/form/index.d.ts +9 -0
  199. package/lib/src/pages/storageclasses/index.d.ts +48 -0
  200. package/lib/src/plugins/index.d.ts +4 -0
  201. package/lib/src/plugins/model-plugin.d.ts +13 -0
  202. package/lib/src/plugins/relation-plugin.d.ts +26 -0
  203. package/lib/src/plugins/type.d.ts +8 -0
  204. package/lib/src/providers/index.d.ts +1 -0
  205. package/lib/src/providers/router-provider/index.d.ts +21 -0
  206. package/lib/src/styles/button.d.ts +1 -0
  207. package/lib/src/styles/modal.d.ts +1 -0
  208. package/lib/src/types/index.d.ts +1 -0
  209. package/lib/src/types/resource.d.ts +62 -0
  210. package/lib/src/utils/addId.d.ts +3 -0
  211. package/lib/src/utils/download.d.ts +1 -0
  212. package/lib/src/utils/error.d.ts +20 -0
  213. package/lib/src/utils/form.d.ts +3 -0
  214. package/lib/src/utils/index.d.ts +1 -0
  215. package/lib/src/utils/k8s.d.ts +3 -0
  216. package/lib/src/utils/labels.d.ts +9 -0
  217. package/lib/src/utils/match-selector.d.ts +3 -0
  218. package/lib/src/utils/openapi.d.ts +40 -0
  219. package/lib/src/utils/schema.d.ts +18 -0
  220. package/lib/src/utils/selector.d.ts +3 -0
  221. package/lib/src/utils/shell.d.ts +16 -0
  222. package/lib/src/utils/storage.d.ts +13 -0
  223. package/lib/src/utils/string.d.ts +1 -0
  224. package/lib/src/utils/time.d.ts +13 -0
  225. package/lib/src/utils/unit.d.ts +12 -0
  226. package/lib/src/utils/yaml.d.ts +2 -0
  227. package/lib/utils/string.d.ts +1 -0
  228. package/lib/vite.config.d.ts +2 -0
  229. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-5616d403.js";
1
+ import { j as jsxRuntimeExports } from "./index-45c3dd0a.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -1014,8 +1014,8 @@ const already_reset$1 = "Already reset";
1014
1014
  const fetch_schema_fail$1 = "获取 schema 失败。";
1015
1015
  const obtain_data_error$1 = "Having trouble getting data.";
1016
1016
  const retry$1 = "Retry";
1017
- const create_resource$1 = "Create{{resource}}";
1018
- const edit_resource$1 = "Edit{{resource}}";
1017
+ const create_resource$1 = "Create {{resource}}";
1018
+ const edit_resource$1 = "Edit {{resource}}";
1019
1019
  const state$1 = "Status";
1020
1020
  const name$1 = "Name";
1021
1021
  const pod$1 = "Pod";
@@ -1355,8 +1355,8 @@ const copied = "已复制";
1355
1355
  const already_reset = "已重置";
1356
1356
  const cancel = "取消";
1357
1357
  const create = "创建";
1358
- const delete_resource = "删除 {{resource}}";
1359
- const confirm_delete_text = "确认删除 {{kind}} <0>{{target}}</0> 吗?";
1358
+ const delete_resource = "删除{{resource}}";
1359
+ const confirm_delete_text = "确认删除{{kind}} <0>{{target}}</0> 吗?";
1360
1360
  const delete_tip = "该操作无法被撤回。";
1361
1361
  const edit = "编辑";
1362
1362
  const namespace = "名字空间";
@@ -1472,16 +1472,16 @@ const password = "密码";
1472
1472
  const username = "用户名";
1473
1473
  const host = "主机";
1474
1474
  const container_num = "容器数量";
1475
- const edit_resource_success = "编辑 {{resource}} {{name}} 成功";
1475
+ const edit_resource_success = "编辑{{resource}} {{name}} 成功";
1476
1476
  const redeploy_success_toast = "重新部署 {{kind}} {{name}} 成功";
1477
1477
  const redeploy_failed_toast = "重新部署 {{kind}} {{name}} 失败";
1478
1478
  const pause_success_toast = "暂停成功";
1479
1479
  const pause_failed_toast = "暂停失败";
1480
1480
  const resume_success_toast = "恢复成功";
1481
1481
  const resume_failed_toast = "恢复失败";
1482
- const delete_success_toast = "删除 {{kind}} {{name}} 成功";
1483
- const delete_failed_toast = "删除 {{kind}} {{name}} 失败";
1484
- const create_success_toast = "创建 {{kind}} {{name}} 成功";
1482
+ const delete_success_toast = "删除{{kind}} {{name}} 成功";
1483
+ const delete_failed_toast = "删除{{kind}} {{name}} 失败";
1484
+ const create_success_toast = "创建{{kind}} {{name}} 成功";
1485
1485
  const save_yaml_success_toast = "编辑 YAML 保存成功";
1486
1486
  const save_replicas_success_toast = "编辑预期副本数成功";
1487
1487
  const save_replicas_failed_toast = "编辑预期副本数失败";
@@ -8369,6 +8369,12 @@ const ConfigsContext = createContext({});
8369
8369
  const modal_1eijuvm = "";
8370
8370
  const FullscreenModalStyle = "fq4465w";
8371
8371
  const SmallModalStyle = "s1nc293e";
8372
+ function shortenedImage(image2) {
8373
+ return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
8374
+ }
8375
+ function isFirstLetterEnglish(str) {
8376
+ return /^[a-zA-Z]/.test(str);
8377
+ }
8372
8378
  const useDeleteModal_mi8he5 = "";
8373
8379
  const TextStyle = "t1vq0ett";
8374
8380
  const TipStyle = "t139onst";
@@ -8386,10 +8392,12 @@ const useDeleteModal = (resource) => {
8386
8392
  const {
8387
8393
  t: t2
8388
8394
  } = useTranslation();
8395
+ const displayName = config.displayName || config.kind;
8396
+ const resourceDisplayName = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
8389
8397
  const modalProps = {
8390
8398
  className: SmallModalStyle,
8391
8399
  title: t2("dovetail.delete_resource", {
8392
- resource: config.kind
8400
+ resource: resourceDisplayName
8393
8401
  }),
8394
8402
  okText: t2("dovetail.delete"),
8395
8403
  okButtonProps: {
@@ -8404,7 +8412,7 @@ const useDeleteModal = (resource) => {
8404
8412
  i18nKey: "dovetail.confirm_delete_text",
8405
8413
  tOptions: {
8406
8414
  target: id,
8407
- kind: config.kind
8415
+ kind: resourceDisplayName
8408
8416
  },
8409
8417
  shouldUnescape: true,
8410
8418
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, {
@@ -8427,11 +8435,11 @@ const useDeleteModal = (resource) => {
8427
8435
  return {
8428
8436
  message: t2("dovetail.delete_success_toast", {
8429
8437
  name: id,
8430
- kind: config.kind,
8438
+ kind: resourceDisplayName,
8431
8439
  interpolation: {
8432
8440
  escapeValue: false
8433
8441
  }
8434
- }),
8442
+ }).trim(),
8435
8443
  type: "success"
8436
8444
  };
8437
8445
  },
@@ -8439,11 +8447,11 @@ const useDeleteModal = (resource) => {
8439
8447
  return {
8440
8448
  message: t2("dovetail.delete_failed_toast", {
8441
8449
  name: id,
8442
- kind: config.kind,
8450
+ kind: resourceDisplayName,
8443
8451
  interpolation: {
8444
8452
  escapeValue: false
8445
8453
  }
8446
- }),
8454
+ }).trim(),
8447
8455
  type: "error"
8448
8456
  };
8449
8457
  }
@@ -10226,11 +10234,13 @@ const STORAGE_CLASS_INIT_VALUE = {
10226
10234
  "apiVersion": "storage.k8s.io/v1",
10227
10235
  "kind": "StorageClass",
10228
10236
  "metadata": {
10229
- "name": "example"
10237
+ "name": ""
10238
+ },
10239
+ "parameters": {
10240
+ "csi.storage.k8s.io/fstype": "ext4"
10230
10241
  },
10231
- "parameters": {},
10232
10242
  "provisioner": "",
10233
- "reclaimPolicy": "Delete",
10243
+ "reclaimPolicy": "",
10234
10244
  "allowVolumeExpansion": true,
10235
10245
  "volumeBindingMode": "Immediate"
10236
10246
  };
@@ -10255,13 +10265,11 @@ const PVC_INIT_VALUE = {
10255
10265
  "apiVersion": "v1",
10256
10266
  "kind": "PersistentVolumeClaim",
10257
10267
  "metadata": {
10258
- "name": "example",
10268
+ "name": "",
10259
10269
  "namespace": "default"
10260
10270
  },
10261
10271
  "spec": {
10262
- "accessModes": [
10263
- "ReadWriteOnce"
10264
- ],
10272
+ "accessModes": [],
10265
10273
  "resources": {
10266
10274
  "requests": {
10267
10275
  "storage": "40Gi"
@@ -10303,9 +10311,6 @@ function matchSelector(pod2, selector, namespace2 = "default") {
10303
10311
  }
10304
10312
  return match && pod2.metadata.namespace === namespace2;
10305
10313
  }
10306
- function shortenedImage(image2) {
10307
- return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
10308
- }
10309
10314
  class WorkloadBaseModel extends ResourceModel {
10310
10315
  constructor(_rawYaml, _globalStore) {
10311
10316
  super(_rawYaml, _globalStore);
@@ -11402,7 +11407,9 @@ function CreateButton(props) {
11402
11407
  prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusAddCreateNew16BoldOntintIcon, {}),
11403
11408
  type: "primary",
11404
11409
  onClick: openForm,
11405
- children: t2("dovetail.create_resource", { resource: /^[a-zA-Z]/.test(label2) ? ` ${label2}` : label2 })
11410
+ children: t2("dovetail.create_resource", {
11411
+ resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
11412
+ })
11406
11413
  }
11407
11414
  );
11408
11415
  }
@@ -12633,7 +12640,7 @@ function Table(props) {
12633
12640
  const { Table: TableComponent } = useContext(ComponentContext);
12634
12641
  const Table2 = TableComponent || Table$1;
12635
12642
  const { i18n: i18n2 } = useTranslation();
12636
- const resourceType = /^[a-zA-Z]/.test(displayName) ? ` ${displayName}` : displayName;
12643
+ const resourceType = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
12637
12644
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12638
12645
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12639
12646
  WidgetErrorContent,
@@ -38204,6 +38211,7 @@ const useForm = ({
38204
38211
  warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
38205
38212
  disableServerSideValidation: disableServerSideValidationProp = false,
38206
38213
  transformApplyValues,
38214
+ transformInitValues,
38207
38215
  ...rest
38208
38216
  } = {}) => {
38209
38217
  const { options } = useRefineContext();
@@ -38212,7 +38220,8 @@ const useForm = ({
38212
38220
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = useWarnAboutChange();
38213
38221
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
38214
38222
  const useHookFormResult = useForm$1({
38215
- ...rest
38223
+ ...rest,
38224
+ defaultValues: transformInitValues && typeof rest.defaultValues === "object" ? transformInitValues(rest.defaultValues) : rest.defaultValues
38216
38225
  });
38217
38226
  const {
38218
38227
  watch,
@@ -38267,14 +38276,15 @@ const useForm = ({
38267
38276
  if (!data2)
38268
38277
  return;
38269
38278
  const registeredFields = Object.keys(flattenObjectKeys(getValues()));
38279
+ const transformedData = transformInitValues ? transformInitValues(data2) : data2;
38270
38280
  registeredFields.forEach((path2) => {
38271
- const hasValue = has$1(data2, path2);
38272
- const dataValue = get$1(data2, path2);
38281
+ const hasValue = has$1(transformedData, path2);
38282
+ const dataValue = get$1(transformedData, path2);
38273
38283
  if (hasValue) {
38274
38284
  setValue(path2, dataValue);
38275
38285
  }
38276
38286
  });
38277
- }, [queryResult == null ? void 0 : queryResult.data, setValue, getValues, formState.isDirty]);
38287
+ }, [queryResult == null ? void 0 : queryResult.data, setValue, getValues, transformInitValues, formState.isDirty]);
38278
38288
  useEffect(() => {
38279
38289
  const subscription = watch((values, { type: type2 }) => {
38280
38290
  if (type2 === "change") {
@@ -38319,7 +38329,7 @@ const useForm = ({
38319
38329
  };
38320
38330
  };
38321
38331
  const useRefineForm = (props) => {
38322
- var _a, _b;
38332
+ var _a, _b, _c;
38323
38333
  const { config, id, refineProps } = props;
38324
38334
  const [responseErrorMsg, setResponseErrorMsg] = useState("");
38325
38335
  const i18n2 = useTranslation();
@@ -38330,15 +38340,17 @@ const useRefineForm = (props) => {
38330
38340
  errorNotification: false,
38331
38341
  successNotification: () => {
38332
38342
  const formValue = result.getValues();
38343
+ const resource = config.displayName || config.kind;
38333
38344
  return {
38334
38345
  message: i18n2.t(
38335
38346
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38336
38347
  {
38337
38348
  kind: formValue.kind,
38338
38349
  name: formValue.metadata.name,
38350
+ resource: isFirstLetterEnglish(resource) ? ` ${resource}` : resource,
38339
38351
  interpolation: { escapeValue: false }
38340
38352
  }
38341
- ),
38353
+ ).trim(),
38342
38354
  description: "Success",
38343
38355
  type: "success"
38344
38356
  };
@@ -38351,7 +38363,8 @@ const useRefineForm = (props) => {
38351
38363
  },
38352
38364
  defaultValues: config == null ? void 0 : config.initValue,
38353
38365
  transformApplyValues: (_a = config.formConfig) == null ? void 0 : _a.transformApplyValues,
38354
- ...(_b = config.formConfig) == null ? void 0 : _b.useFormProps
38366
+ transformInitValues: (_b = config.formConfig) == null ? void 0 : _b.transformInitValues,
38367
+ ...(_c = config.formConfig) == null ? void 0 : _c.useFormProps
38355
38368
  });
38356
38369
  useEffect(() => {
38357
38370
  var _a2, _b2;
@@ -38373,7 +38386,7 @@ const Separator = () => {
38373
38386
  });
38374
38387
  };
38375
38388
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38376
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-b8dc52f9.js"));
38389
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-2636b66c.js"));
38377
38390
  const YamlEditorComponent = forwardRef(
38378
38391
  function YamlEditorComponent2(props, ref) {
38379
38392
  const {
@@ -38988,6 +39001,8 @@ function YamlForm(props) {
38988
39001
  resource
38989
39002
  } = useResource();
38990
39003
  const action = actionFromProps || actionFromResource;
39004
+ const configs = useContext(ConfigsContext);
39005
+ const config = configs[(resource == null ? void 0 : resource.name) || ""];
38991
39006
  const {
38992
39007
  formProps,
38993
39008
  saveButtonProps,
@@ -39010,14 +39025,15 @@ function YamlForm(props) {
39010
39025
  rules,
39011
39026
  successNotification(data2) {
39012
39027
  var _a;
39028
+ const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39013
39029
  return {
39014
39030
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39015
- kind: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind,
39031
+ kind: isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName,
39016
39032
  name: data2 == null ? void 0 : data2.data.id,
39017
39033
  interpolation: {
39018
39034
  escapeValue: false
39019
39035
  }
39020
- }),
39036
+ }).trim(),
39021
39037
  type: "success"
39022
39038
  };
39023
39039
  },
@@ -39177,8 +39193,8 @@ function FormModal(props) {
39177
39193
  const transformApplyValues = ((_a2 = config.formConfig) == null ? void 0 : _a2.transformApplyValues) || ((v) => v);
39178
39194
  return {
39179
39195
  ...props.formProps,
39180
- transformInitValues: (_b2 = config.formConfig) == null ? void 0 : _b2.transformInitValues,
39181
- transformApplyValues,
39196
+ transformInitValues: isYamlMode ? void 0 : (_b2 = config.formConfig) == null ? void 0 : _b2.transformInitValues,
39197
+ transformApplyValues: isYamlMode ? void 0 : transformApplyValues,
39182
39198
  initialValuesForCreate: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : ((_c2 = props.formProps) == null ? void 0 : _c2.initialValuesForCreate) || (config == null ? void 0 : config.initValue),
39183
39199
  initialValuesForEdit: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : void 0,
39184
39200
  id,
@@ -39254,7 +39270,7 @@ function FormModal(props) {
39254
39270
  }
39255
39271
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39256
39272
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39257
- resource: /^[a-zA-Z]/.test(label2) ? ` ${label2}` : label2
39273
+ resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
39258
39274
  });
39259
39275
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39260
39276
  const desc = useMemo(() => {
package/dist/refine.js CHANGED
@@ -1,4 +1,4 @@
1
- import { bN, cC, A, aW, aY, aF, ca, bk, a1, co, cc, aQ, T, C, i, cG, aI, bp, ac, cI, ai, ap, cR, ax, cd, cb, cU, aM, bw, w, aD, bD, cT, cD, bG, D, b1, as, bJ, ar, at, a0, c9, c8, cS, bi, aU, ad, bQ, cF, cH, cm, aG, aj, s, q, cJ, I, bt, aT, t, M, be, bg, ce, cL, aL, bs, aq, ay, az, a8, aA, aX, aE, bE, bH, a9, d2, cn, cx, bM, N, a2, e, aV, a6, bP, by, bx, cK, b$, cZ, g, cY, aJ, bq, cg, L, ba, bb, bo, H, bc, J, bd, B, b5, cA, z, b4, G, b8, E, b6, F, b7, K, c0, b9, cz, aa, d0, c$, P, bm, v, ae, ah, b_, bj, cP, cO, a$, bu, c6, c5, p, aK, bl, x, bv, b0, d1, y, cq, cE, bK, bR, bS, d4, aH, R, ag, an, am, bL, ak, cQ, c2, al, cB, c7, bh, bA, au, h, Q, O, bf, ct, cw, cs, cr, cu, cv, cp, ch, ck, cl, cj, ci, cf, cy, bT, aN, br, aB, m, bW, l, aZ, cX, o, bX, a_, n, aS, bn, k, cW, aP, aR, c4, bC, bB, c3, aO, S, bF, cV, c_, b2, b3, bz, bI, c1, bY, bZ, ab, $, cN, af, W, cM, ao, aw, av, f, aC, bU, U, a3, d, d7, d6, d9, d3, a7, da, d5, d8, a5, a4, r, a, c, X, V, Y, Z, u, bO, _, bV, b } from "./index-5616d403.js";
1
+ import { bN, cC, A, aW, aY, aF, ca, bk, a1, co, cc, aQ, T, C, i, cG, aI, bp, ac, cI, ai, ap, cR, ax, cd, cb, cU, aM, bw, w, aD, bD, cT, cD, bG, D, b1, as, bJ, ar, at, a0, c9, c8, cS, bi, aU, ad, bQ, cF, cH, cm, aG, aj, s, q, cJ, I, bt, aT, t, M, be, bg, ce, cL, aL, bs, aq, ay, az, a8, aA, aX, aE, bE, bH, a9, d2, cn, cx, bM, N, a2, e, aV, a6, bP, by, bx, cK, b$, cZ, g, cY, aJ, bq, cg, L, ba, bb, bo, H, bc, J, bd, B, b5, cA, z, b4, G, b8, E, b6, F, b7, K, c0, b9, cz, aa, d0, c$, P, bm, v, ae, ah, b_, bj, cP, cO, a$, bu, c6, c5, p, aK, bl, x, bv, b0, d1, y, cq, cE, bK, bR, bS, d4, aH, R, ag, an, am, bL, ak, cQ, c2, al, cB, c7, bh, bA, au, h, Q, O, bf, ct, cw, cs, cr, cu, cv, cp, ch, ck, cl, cj, ci, cf, cy, bT, aN, br, aB, m, bW, l, aZ, cX, o, bX, a_, n, aS, bn, k, cW, aP, aR, c4, bC, bB, c3, aO, S, bF, cV, c_, b2, b3, bz, bI, c1, bY, bZ, ab, $, cN, af, W, cM, ao, aw, av, f, aC, bU, U, a3, d, d7, d6, d9, d3, a7, da, d5, d8, a5, a4, r, a, c, X, V, Y, Z, u, bO, _, bV, b } from "./index-45c3dd0a.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "react";
@@ -1020,8 +1020,8 @@ var __publicField = (obj, key, value) => {
1020
1020
  const fetch_schema_fail$1 = "获取 schema 失败。";
1021
1021
  const obtain_data_error$1 = "Having trouble getting data.";
1022
1022
  const retry$1 = "Retry";
1023
- const create_resource$1 = "Create{{resource}}";
1024
- const edit_resource$1 = "Edit{{resource}}";
1023
+ const create_resource$1 = "Create {{resource}}";
1024
+ const edit_resource$1 = "Edit {{resource}}";
1025
1025
  const state$1 = "Status";
1026
1026
  const name$1 = "Name";
1027
1027
  const pod$1 = "Pod";
@@ -1361,8 +1361,8 @@ var __publicField = (obj, key, value) => {
1361
1361
  const already_reset = "已重置";
1362
1362
  const cancel = "取消";
1363
1363
  const create = "创建";
1364
- const delete_resource = "删除 {{resource}}";
1365
- const confirm_delete_text = "确认删除 {{kind}} <0>{{target}}</0> 吗?";
1364
+ const delete_resource = "删除{{resource}}";
1365
+ const confirm_delete_text = "确认删除{{kind}} <0>{{target}}</0> 吗?";
1366
1366
  const delete_tip = "该操作无法被撤回。";
1367
1367
  const edit = "编辑";
1368
1368
  const namespace = "名字空间";
@@ -1478,16 +1478,16 @@ var __publicField = (obj, key, value) => {
1478
1478
  const username = "用户名";
1479
1479
  const host = "主机";
1480
1480
  const container_num = "容器数量";
1481
- const edit_resource_success = "编辑 {{resource}} {{name}} 成功";
1481
+ const edit_resource_success = "编辑{{resource}} {{name}} 成功";
1482
1482
  const redeploy_success_toast = "重新部署 {{kind}} {{name}} 成功";
1483
1483
  const redeploy_failed_toast = "重新部署 {{kind}} {{name}} 失败";
1484
1484
  const pause_success_toast = "暂停成功";
1485
1485
  const pause_failed_toast = "暂停失败";
1486
1486
  const resume_success_toast = "恢复成功";
1487
1487
  const resume_failed_toast = "恢复失败";
1488
- const delete_success_toast = "删除 {{kind}} {{name}} 成功";
1489
- const delete_failed_toast = "删除 {{kind}} {{name}} 失败";
1490
- const create_success_toast = "创建 {{kind}} {{name}} 成功";
1488
+ const delete_success_toast = "删除{{kind}} {{name}} 成功";
1489
+ const delete_failed_toast = "删除{{kind}} {{name}} 失败";
1490
+ const create_success_toast = "创建{{kind}} {{name}} 成功";
1491
1491
  const save_yaml_success_toast = "编辑 YAML 保存成功";
1492
1492
  const save_replicas_success_toast = "编辑预期副本数成功";
1493
1493
  const save_replicas_failed_toast = "编辑预期副本数失败";
@@ -8375,6 +8375,12 @@ var __publicField = (obj, key, value) => {
8375
8375
  const modal_1eijuvm = "";
8376
8376
  const FullscreenModalStyle = "fq4465w";
8377
8377
  const SmallModalStyle = "s1nc293e";
8378
+ function shortenedImage(image2) {
8379
+ return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
8380
+ }
8381
+ function isFirstLetterEnglish(str) {
8382
+ return /^[a-zA-Z]/.test(str);
8383
+ }
8378
8384
  const useDeleteModal_mi8he5 = "";
8379
8385
  const TextStyle = "t1vq0ett";
8380
8386
  const TipStyle = "t139onst";
@@ -8392,10 +8398,12 @@ var __publicField = (obj, key, value) => {
8392
8398
  const {
8393
8399
  t: t2
8394
8400
  } = useTranslation();
8401
+ const displayName = config.displayName || config.kind;
8402
+ const resourceDisplayName = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
8395
8403
  const modalProps = {
8396
8404
  className: SmallModalStyle,
8397
8405
  title: t2("dovetail.delete_resource", {
8398
- resource: config.kind
8406
+ resource: resourceDisplayName
8399
8407
  }),
8400
8408
  okText: t2("dovetail.delete"),
8401
8409
  okButtonProps: {
@@ -8410,7 +8418,7 @@ var __publicField = (obj, key, value) => {
8410
8418
  i18nKey: "dovetail.confirm_delete_text",
8411
8419
  tOptions: {
8412
8420
  target: id,
8413
- kind: config.kind
8421
+ kind: resourceDisplayName
8414
8422
  },
8415
8423
  shouldUnescape: true,
8416
8424
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tag, {
@@ -8433,11 +8441,11 @@ var __publicField = (obj, key, value) => {
8433
8441
  return {
8434
8442
  message: t2("dovetail.delete_success_toast", {
8435
8443
  name: id,
8436
- kind: config.kind,
8444
+ kind: resourceDisplayName,
8437
8445
  interpolation: {
8438
8446
  escapeValue: false
8439
8447
  }
8440
- }),
8448
+ }).trim(),
8441
8449
  type: "success"
8442
8450
  };
8443
8451
  },
@@ -8445,11 +8453,11 @@ var __publicField = (obj, key, value) => {
8445
8453
  return {
8446
8454
  message: t2("dovetail.delete_failed_toast", {
8447
8455
  name: id,
8448
- kind: config.kind,
8456
+ kind: resourceDisplayName,
8449
8457
  interpolation: {
8450
8458
  escapeValue: false
8451
8459
  }
8452
- }),
8460
+ }).trim(),
8453
8461
  type: "error"
8454
8462
  };
8455
8463
  }
@@ -10232,11 +10240,13 @@ var __publicField = (obj, key, value) => {
10232
10240
  "apiVersion": "storage.k8s.io/v1",
10233
10241
  "kind": "StorageClass",
10234
10242
  "metadata": {
10235
- "name": "example"
10243
+ "name": ""
10244
+ },
10245
+ "parameters": {
10246
+ "csi.storage.k8s.io/fstype": "ext4"
10236
10247
  },
10237
- "parameters": {},
10238
10248
  "provisioner": "",
10239
- "reclaimPolicy": "Delete",
10249
+ "reclaimPolicy": "",
10240
10250
  "allowVolumeExpansion": true,
10241
10251
  "volumeBindingMode": "Immediate"
10242
10252
  };
@@ -10261,13 +10271,11 @@ var __publicField = (obj, key, value) => {
10261
10271
  "apiVersion": "v1",
10262
10272
  "kind": "PersistentVolumeClaim",
10263
10273
  "metadata": {
10264
- "name": "example",
10274
+ "name": "",
10265
10275
  "namespace": "default"
10266
10276
  },
10267
10277
  "spec": {
10268
- "accessModes": [
10269
- "ReadWriteOnce"
10270
- ],
10278
+ "accessModes": [],
10271
10279
  "resources": {
10272
10280
  "requests": {
10273
10281
  "storage": "40Gi"
@@ -10309,9 +10317,6 @@ var __publicField = (obj, key, value) => {
10309
10317
  }
10310
10318
  return match && pod2.metadata.namespace === namespace2;
10311
10319
  }
10312
- function shortenedImage(image2) {
10313
- return (image2 || "").replace(/^(index\.)?docker.io\/(library\/)?/, "").replace(/:latest$/, "").replace(/^(.*@sha256:)([0-9a-f]{8})[0-9a-f]+$/i, "$1$2…");
10314
- }
10315
10320
  class WorkloadBaseModel extends ResourceModel {
10316
10321
  constructor(_rawYaml, _globalStore) {
10317
10322
  super(_rawYaml, _globalStore);
@@ -11408,7 +11413,9 @@ var __publicField = (obj, key, value) => {
11408
11413
  prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.PlusAddCreateNew16BoldOntintIcon, {}),
11409
11414
  type: "primary",
11410
11415
  onClick: openForm,
11411
- children: t2("dovetail.create_resource", { resource: /^[a-zA-Z]/.test(label2) ? ` ${label2}` : label2 })
11416
+ children: t2("dovetail.create_resource", {
11417
+ resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
11418
+ })
11412
11419
  }
11413
11420
  );
11414
11421
  }
@@ -12639,7 +12646,7 @@ var __publicField = (obj, key, value) => {
12639
12646
  const { Table: TableComponent } = React.useContext(ComponentContext);
12640
12647
  const Table2 = TableComponent || Table$1;
12641
12648
  const { i18n: i18n2 } = useTranslation();
12642
- const resourceType = /^[a-zA-Z]/.test(displayName) ? ` ${displayName}` : displayName;
12649
+ const resourceType = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
12643
12650
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12644
12651
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12645
12652
  WidgetErrorContent,
@@ -38210,6 +38217,7 @@ WARNING: This link could potentially be dangerous`)) {
38210
38217
  warnWhenUnsavedChanges: warnWhenUnsavedChangesProp,
38211
38218
  disableServerSideValidation: disableServerSideValidationProp = false,
38212
38219
  transformApplyValues,
38220
+ transformInitValues,
38213
38221
  ...rest
38214
38222
  } = {}) => {
38215
38223
  const { options } = core.useRefineContext();
@@ -38218,7 +38226,8 @@ WARNING: This link could potentially be dangerous`)) {
38218
38226
  const { warnWhenUnsavedChanges: warnWhenUnsavedChangesRefine, setWarnWhen } = core.useWarnAboutChange();
38219
38227
  const warnWhenUnsavedChanges = warnWhenUnsavedChangesProp ?? warnWhenUnsavedChangesRefine;
38220
38228
  const useHookFormResult = useForm$1({
38221
- ...rest
38229
+ ...rest,
38230
+ defaultValues: transformInitValues && typeof rest.defaultValues === "object" ? transformInitValues(rest.defaultValues) : rest.defaultValues
38222
38231
  });
38223
38232
  const {
38224
38233
  watch,
@@ -38273,14 +38282,15 @@ WARNING: This link could potentially be dangerous`)) {
38273
38282
  if (!data2)
38274
38283
  return;
38275
38284
  const registeredFields = Object.keys(core.flattenObjectKeys(getValues()));
38285
+ const transformedData = transformInitValues ? transformInitValues(data2) : data2;
38276
38286
  registeredFields.forEach((path2) => {
38277
- const hasValue = has$1(data2, path2);
38278
- const dataValue = get$1(data2, path2);
38287
+ const hasValue = has$1(transformedData, path2);
38288
+ const dataValue = get$1(transformedData, path2);
38279
38289
  if (hasValue) {
38280
38290
  setValue(path2, dataValue);
38281
38291
  }
38282
38292
  });
38283
- }, [queryResult == null ? void 0 : queryResult.data, setValue, getValues, formState.isDirty]);
38293
+ }, [queryResult == null ? void 0 : queryResult.data, setValue, getValues, transformInitValues, formState.isDirty]);
38284
38294
  React.useEffect(() => {
38285
38295
  const subscription = watch((values, { type: type2 }) => {
38286
38296
  if (type2 === "change") {
@@ -38325,7 +38335,7 @@ WARNING: This link could potentially be dangerous`)) {
38325
38335
  };
38326
38336
  };
38327
38337
  const useRefineForm = (props) => {
38328
- var _a, _b;
38338
+ var _a, _b, _c;
38329
38339
  const { config, id, refineProps } = props;
38330
38340
  const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
38331
38341
  const i18n2 = useTranslation();
@@ -38336,15 +38346,17 @@ WARNING: This link could potentially be dangerous`)) {
38336
38346
  errorNotification: false,
38337
38347
  successNotification: () => {
38338
38348
  const formValue = result.getValues();
38349
+ const resource = config.displayName || config.kind;
38339
38350
  return {
38340
38351
  message: i18n2.t(
38341
38352
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38342
38353
  {
38343
38354
  kind: formValue.kind,
38344
38355
  name: formValue.metadata.name,
38356
+ resource: isFirstLetterEnglish(resource) ? ` ${resource}` : resource,
38345
38357
  interpolation: { escapeValue: false }
38346
38358
  }
38347
- ),
38359
+ ).trim(),
38348
38360
  description: "Success",
38349
38361
  type: "success"
38350
38362
  };
@@ -38357,7 +38369,8 @@ WARNING: This link could potentially be dangerous`)) {
38357
38369
  },
38358
38370
  defaultValues: config == null ? void 0 : config.initValue,
38359
38371
  transformApplyValues: (_a = config.formConfig) == null ? void 0 : _a.transformApplyValues,
38360
- ...(_b = config.formConfig) == null ? void 0 : _b.useFormProps
38372
+ transformInitValues: (_b = config.formConfig) == null ? void 0 : _b.transformInitValues,
38373
+ ...(_c = config.formConfig) == null ? void 0 : _c.useFormProps
38361
38374
  });
38362
38375
  React.useEffect(() => {
38363
38376
  var _a2, _b2;
@@ -38994,6 +39007,8 @@ WARNING: This link could potentially be dangerous`)) {
38994
39007
  resource
38995
39008
  } = core.useResource();
38996
39009
  const action = actionFromProps || actionFromResource;
39010
+ const configs = React.useContext(ConfigsContext);
39011
+ const config = configs[(resource == null ? void 0 : resource.name) || ""];
38997
39012
  const {
38998
39013
  formProps,
38999
39014
  saveButtonProps,
@@ -39016,14 +39031,15 @@ WARNING: This link could potentially be dangerous`)) {
39016
39031
  rules,
39017
39032
  successNotification(data2) {
39018
39033
  var _a;
39034
+ const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39019
39035
  return {
39020
39036
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39021
- kind: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind,
39037
+ kind: isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName,
39022
39038
  name: data2 == null ? void 0 : data2.data.id,
39023
39039
  interpolation: {
39024
39040
  escapeValue: false
39025
39041
  }
39026
- }),
39042
+ }).trim(),
39027
39043
  type: "success"
39028
39044
  };
39029
39045
  },
@@ -39183,8 +39199,8 @@ WARNING: This link could potentially be dangerous`)) {
39183
39199
  const transformApplyValues = ((_a2 = config.formConfig) == null ? void 0 : _a2.transformApplyValues) || ((v) => v);
39184
39200
  return {
39185
39201
  ...props.formProps,
39186
- transformInitValues: (_b2 = config.formConfig) == null ? void 0 : _b2.transformInitValues,
39187
- transformApplyValues,
39202
+ transformInitValues: isYamlMode ? void 0 : (_b2 = config.formConfig) == null ? void 0 : _b2.transformInitValues,
39203
+ transformApplyValues: isYamlMode ? void 0 : transformApplyValues,
39188
39204
  initialValuesForCreate: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : ((_c2 = props.formProps) == null ? void 0 : _c2.initialValuesForCreate) || (config == null ? void 0 : config.initValue),
39189
39205
  initialValuesForEdit: isYamlMode ? transformApplyValues(refineFormResult.formResult.getValues()) : void 0,
39190
39206
  id,
@@ -39260,7 +39276,7 @@ WARNING: This link could potentially be dangerous`)) {
39260
39276
  }
39261
39277
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39262
39278
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39263
- resource: /^[a-zA-Z]/.test(label2) ? ` ${label2}` : label2
39279
+ resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
39264
39280
  });
39265
39281
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39266
39282
  const desc = React.useMemo(() => {
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import { CronJobModel } from '../../models';
3
+ import { DropdownSize } from '../K8sDropdown';
4
+ type Props<Model extends CronJobModel> = {
5
+ record: Model;
6
+ size?: DropdownSize;
7
+ };
8
+ export declare function CronJobDropdown<Model extends CronJobModel>(props: Props<Model>): JSX.Element;
9
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { BaseRecord, HttpError, UseFormProps as UseFormCoreProps, UseFormReturnType as UseFormReturnTypeCore } from '@refinedev/core';
2
2
  import React from 'react';
3
+ import { DefaultValues } from 'react-hook-form';
3
4
  import { UseFormProps as UseHookFormProps, UseFormReturn, FieldValues } from 'react-hook-form';
4
5
  export type UseFormReturnType<TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables extends FieldValues = FieldValues, TContext extends object = object, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError> = UseFormReturn<TVariables, TContext> & {
5
6
  refineCore: UseFormReturnTypeCore<TQueryFnData, TError, TVariables, TData, TResponse, TResponseError>;
@@ -26,5 +27,6 @@ export type UseFormProps<TQueryFnData extends BaseRecord = BaseRecord, TError ex
26
27
  */
27
28
  disableServerSideValidation?: boolean;
28
29
  transformApplyValues?: (values: TVariables) => TVariables;
30
+ transformInitValues?: (values: Record<string, unknown>) => DefaultValues<TVariables>;
29
31
  } & UseHookFormProps<TVariables, TContext>;
30
- export declare const useForm: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables extends FieldValues = FieldValues, TContext extends object = object, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError>({ refineCoreProps, warnWhenUnsavedChanges: warnWhenUnsavedChangesProp, disableServerSideValidation: disableServerSideValidationProp, transformApplyValues, ...rest }?: UseFormProps<TQueryFnData, TError, TVariables, TContext, TData, TResponse, TResponseError>) => UseFormReturnType<TQueryFnData, TError, TVariables, TContext, TData, TResponse, TResponseError>;
32
+ export declare const useForm: <TQueryFnData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError, TVariables extends FieldValues = FieldValues, TContext extends object = object, TData extends BaseRecord = TQueryFnData, TResponse extends BaseRecord = TData, TResponseError extends HttpError = TError>({ refineCoreProps, warnWhenUnsavedChanges: warnWhenUnsavedChangesProp, disableServerSideValidation: disableServerSideValidationProp, transformApplyValues, transformInitValues, ...rest }?: UseFormProps<TQueryFnData, TError, TVariables, TContext, TData, TResponse, TResponseError>) => UseFormReturnType<TQueryFnData, TError, TVariables, TContext, TData, TResponse, TResponseError>;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { ResourceModel } from '../../models';
3
+ export type DropdownSize = 'normal' | 'large';
4
+ interface K8sDropdownProps {
5
+ record: ResourceModel;
6
+ size?: DropdownSize;
7
+ }
8
+ export declare function K8sDropdown(props: React.PropsWithChildren<K8sDropdownProps>): JSX.Element;
9
+ export default K8sDropdown;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { PodModel } from '../../models';
3
+ import { DropdownSize } from '../K8sDropdown';
4
+ type Props<Model extends PodModel> = {
5
+ record: Model;
6
+ size?: DropdownSize;
7
+ };
8
+ export declare function PodDropdown<Model extends PodModel>(props: React.PropsWithChildren<Props<Model>>): JSX.Element;
9
+ export {};
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { WorkloadModel } from '../../models';
3
+ import { DropdownSize } from '../K8sDropdown';
4
+ type Props<Model extends WorkloadModel> = {
5
+ record: Model;
6
+ size?: DropdownSize;
7
+ };
8
+ export declare function ReplicasDropdown<Model extends WorkloadModel>(props: React.PropsWithChildren<Props<Model>>): JSX.Element;
9
+ export {};