@dovetail-v2/refine 0.0.49-alpha.0 → 0.0.51

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 (211) hide show
  1. package/dist/{MonacoYamlDiffEditor-7cb1e598.js → MonacoYamlDiffEditor-b82fbea9.js} +1 -1
  2. package/dist/{index-8f27c902.js → index-51cc13dd.js} +116 -82
  3. package/dist/refine.js +1 -1
  4. package/dist/refine.umd.cjs +114 -80
  5. package/dist/style.css +2 -1
  6. package/lib/src/App.js +91 -0
  7. package/lib/src/Dovetail.js +45 -0
  8. package/lib/src/components/Breadcrumb/index.js +20 -0
  9. package/lib/src/components/ConditionsTable/ConditionsTable.js +56 -0
  10. package/lib/src/components/ConditionsTable/index.js +1 -0
  11. package/lib/src/components/CreateButton/index.js +10 -0
  12. package/lib/src/components/CronJobDropdown/index.js +26 -0
  13. package/lib/src/components/CronjobJobsTable/index.js +49 -0
  14. package/lib/src/components/DeleteButton/index.js +13 -0
  15. package/lib/src/components/DeleteManyButton/index.js +16 -0
  16. package/lib/src/components/DrawerShow/DrawerShow.js +13 -0
  17. package/lib/src/components/DrawerShow/index.js +1 -0
  18. package/lib/src/components/EditButton/index.js +13 -0
  19. package/lib/src/components/EditField/index.js +47 -0
  20. package/lib/src/components/ErrorContent/index.js +36 -0
  21. package/lib/src/components/EventsTable/EventsTable.js +59 -0
  22. package/lib/src/components/EventsTable/index.js +1 -0
  23. package/lib/src/components/Form/KeyValueListWidget.js +56 -0
  24. package/lib/src/components/Form/MetadataForm.js +9 -0
  25. package/lib/src/components/Form/NameInputWidget.js +50 -0
  26. package/lib/src/components/Form/NamespaceSelectWidget.js +21 -0
  27. package/lib/src/components/Form/index.js +4 -0
  28. package/lib/src/components/Form/widget.js +1 -0
  29. package/lib/src/components/FormErrorAlert/index.js +8 -0
  30. package/lib/src/components/FormLayout/index.js +21 -0
  31. package/lib/src/components/FormModal/index.js +51 -0
  32. package/lib/src/components/ImageNames/index.js +14 -0
  33. package/lib/src/components/IngressRulesComponent/index.js +11 -0
  34. package/lib/src/components/IngressRulesTable/IngressRulesTable.js +51 -0
  35. package/lib/src/components/IngressRulesTable/index.js +1 -0
  36. package/lib/src/components/K8sDropdown/index.js +31 -0
  37. package/lib/src/components/KeyValue/KeyValue.js +27 -0
  38. package/lib/src/components/KeyValue/index.js +1 -0
  39. package/lib/src/components/KeyValueData/index.js +50 -0
  40. package/lib/src/components/Layout/index.js +39 -0
  41. package/lib/src/components/ListPage/index.js +25 -0
  42. package/lib/src/components/Menu/index.js +36 -0
  43. package/lib/src/components/NamespacesFilter/index.js +34 -0
  44. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +1 -2
  45. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +77 -0
  46. package/lib/src/components/NetworkPolicyRulesTable/index.js +1 -0
  47. package/lib/src/components/PageShow/PageShow.js +11 -0
  48. package/lib/src/components/PageShow/index.js +1 -0
  49. package/lib/src/components/PodContainersTable/PodContainersTable.js +78 -0
  50. package/lib/src/components/PodContainersTable/index.js +1 -0
  51. package/lib/src/components/PodLog/index.js +136 -0
  52. package/lib/src/components/ReferenceLink/index.js +17 -0
  53. package/lib/src/components/RefineForm/RefineFormContent.d.ts +10 -0
  54. package/lib/src/components/RefineForm/RefineFormModal.d.ts +8 -0
  55. package/lib/src/components/RefineForm/RefineFormPage.d.ts +7 -0
  56. package/lib/src/components/RefineForm/index.d.ts +3 -0
  57. package/lib/src/components/RefineForm/type.d.ts +20 -0
  58. package/lib/src/components/RefineForm/useRefineForm.d.ts +10 -0
  59. package/lib/src/components/ResourceCRUD/ResourceCRUD.js +15 -0
  60. package/lib/src/components/ResourceCRUD/create/index.js +13 -0
  61. package/lib/src/components/ResourceCRUD/index.js +4 -0
  62. package/lib/src/components/ResourceCRUD/list/index.js +19 -0
  63. package/lib/src/components/ResourceCRUD/show/index.js +6 -0
  64. package/lib/src/components/ResourceLink/index.js +21 -0
  65. package/lib/src/components/ResourceUsageBar/index.js +81 -0
  66. package/lib/src/components/Separator/index.js +11 -0
  67. package/lib/src/components/ServiceComponents/index.d.ts +0 -1
  68. package/lib/src/components/ShowContent/ShowContent.d.ts +1 -1
  69. package/lib/src/components/ShowContent/ShowContent.js +157 -0
  70. package/lib/src/components/ShowContent/fields.d.ts +1 -1
  71. package/lib/src/components/ShowContent/fields.js +157 -0
  72. package/lib/src/components/ShowContent/index.js +2 -0
  73. package/lib/src/components/StateTag/StateTag.js +22 -0
  74. package/lib/src/components/StateTag/index.js +1 -0
  75. package/lib/src/components/Table/ErrorContent.js +36 -0
  76. package/lib/src/components/Table/TableToolBar.js +14 -0
  77. package/lib/src/components/Table/TableWidgets.js +28 -0
  78. package/lib/src/components/Table/index.js +69 -0
  79. package/lib/src/components/Tags/index.js +22 -0
  80. package/lib/src/components/Time/index.js +14 -0
  81. package/lib/src/components/WorkloadDropdown/index.js +24 -0
  82. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +39 -0
  83. package/lib/src/components/WorkloadPodsTable/index.js +1 -0
  84. package/lib/src/components/WorkloadReplicas/index.js +50 -0
  85. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.js +34 -0
  86. package/lib/src/components/YamlEditor/MonacoYamlEditor.js +149 -0
  87. package/lib/src/components/YamlEditor/YamlEditorComponent.js +90 -0
  88. package/lib/src/components/YamlEditor/index.js +1 -0
  89. package/lib/src/components/YamlEditor/style.js +102 -0
  90. package/lib/src/components/YamlEditor/yaml.worker.js +1 -0
  91. package/lib/src/components/YamlForm/index.d.ts +0 -4
  92. package/lib/src/components/YamlForm/index.js +61 -0
  93. package/lib/src/components/index.js +38 -0
  94. package/lib/src/constants/index.js +2 -0
  95. package/lib/src/constants/k8s.js +203 -0
  96. package/lib/src/constants/state.d.ts +2 -1
  97. package/lib/src/constants/state.js +15 -0
  98. package/lib/src/contexts/component.js +3 -0
  99. package/lib/src/contexts/configs.js +3 -0
  100. package/lib/src/contexts/global-store.js +3 -0
  101. package/lib/src/contexts/index.js +3 -0
  102. package/lib/src/hooks/index.js +7 -0
  103. package/lib/src/hooks/useDeleteModal/index.js +1 -0
  104. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +31 -0
  105. package/lib/src/hooks/useDeleteModal/useDeleteModal.js +38 -0
  106. package/lib/src/hooks/useDownloadYAML.js +10 -0
  107. package/lib/src/hooks/useEagleForm.d.ts +1 -2
  108. package/lib/src/hooks/useEagleForm.js +177 -0
  109. package/lib/src/hooks/useEagleTable/columns.d.ts +1 -1
  110. package/lib/src/hooks/useEagleTable/columns.js +246 -0
  111. package/lib/src/hooks/useEagleTable/index.js +2 -0
  112. package/lib/src/hooks/useEagleTable/useEagleTable.js +63 -0
  113. package/lib/src/hooks/useEdit.js +19 -0
  114. package/lib/src/hooks/useGlobalStore.js +5 -0
  115. package/lib/src/hooks/useK8sYamlEditor.js +37 -0
  116. package/lib/src/hooks/useOpenForm.js +43 -0
  117. package/lib/src/hooks/useSchema.js +37 -0
  118. package/lib/src/hooks/useSubmitForm.js +42 -0
  119. package/lib/src/i18n.d.ts +4 -0
  120. package/lib/src/i18n.js +19 -0
  121. package/lib/src/index.js +13 -0
  122. package/lib/src/locales/en-US/dovetail.json +18 -0
  123. package/lib/src/locales/en-US/index.d.ts +2 -0
  124. package/lib/src/locales/en-US/index.js +4 -0
  125. package/lib/src/locales/index.js +6 -0
  126. package/lib/src/locales/zh-CN/dovetail.json +91 -0
  127. package/lib/src/locales/zh-CN/index.d.ts +2 -0
  128. package/lib/src/locales/zh-CN/index.js +4 -0
  129. package/lib/src/main.js +12 -0
  130. package/lib/src/models/cronjob-model.js +32 -0
  131. package/lib/src/models/daemonset-model.js +17 -0
  132. package/lib/src/models/deployment-model.d.ts +1 -1
  133. package/lib/src/models/deployment-model.js +17 -0
  134. package/lib/src/models/event-model.js +11 -0
  135. package/lib/src/models/index.js +14 -0
  136. package/lib/src/models/ingress-model.js +24 -0
  137. package/lib/src/models/job-model.js +56 -0
  138. package/lib/src/models/network-policy-model.js +10 -0
  139. package/lib/src/models/pod-metrics-model.js +34 -0
  140. package/lib/src/models/pod-model.js +78 -0
  141. package/lib/src/models/resource-model.js +34 -0
  142. package/lib/src/models/server-instance-model.d.ts +10 -0
  143. package/lib/src/models/service-model.d.ts +2 -1
  144. package/lib/src/models/service-model.js +17 -0
  145. package/lib/src/models/statefulset-model.d.ts +1 -1
  146. package/lib/src/models/statefulset-model.js +17 -0
  147. package/lib/src/models/types/index.js +1 -0
  148. package/lib/src/models/types/metric.js +1 -0
  149. package/lib/src/models/workload-base-model.js +22 -0
  150. package/lib/src/models/workload-model.js +51 -0
  151. package/lib/src/pages/configmaps/index.js +15 -0
  152. package/lib/src/pages/cronjobs/create/index.js +6 -0
  153. package/lib/src/pages/cronjobs/index.js +3 -0
  154. package/lib/src/pages/cronjobs/list/index.js +42 -0
  155. package/lib/src/pages/cronjobs/show/index.js +16 -0
  156. package/lib/src/pages/daemonsets/create/index.js +6 -0
  157. package/lib/src/pages/daemonsets/index.js +3 -0
  158. package/lib/src/pages/daemonsets/list/index.js +32 -0
  159. package/lib/src/pages/daemonsets/show/index.js +16 -0
  160. package/lib/src/pages/deployments/create/index.js +7 -0
  161. package/lib/src/pages/deployments/index.js +3 -0
  162. package/lib/src/pages/deployments/list/index.js +26 -0
  163. package/lib/src/pages/deployments/show/index.js +16 -0
  164. package/lib/src/pages/ingresses/index.js +26 -0
  165. package/lib/src/pages/jobs/index.js +34 -0
  166. package/lib/src/pages/networkPolicies/index.js +67 -0
  167. package/lib/src/pages/pods/create/index.js +6 -0
  168. package/lib/src/pages/pods/index.js +3 -0
  169. package/lib/src/pages/pods/list/index.js +81 -0
  170. package/lib/src/pages/pods/show/index.js +54 -0
  171. package/lib/src/pages/secrets/index.js +15 -0
  172. package/lib/src/pages/services/index.js +26 -0
  173. package/lib/src/pages/statefulsets/create/index.js +6 -0
  174. package/lib/src/pages/statefulsets/index.js +3 -0
  175. package/lib/src/pages/statefulsets/list/index.js +26 -0
  176. package/lib/src/pages/statefulsets/show/index.js +16 -0
  177. package/lib/src/plugins/index.js +3 -0
  178. package/lib/src/plugins/model-plugin.js +46 -0
  179. package/lib/src/plugins/relation-plugin.js +81 -0
  180. package/lib/src/plugins/type.js +1 -0
  181. package/lib/src/providers/index.js +1 -0
  182. package/lib/src/providers/router-provider/index.js +100 -0
  183. package/lib/src/types/index.js +1 -0
  184. package/lib/src/types/resource.js +12 -0
  185. package/lib/src/utils/addId.js +8 -0
  186. package/lib/src/utils/download.js +9 -0
  187. package/lib/src/utils/error.js +53 -0
  188. package/lib/src/utils/form.js +9 -0
  189. package/lib/src/utils/k8s.js +6 -0
  190. package/lib/src/utils/labels.js +15 -0
  191. package/lib/src/utils/match-selector.js +12 -0
  192. package/lib/src/utils/openapi.js +33 -0
  193. package/lib/src/utils/schema.js +117 -0
  194. package/lib/src/utils/selector.js +12 -0
  195. package/lib/src/utils/string.js +6 -0
  196. package/lib/src/utils/time.js +46 -0
  197. package/lib/src/utils/unit.js +69 -0
  198. package/lib/src/utils/yaml.js +44 -0
  199. package/lib/vite.config.js +60 -0
  200. package/package.json +2 -2
  201. package/lib/src/components/ModalContextProvider/index.d.ts +0 -12
  202. package/lib/src/hooks/useModal.d.ts +0 -0
  203. package/lib/src/hooks/useNamespaceFilter.d.ts +0 -5
  204. package/lib/src/model/cronjob-model.d.ts +0 -9
  205. package/lib/src/model/index.d.ts +0 -6
  206. package/lib/src/model/job-model.d.ts +0 -10
  207. package/lib/src/model/pod-metrics-model.d.ts +0 -7
  208. package/lib/src/model/pod-model.d.ts +0 -15
  209. package/lib/src/model/resource-model.d.ts +0 -17
  210. package/lib/src/model/workload-model.d.ts +0 -17
  211. package/lib/src/types/metric.d.ts +0 -25
