@dovetail-v2/refine 0.1.14-alpha.5 → 0.1.15-alpha.0

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 (226) hide show
  1. package/dist/{MonacoYamlDiffEditor-d3889aba.js → MonacoYamlDiffEditor-22b5ead6.js} +1 -1
  2. package/dist/{index-ee3bfb45.js → index-11293d19.js} +22 -14
  3. package/dist/refine.js +1 -1
  4. package/dist/refine.umd.cjs +21 -13
  5. package/lib/utils/string.d.ts +1 -0
  6. package/package.json +1 -1
  7. package/lib/components/CronJobDropdown/index.d.ts +0 -9
  8. package/lib/components/K8sDropdown/index.d.ts +0 -9
  9. package/lib/components/PodDropdown/index.d.ts +0 -9
  10. package/lib/components/ReplicasDropdown/index.d.ts +0 -9
  11. package/lib/components/Table/TableToolBar.d.ts +0 -9
  12. package/lib/components/Table/TableWidgets.d.ts +0 -6
  13. package/lib/components/WorkloadDropdown/index.d.ts +0 -9
  14. package/lib/src/App.d.ts +0 -3
  15. package/lib/src/Dovetail.d.ts +0 -18
  16. package/lib/src/components/Breadcrumb/index.d.ts +0 -6
  17. package/lib/src/components/ConditionsTable/ConditionsTable.d.ts +0 -7
  18. package/lib/src/components/ConditionsTable/index.d.ts +0 -1
  19. package/lib/src/components/CreateButton/index.d.ts +0 -2
  20. package/lib/src/components/CronJobDropdown/index.d.ts +0 -9
  21. package/lib/src/components/CronjobJobsTable/index.d.ts +0 -8
  22. package/lib/src/components/DeleteButton/index.d.ts +0 -2
  23. package/lib/src/components/DeleteManyButton/index.d.ts +0 -4
  24. package/lib/src/components/DrawerShow/DrawerShow.d.ts +0 -9
  25. package/lib/src/components/DrawerShow/index.d.ts +0 -1
  26. package/lib/src/components/DurationTime/index.d.ts +0 -6
  27. package/lib/src/components/EditButton/index.d.ts +0 -2
  28. package/lib/src/components/EditField/index.d.ts +0 -15
  29. package/lib/src/components/ErrorContent/index.d.ts +0 -17
  30. package/lib/src/components/EventsTable/EventsTable.d.ts +0 -6
  31. package/lib/src/components/EventsTable/index.d.ts +0 -1
  32. package/lib/src/components/Form/FormModal.d.ts +0 -9
  33. package/lib/src/components/Form/RefineFormContent.d.ts +0 -12
  34. package/lib/src/components/Form/RefineFormPage.d.ts +0 -7
  35. package/lib/src/components/Form/YamlForm.d.ts +0 -29
  36. package/lib/src/components/Form/index.d.ts +0 -7
  37. package/lib/src/components/Form/type.d.ts +0 -17
  38. package/lib/src/components/Form/useFieldsConfig.d.ts +0 -4
  39. package/lib/src/components/Form/useReactHookForm.d.ts +0 -30
  40. package/lib/src/components/Form/useRefineForm.d.ts +0 -13
  41. package/lib/src/components/Form/useYamlForm.d.ts +0 -50
  42. package/lib/src/components/FormErrorAlert/index.d.ts +0 -9
  43. package/lib/src/components/FormLayout/index.d.ts +0 -7
  44. package/lib/src/components/FormWidgets/KeyValueListWidget.d.ts +0 -6
  45. package/lib/src/components/FormWidgets/MetadataForm.d.ts +0 -2
  46. package/lib/src/components/FormWidgets/NameInputWidget.d.ts +0 -51
  47. package/lib/src/components/FormWidgets/NamespaceSelectWidget.d.ts +0 -9
  48. package/lib/src/components/FormWidgets/index.d.ts +0 -4
  49. package/lib/src/components/FormWidgets/widget.d.ts +0 -5
  50. package/lib/src/components/ImageNames/index.d.ts +0 -5
  51. package/lib/src/components/IngressRulesComponent/index.d.ts +0 -5
  52. package/lib/src/components/IngressRulesTable/IngressRulesTable.d.ts +0 -7
  53. package/lib/src/components/IngressRulesTable/index.d.ts +0 -1
  54. package/lib/src/components/K8sDropdown/index.d.ts +0 -9
  55. package/lib/src/components/KeyValue/KeyValue.d.ts +0 -7
  56. package/lib/src/components/KeyValue/KeyValueAnnotation.d.ts +0 -6
  57. package/lib/src/components/KeyValue/KeyValueSecret.d.ts +0 -5
  58. package/lib/src/components/KeyValue/index.d.ts +0 -3
  59. package/lib/src/components/Layout/index.d.ts +0 -3
  60. package/lib/src/components/LinkFallback/index.d.ts +0 -4
  61. package/lib/src/components/ListPage/index.d.ts +0 -10
  62. package/lib/src/components/Menu/index.d.ts +0 -2
  63. package/lib/src/components/NamespacesFilter/index.d.ts +0 -11
  64. package/lib/src/components/NetworkPolicyRulesViewer/NetworkPolicyRulesViewer.d.ts +0 -8
  65. package/lib/src/components/NetworkPolicyRulesViewer/index.d.ts +0 -1
  66. package/lib/src/components/PVCDistributeStorage/index.d.ts +0 -16
  67. package/lib/src/components/PageShow/PageShow.d.ts +0 -12
  68. package/lib/src/components/PageShow/index.d.ts +0 -1
  69. package/lib/src/components/PodContainersTable/PodContainersTable.d.ts +0 -8
  70. package/lib/src/components/PodContainersTable/index.d.ts +0 -1
  71. package/lib/src/components/PodDropdown/index.d.ts +0 -9
  72. package/lib/src/components/PodLog/index.d.ts +0 -6
  73. package/lib/src/components/PodSelectorTable/index.d.ts +0 -6
  74. package/lib/src/components/PodShellModal/PodShell.d.ts +0 -18
  75. package/lib/src/components/PodShellModal/index.d.ts +0 -10
  76. package/lib/src/components/PortsTable/index.d.ts +0 -7
  77. package/lib/src/components/ReferenceLink/index.d.ts +0 -8
  78. package/lib/src/components/ReplicasDropdown/index.d.ts +0 -9
  79. package/lib/src/components/ResourceCRUD/ResourceCRUD.d.ts +0 -8
  80. package/lib/src/components/ResourceCRUD/create/index.d.ts +0 -8
  81. package/lib/src/components/ResourceCRUD/index.d.ts +0 -4
  82. package/lib/src/components/ResourceCRUD/list/index.d.ts +0 -9
  83. package/lib/src/components/ResourceCRUD/show/index.d.ts +0 -9
  84. package/lib/src/components/ResourceFiledDisplays.d.ts +0 -7
  85. package/lib/src/components/ResourceLink/index.d.ts +0 -8
  86. package/lib/src/components/ResourceSelect/index.d.ts +0 -12
  87. package/lib/src/components/ResourceTable/index.d.ts +0 -9
  88. package/lib/src/components/ResourceUsageBar/index.d.ts +0 -8
  89. package/lib/src/components/Separator/index.d.ts +0 -2
  90. package/lib/src/components/ServiceComponents/index.d.ts +0 -10
  91. package/lib/src/components/Shell/ShellToolbar.d.ts +0 -16
  92. package/lib/src/components/Shell/index.d.ts +0 -74
  93. package/lib/src/components/ShowContent/ShowContent.d.ts +0 -18
  94. package/lib/src/components/ShowContent/fields.d.ts +0 -76
  95. package/lib/src/components/ShowContent/groups.d.ts +0 -24
  96. package/lib/src/components/ShowContent/index.d.ts +0 -4
  97. package/lib/src/components/ShowContent/tabs.d.ts +0 -5
  98. package/lib/src/components/StateTag/StateTag.d.ts +0 -10
  99. package/lib/src/components/StateTag/index.d.ts +0 -1
  100. package/lib/src/components/Table/TableToolBar.d.ts +0 -8
  101. package/lib/src/components/Table/TableWidgets.d.ts +0 -6
  102. package/lib/src/components/Table/index.d.ts +0 -43
  103. package/lib/src/components/Tabs/index.d.ts +0 -10
  104. package/lib/src/components/Tags/index.d.ts +0 -6
  105. package/lib/src/components/TextTags/index.d.ts +0 -6
  106. package/lib/src/components/Time/index.d.ts +0 -8
  107. package/lib/src/components/ValueDisplay/index.d.ts +0 -9
  108. package/lib/src/components/WorkloadDropdown/index.d.ts +0 -9
  109. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +0 -9
  110. package/lib/src/components/WorkloadPodsTable/index.d.ts +0 -1
  111. package/lib/src/components/WorkloadReplicas/index.d.ts +0 -17
  112. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.d.ts +0 -9
  113. package/lib/src/components/YamlEditor/MonacoYamlEditor.d.ts +0 -19
  114. package/lib/src/components/YamlEditor/YamlEditorComponent.d.ts +0 -27
  115. package/lib/src/components/YamlEditor/index.d.ts +0 -1
  116. package/lib/src/components/YamlEditor/style.d.ts +0 -11
  117. package/lib/src/components/YamlEditor/yaml.worker.d.ts +0 -1
  118. package/lib/src/components/index.d.ts +0 -49
  119. package/lib/src/constants/auth.d.ts +0 -5
  120. package/lib/src/constants/index.d.ts +0 -3
  121. package/lib/src/constants/k8s.d.ts +0 -522
  122. package/lib/src/constants/state.d.ts +0 -15
  123. package/lib/src/contexts/component.d.ts +0 -8
  124. package/lib/src/contexts/configs.d.ts +0 -4
  125. package/lib/src/contexts/global-store.d.ts +0 -6
  126. package/lib/src/contexts/index.d.ts +0 -3
  127. package/lib/src/hooks/index.d.ts +0 -8
  128. package/lib/src/hooks/useDeleteModal/index.d.ts +0 -1
  129. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.d.ts +0 -8
  130. package/lib/src/hooks/useDeleteModal/useDeleteModal.d.ts +0 -7
  131. package/lib/src/hooks/useDownloadYAML.d.ts +0 -7
  132. package/lib/src/hooks/useEagleTable/columns.d.ts +0 -47
  133. package/lib/src/hooks/useEagleTable/index.d.ts +0 -2
  134. package/lib/src/hooks/useEagleTable/useEagleTable.d.ts +0 -56
  135. package/lib/src/hooks/useEdit.d.ts +0 -4
  136. package/lib/src/hooks/useGlobalStore.d.ts +0 -3
  137. package/lib/src/hooks/useK8sYamlEditor.d.ts +0 -5
  138. package/lib/src/hooks/useNamespaceRefineFilter.d.ts +0 -5
  139. package/lib/src/hooks/useOpenForm.d.ts +0 -8
  140. package/lib/src/hooks/useSchema.d.ts +0 -21
  141. package/lib/src/hooks/useSubmitForm.d.ts +0 -14
  142. package/lib/src/hooks/useTableData.d.ts +0 -20
  143. package/lib/src/i18n.d.ts +0 -371
  144. package/lib/src/index.d.ts +0 -12
  145. package/lib/src/locales/en-US/index.d.ts +0 -175
  146. package/lib/src/locales/index.d.ts +0 -2
  147. package/lib/src/locales/zh-CN/index.d.ts +0 -193
  148. package/lib/src/main.d.ts +0 -3
  149. package/lib/src/models/cronjob-model.d.ts +0 -15
  150. package/lib/src/models/daemonset-model.d.ts +0 -15
  151. package/lib/src/models/deployment-model.d.ts +0 -13
  152. package/lib/src/models/event-model.d.ts +0 -7
  153. package/lib/src/models/index.d.ts +0 -19
  154. package/lib/src/models/ingress-model.d.ts +0 -20
  155. package/lib/src/models/job-model.d.ts +0 -20
  156. package/lib/src/models/network-policy-model.d.ts +0 -9
  157. package/lib/src/models/node-model.d.ts +0 -17
  158. package/lib/src/models/persistent-volume-claim.d.ts +0 -13
  159. package/lib/src/models/persistent-volume.d.ts +0 -13
  160. package/lib/src/models/pod-metrics-model.d.ts +0 -8
  161. package/lib/src/models/pod-model.d.ts +0 -20
  162. package/lib/src/models/resource-model.d.ts +0 -21
  163. package/lib/src/models/service-model.d.ts +0 -24
  164. package/lib/src/models/statefulset-model.d.ts +0 -13
  165. package/lib/src/models/storage-class.d.ts +0 -16
  166. package/lib/src/models/types/index.d.ts +0 -1
  167. package/lib/src/models/types/metric.d.ts +0 -25
  168. package/lib/src/models/workload-base-model.d.ts +0 -12
  169. package/lib/src/models/workload-model.d.ts +0 -18
  170. package/lib/src/pages/configmaps/index.d.ts +0 -4
  171. package/lib/src/pages/cronjobs/create/index.d.ts +0 -3
  172. package/lib/src/pages/cronjobs/index.d.ts +0 -3
  173. package/lib/src/pages/cronjobs/list/index.d.ts +0 -3
  174. package/lib/src/pages/cronjobs/show/index.d.ts +0 -3
  175. package/lib/src/pages/daemonsets/create/index.d.ts +0 -3
  176. package/lib/src/pages/daemonsets/index.d.ts +0 -3
  177. package/lib/src/pages/daemonsets/list/index.d.ts +0 -3
  178. package/lib/src/pages/daemonsets/show/index.d.ts +0 -3
  179. package/lib/src/pages/deployments/index.d.ts +0 -2
  180. package/lib/src/pages/deployments/list/index.d.ts +0 -3
  181. package/lib/src/pages/deployments/show/index.d.ts +0 -3
  182. package/lib/src/pages/ingresses/index.d.ts +0 -4
  183. package/lib/src/pages/jobs/index.d.ts +0 -4
  184. package/lib/src/pages/networkPolicies/index.d.ts +0 -4
  185. package/lib/src/pages/nodes/index.d.ts +0 -2
  186. package/lib/src/pages/nodes/list/index.d.ts +0 -3
  187. package/lib/src/pages/nodes/show/index.d.ts +0 -3
  188. package/lib/src/pages/persistentvolumeclaims/index.d.ts +0 -4
  189. package/lib/src/pages/persistentvolumes/index.d.ts +0 -4
  190. package/lib/src/pages/pods/create/index.d.ts +0 -3
  191. package/lib/src/pages/pods/index.d.ts +0 -3
  192. package/lib/src/pages/pods/list/index.d.ts +0 -3
  193. package/lib/src/pages/pods/show/index.d.ts +0 -3
  194. package/lib/src/pages/secrets/index.d.ts +0 -4
  195. package/lib/src/pages/services/index.d.ts +0 -4
  196. package/lib/src/pages/statefulsets/index.d.ts +0 -4
  197. package/lib/src/pages/storageclasses/form/index.d.ts +0 -9
  198. package/lib/src/pages/storageclasses/index.d.ts +0 -48
  199. package/lib/src/plugins/index.d.ts +0 -4
  200. package/lib/src/plugins/model-plugin.d.ts +0 -13
  201. package/lib/src/plugins/relation-plugin.d.ts +0 -26
  202. package/lib/src/plugins/type.d.ts +0 -8
  203. package/lib/src/providers/index.d.ts +0 -1
  204. package/lib/src/providers/router-provider/index.d.ts +0 -21
  205. package/lib/src/styles/button.d.ts +0 -1
  206. package/lib/src/styles/modal.d.ts +0 -1
  207. package/lib/src/types/index.d.ts +0 -1
  208. package/lib/src/types/resource.d.ts +0 -62
  209. package/lib/src/utils/addId.d.ts +0 -3
  210. package/lib/src/utils/download.d.ts +0 -1
  211. package/lib/src/utils/error.d.ts +0 -20
  212. package/lib/src/utils/form.d.ts +0 -3
  213. package/lib/src/utils/index.d.ts +0 -1
  214. package/lib/src/utils/k8s.d.ts +0 -3
  215. package/lib/src/utils/labels.d.ts +0 -9
  216. package/lib/src/utils/match-selector.d.ts +0 -3
  217. package/lib/src/utils/openapi.d.ts +0 -40
  218. package/lib/src/utils/schema.d.ts +0 -18
  219. package/lib/src/utils/selector.d.ts +0 -3
  220. package/lib/src/utils/shell.d.ts +0 -16
  221. package/lib/src/utils/storage.d.ts +0 -13
  222. package/lib/src/utils/string.d.ts +0 -1
  223. package/lib/src/utils/time.d.ts +0 -13
  224. package/lib/src/utils/unit.d.ts +0 -12
  225. package/lib/src/utils/yaml.d.ts +0 -2
  226. package/lib/vite.config.d.ts +0 -2