@@ -1016,7 +1016,7 @@ var __publicField = (obj, key, value) => {
1016
1016
  }
1017
1017
  const copy$1 = "Copy";
1018
1018
  const reset_arguments$1 = "Reset";
1019
- const view_changes$1 = "Show Diff";
1019
+ const view_changes$1 = "Show diff";
1020
1020
  const back_to_edit$1 = "Edit";
1021
1021
  const configure_file$1 = "Configuration";
1022
1022
  const yaml_format_wrong$1 = "Configuration is in an invalid YAML format.";
@@ -1053,7 +1053,7 @@ var __publicField = (obj, key, value) => {
1053
1053
  const workload$1 = "Workload";
1054
1054
  const empty$1 = "No data available";
1055
1055
  const schedule$1 = "Schedule";
1056
- const lastScheduleTime$1 = "Last Schedule";
1056
+ const lastScheduleTime$1 = "Last schedule";
1057
1057
  const duration$1 = "Duration";
1058
1058
  const started$1 = "Start time";
1059
1059
  const container$1 = "Container";
@@ -1080,7 +1080,7 @@ var __publicField = (obj, key, value) => {
1080
1080
  const port$1 = "Port";
1081
1081
  const cert$1 = "Certificate";
1082
1082
  const ip_address$1 = "IP address";
1083
- const last_seen$1 = "Last Seen";
1083
+ const last_seen$1 = "Last seen";
1084
1084
  const node_port$1 = "NodePort";
1085
1085
  const protocol$1 = "Protocol";
1086
1086
  const key$1 = "Key";
@@ -1150,9 +1150,9 @@ var __publicField = (obj, key, value) => {
1150
1150
  const suspend$1 = "Suspend";
1151
1151
  const default_backend$1 = "Default backend";
1152
1152
  const ingress_class$1 = "IngressClass";
1153
- const pod_ready_num$1 = "Ready Pod";
1154
- const pod_complete_num$1 = "Completion Pod";
1155
- const pod_replicas_num$1 = "Desired Pod";
1153
+ const pod_ready_num$1 = "Ready pod";
1154
+ const pod_complete_num$1 = "Completion pod";
1155
+ const pod_replicas_num$1 = "Desired pod";
1156
1156
  const edit_replicas$1 = "Edit expected number of replicas";
1157
1157
  const dns_record$1 = "DNS record";
1158
1158
  const basic_info$1 = "Basic information";
@@ -1164,6 +1164,8 @@ var __publicField = (obj, key, value) => {
1164
1164
  const path_type$1 = "Path type";
1165
1165
  const only_support_one_yaml$1 = "Only one YAML configuration is supported at a time.";
1166
1166
  const not_support$1 = "Not supported";
1167
+ const stopped$1 = "Stopped";
1168
+ const any_node_ip$1 = "Any node IP";
1167
1169
  const dovetail$1 = {
1168
1170
  copy: copy$1,
1169
1171
  reset_arguments: reset_arguments$1,
@@ -1317,7 +1319,9 @@ var __publicField = (obj, key, value) => {
1317
1319
  pod_port: pod_port$1,
1318
1320
  path_type: path_type$1,
1319
1321
  only_support_one_yaml: only_support_one_yaml$1,
1320
- not_support: not_support$1
1322
+ not_support: not_support$1,
1323
+ stopped: stopped$1,
1324
+ any_node_ip: any_node_ip$1
1321
1325
  };
1322
1326
  const EN = {
1323
1327
  dovetail: dovetail$1
@@ -1473,6 +1477,8 @@ var __publicField = (obj, key, value) => {
1473
1477
  const out_external_name_desc = "ExternalName 展示 <strong>external-ip</strong>。";
1474
1478
  const only_support_one_yaml = "一次仅支持输入一个 YAML 配置。";
1475
1479
  const not_support = "不支持";
1480
+ const stopped = "已停止";
1481
+ const any_node_ip = "任意节点 IP";
1476
1482
  const dovetail = {
1477
1483
  copy,
1478
1484
  reset_arguments,
@@ -1627,7 +1633,9 @@ var __publicField = (obj, key, value) => {
1627
1633
  out_cluster_lb_desc,
1628
1634
  out_external_name_desc,
1629
1635
  only_support_one_yaml,
1630
- not_support
1636
+ not_support,
1637
+ stopped,
1638
+ any_node_ip
1631
1639
  };
1632
1640
  const ZH = {
1633
1641
  dovetail
@@ -9550,6 +9558,7 @@ var __publicField = (obj, key, value) => {
9550
9558
  WorkloadState2["TERMINATING"] = "terminating";
9551
9559
  WorkloadState2["PENDING"] = "pending";
9552
9560
  WorkloadState2["WAITING"] = "waiting";
9561
+ WorkloadState2["STOPPED"] = "stopped";
9553
9562
  return WorkloadState2;
9554
9563
  })(WorkloadState || {});
9555
9564
  var AccessControlAuth = /* @__PURE__ */ ((AccessControlAuth2) => {
@@ -9840,7 +9849,7 @@ var __publicField = (obj, key, value) => {
9840
9849
  }
9841
9850
  get readyDisplay() {
9842
9851
  var _a, _b, _c;
9843
- return `${(_b = (_a = this._rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c2) => c2.ready).length}/${(_c = this._rawYaml.spec) == null ? void 0 : _c.containers.length}`;
9852
+ return `${((_b = (_a = this._rawYaml.status) == null ? void 0 : _a.containerStatuses) == null ? void 0 : _b.filter((c2) => c2.ready).length) || 0}/${((_c = this._rawYaml.spec) == null ? void 0 : _c.containers.length) || 0}`;
9844
9853
  }
9845
9854
  get readyContainerCount() {
9846
9855
  var _a, _b;
@@ -9931,8 +9940,10 @@ var __publicField = (obj, key, value) => {
9931
9940
  this._globalStore = _globalStore;
9932
9941
  }
9933
9942
  get stateDisplay() {
9934
- var _a, _b;
9935
- if (((_a = this.spec) == null ? void 0 : _a.replicas) !== ((_b = this.status) == null ? void 0 : _b.readyReplicas)) {
9943
+ var _a, _b, _c;
9944
+ if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
9945
+ return WorkloadState.STOPPED;
9946
+ } else if (((_b = this.spec) == null ? void 0 : _b.replicas) !== ((_c = this.status) == null ? void 0 : _c.readyReplicas)) {
9936
9947
  return WorkloadState.UPDATING;
9937
9948
  }
9938
9949
  return WorkloadState.READY;
@@ -9965,8 +9976,10 @@ var __publicField = (obj, key, value) => {
9965
9976
  this._globalStore = _globalStore;
9966
9977
  }
9967
9978
  get stateDisplay() {
9968
- var _a, _b;
9969
- if (((_a = this.spec) == null ? void 0 : _a.replicas) !== ((_b = this.status) == null ? void 0 : _b.readyReplicas)) {
9979
+ var _a, _b, _c;
9980
+ if (((_a = this.spec) == null ? void 0 : _a.replicas) === 0) {
9981
+ return WorkloadState.STOPPED;
9982
+ } else if (((_b = this.spec) == null ? void 0 : _b.replicas) !== ((_c = this.status) == null ? void 0 : _c.readyReplicas)) {
9970
9983
  return WorkloadState.UPDATING;
9971
9984
  }
9972
9985
  return WorkloadState.READY;
@@ -10000,19 +10013,20 @@ var __publicField = (obj, key, value) => {
10000
10013
  get displayPortMapping() {
10001
10014
  var _a;
10002
10015
  return (_a = this._rawYaml.spec.ports) == null ? void 0 : _a.map((p) => {
10003
- let servicePort = `${p.port}`;
10016
+ let link = "";
10004
10017
  if (this._rawYaml.spec.clusterIP && this._rawYaml.spec.clusterIP !== "None") {
10005
- servicePort = `${this._rawYaml.spec.clusterIP}:${p.port}`;
10018
+ link = `${this._rawYaml.spec.clusterIP}:${p.port}`;
10006
10019
  }
10007
10020
  return {
10008
- servicePort,
10021
+ servicePort: p.port,
10022
+ link,
10009
10023
  targetPort: p.targetPort,
10010
10024
  protocol: p.protocol
10011
10025
  };
10012
10026
  });
10013
10027
  }
10014
10028
  }
10015
- const index_w8956m = "";
10029
+ const index_1lzkrja = "";
10016
10030
  const ServiceInClusterAccessComponent = ({
10017
10031
  service
10018
10032
  }) => {
@@ -10033,10 +10047,8 @@ var __publicField = (obj, key, value) => {
10033
10047
  }
10034
10048
  };
10035
10049
  const BreakLineStyle = "b1vtjd4k";
10036
- const LinkStyle = "luro4rx";
10037
10050
  const ServiceOutClusterAccessComponent = ({
10038
10051
  service,
10039
- clusterVip,
10040
10052
  breakLine = true
10041
10053
  }) => {
10042
10054
  var _a, _b, _c, _d;
@@ -10048,17 +10060,12 @@ var __publicField = (obj, key, value) => {
10048
10060
  let content = "-";
10049
10061
  switch (spec.type) {
10050
10062
  case ServiceTypeEnum.NodePort:
10051
- content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Link, {
10052
- target: "_blank",
10053
- href: `http://${clusterVip}:${p.nodePort}`,
10054
- className: cx_default(breakLine ? BreakLineStyle : "", LinkStyle),
10055
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
10056
- content: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
10057
- className: eagle.Typo.Label.l4_regular_title,
10058
- children: [clusterVip, ":", p.nodePort, !breakLine && index !== (spec.ports || []).length - 1 ? ", " : ""]
10059
- }),
10060
- tooltip: `${clusterVip}:${p.nodePort}`
10061
- })
10063
+ content = (_a = spec.ports) == null ? void 0 : _a.filter((v) => !!v).map((p, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
10064
+ content: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
10065
+ className: cx_default(eagle.Typo.Label.l4_regular_title, BreakLineStyle),
10066
+ children: [i18n2.t("dovetail.any_node_ip"), ":", p.nodePort, !breakLine && index !== (spec.ports || []).length - 1 ? ", " : ""]
10067
+ }),
10068
+ tooltip: `${i18n2.t("dovetail.any_node_ip")}:${p.nodePort}`
10062
10069
  }, p.nodePort));
10063
10070
  return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", {
10064
10071
  children: content
@@ -10142,7 +10149,8 @@ var __publicField = (obj, key, value) => {
10142
10149
  terminating: "loading",
10143
10150
  pending: "warning",
10144
10151
  waiting: "warning",
10145
- terminated: "red"
10152
+ terminated: "red",
10153
+ stopped: "gray"
10146
10154
  };
10147
10155
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
10148
10156
  className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
@@ -10902,8 +10910,14 @@ var __publicField = (obj, key, value) => {
10902
10910
  }, `${image2}-${index}`)) : value2.join(", ")
10903
10911
  });
10904
10912
  };
10913
+ const index_cbhkdt = "";
10914
+ const LinkStyle$1 = "l1vnw9x0";
10905
10915
  const ResourceLink = (props) => {
10906
- const { name: name2, namespace: namespace2, resourceId } = props;
10916
+ const {
10917
+ name: name2,
10918
+ namespace: namespace2,
10919
+ resourceId
10920
+ } = props;
10907
10921
  const kit = eagle.useUIKit();
10908
10922
  const navigation = core.useNavigation();
10909
10923
  const go = core.useGo();
@@ -10918,7 +10932,11 @@ var __publicField = (obj, key, value) => {
10918
10932
  }
10919
10933
  });
10920
10934
  };
10921
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.Link, { onClick, children: resourceId });
10935
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.Link, {
10936
+ className: LinkStyle$1,
10937
+ onClick,
10938
+ children: resourceId
10939
+ });
10922
10940
  };
10923
10941
  const IngressRulesTable = ({ ingress }) => {
10924
10942
  const { t: t2 } = useTranslation();
@@ -11324,7 +11342,7 @@ var __publicField = (obj, key, value) => {
11324
11342
  i18n: i18n2
11325
11343
  } = useTranslation();
11326
11344
  const [hideSecret, setHideSecret] = React.useState(true);
11327
- const toggleButton = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
11345
+ const toggleButton = Object.keys(data2).length ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
11328
11346
  type: "quiet",
11329
11347
  prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, {
11330
11348
  src: hideSecret ? iconsReact.ViewEye16GradientGrayIcon : iconsReact.EntityFilterIgnoreGradient16GrayIcon
@@ -11333,7 +11351,7 @@ var __publicField = (obj, key, value) => {
11333
11351
  className: ButtonStyle,
11334
11352
  size: "small",
11335
11353
  children: hideSecret ? i18n2.t("dovetail.show_data_value") : i18n2.t("dovetail.hide_data_value")
11336
- });
11354
+ }) : null;
11337
11355
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ShowGroupComponent, {
11338
11356
  title: i18n2.t("dovetail.data"),
11339
11357
  operationEle: toggleButton,
@@ -11845,7 +11863,13 @@ var __publicField = (obj, key, value) => {
11845
11863
  key: "data",
11846
11864
  path: ["data"],
11847
11865
  renderContent: (val) => {
11848
- return /* @__PURE__ */ jsxRuntimeExports.jsx(KeyValue, { data: val, empty: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.data") }) });
11866
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
11867
+ KeyValue,
11868
+ {
11869
+ data: val,
11870
+ empty: i18n2.t("dovetail.no_resource", { kind: i18n2.t("dovetail.data") })
11871
+ }
11872
+ );
11849
11873
  }
11850
11874
  };
11851
11875
  };
@@ -11970,12 +11994,12 @@ var __publicField = (obj, key, value) => {
11970
11994
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceInClusterAccessComponent, { service: record });
11971
11995
  }
11972
11996
  });
11973
- const ServiceOutClusterAccessField = (clusterVip) => ({
11997
+ const ServiceOutClusterAccessField = () => ({
11974
11998
  key: "innerClusterAccess",
11975
11999
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
11976
12000
  path: [],
11977
12001
  renderContent: (_, record) => {
11978
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, clusterVip, breakLine: false });
12002
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, { service: record, breakLine: false });
11979
12003
  }
11980
12004
  });
11981
12005
  const PodSelectorField = () => ({
@@ -23498,6 +23522,9 @@ var __publicField = (obj, key, value) => {
23498
23522
  errorNotification: false,
23499
23523
  transformInitValues,
23500
23524
  transformApplyValues,
23525
+ mutationMeta: {
23526
+ updateType: "put"
23527
+ },
23501
23528
  ...useFormProps
23502
23529
  });
23503
23530
  const kit = eagle.useUIKit();
@@ -23604,9 +23631,9 @@ var __publicField = (obj, key, value) => {
23604
23631
  onErrorsChange(errors) {
23605
23632
  setIsError(!!errors.length);
23606
23633
  },
23607
- onFinish: eagle.usePopModal
23634
+ onFinish: popModal
23608
23635
  };
23609
- }, [props.formProps, (_a = config.formConfig) == null ? void 0 : _a.transformInitValues, (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues, config == null ? void 0 : config.initValue, id, action]);
23636
+ }, [props.formProps, (_a = config.formConfig) == null ? void 0 : _a.transformInitValues, (_b = config.formConfig) == null ? void 0 : _b.transformApplyValues, config == null ? void 0 : config.initValue, id, action, popModal]);
23610
23637
  const refineFormResult = useRefineForm({
23611
23638
  config,
23612
23639
  id,
@@ -24010,41 +24037,45 @@ var __publicField = (obj, key, value) => {
24010
24037
  });
24011
24038
  return /* @__PURE__ */ jsxRuntimeExports.jsx("ul", { children: tags });
24012
24039
  };