@@ -1,4 +1,4 @@
1
- import { j as jsxRuntimeExports } from "./index-ee3bfb45.js";
1
+ import { j as jsxRuntimeExports } from "./index-11293d19.js";
2
2
  import * as monaco from "monaco-editor";
3
3
  import { useRef, useEffect } from "react";
4
4
  import "i18next";
@@ -8375,6 +8375,9 @@ function shortenedImage(image2) {
8375
8375
  function isFirstLetterEnglish(str) {
8376
8376
  return /^[a-zA-Z]/.test(str);
8377
8377
  }
8378
+ function addSpaceBeforeLetter(str) {
8379
+ return isFirstLetterEnglish(str) ? ` ${str}` : str;
8380
+ }
8378
8381
  const useDeleteModal_mi8he5 = "";
8379
8382
  const TextStyle = "t1vq0ett";
8380
8383
  const TipStyle = "t139onst";
@@ -8393,7 +8396,7 @@ const useDeleteModal = (resource) => {
8393
8396
  t: t2
8394
8397
  } = useTranslation();
8395
8398
  const displayName = config.displayName || config.kind;
8396
- const resourceDisplayName = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
8399
+ const resourceDisplayName = addSpaceBeforeLetter(displayName);
8397
8400
  const modalProps = {
8398
8401
  className: SmallModalStyle,
8399
8402
  title: t2("dovetail.delete_resource", {
@@ -11408,7 +11411,7 @@ function CreateButton(props) {
11408
11411
  type: "primary",
11409
11412
  onClick: openForm,
11410
11413
  children: t2("dovetail.create_resource", {
11411
- resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
11414
+ resource: addSpaceBeforeLetter(label2)
11412
11415
  })
11413
11416
  }
11414
11417
  );
@@ -12640,7 +12643,7 @@ function Table(props) {
12640
12643
  const { Table: TableComponent } = useContext(ComponentContext);
12641
12644
  const Table2 = TableComponent || Table$1;
12642
12645
  const { i18n: i18n2 } = useTranslation();
12643
- const resourceType = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
12646
+ const resourceType = addSpaceBeforeLetter(displayName);
12644
12647
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12645
12648
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12646
12649
  WidgetErrorContent,
@@ -12737,6 +12740,9 @@ const WorkloadPodsTable = ({
12737
12740
  }
12738
12741
  }
12739
12742
  });
12743
+ if (tableProps.loading) {
12744
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {});
12745
+ }
12740
12746
  if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
12741
12747
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
12742
12748
  errorText: i18n2.t("dovetail.no_resource", {
@@ -19467,13 +19473,13 @@ const PodContainersTable = ({
19467
19473
  },
19468
19474
  {
19469
19475
  key: "started",
19470
- dataIndex: ["state", "running", "startedAt"],
19476
+ dataIndex: ["startedAt"],
19471
19477
  title: i18n2.t("dovetail.created_time"),
19472
19478
  sortable: true,
19473
- sorter: CommonSorter(["state", "running", "startedAt"]),
19479
+ sorter: CommonSorter(["startedAt"]),
19474
19480
  width: 120,
19475
19481
  render: (_, record) => {
19476
- const value2 = get$3(record, ["state", "running", "startedAt"]) || get$3(record, ["state", "terminated", "startedAt"]);
19482
+ const value2 = record.startedAt;
19477
19483
  if (value2)
19478
19484
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
19479
19485
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
@@ -19483,7 +19489,10 @@ const PodContainersTable = ({
19483
19489
  [i18n2, initContainerStatuses]
19484
19490
  );
19485
19491
  const dataSource = useMemo(
19486
- () => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
19492
+ () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map((container2) => ({
19493
+ ...container2,
19494
+ startedAt: get$3(container2, ["state", "running", "startedAt"]) || get$3(container2, ["state", "terminated", "startedAt"])
19495
+ })),
19487
19496
  [containerStatuses, initContainerStatuses]
19488
19497
  );
19489
19498
  const {
@@ -19495,7 +19504,7 @@ const PodContainersTable = ({
19495
19504
  data: dataSource,
19496
19505
  columns,
19497
19506
  defaultSorters: [{
19498
- field: "state.running.startedAt",
19507
+ field: "startedAt",
19499
19508
  order: "desc"
19500
19509
  }]
19501
19510
  });
@@ -33154,7 +33163,7 @@ const Shell = React__default.forwardRef(function Shell2(props, ref) {
33154
33163
  });
33155
33164
  }
33156
33165
  }, [encode, send, props.fit]);
33157
- const debouncedFit = useCallback(() => debounce(fit, 200), [fit]);
33166
+ const debouncedFit = useMemo(() => debounce(fit, 200), [fit]);
33158
33167
  const flush = useCallback(() => {
33159
33168
  const backlog = backlogRef.current.slice();
33160
33169
  backlogRef.current = [];
@@ -38340,12 +38349,11 @@ const useRefineForm = (props) => {
38340
38349
  errorNotification: false,
38341
38350
  successNotification: () => {
38342
38351
  const formValue = result.getValues();
38343
- const resource = config.displayName || config.kind;
38344
38352
  return {
38345
38353
  message: i18n2.t(
38346
38354
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38347
38355
  {
38348
- kind: isFirstLetterEnglish(resource) ? ` ${resource}` : resource,
38356
+ kind: addSpaceBeforeLetter(config.displayName || config.kind),
38349
38357
  name: formValue.metadata.name,
38350
38358
  interpolation: { escapeValue: false }
38351
38359
  }
@@ -38385,7 +38393,7 @@ const Separator = () => {
38385
38393
  });
38386
38394
  };
38387
38395
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
38388
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-d3889aba.js"));
38396
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-22b5ead6.js"));
38389
38397
  const YamlEditorComponent = forwardRef(
38390
38398
  function YamlEditorComponent2(props, ref) {
38391
38399
  const {
@@ -39027,7 +39035,7 @@ function YamlForm(props) {
39027
39035
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39028
39036
  return {
39029
39037
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39030
- kind: isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName,
39038
+ kind: addSpaceBeforeLetter(displayName),
39031
39039
  name: data2 == null ? void 0 : data2.data.id,
39032
39040
  interpolation: {
39033
39041
  escapeValue: false
@@ -39269,7 +39277,7 @@ function FormModal(props) {
39269
39277
  }
39270
39278
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39271
39279
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39272
- resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
39280
+ resource: addSpaceBeforeLetter(label2)
39273
39281
  });
39274
39282
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39275
39283
  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-ee3bfb45.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-11293d19.js";
2
2
  import "@cloudtower/eagle";
3
3
  import "@refinedev/core";
4
4
  import "react";
@@ -8381,6 +8381,9 @@ var __publicField = (obj, key, value) => {
8381
8381
  function isFirstLetterEnglish(str) {
8382
8382
  return /^[a-zA-Z]/.test(str);
8383
8383
  }
8384
+ function addSpaceBeforeLetter(str) {
8385
+ return isFirstLetterEnglish(str) ? ` ${str}` : str;
8386
+ }
8384
8387
  const useDeleteModal_mi8he5 = "";
8385
8388
  const TextStyle = "t1vq0ett";
8386
8389
  const TipStyle = "t139onst";
@@ -8399,7 +8402,7 @@ var __publicField = (obj, key, value) => {
8399
8402
  t: t2
8400
8403
  } = useTranslation();
8401
8404
  const displayName = config.displayName || config.kind;
8402
- const resourceDisplayName = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
8405
+ const resourceDisplayName = addSpaceBeforeLetter(displayName);
8403
8406
  const modalProps = {
8404
8407
  className: SmallModalStyle,
8405
8408
  title: t2("dovetail.delete_resource", {
@@ -11414,7 +11417,7 @@ var __publicField = (obj, key, value) => {
11414
11417
  type: "primary",
11415
11418
  onClick: openForm,
11416
11419
  children: t2("dovetail.create_resource", {
11417
- resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
11420
+ resource: addSpaceBeforeLetter(label2)
11418
11421
  })
11419
11422
  }
11420
11423
  );
@@ -12646,7 +12649,7 @@ var __publicField = (obj, key, value) => {
12646
12649
  const { Table: TableComponent } = React.useContext(ComponentContext);
12647
12650
  const Table2 = TableComponent || Table$1;
12648
12651
  const { i18n: i18n2 } = useTranslation();
12649
- const resourceType = isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName;
12652
+ const resourceType = addSpaceBeforeLetter(displayName);
12650
12653
  if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
12651
12654
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
12652
12655
  WidgetErrorContent,
@@ -12743,6 +12746,9 @@ var __publicField = (obj, key, value) => {
12743
12746
  }
12744
12747
  }
12745
12748
  });
12749
+ if (tableProps.loading) {
12750
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {});
12751
+ }
12746
12752
  if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
12747
12753
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
12748
12754
  errorText: i18n2.t("dovetail.no_resource", {
@@ -19473,13 +19479,13 @@ var __publicField = (obj, key, value) => {
19473
19479
  },
19474
19480
  {
19475
19481
  key: "started",
19476
- dataIndex: ["state", "running", "startedAt"],
19482
+ dataIndex: ["startedAt"],
19477
19483
  title: i18n2.t("dovetail.created_time"),
19478
19484
  sortable: true,
19479
- sorter: CommonSorter(["state", "running", "startedAt"]),
19485
+ sorter: CommonSorter(["startedAt"]),
19480
19486
  width: 120,
19481
19487
  render: (_, record) => {
19482
- const value2 = lodashEs.get(record, ["state", "running", "startedAt"]) || lodashEs.get(record, ["state", "terminated", "startedAt"]);
19488
+ const value2 = record.startedAt;
19483
19489
  if (value2)
19484
19490
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
19485
19491
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
@@ -19489,7 +19495,10 @@ var __publicField = (obj, key, value) => {
19489
19495
  [i18n2, initContainerStatuses]
19490
19496
  );
19491
19497
  const dataSource = React.useMemo(
19492
- () => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
19498
+ () => addId(containerStatuses.concat(initContainerStatuses), "containerID").map((container2) => ({
19499
+ ...container2,
19500
+ startedAt: lodashEs.get(container2, ["state", "running", "startedAt"]) || lodashEs.get(container2, ["state", "terminated", "startedAt"])
19501
+ })),
19493
19502
  [containerStatuses, initContainerStatuses]
19494
19503
  );
19495
19504
  const {
@@ -19501,7 +19510,7 @@ var __publicField = (obj, key, value) => {
19501
19510
  data: dataSource,
19502
19511
  columns,
19503
19512
  defaultSorters: [{
19504
- field: "state.running.startedAt",
19513
+ field: "startedAt",
19505
19514
  order: "desc"
19506
19515
  }]
19507
19516
  });
@@ -33160,7 +33169,7 @@ WARNING: This link could potentially be dangerous`)) {
33160
33169
  });
33161
33170
  }
33162
33171
  }, [encode, send, props.fit]);
33163
- const debouncedFit = React.useCallback(() => lodashEs.debounce(fit, 200), [fit]);
33172
+ const debouncedFit = React.useMemo(() => lodashEs.debounce(fit, 200), [fit]);
33164
33173
  const flush = React.useCallback(() => {
33165
33174
  const backlog = backlogRef.current.slice();
33166
33175
  backlogRef.current = [];
@@ -38346,12 +38355,11 @@ WARNING: This link could potentially be dangerous`)) {
38346
38355
  errorNotification: false,
38347
38356
  successNotification: () => {
38348
38357
  const formValue = result.getValues();
38349
- const resource = config.displayName || config.kind;
38350
38358
  return {
38351
38359
  message: i18n2.t(
38352
38360
  id ? "dovetail.edit_resource_success" : "dovetail.create_success_toast",
38353
38361
  {
38354
- kind: isFirstLetterEnglish(resource) ? ` ${resource}` : resource,
38362
+ kind: addSpaceBeforeLetter(config.displayName || config.kind),
38355
38363
  name: formValue.metadata.name,
38356
38364
  interpolation: { escapeValue: false }
38357
38365
  }
@@ -39033,7 +39041,7 @@ WARNING: This link could potentially be dangerous`)) {
39033
39041
  const displayName = config.displayName || ((_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind);
39034
39042
  return {
39035
39043
  message: i18n2.t(action === "create" ? "dovetail.create_success_toast" : "dovetail.save_yaml_success_toast", {
39036
- kind: isFirstLetterEnglish(displayName) ? ` ${displayName}` : displayName,
39044
+ kind: addSpaceBeforeLetter(displayName),
39037
39045
  name: data2 == null ? void 0 : data2.data.id,
39038
39046
  interpolation: {
39039
39047
  escapeValue: false
@@ -39275,7 +39283,7 @@ WARNING: This link could potentially be dangerous`)) {
39275
39283
  }
39276
39284
  const label2 = config.displayName || (config == null ? void 0 : config.kind);
39277
39285
  return i18n2.t(id ? "dovetail.edit_resource" : "dovetail.create_resource", {
39278
- resource: isFirstLetterEnglish(label2) ? ` ${label2}` : label2
39286
+ resource: addSpaceBeforeLetter(label2)
39279
39287
  });
39280
39288
  }, [action, config.formConfig, config.displayName, config == null ? void 0 : config.kind, i18n2, id]);
39281
39289
  const desc = React.useMemo(() => {
@@ -1,2 +1,3 @@
1
1
  export declare function shortenedImage(image: string): string;
2
2
  export declare function isFirstLetterEnglish(str: string): boolean;
3
+ export declare function addSpaceBeforeLetter(str: string): string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dovetail-v2/refine",
3
- "version": "0.1.14-alpha.5",
3
+ "version": "0.1.15-alpha.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",
@@ -1,9 +0,0 @@
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,9 +0,0 @@
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;
@@ -1,9 +0,0 @@
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 {};
@@ -1,9 +0,0 @@
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 {};
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- type Props = {
3
- title?: string;
4
- description?: string;
5
- selectedKeys: string[];
6
- hideCreate?: boolean;
7
- };
8
- export declare const TableToolBar: React.FC<Props>;
9
- export {};
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- export declare const ColumnTitle: React.FC<{
3
- sortOrder?: 'descend' | 'ascend' | null;
4
- title: React.ReactNode;
5
- }>;
6
- export declare const AuxiliaryLine: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
@@ -1,9 +0,0 @@
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 WorkloadDropdown<Model extends WorkloadModel>(props: React.PropsWithChildren<Props<Model>>): JSX.Element;
9
- export {};
package/lib/src/App.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference types="react" />
2
- declare function App(): JSX.Element;
3
- export default App;
@@ -1,18 +0,0 @@
1
- import { AccessControlProvider } from '@refinedev/core';
2
- import { History } from 'history';
3
- import { GlobalStore } from 'k8s-api-provider';
4
- import React from 'react';
5
- import { ResourceConfig } from './types';
6
- import './styles.css';
7
- type Props = {
8
- resourcesConfig: ResourceConfig[];
9
- useHashUrl?: boolean;
10
- urlPrefix?: string;
11
- Layout?: React.FC<unknown>;
12
- history: History;
13
- globalStore: GlobalStore;
14
- accessControlProvider?: AccessControlProvider;
15
- routerProvider?: any;
16
- };
17
- export declare const Dovetail: React.FC<Props>;
18
- export {};
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- interface BreadcrumbProps {
3
- className?: string;
4
- }
5
- export declare function Breadcrumb(props: BreadcrumbProps): JSX.Element;
6
- export {};
@@ -1,7 +0,0 @@
1
- import { Condition } from 'kubernetes-types/meta/v1';
2
- import React from 'react';
3
- type Props = {
4
- conditions: Condition[];
5
- };
6
- export declare const ConditionsTable: React.FC<Props>;
7
- export {};
@@ -1 +0,0 @@
1
- export * from './ConditionsTable';
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare function CreateButton(): JSX.Element;
@@ -1,9 +0,0 @@
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,8 +0,0 @@
1
- import { OwnerReference } from 'kubernetes-types/meta/v1';
2
- import React from 'react';
3
- export declare const CronjobJobsTable: React.FC<{
4
- owner?: OwnerReference & {
5
- namespace: string;
6
- };
7
- hideToolBar?: boolean;
8
- }>;
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const DeleteButton: React.FC;
@@ -1,4 +0,0 @@
1
- import React from 'react';
2
- export declare const DeleteManyButton: React.FC<{
3
- ids: string[];
4
- }>;
@@ -1,9 +0,0 @@
1
- /// <reference types="react" />
2
- import { ResourceModel } from '../../models';
3
- import { ShowConfig } from '../ShowContent';
4
- type Props<Model extends ResourceModel> = {
5
- showConfig: ShowConfig<Model>;
6
- formatter?: (r: Model) => Model;
7
- };
8
- export declare const DrawerShow: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: Props<Model>) => JSX.Element;
9
- export {};
@@ -1 +0,0 @@
1
- export * from './DrawerShow';
@@ -1,6 +0,0 @@
1
- /// <reference types="react" />
2
- interface DurationTimeProps {
3
- value: number;
4
- }
5
- declare function DurationTime(props: DurationTimeProps): JSX.Element;
6
- export { DurationTime };
@@ -1,2 +0,0 @@
1
- import React from 'react';
2
- export declare const EditButton: React.FC;
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export interface EditFieldModalProps {
3
- title?: string;
4
- submitting?: boolean;
5
- errorMsgs?: string[];
6
- formRef: React.MutableRefObject<{
7
- submit: () => (Promise<unknown> | undefined);
8
- } | null>;
9
- renderContent: () => React.ReactNode;
10
- }
11
- export declare function EditFieldModal(props: EditFieldModalProps): JSX.Element;
12
- export interface EditField {
13
- modalProps: EditFieldModalProps;
14
- }
15
- export declare function EditField(props: EditField): JSX.Element;
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- export declare const ErrorWrapper: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
3
- export declare const ErrorContent: import("@linaria/react").StyledComponent<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & Record<never, unknown>>;
4
- export declare enum ErrorContentType {
5
- List = "list",
6
- Card = "card",
7
- Widget = "widget"
8
- }
9
- export type WidgetErrorContentProps = {
10
- className?: string;
11
- style?: React.CSSProperties;
12
- errorText?: string;
13
- type?: ErrorContentType;
14
- refetch?: () => void;
15
- };
16
- declare const WidgetErrorContent: React.FunctionComponent<WidgetErrorContentProps>;
17
- export default WidgetErrorContent;
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- type EventTableProps = {
3
- uid: string;
4
- };
5
- export declare const EventsTable: React.FC<EventTableProps>;
6
- export {};
@@ -1 +0,0 @@
1
- export * from './EventsTable';
@@ -1,9 +0,0 @@
1
- import React from 'react';
2
- import { YamlFormProps } from './YamlForm';
3
- export type FormModalProps = {
4
- resource?: string;
5
- id?: string;
6
- formProps?: YamlFormProps;
7
- renderForm?: (props: YamlFormProps) => React.ReactNode;
8
- };
9
- export declare function FormModal(props: FormModalProps): JSX.Element;
@@ -1,12 +0,0 @@
1
- /// <reference types="react" />
2
- import { UseFormReturnType } from '@refinedev/react-hook-form';
3
- import { ResourceModel } from '../../models';
4
- import { ResourceConfig } from '../../types';
5
- type Props<Model extends ResourceModel> = {
6
- config?: ResourceConfig<Model>;
7
- formResult: UseFormReturnType;
8
- errorMsg?: string;
9
- resourceId?: string;
10
- };
11
- export declare const RefineFormContent: <Model extends ResourceModel<import("k8s-api-provider").Unstructured>>(props: Props<Model>) => JSX.Element;
12
- export {};
@@ -1,7 +0,0 @@
1
- /// <reference types="react" />
2
- import { ResourceConfig } from '../../types';
3
- type Props = {
4
- config: ResourceConfig<any>;
5
- };
6
- export declare const RefineFormPage: (props: Props) => JSX.Element;
7
- export {};
@@ -1,29 +0,0 @@
1
- /// <reference types="react" />
2
- import { FormAction } from '@refinedev/core';
3
- import { Unstructured } from 'k8s-api-provider';
4
- import useYamlForm from './useYamlForm';
5
- export declare enum SchemaStrategy {
6
- Required = "Required",
7
- Optional = "Optional",
8
- None = "None"
9
- }
10
- export interface YamlFormProps {
11
- id?: string;
12
- action?: FormAction;
13
- initialValues?: Record<string, unknown>;
14
- schemaStrategy?: SchemaStrategy;
15
- isShowLayout?: boolean;
16
- useFormProps?: Parameters<typeof useYamlForm>[0];
17
- transformInitValues?: (values: Record<string, unknown>) => Record<string, unknown>;
18
- transformApplyValues?: (values: Unstructured) => Unstructured;
19
- onSaveButtonPropsChange?: (saveButtonProps: {
20
- disabled?: boolean;
21
- onClick: () => void;
22
- loading?: boolean | {
23
- delay?: number | undefined;
24
- };
25
- }) => void;
26
- onErrorsChange?: (errors: string[]) => void;
27
- onFinish?: () => void;
28
- }
29
- export declare function YamlForm(props: YamlFormProps): JSX.Element;
@@ -1,7 +0,0 @@
1
- export * from './FormModal';
2
- export * from './RefineFormContent';
3
- export * from './RefineFormPage';
4
- export * from './YamlForm';
5
- export * from './useRefineForm';
6
- export * from './useYamlForm';
7
- export * from './type';
@@ -1,17 +0,0 @@
1
- import React from 'react';
2
- import { Control } from 'react-hook-form';
3
- export type RefineFormValidator = (value: unknown, formValue: unknown) => {
4
- isValid: boolean;
5
- errorMsg: string;
6
- };
7
- export type RefineFormField = {
8
- path: string[];
9
- key: string;
10
- label: string;
11
- placeholder?: string;
12
- helperText?: React.ReactNode;
13
- type?: 'number';
14
- validators?: RefineFormValidator[];
15
- disabledWhenEdit?: boolean;
16
- render?: (value: unknown, onChange: (event: unknown) => void, formValue: unknown, onBlur: () => void, action: 'edit' | 'create', control: Control) => React.ReactElement;
17
- };
@@ -1,4 +0,0 @@
1
- import { ResourceModel } from 'src/models';
2
- import { ResourceConfig } from 'src/types';
3
- declare function useFieldsConfig<Model extends ResourceModel>(config?: ResourceConfig<Model>, resourceId?: string): import("./type").RefineFormField[] | undefined;
4
- export default useFieldsConfig;