24013
- const IngressRulesComponent = ({ ingress }) => {
24040
+ const index_18ct5u4 = "";
24041
+ const LinkStyle = "l25ca2k";
24042
+ const IngressRulesComponent = ({
24043
+ ingress
24044
+ }) => {
24014
24045
  const kit = eagle.useUIKit();
24015
24046
  const result = ingress.flattenedRules.map((r2) => {
24016
24047
  const divider = " > ";
24017
- let pre = /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: r2.fullPath });
24048
+ let pre = /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
24049
+ children: r2.fullPath
24050
+ });
24018
24051
  if (r2.fullPath.includes("http") && !r2.fullPath.includes("*")) {
24019
- pre = /* @__PURE__ */ jsxRuntimeExports.jsx(kit.Link, { href: r2.fullPath, target: "_blank", children: r2.fullPath });
24052
+ pre = /* @__PURE__ */ jsxRuntimeExports.jsx(kit.Link, {
24053
+ className: LinkStyle,
24054
+ href: r2.fullPath,
24055
+ target: "_blank",
24056
+ children: r2.fullPath
24057
+ });
24020
24058
  }
24021
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
24022
- kit.overflowTooltip,
24023
- {
24024
- content: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
24025
- pre,
24026
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: divider }),
24027
- r2.serviceName ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
24028
- /* @__PURE__ */ jsxRuntimeExports.jsx(
24029
- ResourceLink,
24030
- {
24031
- name: "services",
24032
- namespace: ingress.metadata.namespace || "default",
24033
- resourceId: r2.serviceName
24034
- }
24035
- ),
24036
- /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { children: [
24037
- ":",
24038
- r2.servicePort
24039
- ] })
24040
- ] }) : r2.resourceName
24041
- ] }),
24042
- tooltip: `${r2.fullPath}${divider}:${r2.servicePort}`
24043
- },
24044
- r2.fullPath
24045
- );
24059
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
24060
+ content: /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
24061
+ children: [pre, /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
24062
+ children: divider
24063
+ }), r2.serviceName ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
24064
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(ResourceLink, {
24065
+ name: "services",
24066
+ namespace: ingress.metadata.namespace || "default",
24067
+ resourceId: r2.serviceName
24068
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
24069
+ children: [":", r2.servicePort]
24070
+ })]
24071
+ }) : r2.resourceName]
24072
+ }),
24073
+ tooltip: `${r2.fullPath}${divider}:${r2.servicePort}`
24074
+ }, r2.fullPath);
24075
+ });
24076
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
24077
+ children: result
24046
24078
  });
24047
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: result });
24048
24079
  };
24049
24080
  const columns_qgyagz = "";
24050
24081
  const DashedTitleStyle = "dh5j833";
@@ -24175,8 +24206,7 @@ var __publicField = (obj, key, value) => {
24175
24206
  width: 120,
24176
24207
  dataIndex,
24177
24208
  align: "right",
24178
- title: i18n2.t("dovetail.restarts"),
24179
- sortable: false
24209
+ title: i18n2.t("dovetail.restarts")
24180
24210
  };
24181
24211
  };
24182
24212
  const ReplicasColumnRenderer = (i18n2) => {
@@ -24186,7 +24216,7 @@ var __publicField = (obj, key, value) => {
24186
24216
  display: true,
24187
24217
  dataIndex,
24188
24218
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Tooltip, {
24189
- title: i18n2.t("dovetail.completion_num_tooltip"),
24219
+ title: i18n2.t("dovetail.ready_num_tooltip"),
24190
24220
  children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
24191
24221
  className: DashedTitleStyle,
24192
24222
  children: i18n2.t("dovetail.pod_num")
@@ -24207,6 +24237,7 @@ var __publicField = (obj, key, value) => {
24207
24237
  isRelativeTime = true
24208
24238
  } = {}) => {
24209
24239
  const dataIndex = ["metadata", "creationTimestamp"];
24240
+ const kit = eagle.useUIKit();
24210
24241
  return {
24211
24242
  key: "creationTimestamp",
24212
24243
  display: true,
@@ -24218,7 +24249,11 @@ var __publicField = (obj, key, value) => {
24218
24249
  return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
24219
24250
  date: new Date(value2)
24220
24251
  }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
24221
- value: dayjs(value2).format("YYYY-MM-DD hh:mm:ss")
24252
+ value: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.time, {
24253
+ date: value2,
24254
+ timeTemplate: "HH:mm:ss",
24255
+ dateTemplate: "YYYY-MM-DD"
24256
+ })
24222
24257
  });
24223
24258
  },
24224
24259
  ...config
@@ -24379,7 +24414,7 @@ var __publicField = (obj, key, value) => {
24379
24414
  })
24380
24415
  });
24381
24416
  }
24382
- const ServiceOutClusterAccessColumnRenderer = (clusterVip) => {
24417
+ const ServiceOutClusterAccessColumnRenderer = () => {
24383
24418
  return {
24384
24419
  key: "outClusterAccess",
24385
24420
  title: /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessTitle, {}),
@@ -24388,8 +24423,7 @@ var __publicField = (obj, key, value) => {
24388
24423
  width: 160,
24389
24424
  render(_, record) {
24390
24425
  return /* @__PURE__ */ jsxRuntimeExports.jsx(ServiceOutClusterAccessComponent, {
24391
- service: record,
24392
- clusterVip
24426
+ service: record
24393
24427
  });
24394
24428
  }
24395
24429
  };
@@ -24552,15 +24586,15 @@ var __publicField = (obj, key, value) => {
24552
24586
  whiteSpace: "pre"
24553
24587
  },
24554
24588
  children: [record.displayType === "NodePort" ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Link, {
24555
- href: `//${v.servicePort}`,
24589
+ href: `//${v.link}`,
24556
24590
  target: "_blank",
24557
24591
  children: v.servicePort
24558
- }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
24592
+ }) : v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
24559
24593
  }),
24560
24594
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
24561
24595
  }, v.servicePort));
24562
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {
24563
- children: content
24596
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, {
24597
+ value: content
24564
24598
  });
24565
24599
  }
24566
24600
  };
package/dist/style.css CHANGED
@@ -10,7 +10,6 @@
10
10
  .ax1qopv{position:absolute;top:0;left:0;bottom:0;width:1px;background:$blue-60;-webkit-transform:translateX(-9999px);-ms-transform:translateX(-9999px);transform:translateX(-9999px);z-index:999;}.ax1qopv::before{content:'';position:absolute;height:34px;width:3px;top:0;left:-1px;background:$blue-60;}
11
11
  .t1upn1sz{width:100%;border-top:1px solid rgba(211,218,235,0.6);display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.t1upn1sz .ant-table-pagination{display:none;}.t1upn1sz .table-container{min-height:0;}
12
12
  .b1vtjd4k.ant-btn.ant-btn-link{display:block;}
13
- .luro4rx.ant-btn.ant-btn-link{line-height:18px;height:18px;}
14
13
  .t13a6vox{-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;max-width:100%;gap:8px 8px;}
15
14
  .t12ikbmp.ant-tag{overflow:hidden;text-overflow:ellipsis;color:#1D326C;}.t12ikbmp.ant-tag.outside-tag{border:1px solid #A3B4CC;background-color:#E4E9F2;}.t12ikbmp.ant-tag .inside-tag{background-color:#CCD4E3;}
16
15
  .s8qkbck.ant-tag{padding:3px 16px;height:24px;}.s8qkbck.no-background{background-color:transparent !important;padding:0;}
@@ -21,6 +20,7 @@
21
20
  .d1wqyhgc{color:rgba(44,56,82,0.75);}
22
21
  .w16agr8o.ant-space{width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;}
23
22
  .i1u1f5zp{white-space:pre-line;}
23
+ .l1vnw9x0{padding:0 !important;}
24
24
  .c8jy7dc{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;padding:8px 10px;-webkit-flex-direction:row;-ms-flex-direction:row;flex-direction:row;-webkit-align-items:flex-start;-webkit-box-align:flex-start;-ms-flex-align:flex-start;align-items:flex-start;gap:8px;-webkit-align-self:stretch;-ms-flex-item-align:stretch;align-self:stretch;border-radius:4px;background:rgba(237,241,250,0.6);}.c8jy7dc:not(:last-of-type){margin-bottom:8px;}
25
25
  .k2sddxl{color:rgba(44,56,82,0.75);width:calc(30% - 4px);margin-right:8px;word-break:break-all;}
26
26
  .v16vicsr{word-break:break-all;white-space:pre-wrap;width:calc(70% - 4px);}
@@ -1536,6 +1536,7 @@
1536
1536
  .c1i80kj{height:100%;}
1537
1537
  .s18sezq1.ant-layout-sider{background:#edf0f7;}
1538
1538
  .cyc9hl2.ant-layout-content{background:#fff;}
1539
+ .l25ca2k{padding:0 !important;}
1539
1540
  .dh5j833{border-bottom:1px dashed rgba(107,128,167,0.6);padding-bottom:1px;}
1540
1541
  .s1fcgan.ant-tooltip .ant-tooltip-inner{width:256px;}
1541
1542
  body,
package/lib/src/App.js ADDED
@@ -0,0 +1,91 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { createBrowserHistory } from 'history';
3
+ import { GlobalStore } from 'k8s-api-provider';
4
+ import { useMemo } from 'react';
5
+ import { I18nextProvider } from 'react-i18next';
6
+ import { Route, Router } from 'react-router-dom';
7
+ import { Layout } from './components';
8
+ import { CRONJOB_INIT_VALUE, DAEMONSET_INIT_VALUE, STATEFULSET_INIT_VALUE, POD_INIT_VALUE, } from './constants/k8s';
9
+ import { Dovetail } from './Dovetail';
10
+ import i18n from './i18n';
11
+ import { ConfigMapConfig } from './pages/configmaps';
12
+ import { CronJobForm, CronJobList, CronJobShow } from './pages/cronjobs';
13
+ import { DaemonSetForm, DaemonSetList, DaemonSetShow } from './pages/daemonsets';
14
+ import { DeploymentForm, DeploymentList, DeploymentShow } from './pages/deployments';
15
+ import { IngressConfig } from './pages/ingresses';
16
+ import { JobConfig } from './pages/jobs';
17
+ import { NetworkPolicyConfig } from './pages/networkPolicies';
18
+ import { PodShow, PodList, PodForm } from './pages/pods';
19
+ import { SecretsConfig } from './pages/secrets';
20
+ import { ServicesConfig } from './pages/services';
21
+ import { StatefulSetShow, StatefulSetList, StatefulSetForm } from './pages/statefulsets';
22
+ import { ProviderPlugins } from './plugins';
23
+ import { RESOURCE_GROUP, FormType } from './types';
24
+ function App() {
25
+ const histroy = createBrowserHistory();
26
+ const resourcesConfig = useMemo(() => {
27
+ return [
28
+ {
29
+ name: 'cronjobs',
30
+ basePath: '/apis/batch/v1beta1',
31
+ kind: 'CronJob',
32
+ parent: RESOURCE_GROUP.WORKLOAD,
33
+ label: 'CronJobs',
34
+ initValue: CRONJOB_INIT_VALUE,
35
+ isCustom: true,
36
+ },
37
+ {
38
+ name: 'daemonsets',
39
+ basePath: '/apis/apps/v1',
40
+ kind: 'DaemonSet',
41
+ parent: RESOURCE_GROUP.WORKLOAD,
42
+ label: 'DaemonSets',
43
+ initValue: DAEMONSET_INIT_VALUE,
44
+ isCustom: true,
45
+ },
46
+ {
47
+ name: 'deployments',
48
+ basePath: '/apis/apps/v1',
49
+ kind: 'Deployment',
50
+ parent: RESOURCE_GROUP.WORKLOAD,
51
+ label: 'Deployments',
52
+ formType: FormType.MODAL,
53
+ FormModal: DeploymentForm,
54
+ isCustom: true,
55
+ },
56
+ {
57
+ name: 'statefulsets',
58
+ basePath: '/apis/apps/v1',
59
+ kind: 'StatefulSet',
60
+ parent: RESOURCE_GROUP.WORKLOAD,
61
+ label: 'StatefulSets',
62
+ initValue: STATEFULSET_INIT_VALUE,
63
+ isCustom: true,
64
+ },
65
+ {
66
+ name: 'pods',
67
+ basePath: '/api/v1',
68
+ kind: 'Pod',
69
+ parent: RESOURCE_GROUP.WORKLOAD,
70
+ label: 'Pods',
71
+ initValue: POD_INIT_VALUE,
72
+ isCustom: true,
73
+ },
74
+ JobConfig,
75
+ IngressConfig,
76
+ NetworkPolicyConfig,
77
+ ConfigMapConfig,
78
+ SecretsConfig,
79
+ ServicesConfig,
80
+ ];
81
+ }, []);
82
+ const globalStore = useMemo(() => {
83
+ return new GlobalStore({
84
+ apiUrl: '/api/k8s',
85
+ watchWsApiUrl: 'api/sks-ws/k8s',
86
+ prefix: 'default',
87
+ }, ProviderPlugins);
88
+ }, []);
89
+ return (_jsx(I18nextProvider, { i18n: i18n, children: _jsx(Dovetail, { resourcesConfig: resourcesConfig, Layout: Layout, history: histroy, globalStore: globalStore, children: _jsxs(Router, { history: histroy, children: [_jsx(Route, { path: "/cronjobs", exact: true, children: _jsx(CronJobList, {}) }), _jsx(Route, { path: "/cronjobs/show", children: _jsx(CronJobShow, {}) }), _jsx(Route, { path: "/cronjobs/create", children: _jsx(CronJobForm, {}) }), _jsx(Route, { path: "/cronjobs/edit", children: _jsx(CronJobForm, {}) }), _jsx(Route, { path: "/daemonsets", exact: true, children: _jsx(DaemonSetList, {}) }), _jsx(Route, { path: "/daemonsets/show", children: _jsx(DaemonSetShow, {}) }), _jsx(Route, { path: "/daemonsets/create", children: _jsx(DaemonSetForm, {}) }), _jsx(Route, { path: "/daemonsets/edit", children: _jsx(DaemonSetForm, {}) }), _jsx(Route, { path: "/deployments", exact: true, children: _jsx(DeploymentList, {}) }), _jsx(Route, { path: "/deployments/show", children: _jsx(DeploymentShow, {}) }), _jsx(Route, { path: "/statefulsets", exact: true, children: _jsx(StatefulSetList, {}) }), _jsx(Route, { path: "/statefulsets/show", children: _jsx(StatefulSetShow, {}) }), _jsx(Route, { path: "/statefulsets/create", children: _jsx(StatefulSetForm, {}) }), _jsx(Route, { path: "/statefulsets/edit", children: _jsx(StatefulSetForm, {}) }), _jsx(Route, { path: "/pods", exact: true, children: _jsx(PodList, {}) }), _jsx(Route, { path: "/pods/show", children: _jsx(PodShow, {}) }), _jsx(Route, { path: "/pods/create", children: _jsx(PodForm, {}) }), _jsx(Route, { path: "/pods/edit", children: _jsx(PodForm, {}) })] }) }) }));
90
+ }
91
+ export default App;
@@ -0,0 +1,45 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { KitStoreProvider, ModalStack } from '@cloudtower/eagle';
3
+ import { Refine } from '@refinedev/core';
4
+ import { dataProvider, liveProvider } from 'k8s-api-provider';
5
+ import { keyBy } from 'lodash-es';
6
+ import { useMemo } from 'react';
7
+ import { Router } from 'react-router-dom';
8
+ import ConfigsContext from 'src/contexts/configs';
9
+ import { ResourceCRUD } from './components/ResourceCRUD';
10
+ import GlobalStoreContext from './contexts/global-store';
11
+ import { routerProvider } from './providers/router-provider';
12
+ import './styles.css';
13
+ export const Dovetail = props => {
14
+ const { resourcesConfig, urlPrefix = '', Layout, history, globalStore } = props;
15
+ const notCustomResources = useMemo(() => {
16
+ return resourcesConfig.filter(c => !c.isCustom);
17
+ }, [resourcesConfig]);
18
+ const content = useMemo(() => {
19
+ const _content = (_jsxs(_Fragment, { children: [_jsx(ModalStack, {}), _jsx(ResourceCRUD, { configs: notCustomResources, urlPrefix: urlPrefix }), props.children] }));
20
+ if (Layout) {
21
+ return _jsx(Layout, { children: _content });
22
+ }
23
+ return _content;
24
+ }, [Layout, notCustomResources, props.children, urlPrefix]);
25
+ return (_jsx(Router, { history: history, children: _jsx(KitStoreProvider, { children: _jsx(GlobalStoreContext.Provider, { value: { globalStore }, children: _jsx(ConfigsContext.Provider, { value: keyBy(resourcesConfig, 'name'), children: _jsx(Refine, { dataProvider: {
26
+ default: dataProvider(globalStore),
27
+ }, routerProvider: routerProvider, liveProvider: liveProvider(globalStore), options: {
28
+ warnWhenUnsavedChanges: true,
29
+ liveMode: 'auto',
30
+ }, resources: resourcesConfig.map(c => {
31
+ return {
32
+ name: c.name,
33
+ meta: {
34
+ resourceBasePath: c.basePath,
35
+ kind: c.kind,
36
+ parent: c.parent,
37
+ label: `${c.kind}s`,
38
+ },
39
+ list: `${urlPrefix}/${c.name}`,
40
+ show: `${urlPrefix}/${c.name}/show`,
41
+ create: `${urlPrefix}/${c.name}/create`,
42
+ edit: `${urlPrefix}/${c.name}/edit`,
43
+ };
44
+ }), children: content }) }) }) }) }));
45
+ };
@@ -0,0 +1,20 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { css, cx } from '@linaria/core';
3
+ import { useBreadcrumb } from '@refinedev/core';
4
+ import { Link } from 'react-router-dom';
5
+ const BreadcrumbStyle = css `
6
+ display: flex;
7
+
8
+ .breadcrumb-item {
9
+ &:not(:last-of-type):after {
10
+ content: '>';
11
+ margin: 0 8px;
12
+ }
13
+ }
14
+ `;
15
+ export function Breadcrumb(props) {
16
+ const { breadcrumbs } = useBreadcrumb();
17
+ return (_jsx("ul", { className: cx(BreadcrumbStyle, props.className), children: breadcrumbs.map(breadcrumb => {
18
+ return (_jsx("li", { className: "breadcrumb-item", children: breadcrumb.href ? (_jsx(Link, { to: breadcrumb.href, children: breadcrumb.label })) : (_jsx("span", { children: breadcrumb.label })) }, `breadcrumb-${breadcrumb.label}`));
19
+ }) }));
20
+ }