@dovetail-v2/refine 0.0.45-bowen.4 → 0.0.46-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 (206) hide show
  1. package/dist/{MonacoYamlDiffEditor-edd70925.js → MonacoYamlDiffEditor-a06e0978.js} +2 -2
  2. package/dist/{index-1a64b0dc.js → index-5213b638.js} +922 -989
  3. package/dist/refine.js +3 -3
  4. package/dist/refine.umd.cjs +917 -984
  5. package/dist/style.css +13 -15
  6. package/lib/src/components/Form/RefineFormContent.d.ts +1 -1
  7. package/lib/src/components/Form/type.d.ts +0 -2
  8. package/lib/src/components/ModalContextProvider/index.d.ts +12 -0
  9. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +2 -1
  10. package/lib/src/components/ShowContent/ShowContent.d.ts +2 -0
  11. package/lib/src/components/Table/index.d.ts +2 -0
  12. package/lib/src/components/YamlForm/index.d.ts +4 -0
  13. package/lib/src/hooks/useDownloadYAML.d.ts +1 -1
  14. package/lib/src/hooks/useEagleForm.d.ts +2 -1
  15. package/lib/src/hooks/useModal.d.ts +0 -0
  16. package/lib/src/hooks/useTableData.d.ts +18 -0
  17. package/lib/src/model/cronjob-model.d.ts +9 -0
  18. package/lib/src/model/index.d.ts +6 -0
  19. package/lib/src/model/job-model.d.ts +10 -0
  20. package/lib/src/model/pod-metrics-model.d.ts +7 -0
  21. package/lib/src/model/pod-model.d.ts +15 -0
  22. package/lib/src/model/resource-model.d.ts +17 -0
  23. package/lib/src/model/workload-model.d.ts +17 -0
  24. package/lib/src/types/metric.d.ts +25 -0
  25. package/lib/src/types/resource.d.ts +2 -7
  26. package/package.json +2 -2
  27. package/lib/src/App.js +0 -91
  28. package/lib/src/Dovetail.js +0 -45
  29. package/lib/src/components/Breadcrumb/index.js +0 -20
  30. package/lib/src/components/ConditionsTable/ConditionsTable.js +0 -56
  31. package/lib/src/components/ConditionsTable/index.js +0 -1
  32. package/lib/src/components/CreateButton/index.js +0 -10
  33. package/lib/src/components/CronJobDropdown/index.js +0 -26
  34. package/lib/src/components/CronjobJobsTable/index.js +0 -49
  35. package/lib/src/components/DeleteButton/index.js +0 -13
  36. package/lib/src/components/DeleteManyButton/index.js +0 -16
  37. package/lib/src/components/DrawerShow/DrawerShow.js +0 -13
  38. package/lib/src/components/DrawerShow/index.js +0 -1
  39. package/lib/src/components/EditButton/index.js +0 -13
  40. package/lib/src/components/EditField/index.js +0 -47
  41. package/lib/src/components/ErrorContent/index.js +0 -36
  42. package/lib/src/components/EventsTable/EventsTable.js +0 -59
  43. package/lib/src/components/EventsTable/index.js +0 -1
  44. package/lib/src/components/Form/KeyValueListWidget.js +0 -56
  45. package/lib/src/components/Form/MetadataForm.js +0 -9
  46. package/lib/src/components/Form/NameInputWidget.js +0 -50
  47. package/lib/src/components/Form/NamespaceSelectWidget.js +0 -21
  48. package/lib/src/components/Form/index.js +0 -4
  49. package/lib/src/components/Form/widget.js +0 -1
  50. package/lib/src/components/FormErrorAlert/index.js +0 -8
  51. package/lib/src/components/FormLayout/index.js +0 -21
  52. package/lib/src/components/FormModal/index.js +0 -51
  53. package/lib/src/components/ImageNames/index.js +0 -14
  54. package/lib/src/components/IngressRulesComponent/index.js +0 -11
  55. package/lib/src/components/IngressRulesTable/IngressRulesTable.js +0 -51
  56. package/lib/src/components/IngressRulesTable/index.js +0 -1
  57. package/lib/src/components/K8sDropdown/index.js +0 -31
  58. package/lib/src/components/KeyValue/KeyValue.js +0 -27
  59. package/lib/src/components/KeyValue/index.js +0 -1
  60. package/lib/src/components/KeyValueData/index.js +0 -50
  61. package/lib/src/components/Layout/index.js +0 -39
  62. package/lib/src/components/ListPage/index.js +0 -25
  63. package/lib/src/components/Menu/index.js +0 -36
  64. package/lib/src/components/NamespacesFilter/index.js +0 -34
  65. package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +0 -77
  66. package/lib/src/components/NetworkPolicyRulesTable/index.js +0 -1
  67. package/lib/src/components/PageShow/PageShow.js +0 -11
  68. package/lib/src/components/PageShow/index.js +0 -1
  69. package/lib/src/components/PodContainersTable/PodContainersTable.js +0 -78
  70. package/lib/src/components/PodContainersTable/index.js +0 -1
  71. package/lib/src/components/PodLog/index.js +0 -136
  72. package/lib/src/components/ReferenceLink/index.js +0 -17
  73. package/lib/src/components/RefineForm/RefineFormContent.d.ts +0 -10
  74. package/lib/src/components/RefineForm/RefineFormModal.d.ts +0 -8
  75. package/lib/src/components/RefineForm/RefineFormPage.d.ts +0 -7
  76. package/lib/src/components/RefineForm/index.d.ts +0 -3
  77. package/lib/src/components/RefineForm/type.d.ts +0 -20
  78. package/lib/src/components/RefineForm/useRefineForm.d.ts +0 -10
  79. package/lib/src/components/ResourceCRUD/ResourceCRUD.js +0 -15
  80. package/lib/src/components/ResourceCRUD/create/index.js +0 -13
  81. package/lib/src/components/ResourceCRUD/index.js +0 -4
  82. package/lib/src/components/ResourceCRUD/list/index.js +0 -19
  83. package/lib/src/components/ResourceCRUD/show/index.js +0 -6
  84. package/lib/src/components/ResourceLink/index.js +0 -21
  85. package/lib/src/components/ResourceUsageBar/index.js +0 -81
  86. package/lib/src/components/Separator/index.js +0 -11
  87. package/lib/src/components/ShowContent/ShowContent.js +0 -157
  88. package/lib/src/components/ShowContent/fields.js +0 -157
  89. package/lib/src/components/ShowContent/index.js +0 -2
  90. package/lib/src/components/StateTag/StateTag.js +0 -22
  91. package/lib/src/components/StateTag/index.js +0 -1
  92. package/lib/src/components/Table/ErrorContent.js +0 -36
  93. package/lib/src/components/Table/TableToolBar.js +0 -14
  94. package/lib/src/components/Table/TableWidgets.js +0 -28
  95. package/lib/src/components/Table/index.js +0 -69
  96. package/lib/src/components/Tags/index.js +0 -22
  97. package/lib/src/components/Time/index.js +0 -14
  98. package/lib/src/components/WorkloadDropdown/index.js +0 -24
  99. package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +0 -39
  100. package/lib/src/components/WorkloadPodsTable/index.js +0 -1
  101. package/lib/src/components/WorkloadReplicas/index.js +0 -50
  102. package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.js +0 -34
  103. package/lib/src/components/YamlEditor/MonacoYamlEditor.js +0 -149
  104. package/lib/src/components/YamlEditor/YamlEditorComponent.js +0 -90
  105. package/lib/src/components/YamlEditor/index.js +0 -1
  106. package/lib/src/components/YamlEditor/style.js +0 -102
  107. package/lib/src/components/YamlEditor/yaml.worker.js +0 -1
  108. package/lib/src/components/YamlForm/index.js +0 -61
  109. package/lib/src/components/index.js +0 -38
  110. package/lib/src/constants/index.js +0 -2
  111. package/lib/src/constants/k8s.js +0 -203
  112. package/lib/src/constants/state.js +0 -15
  113. package/lib/src/contexts/component.js +0 -3
  114. package/lib/src/contexts/configs.js +0 -3
  115. package/lib/src/contexts/global-store.js +0 -3
  116. package/lib/src/contexts/index.js +0 -3
  117. package/lib/src/hooks/index.js +0 -7
  118. package/lib/src/hooks/useDeleteModal/index.js +0 -1
  119. package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +0 -31
  120. package/lib/src/hooks/useDeleteModal/useDeleteModal.js +0 -38
  121. package/lib/src/hooks/useDownloadYAML.js +0 -10
  122. package/lib/src/hooks/useEagleForm.js +0 -177
  123. package/lib/src/hooks/useEagleTable/columns.js +0 -246
  124. package/lib/src/hooks/useEagleTable/index.js +0 -2
  125. package/lib/src/hooks/useEagleTable/useEagleTable.js +0 -63
  126. package/lib/src/hooks/useEdit.js +0 -19
  127. package/lib/src/hooks/useGlobalStore.js +0 -5
  128. package/lib/src/hooks/useK8sYamlEditor.js +0 -37
  129. package/lib/src/hooks/useOpenForm.js +0 -43
  130. package/lib/src/hooks/useSchema.js +0 -37
  131. package/lib/src/hooks/useSubmitForm.js +0 -42
  132. package/lib/src/i18n.js +0 -19
  133. package/lib/src/index.js +0 -13
  134. package/lib/src/locales/en-US/dovetail.json +0 -18
  135. package/lib/src/locales/en-US/index.js +0 -4
  136. package/lib/src/locales/index.js +0 -6
  137. package/lib/src/locales/zh-CN/dovetail.json +0 -91
  138. package/lib/src/locales/zh-CN/index.js +0 -4
  139. package/lib/src/main.js +0 -12
  140. package/lib/src/models/cronjob-model.js +0 -32
  141. package/lib/src/models/daemonset-model.js +0 -17
  142. package/lib/src/models/deployment-model.js +0 -17
  143. package/lib/src/models/event-model.js +0 -11
  144. package/lib/src/models/index.js +0 -14
  145. package/lib/src/models/ingress-model.js +0 -24
  146. package/lib/src/models/job-model.js +0 -56
  147. package/lib/src/models/network-policy-model.js +0 -10
  148. package/lib/src/models/pod-metrics-model.js +0 -34
  149. package/lib/src/models/pod-model.js +0 -78
  150. package/lib/src/models/resource-model.js +0 -34
  151. package/lib/src/models/server-instance-model.d.ts +0 -10
  152. package/lib/src/models/service-model.js +0 -17
  153. package/lib/src/models/statefulset-model.js +0 -17
  154. package/lib/src/models/types/index.js +0 -1
  155. package/lib/src/models/types/metric.js +0 -1
  156. package/lib/src/models/workload-base-model.js +0 -22
  157. package/lib/src/models/workload-model.js +0 -51
  158. package/lib/src/pages/configmaps/index.js +0 -15
  159. package/lib/src/pages/cronjobs/create/index.js +0 -6
  160. package/lib/src/pages/cronjobs/index.js +0 -3
  161. package/lib/src/pages/cronjobs/list/index.js +0 -42
  162. package/lib/src/pages/cronjobs/show/index.js +0 -16
  163. package/lib/src/pages/daemonsets/create/index.js +0 -6
  164. package/lib/src/pages/daemonsets/index.js +0 -3
  165. package/lib/src/pages/daemonsets/list/index.js +0 -32
  166. package/lib/src/pages/daemonsets/show/index.js +0 -16
  167. package/lib/src/pages/deployments/create/index.js +0 -7
  168. package/lib/src/pages/deployments/index.js +0 -3
  169. package/lib/src/pages/deployments/list/index.js +0 -26
  170. package/lib/src/pages/deployments/show/index.js +0 -16
  171. package/lib/src/pages/ingresses/index.js +0 -26
  172. package/lib/src/pages/jobs/index.js +0 -34
  173. package/lib/src/pages/networkPolicies/index.js +0 -67
  174. package/lib/src/pages/pods/create/index.js +0 -6
  175. package/lib/src/pages/pods/index.js +0 -3
  176. package/lib/src/pages/pods/list/index.js +0 -81
  177. package/lib/src/pages/pods/show/index.js +0 -54
  178. package/lib/src/pages/secrets/index.js +0 -15
  179. package/lib/src/pages/services/index.js +0 -26
  180. package/lib/src/pages/statefulsets/create/index.js +0 -6
  181. package/lib/src/pages/statefulsets/index.js +0 -3
  182. package/lib/src/pages/statefulsets/list/index.js +0 -26
  183. package/lib/src/pages/statefulsets/show/index.js +0 -16
  184. package/lib/src/plugins/index.js +0 -3
  185. package/lib/src/plugins/model-plugin.js +0 -46
  186. package/lib/src/plugins/relation-plugin.js +0 -81
  187. package/lib/src/plugins/type.js +0 -1
  188. package/lib/src/providers/index.js +0 -1
  189. package/lib/src/providers/router-provider/index.js +0 -100
  190. package/lib/src/types/index.js +0 -1
  191. package/lib/src/types/resource.js +0 -12
  192. package/lib/src/utils/addId.js +0 -8
  193. package/lib/src/utils/download.js +0 -9
  194. package/lib/src/utils/error.js +0 -53
  195. package/lib/src/utils/form.js +0 -9
  196. package/lib/src/utils/k8s.js +0 -6
  197. package/lib/src/utils/labels.js +0 -15
  198. package/lib/src/utils/match-selector.js +0 -12
  199. package/lib/src/utils/openapi.js +0 -33
  200. package/lib/src/utils/schema.js +0 -117
  201. package/lib/src/utils/selector.js +0 -12
  202. package/lib/src/utils/string.js +0 -6
  203. package/lib/src/utils/time.js +0 -46
  204. package/lib/src/utils/unit.js +0 -69
  205. package/lib/src/utils/yaml.js +0 -44
  206. package/lib/vite.config.js +0 -60
@@ -1,6 +1,6 @@
1
1
  (function(global2, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd"), require("k8s-api-provider")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "@cloudtower/icons-react", "lodash-es", "js-yaml", "monaco-editor", "monaco-yaml", "react-dom", "sunflower-antd", "antd", "k8s-api-provider"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.iconsReact, global2.lodashEs, global2.yaml, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.sunflowerAntd, global2.antd, global2.k8sApiProvider));
3
- })(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd, k8sApiProvider) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("k8s-api-provider"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "@cloudtower/icons-react", "lodash-es", "js-yaml", "k8s-api-provider", "monaco-editor", "monaco-yaml", "react-dom", "sunflower-antd", "antd"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.iconsReact, global2.lodashEs, global2.yaml, global2.k8sApiProvider, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.sunflowerAntd, global2.antd));
3
+ })(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml, k8sApiProvider, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -8624,7 +8624,7 @@ var __publicField = (obj, key, value) => {
8624
8624
  } = props;
8625
8625
  const auxiliaryLineRef = React.useRef(null);
8626
8626
  const wrapperRef = React.useRef(null);
8627
- const pagination = React.useMemo(() => ({
8627
+ React.useMemo(() => ({
8628
8628
  current: currentPage,
8629
8629
  pageSize: defaultSize,
8630
8630
  onChange: onPageChange
@@ -8671,7 +8671,6 @@ var __publicField = (obj, key, value) => {
8671
8671
  tableLayout: "fixed",
8672
8672
  columns: finalColumns,
8673
8673
  dataSource,
8674
- pagination,
8675
8674
  error,
8676
8675
  loading,
8677
8676
  rowKey,
@@ -8689,11 +8688,38 @@ var __publicField = (obj, key, value) => {
8689
8688
  });
8690
8689
  }
8691
8690
  const ComponentContext = React.createContext({});
8691
+ function useTableData({ data: data2, columns, pageSize = 10 }) {
8692
+ const [currentPage, setCurrentPage] = React.useState(1);
8693
+ const [sorters, setSorters] = React.useState([]);
8694
+ const onSorterChange = React.useCallback((order, key2) => {
8695
+ var _a;
8696
+ const ORDER_MAP = {
8697
+ descend: "desc",
8698
+ ascend: "asc"
8699
+ };
8700
+ const sorters2 = [{
8701
+ field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8702
+ order: order ? ORDER_MAP[order] : order
8703
+ }];
8704
+ setSorters(sorters2);
8705
+ }, [columns]);
8706
+ return {
8707
+ data: k8sApiProvider.paginateData(
8708
+ {
8709
+ pageSize,
8710
+ current: currentPage
8711
+ },
8712
+ k8sApiProvider.sortData(sorters, data2)
8713
+ ),
8714
+ currentPage,
8715
+ onPageChange: setCurrentPage,
8716
+ onSorterChange
8717
+ };
8718
+ }
8692
8719
  const PodSelectorTable = ({ podSelectors = {} }) => {
8693
8720
  const { t: t2 } = useTranslation();
8694
8721
  const component = React.useContext(ComponentContext);
8695
8722
  const Table$1 = component.Table || Table;
8696
- const [currentPage, setCurrentPage] = React.useState(1);
8697
8723
  const currentSize = 10;
8698
8724
  const datas = Object.keys(podSelectors).map((key2) => ({
8699
8725
  id: key2,
@@ -8718,6 +8744,15 @@ var __publicField = (obj, key, value) => {
8718
8744
  width: "50%"
8719
8745
  }
8720
8746
  ];
8747
+ const {
8748
+ data: finalData,
8749
+ currentPage,
8750
+ onPageChange,
8751
+ onSorterChange
8752
+ } = useTableData({
8753
+ data: datas,
8754
+ columns
8755
+ });
8721
8756
  if (datas.length === 0) {
8722
8757
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8723
8758
  WidgetErrorContent,
@@ -8733,14 +8768,15 @@ var __publicField = (obj, key, value) => {
8733
8768
  {
8734
8769
  tableKey: "podSelector",
8735
8770
  loading: false,
8736
- data: datas.slice((currentPage - 1) * currentSize, currentPage * currentSize),
8771
+ data: finalData,
8737
8772
  total: datas.length,
8738
8773
  columns: addDefaultRenderToColumns(columns),
8739
8774
  rowKey: "key",
8740
8775
  empty: t2("dovetail.empty"),
8741
8776
  defaultSize: currentSize,
8742
8777
  currentPage,
8743
- onPageChange: setCurrentPage,
8778
+ onPageChange,
8779
+ onSorterChange,
8744
8780
  showMenuColumn: false
8745
8781
  }
8746
8782
  );
@@ -8749,7 +8785,6 @@ var __publicField = (obj, key, value) => {
8749
8785
  const { t: t2 } = useTranslation();
8750
8786
  const component = React.useContext(ComponentContext);
8751
8787
  const Table$1 = component.Table || Table;
8752
- const [currentPage, setCurrentPage] = React.useState(1);
8753
8788
  const currentSize = 10;
8754
8789
  const columns = [
8755
8790
  {
@@ -8797,6 +8832,15 @@ var __publicField = (obj, key, value) => {
8797
8832
  ...port2,
8798
8833
  id: port2.name || ""
8799
8834
  }));
8835
+ const {
8836
+ data: finalData,
8837
+ currentPage,
8838
+ onPageChange,
8839
+ onSorterChange
8840
+ } = useTableData({
8841
+ data: ports,
8842
+ columns
8843
+ });
8800
8844
  if ((ports == null ? void 0 : ports.length) === 0) {
8801
8845
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8802
8846
  WidgetErrorContent,
@@ -8812,14 +8856,15 @@ var __publicField = (obj, key, value) => {
8812
8856
  {
8813
8857
  tableKey: "ports",
8814
8858
  loading: false,
8815
- data: ports.slice((currentPage - 1) * currentSize, currentPage * currentSize),
8859
+ data: finalData,
8816
8860
  total: ports.length,
8817
8861
  columns: addDefaultRenderToColumns(columns),
8818
8862
  rowKey: "name",
8819
8863
  empty: t2("dovetail.empty"),
8820
8864
  defaultSize: currentSize,
8821
8865
  currentPage,
8822
- onPageChange: setCurrentPage,
8866
+ onPageChange,
8867
+ onSorterChange,
8823
8868
  showMenuColumn: false
8824
8869
  }
8825
8870
  );
@@ -9959,7 +10004,7 @@ var __publicField = (obj, key, value) => {
9959
10004
  children: content || "-"
9960
10005
  });
9961
10006
  };
9962
- const index_10ylmu3 = "";
10007
+ const index_1wlqq0y = "";
9963
10008
  const TagWrapper = "t13a6vox";
9964
10009
  const TagStyle = "t12ikbmp";
9965
10010
  const Tags = (props) => {
@@ -9998,24 +10043,23 @@ var __publicField = (obj, key, value) => {
9998
10043
  const {
9999
10044
  t: t2
10000
10045
  } = useTranslation();
10001
- const statusMap = {
10002
- updating: "loading",
10046
+ const colorMap = {
10047
+ updating: "blue",
10003
10048
  ready: "green",
10004
10049
  completed: "gray",
10005
10050
  failed: "red",
10006
10051
  suspended: "warning",
10007
- running: "green",
10008
- succeeded: "blue",
10009
- unknown: "gray",
10010
- terminating: "loading",
10011
- pending: "warning",
10052
+ running: "blue",
10053
+ succeeded: "green",
10054
+ unknown: "warning",
10055
+ terminating: "red",
10056
+ pending: "gray",
10012
10057
  waiting: "warning",
10013
10058
  terminated: "red"
10014
10059
  };
10015
10060
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
10016
10061
  className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
10017
- color: statusMap[state2] !== "loading" ? statusMap[state2] : void 0,
10018
- loading: statusMap[state2] === "loading",
10062
+ color: colorMap[state2],
10019
10063
  children: t2(`dovetail.${state2 || "updating"}`)
10020
10064
  });
10021
10065
  };
@@ -10133,11 +10177,9 @@ var __publicField = (obj, key, value) => {
10133
10177
  });
10134
10178
  };
10135
10179
  const ConditionsTable = ({ conditions = [] }) => {
10136
- const [currentPage, setCurrentPage] = React.useState(1);
10137
10180
  const { t: t2 } = useTranslation();
10138
10181
  const component = React.useContext(ComponentContext);
10139
10182
  const Table$1 = component.Table || Table;
10140
- const currentSize = 10;
10141
10183
  const conditionsWithId = addId(conditions, "type");
10142
10184
  const columns = [
10143
10185
  {
@@ -10193,6 +10235,8 @@ var __publicField = (obj, key, value) => {
10193
10235
  width: 403
10194
10236
  }
10195
10237
  ];
10238
+ const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({ data: conditionsWithId, columns });
10239
+ const currentSize = 10;
10196
10240
  if (conditionsWithId.length === 0) {
10197
10241
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10198
10242
  WidgetErrorContent,
@@ -10208,18 +10252,38 @@ var __publicField = (obj, key, value) => {
10208
10252
  {
10209
10253
  tableKey: "condition",
10210
10254
  loading: false,
10211
- data: conditionsWithId.slice((currentPage - 1) * currentSize, currentPage * currentSize),
10255
+ data: finalData,
10212
10256
  total: conditionsWithId.length,
10213
10257
  columns: addDefaultRenderToColumns(columns),
10214
10258
  rowKey: "type",
10215
10259
  empty: t2("dovetail.empty"),
10216
10260
  defaultSize: currentSize,
10217
10261
  currentPage,
10218
- onPageChange: setCurrentPage,
10262
+ onPageChange,
10263
+ onSorterChange,
10219
10264
  showMenuColumn: false
10220
10265
  }
10221
10266
  );
10222
10267
  };
10268
+ function download(filename, content) {
10269
+ const element = document.createElement("a");
10270
+ element.setAttribute(
10271
+ "href",
10272
+ "data:text/plain;charset=utf-8," + encodeURIComponent(content)
10273
+ );
10274
+ element.setAttribute("download", filename);
10275
+ element.style.display = "none";
10276
+ document.body.appendChild(element);
10277
+ element.click();
10278
+ document.body.removeChild(element);
10279
+ }
10280
+ function useDownloadYAML() {
10281
+ return function(options) {
10282
+ const { name: name2, item } = options;
10283
+ const content = yaml.dump(item);
10284
+ download(`${name2}.yaml`, content);
10285
+ };
10286
+ }
10223
10287
  function useEdit() {
10224
10288
  const { resource } = core.useParsed();
10225
10289
  const go = core.useGo();
@@ -10298,222 +10362,650 @@ var __publicField = (obj, key, value) => {
10298
10362
  }
10299
10363
  };
10300
10364
  }
10301
- function CreateButton() {
10302
- var _a;
10365
+ function K8sDropdown(props) {
10366
+ const { record, size = "normal" } = props;
10303
10367
  const kit = eagle.useUIKit();
10304
- const { t: t2 } = useTranslation();
10305
- const openForm = useOpenForm();
10306
- const { resource } = core.useResource();
10307
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10308
- kit.button,
10309
- {
10310
- prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.PlusAddCreateNew16BoldOntintIcon, {}),
10311
- type: "primary",
10312
- onClick: openForm,
10313
- children: t2("dovetail.create_resource", { resource: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind })
10314
- }
10368
+ const { globalStore } = useGlobalStore();
10369
+ const useResourceResult = core.useResource();
10370
+ const resource = useResourceResult.resource;
10371
+ const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
10372
+ (resource == null ? void 0 : resource.name) || ""
10315
10373
  );
10316
- }
10317
- const useDeleteManyModal = (resource, ids) => {
10318
- const { mutate } = core.useDeleteMany();
10319
- const [visible, setVisible] = React.useState(false);
10320
- const { t: t2 } = useTranslation();
10321
- const modalProps = {
10322
- title: t2("dovetail.delete"),
10323
- okText: t2("dovetail.delete"),
10324
- okButtonProps: {
10325
- danger: true
10326
- },
10327
- cancelText: t2("dovetail.cancel"),
10328
- children: t2("dovetail.confirm_delete_text", {
10329
- target: ids,
10330
- interpolation: { escapeValue: false }
10331
- }),
10332
- onOk() {
10333
- mutate({
10334
- resource,
10335
- ids
10336
- });
10337
- setVisible(false);
10338
- },
10339
- onCancel() {
10340
- setVisible(false);
10341
- }
10342
- };
10343
- return { modalProps, visible, setVisible };
10344
- };
10345
- const DeleteManyButton = (props) => {
10346
- const { resource } = core.useResource();
10347
- const kit = eagle.useUIKit();
10374
+ const download2 = useDownloadYAML();
10348
10375
  const { t: t2 } = useTranslation();
10349
- const { modalProps, visible, setVisible } = useDeleteManyModal(
10350
- (resource == null ? void 0 : resource.name) || "",
10351
- props.ids
10352
- );
10353
- const onClick = React.useCallback(() => {
10354
- setVisible(true);
10355
- }, [setVisible]);
10376
+ const openForm = useOpenForm({ id: record.id });
10377
+ const isInShowPage = useResourceResult.action === "show";
10378
+ const { data: canEditData } = core.useCan({
10379
+ resource: resource == null ? void 0 : resource.name,
10380
+ action: AccessControlAuth.Edit
10381
+ });
10382
+ const { data: canDeleteData } = core.useCan({
10383
+ resource: resource == null ? void 0 : resource.name,
10384
+ action: AccessControlAuth.Delete
10385
+ });
10356
10386
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10357
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t2("dovetail.delete") }),
10387
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10388
+ kit.dropdown,
10389
+ {
10390
+ overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
10391
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10392
+ kit.menuItem,
10393
+ {
10394
+ onClick: openForm,
10395
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10396
+ }
10397
+ ),
10398
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10399
+ kit.menu.Item,
10400
+ {
10401
+ onClick: () => {
10402
+ var _a;
10403
+ if (record.id) {
10404
+ download2({
10405
+ name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
10406
+ item: lodashEs.omit((globalStore == null ? void 0 : globalStore.restoreItem(record)) || record, "id")
10407
+ });
10408
+ }
10409
+ },
10410
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10411
+ }
10412
+ ),
10413
+ props.children,
10414
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
10415
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10416
+ kit.menuItem,
10417
+ {
10418
+ danger: true,
10419
+ onClick: () => {
10420
+ openDeleteConfirmModal(record.id);
10421
+ },
10422
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t2("dovetail.delete") })
10423
+ }
10424
+ ) : null
10425
+ ] }),
10426
+ trigger: ["click"],
10427
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10428
+ kit.button,
10429
+ {
10430
+ type: "quiet",
10431
+ size: size === "large" ? "middle" : "small",
10432
+ prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10433
+ eagle.Icon,
10434
+ {
10435
+ src: iconsReact.MoreEllipsis324BoldSecondaryIcon,
10436
+ hoverSrc: iconsReact.MoreEllipsis324BoldBlueIcon,
10437
+ iconWidth: 24,
10438
+ iconHeight: 24
10439
+ }
10440
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon })
10441
+ }
10442
+ )
10443
+ }
10444
+ ),
10358
10445
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10359
10446
  ] });
10360
- };
10361
- const TableToolBar_4s5vf2 = "";
10362
- const ToolbarWrapperStyle = "t1v3ienx";
10363
- const ToolbarStyle$1 = "tgejfwe";
10364
- const TitleStyle$2 = "tq6dc79";
10365
- const DescriptionStyle = "d1wqyhgc";
10366
- const TableToolBar = ({
10367
- description,
10368
- selectedKeys,
10369
- hideCreate
10370
- }) => {
10371
- var _a;
10372
- const kit = eagle.useUIKit();
10373
- const {
10374
- resource
10375
- } = core.useResource();
10376
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10377
- className: cx_default(ToolbarWrapperStyle, "table-toolbar"),
10378
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10379
- className: ToolbarStyle$1,
10380
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10381
- className: cx_default(eagle.Typo.Display.d2_regular_title, TitleStyle$2),
10382
- children: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind
10383
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10384
- children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
10385
- ids: selectedKeys
10386
- }) : void 0, /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
10387
- resource: resource == null ? void 0 : resource.name,
10388
- action: AccessControlAuth.Create,
10389
- children: !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null
10390
- })]
10391
- })]
10392
- }), description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10393
- className: DescriptionStyle,
10394
- children: description
10395
- }) : null]
10447
+ }
10448
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10449
+ function adopt(value2) {
10450
+ return value2 instanceof P ? value2 : new P(function(resolve) {
10451
+ resolve(value2);
10452
+ });
10453
+ }
10454
+ return new (P || (P = Promise))(function(resolve, reject) {
10455
+ function fulfilled(value2) {
10456
+ try {
10457
+ step(generator.next(value2));
10458
+ } catch (e2) {
10459
+ reject(e2);
10460
+ }
10461
+ }
10462
+ function rejected(value2) {
10463
+ try {
10464
+ step(generator["throw"](value2));
10465
+ } catch (e2) {
10466
+ reject(e2);
10467
+ }
10468
+ }
10469
+ function step(result) {
10470
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10471
+ }
10472
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10396
10473
  });
10397
10474
  };
10398
- const index_6qzjtx = "";
10399
- const WrapperStyle$5 = "w16agr8o";
10400
- function matchOwner(job, owner) {
10401
- var _a;
10402
- let match = false;
10403
- for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
10404
- if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
10405
- match = true;
10406
- }
10407
- }
10408
- return match;
10475
+ function useEventCallback(fn) {
10476
+ const ref = React.useRef(() => {
10477
+ throw new Error("Cannot call an event handler while rendering.");
10478
+ });
10479
+ useIsomorphicLayoutEffect(() => {
10480
+ ref.current = fn;
10481
+ }, [fn]);
10482
+ return React.useCallback((...args) => ref.current(...args), [ref]);
10409
10483
  }
10410
- const CronjobJobsTable = ({
10411
- owner,
10412
- hideToolBar
10413
- }) => {
10484
+ function useEventListener(eventName, handler, element, options) {
10485
+ const savedHandler = React.useRef(handler);
10486
+ useIsomorphicLayoutEffect(() => {
10487
+ savedHandler.current = handler;
10488
+ }, [handler]);
10489
+ React.useEffect(() => {
10490
+ var _a;
10491
+ const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
10492
+ if (!(targetElement && targetElement.addEventListener))
10493
+ return;
10494
+ const listener = (event2) => savedHandler.current(event2);
10495
+ targetElement.addEventListener(eventName, listener, options);
10496
+ return () => {
10497
+ targetElement.removeEventListener(eventName, listener, options);
10498
+ };
10499
+ }, [eventName, element, options]);
10500
+ }
10501
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10502
+ function adopt(value2) {
10503
+ return value2 instanceof P ? value2 : new P(function(resolve) {
10504
+ resolve(value2);
10505
+ });
10506
+ }
10507
+ return new (P || (P = Promise))(function(resolve, reject) {
10508
+ function fulfilled(value2) {
10509
+ try {
10510
+ step(generator.next(value2));
10511
+ } catch (e2) {
10512
+ reject(e2);
10513
+ }
10514
+ }
10515
+ function rejected(value2) {
10516
+ try {
10517
+ step(generator["throw"](value2));
10518
+ } catch (e2) {
10519
+ reject(e2);
10520
+ }
10521
+ }
10522
+ function step(result) {
10523
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10524
+ }
10525
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10526
+ });
10527
+ };
10528
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
10529
+ function useLocalStorage(key2, initialValue) {
10530
+ const readValue = React.useCallback(() => {
10531
+ if (typeof window === "undefined") {
10532
+ return initialValue;
10533
+ }
10534
+ try {
10535
+ const item = window.localStorage.getItem(key2);
10536
+ return item ? parseJSON(item) : initialValue;
10537
+ } catch (error) {
10538
+ console.warn(`Error reading localStorage key “${key2}”:`, error);
10539
+ return initialValue;
10540
+ }
10541
+ }, [initialValue, key2]);
10542
+ const [storedValue, setStoredValue] = React.useState(readValue);
10543
+ const setValue = useEventCallback((value2) => {
10544
+ if (typeof window === "undefined") {
10545
+ console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
10546
+ }
10547
+ try {
10548
+ const newValue = value2 instanceof Function ? value2(storedValue) : value2;
10549
+ window.localStorage.setItem(key2, JSON.stringify(newValue));
10550
+ setStoredValue(newValue);
10551
+ window.dispatchEvent(new Event("local-storage"));
10552
+ } catch (error) {
10553
+ console.warn(`Error setting localStorage key “${key2}”:`, error);
10554
+ }
10555
+ });
10556
+ React.useEffect(() => {
10557
+ setStoredValue(readValue());
10558
+ }, []);
10559
+ const handleStorageChange = React.useCallback((event2) => {
10560
+ if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
10561
+ return;
10562
+ }
10563
+ setStoredValue(readValue());
10564
+ }, [key2, readValue]);
10565
+ useEventListener("storage", handleStorageChange);
10566
+ useEventListener("local-storage", handleStorageChange);
10567
+ return [storedValue, setValue];
10568
+ }
10569
+ function parseJSON(value2) {
10570
+ try {
10571
+ return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
10572
+ } catch (_a) {
10573
+ console.log("parsing error on", { value: value2 });
10574
+ return void 0;
10575
+ }
10576
+ }
10577
+ const GlobalStoreContext = React.createContext({});
10578
+ const index_1uuzt53 = "";
10579
+ const SelectStyle = "sj0ggy";
10580
+ const DropdownStyle = "d1eo8uqs";
10581
+ const SearchInputStyle = "s64gojc";
10582
+ const SelectContentStyle = "s16fqgtu";
10583
+ const TokenStyle = "tgaujbg";
10584
+ const CountTokenStyle = "c1vbd54v";
10585
+ const SelectOptionGroupStyle = "sxzmtrx";
10586
+ const LabelWrapperStyle = "lqrghwd";
10587
+ const AllNamespaceOptionStyle = "api7z1z";
10588
+ const OptionStyle = "o38b23x";
10589
+ const NS_STORE_KEY = "namespace-filter";
10590
+ const ALL_NS = "_all";
10591
+ const useNamespacesFilter = () => {
10592
+ const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10414
10593
  const {
10415
- i18n: i18n2
10416
- } = useTranslation();
10594
+ resource
10595
+ } = core.useResource();
10596
+ const configs = React.useContext(ConfigsContext);
10597
+ if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
10598
+ return {
10599
+ value: []
10600
+ };
10601
+ }
10602
+ return {
10603
+ value: value2
10604
+ };
10605
+ };
10606
+ const NamespacesFilter = ({
10607
+ className
10608
+ }) => {
10417
10609
  const kit = eagle.useUIKit();
10418
- const [selectedKeys] = React.useState([]);
10419
- const [currentPage, setCurrentPage] = React.useState(1);
10420
- const component = React.useContext(ComponentContext);
10421
- const Table$1 = component.Table || Table;
10422
- const currentSize = 10;
10610
+ const {
10611
+ t: t2
10612
+ } = useTranslation();
10613
+ const [search, setSearch] = React.useState("");
10423
10614
  const {
10424
10615
  data: data2,
10425
10616
  isLoading
10426
10617
  } = core.useList({
10427
- resource: "jobs",
10618
+ resource: "namespaces",
10428
10619
  meta: {
10429
- resourceBasePath: "/apis/batch/v1",
10430
- kind: "Job"
10620
+ resourceBasePath: "/api/v1",
10621
+ kind: "Namespace"
10431
10622
  },
10432
10623
  pagination: {
10433
10624
  mode: "off"
10434
10625
  }
10435
10626
  });
10436
- const dataSource = React.useMemo(() => {
10437
- return data2 == null ? void 0 : data2.data.filter((p) => {
10438
- return owner ? matchOwner(p, owner) : true;
10439
- });
10440
- }, [data2 == null ? void 0 : data2.data, owner]);
10441
- const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
10442
- ...WorkloadImageColumnRenderer(i18n2),
10443
- width: 238
10444
- }, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
10445
- if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
10446
- return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
10447
- errorText: i18n2.t("dovetail.no_resource", {
10448
- kind: " Job"
10449
- }),
10450
- type: ErrorContentType.Card
10451
- });
10452
- }
10453
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10454
- direction: "vertical",
10455
- className: WrapperStyle$5,
10456
- children: [hideToolBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
10457
- selectedKeys,
10458
- hideCreate: true
10459
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
10460
- tableKey: "cronjobs",
10461
- loading: isLoading,
10462
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
10463
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
10464
- columns,
10465
- rowKey: "id",
10466
- error: false,
10467
- currentPage,
10468
- onPageChange: (p) => setCurrentPage(p),
10469
- defaultSize: currentSize,
10470
- refetch: () => null,
10471
- showMenuColumn: false
10627
+ const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10628
+ const debouncedSetSearch = lodashEs.debounce(setSearch, 100);
10629
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
10630
+ loading: isLoading,
10631
+ style: {
10632
+ width: 278
10633
+ },
10634
+ className: cx_default(SelectStyle, className),
10635
+ dropdownClassName: DropdownStyle,
10636
+ searchValue: search,
10637
+ virtual: false,
10638
+ input: {
10639
+ value: value2,
10640
+ onChange(value22) {
10641
+ if (lodashEs.last(value22) === ALL_NS || value22.length === 0) {
10642
+ setValue([ALL_NS]);
10643
+ } else {
10644
+ setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
10645
+ }
10646
+ }
10647
+ },
10648
+ dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10649
+ className: SelectContentStyle,
10650
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
10651
+ style: {
10652
+ width: "100%"
10653
+ },
10654
+ className: SearchInputStyle,
10655
+ onChange: debouncedSetSearch,
10656
+ placeholder: t2("dovetail.please_input")
10657
+ }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
10658
+ }),
10659
+ tagRender: ({
10660
+ label: label2,
10661
+ value: value22,
10662
+ closable,
10663
+ onClose
10664
+ }) => {
10665
+ const isCountToken = label2 !== value22 && typeof label2 === "string";
10666
+ const isAll = value22 === ALL_NS;
10667
+ return isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10668
+ style: {
10669
+ marginLeft: 8
10670
+ },
10671
+ children: label2
10672
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
10673
+ className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
10674
+ closable,
10675
+ size: "medium",
10676
+ onClose,
10677
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10678
+ content: isCountToken ? label2.replace(/[\s\.]/g, "") : label2
10679
+ })
10680
+ });
10681
+ },
10682
+ maxTagCount: 1,
10683
+ optionLabelProp: "label",
10684
+ showArrow: true,
10685
+ showSearch: false,
10686
+ multiple: true,
10687
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10688
+ value: "_all",
10689
+ label: t2("dovetail.all_namespaces"),
10690
+ className: AllNamespaceOptionStyle,
10691
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10692
+ content: t2("dovetail.all_namespaces"),
10693
+ className: LabelWrapperStyle
10694
+ })
10695
+ }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
10696
+ label: "",
10697
+ className: SelectOptionGroupStyle,
10698
+ children: data2 == null ? void 0 : data2.data.map((namespace2) => {
10699
+ const {
10700
+ name: name2
10701
+ } = namespace2.metadata;
10702
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10703
+ value: name2,
10704
+ label: name2,
10705
+ className: OptionStyle,
10706
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10707
+ content: name2,
10708
+ className: LabelWrapperStyle
10709
+ })
10710
+ }, name2);
10711
+ })
10472
10712
  })]
10473
10713
  });
10474
10714
  };
10475
- const EventsTable = ({}) => {
10476
- const { i18n: i18n2 } = useTranslation();
10477
- const [currentPage, setCurrentPage] = React.useState(1);
10478
- const currentSize = 10;
10479
- const { data: data2, isLoading } = core.useList({
10480
- resource: "events",
10481
- meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
10482
- pagination: {
10483
- mode: "off"
10484
- }
10485
- });
10486
- const parsed = core.useParsed();
10487
- const columns = React.useMemo(
10488
- () => [
10489
- {
10490
- key: "type",
10491
- display: true,
10492
- dataIndex: ["type"],
10493
- title: i18n2.t("dovetail.type"),
10494
- sortable: true,
10495
- width: 120,
10496
- render(value2) {
10497
- const colorMap = {
10498
- "Warning": "red",
10499
- "Normal": "green"
10500
- };
10501
- return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.StatusCapsule, { color: colorMap[value2], className: cx_default(StateTagStyle, "no-background"), children: i18n2.t(`dovetail.${value2.toLowerCase()}`) });
10502
- },
10503
- sorter: CommonSorter(["type"])
10504
- },
10505
- {
10506
- key: "reason",
10507
- display: true,
10508
- dataIndex: ["reason"],
10509
- title: i18n2.t("dovetail.reason"),
10510
- sortable: true,
10511
- width: 120,
10512
- sorter: CommonSorter(["reason"])
10715
+ var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
10716
+ ColumnKeys2["age"] = "age";
10717
+ ColumnKeys2["name"] = "name";
10718
+ ColumnKeys2["namespace"] = "namespace";
10719
+ ColumnKeys2["phase"] = "phase";
10720
+ ColumnKeys2["replicas"] = "replicas";
10721
+ ColumnKeys2["deploymentImage"] = "deploymentImage";
10722
+ ColumnKeys2["podImage"] = "podImage";
10723
+ return ColumnKeys2;
10724
+ })(ColumnKeys || {});
10725
+ function addDefaultRenderToColumns(columns) {
10726
+ return columns.map((col) => ({
10727
+ render(value2) {
10728
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10729
+ ValueDisplay,
10730
+ {
10731
+ value: value2
10732
+ }
10733
+ );
10734
+ },
10735
+ ...col
10736
+ }));
10737
+ }
10738
+ const useEagleTable = (params) => {
10739
+ var _a, _b;
10740
+ const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
10741
+ const [selectedKeys, setSelectedKeys] = React.useState([]);
10742
+ const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10743
+ const { resource } = core.useResource();
10744
+ const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10745
+ const { value: nsFilters = [] } = useNamespacesFilter();
10746
+ const useTableParams = React.useMemo(() => {
10747
+ const mergedParams = lodashEs.merge(params.useTableParams, {
10748
+ pagination: {
10749
+ pageSize: currentSize,
10750
+ mode: "server"
10513
10751
  },
10514
- {
10515
- key: "note",
10516
- display: true,
10752
+ filters: {
10753
+ permanent: [
10754
+ {
10755
+ operator: "or",
10756
+ value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
10757
+ field: "metadata.namespace",
10758
+ operator: "eq",
10759
+ value: filter
10760
+ }))
10761
+ }
10762
+ ]
10763
+ }
10764
+ });
10765
+ return mergedParams;
10766
+ }, [params.useTableParams, nsFilters, currentSize]);
10767
+ const finalColumns = React.useMemo(
10768
+ () => addDefaultRenderToColumns(columns),
10769
+ [columns]
10770
+ );
10771
+ const table = core.useTable(useTableParams);
10772
+ const onPageChange = React.useCallback(
10773
+ (page) => {
10774
+ var _a2;
10775
+ setCurrentPage(page);
10776
+ (_a2 = table.setCurrent) == null ? void 0 : _a2.call(table, page || 1);
10777
+ },
10778
+ [setCurrentPage, table]
10779
+ );
10780
+ const onSorterChange = React.useCallback((order, key2) => {
10781
+ var _a2;
10782
+ const ORDER_MAP = {
10783
+ descend: "desc",
10784
+ ascend: "asc"
10785
+ };
10786
+ const sorters = [{
10787
+ field: (_a2 = columns.find((col) => col.key === key2)) == null ? void 0 : _a2.dataIndex,
10788
+ order: order ? ORDER_MAP[order] : order
10789
+ }];
10790
+ table.setSorters(sorters);
10791
+ }, [table, columns]);
10792
+ const data2 = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data;
10793
+ const total = ((_b = table.tableQueryResult.data) == null ? void 0 : _b.total) || 0;
10794
+ const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
10795
+ const finalProps = {
10796
+ tableKey: (resource == null ? void 0 : resource.name) || "table",
10797
+ loading: table.tableQueryResult.isLoading,
10798
+ data: finalDataSource || [],
10799
+ columns: finalColumns,
10800
+ error: false,
10801
+ rowKey: "id",
10802
+ currentPage,
10803
+ defaultSize: currentSize,
10804
+ onPageChange,
10805
+ onSorterChange,
10806
+ onSelect: (keys) => {
10807
+ setSelectedKeys(keys);
10808
+ },
10809
+ total,
10810
+ RowMenu: Dropdown
10811
+ };
10812
+ return { tableProps: finalProps, selectedKeys, ...table };
10813
+ };
10814
+ function CreateButton() {
10815
+ var _a;
10816
+ const kit = eagle.useUIKit();
10817
+ const { t: t2 } = useTranslation();
10818
+ const openForm = useOpenForm();
10819
+ const { resource } = core.useResource();
10820
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10821
+ kit.button,
10822
+ {
10823
+ prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(iconsReact.PlusAddCreateNew16BoldOntintIcon, {}),
10824
+ type: "primary",
10825
+ onClick: openForm,
10826
+ children: t2("dovetail.create_resource", { resource: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind })
10827
+ }
10828
+ );
10829
+ }
10830
+ const useDeleteManyModal = (resource, ids) => {
10831
+ const { mutate } = core.useDeleteMany();
10832
+ const [visible, setVisible] = React.useState(false);
10833
+ const { t: t2 } = useTranslation();
10834
+ const modalProps = {
10835
+ title: t2("dovetail.delete"),
10836
+ okText: t2("dovetail.delete"),
10837
+ okButtonProps: {
10838
+ danger: true
10839
+ },
10840
+ cancelText: t2("dovetail.cancel"),
10841
+ children: t2("dovetail.confirm_delete_text", {
10842
+ target: ids,
10843
+ interpolation: { escapeValue: false }
10844
+ }),
10845
+ onOk() {
10846
+ mutate({
10847
+ resource,
10848
+ ids
10849
+ });
10850
+ setVisible(false);
10851
+ },
10852
+ onCancel() {
10853
+ setVisible(false);
10854
+ }
10855
+ };
10856
+ return { modalProps, visible, setVisible };
10857
+ };
10858
+ const DeleteManyButton = (props) => {
10859
+ const { resource } = core.useResource();
10860
+ const kit = eagle.useUIKit();
10861
+ const { t: t2 } = useTranslation();
10862
+ const { modalProps, visible, setVisible } = useDeleteManyModal(
10863
+ (resource == null ? void 0 : resource.name) || "",
10864
+ props.ids
10865
+ );
10866
+ const onClick = React.useCallback(() => {
10867
+ setVisible(true);
10868
+ }, [setVisible]);
10869
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10870
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t2("dovetail.delete") }),
10871
+ visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10872
+ ] });
10873
+ };
10874
+ const TableToolBar_4s5vf2 = "";
10875
+ const ToolbarWrapperStyle = "t1v3ienx";
10876
+ const ToolbarStyle$1 = "tgejfwe";
10877
+ const TitleStyle$2 = "tq6dc79";
10878
+ const DescriptionStyle = "d1wqyhgc";
10879
+ const TableToolBar = ({
10880
+ description,
10881
+ selectedKeys,
10882
+ hideCreate
10883
+ }) => {
10884
+ var _a;
10885
+ const kit = eagle.useUIKit();
10886
+ const {
10887
+ resource
10888
+ } = core.useResource();
10889
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10890
+ className: cx_default(ToolbarWrapperStyle, "table-toolbar"),
10891
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10892
+ className: ToolbarStyle$1,
10893
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10894
+ className: cx_default(eagle.Typo.Display.d2_regular_title, TitleStyle$2),
10895
+ children: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind
10896
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10897
+ children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
10898
+ ids: selectedKeys
10899
+ }) : void 0, /* @__PURE__ */ jsxRuntimeExports.jsx(core.CanAccess, {
10900
+ resource: resource == null ? void 0 : resource.name,
10901
+ action: AccessControlAuth.Create,
10902
+ children: !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null
10903
+ })]
10904
+ })]
10905
+ }), description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10906
+ className: DescriptionStyle,
10907
+ children: description
10908
+ }) : null]
10909
+ });
10910
+ };
10911
+ const index_6qzjtx = "";
10912
+ const WrapperStyle$5 = "w16agr8o";
10913
+ function matchOwner(job, owner) {
10914
+ var _a;
10915
+ let match = false;
10916
+ for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
10917
+ if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
10918
+ match = true;
10919
+ }
10920
+ }
10921
+ return match;
10922
+ }
10923
+ const CronjobJobsTable = ({
10924
+ owner,
10925
+ hideToolBar
10926
+ }) => {
10927
+ const {
10928
+ i18n: i18n2
10929
+ } = useTranslation();
10930
+ const kit = eagle.useUIKit();
10931
+ const [selectedKeys] = React.useState([]);
10932
+ const component = React.useContext(ComponentContext);
10933
+ const Table$1 = component.Table || Table;
10934
+ const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
10935
+ ...WorkloadImageColumnRenderer(i18n2),
10936
+ width: 238
10937
+ }, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
10938
+ const {
10939
+ tableProps
10940
+ } = useEagleTable({
10941
+ columns,
10942
+ useTableParams: {
10943
+ resource: "jobs",
10944
+ meta: {
10945
+ resourceBasePath: "/apis/batch/v1",
10946
+ kind: "Job"
10947
+ }
10948
+ }
10949
+ });
10950
+ const dataSource = React.useMemo(() => {
10951
+ return tableProps.data.filter((p) => {
10952
+ return owner ? matchOwner(p, owner) : true;
10953
+ });
10954
+ }, [tableProps.data, owner]);
10955
+ if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10956
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
10957
+ errorText: i18n2.t("dovetail.no_resource", {
10958
+ kind: " Job"
10959
+ }),
10960
+ type: ErrorContentType.Card
10961
+ });
10962
+ }
10963
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10964
+ direction: "vertical",
10965
+ className: WrapperStyle$5,
10966
+ children: [hideToolBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
10967
+ selectedKeys,
10968
+ hideCreate: true
10969
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
10970
+ ...tableProps,
10971
+ tableKey: "cronjobs",
10972
+ showMenuColumn: false
10973
+ })]
10974
+ });
10975
+ };
10976
+ const EventsTable = ({}) => {
10977
+ const { i18n: i18n2 } = useTranslation();
10978
+ const parsed = core.useParsed();
10979
+ const columns = React.useMemo(
10980
+ () => [
10981
+ {
10982
+ key: "type",
10983
+ display: true,
10984
+ dataIndex: ["type"],
10985
+ title: i18n2.t("dovetail.type"),
10986
+ sortable: true,
10987
+ width: 120,
10988
+ render(value2) {
10989
+ const colorMap = {
10990
+ "Warning": "red",
10991
+ "Normal": "green"
10992
+ };
10993
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.StatusCapsule, { color: colorMap[value2], className: cx_default(StateTagStyle, "no-background"), children: i18n2.t(`dovetail.${value2.toLowerCase()}`) });
10994
+ },
10995
+ sorter: CommonSorter(["type"])
10996
+ },
10997
+ {
10998
+ key: "reason",
10999
+ display: true,
11000
+ dataIndex: ["reason"],
11001
+ title: i18n2.t("dovetail.reason"),
11002
+ sortable: true,
11003
+ width: 120,
11004
+ sorter: CommonSorter(["reason"])
11005
+ },
11006
+ {
11007
+ key: "note",
11008
+ display: true,
10517
11009
  dataIndex: ["note"],
10518
11010
  title: i18n2.t("dovetail.note"),
10519
11011
  sortable: true,
@@ -10524,15 +11016,22 @@ var __publicField = (obj, key, value) => {
10524
11016
  ],
10525
11017
  [i18n2]
10526
11018
  );
11019
+ const { tableProps } = useEagleTable({
11020
+ columns,
11021
+ useTableParams: {
11022
+ resource: "events",
11023
+ meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
11024
+ }
11025
+ });
10527
11026
  const component = React.useContext(ComponentContext);
10528
- const Table$1 = component.Table || Table;
10529
11027
  const dataSource = React.useMemo(() => {
10530
- return data2 == null ? void 0 : data2.data.filter((d) => {
11028
+ return tableProps.data.filter((d) => {
10531
11029
  const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
10532
11030
  return objectId === parsed.id;
10533
11031
  });
10534
- }, [data2 == null ? void 0 : data2.data, parsed]);
10535
- if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
11032
+ }, [tableProps.data, parsed]);
11033
+ const Table$1 = component.Table || Table;
11034
+ if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10536
11035
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10537
11036
  WidgetErrorContent,
10538
11037
  {
@@ -10543,17 +11042,8 @@ var __publicField = (obj, key, value) => {
10543
11042
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10544
11043
  Table$1,
10545
11044
  {
11045
+ ...tableProps,
10546
11046
  tableKey: "events",
10547
- loading: isLoading,
10548
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
10549
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
10550
- columns: addDefaultRenderToColumns(columns),
10551
- rowKey: "id",
10552
- error: false,
10553
- currentPage,
10554
- onPageChange: (p) => setCurrentPage(p),
10555
- defaultSize: currentSize,
10556
- refetch: () => null,
10557
11047
  showMenuColumn: false
10558
11048
  }
10559
11049
  );
@@ -10597,7 +11087,6 @@ var __publicField = (obj, key, value) => {
10597
11087
  }, [ingress.flattenedRules]);
10598
11088
  const component = React.useContext(ComponentContext);
10599
11089
  const Table$1 = component.Table || Table;
10600
- const [currentPage, setCurrentPage] = React.useState(1);
10601
11090
  const currentSize = 10;
10602
11091
  const columns = [
10603
11092
  {
@@ -10663,6 +11152,15 @@ var __publicField = (obj, key, value) => {
10663
11152
  sortable: true
10664
11153
  }
10665
11154
  ];
11155
+ const {
11156
+ data: finalData,
11157
+ currentPage,
11158
+ onPageChange,
11159
+ onSorterChange
11160
+ } = useTableData({
11161
+ columns,
11162
+ data: rows
11163
+ });
10666
11164
  if ((rows == null ? void 0 : rows.length) === 0) {
10667
11165
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10668
11166
  WidgetErrorContent,
@@ -10678,19 +11176,20 @@ var __publicField = (obj, key, value) => {
10678
11176
  {
10679
11177
  tableKey: "ingressRules",
10680
11178
  loading: false,
10681
- data: rows.slice((currentPage - 1) * currentSize, currentPage * currentSize),
11179
+ data: finalData,
10682
11180
  total: rows.length,
10683
11181
  columns: addDefaultRenderToColumns(columns),
10684
11182
  rowKey: "pathType",
10685
11183
  empty: t2("dovetail.empty"),
10686
11184
  defaultSize: currentSize,
10687
11185
  currentPage,
10688
- onPageChange: setCurrentPage,
11186
+ onPageChange,
11187
+ onSorterChange,
10689
11188
  showMenuColumn: false
10690
11189
  }
10691
11190
  );
10692
11191
  };
10693
- const KeyValue_q4vd5r = "";
11192
+ const KeyValue_1v1utgj = "";
10694
11193
  const ContentBlockStyle = "c8jy7dc";
10695
11194
  const KeyStyle = "k2sddxl";
10696
11195
  const ValueStyle$2 = "v16vicsr";
@@ -10764,109 +11263,6 @@ var __publicField = (obj, key, value) => {
10764
11263
  }) : null]
10765
11264
  });
10766
11265
  }
10767
- function download(filename, content) {
10768
- const element = document.createElement("a");
10769
- element.setAttribute(
10770
- "href",
10771
- "data:text/plain;charset=utf-8," + encodeURIComponent(content)
10772
- );
10773
- element.setAttribute("download", filename);
10774
- element.style.display = "none";
10775
- document.body.appendChild(element);
10776
- element.click();
10777
- document.body.removeChild(element);
10778
- }
10779
- function useDownloadYAML() {
10780
- return function(options) {
10781
- const { name: name2, item } = options;
10782
- console.log("download", item);
10783
- const content = yaml.dump(item);
10784
- download(`${name2}.yaml`, content);
10785
- };
10786
- }
10787
- function K8sDropdown(props) {
10788
- const { record, size = "normal" } = props;
10789
- const kit = eagle.useUIKit();
10790
- const { globalStore } = useGlobalStore();
10791
- const useResourceResult = core.useResource();
10792
- const resource = useResourceResult.resource;
10793
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
10794
- (resource == null ? void 0 : resource.name) || ""
10795
- );
10796
- const download2 = useDownloadYAML();
10797
- const { t: t2 } = useTranslation();
10798
- const openForm = useOpenForm({ id: record.id });
10799
- const isInShowPage = useResourceResult.action === "show";
10800
- const { data: canEditData } = core.useCan({
10801
- resource: resource == null ? void 0 : resource.name,
10802
- action: AccessControlAuth.Edit
10803
- });
10804
- const { data: canDeleteData } = core.useCan({
10805
- resource: resource == null ? void 0 : resource.name,
10806
- action: AccessControlAuth.Delete
10807
- });
10808
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10809
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10810
- kit.dropdown,
10811
- {
10812
- overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
10813
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10814
- kit.menuItem,
10815
- {
10816
- onClick: openForm,
10817
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10818
- }
10819
- ),
10820
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10821
- kit.menu.Item,
10822
- {
10823
- onClick: () => {
10824
- var _a;
10825
- if (record.id) {
10826
- download2({
10827
- name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
10828
- item: (globalStore == null ? void 0 : globalStore.restoreItem(record)) || record
10829
- });
10830
- }
10831
- },
10832
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10833
- }
10834
- ),
10835
- props.children,
10836
- (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
10837
- (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10838
- kit.menuItem,
10839
- {
10840
- danger: true,
10841
- onClick: () => {
10842
- openDeleteConfirmModal(record.id);
10843
- },
10844
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t2("dovetail.delete") })
10845
- }
10846
- ) : null
10847
- ] }),
10848
- trigger: ["click"],
10849
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10850
- kit.button,
10851
- {
10852
- type: "quiet",
10853
- size: size === "large" ? "middle" : "small",
10854
- prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10855
- eagle.Icon,
10856
- {
10857
- src: iconsReact.MoreEllipsis324BoldSecondaryIcon,
10858
- hoverSrc: iconsReact.MoreEllipsis324BoldBlueIcon,
10859
- iconWidth: 24,
10860
- iconHeight: 24
10861
- }
10862
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon })
10863
- }
10864
- )
10865
- }
10866
- ),
10867
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10868
- ] });
10869
- }
10870
11266
  function Tabs(props) {
10871
11267
  const { tabs, className } = props;
10872
11268
  const kit = eagle.useUIKit();
@@ -10910,7 +11306,8 @@ var __publicField = (obj, key, value) => {
10910
11306
  const {
10911
11307
  showConfig,
10912
11308
  formatter,
10913
- Dropdown = K8sDropdown
11309
+ Dropdown = K8sDropdown,
11310
+ data: data2
10914
11311
  } = props;
10915
11312
  const kit = eagle.useUIKit();
10916
11313
  const parsed = core.useParsed();
@@ -10918,17 +11315,9 @@ var __publicField = (obj, key, value) => {
10918
11315
  resource
10919
11316
  } = core.useResource();
10920
11317
  const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
10921
- const {
10922
- queryResult
10923
- } = core.useShow({
10924
- id
10925
- });
10926
11318
  const {
10927
11319
  t: t2
10928
11320
  } = useTranslation();
10929
- const {
10930
- data: data2
10931
- } = queryResult;
10932
11321
  const navigation = core.useNavigation();
10933
11322
  const go = core.useGo();
10934
11323
  const openForm = useOpenForm({
@@ -11119,27 +11508,9 @@ var __publicField = (obj, key, value) => {
11119
11508
  } = useTranslation();
11120
11509
  const kit = eagle.useUIKit();
11121
11510
  const [selectedKeys, setSelectedKeys] = React.useState([]);
11122
- const [currentPage, setCurrentPage] = React.useState(1);
11123
11511
  const component = React.useContext(ComponentContext);
11124
11512
  const Table$1 = component.Table || Table;
11125
11513
  const currentSize = 10;
11126
- const {
11127
- data: data2
11128
- } = core.useList({
11129
- resource: "pods",
11130
- meta: {
11131
- resourceBasePath: "/api/v1",
11132
- kind: "Pod"
11133
- },
11134
- pagination: {
11135
- mode: "off"
11136
- }
11137
- });
11138
- const dataSource = React.useMemo(() => {
11139
- return data2 == null ? void 0 : data2.data.filter((p) => {
11140
- return selector ? matchSelector(p, selector) : true;
11141
- });
11142
- }, [data2 == null ? void 0 : data2.data, selector]);
11143
11514
  const columns = [NameColumnRenderer(i18n2, "pods"), StateDisplayColumnRenderer(i18n2), {
11144
11515
  key: "ip",
11145
11516
  display: true,
@@ -11148,6 +11519,23 @@ var __publicField = (obj, key, value) => {
11148
11519
  sortable: true,
11149
11520
  width: 160
11150
11521
  }, NodeNameColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), PodContainersNumColumnRenderer(i18n2), RestartCountColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
11522
+ const {
11523
+ tableProps
11524
+ } = useEagleTable({
11525
+ columns,
11526
+ useTableParams: {
11527
+ resource: "pods",
11528
+ meta: {
11529
+ resourceBasePath: "/api/v1",
11530
+ kind: "Pod"
11531
+ }
11532
+ }
11533
+ });
11534
+ const dataSource = React.useMemo(() => {
11535
+ return tableProps.data.filter((p) => {
11536
+ return selector ? matchSelector(p, selector) : true;
11537
+ });
11538
+ }, [tableProps.data, selector]);
11151
11539
  if ((dataSource == null ? void 0 : dataSource.length) === 0) {
11152
11540
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
11153
11541
  errorText: i18n2.t("dovetail.no_resource", {
@@ -11166,18 +11554,10 @@ var __publicField = (obj, key, value) => {
11166
11554
  selectedKeys,
11167
11555
  hideCreate: true
11168
11556
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
11557
+ ...tableProps,
11169
11558
  tableKey: "pods",
11170
- loading: !dataSource,
11171
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
11172
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
11173
- columns: addDefaultRenderToColumns(columns),
11174
11559
  onSelect: (keys) => setSelectedKeys(keys),
11175
- rowKey: "id",
11176
- error: false,
11177
- currentPage,
11178
- onPageChange: (p) => setCurrentPage(p),
11179
11560
  defaultSize: currentSize,
11180
- refetch: () => null,
11181
11561
  showMenuColumn: false
11182
11562
  })]
11183
11563
  });
@@ -17369,7 +17749,7 @@ var __publicField = (obj, key, value) => {
17369
17749
  const kit = eagle.useUIKit();
17370
17750
  const [selectedContainer, setSelectedContainer] = React.useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
17371
17751
  const [logs, setLogs] = React.useState([]);
17372
- const [logType, setLogType] = React.useState();
17752
+ const [logType, setLogType] = React.useState("realtime");
17373
17753
  const [currentItemCount, setCurrentItemCount] = React.useState(0);
17374
17754
  const [paused, setPaused] = React.useState(false);
17375
17755
  const [wrap2, setWrap] = React.useState(false);
@@ -17406,30 +17786,20 @@ var __publicField = (obj, key, value) => {
17406
17786
  }
17407
17787
  }
17408
17788
  };
17409
- const fetchLogs = React.useCallback(() => {
17410
- var _a2, _b2;
17411
- if (!selectedContainer) {
17412
- return;
17413
- }
17789
+ const fetchLogsByUrl = React.useCallback(async (url) => {
17414
17790
  abortControllerRef.current = new AbortController();
17415
17791
  const {
17416
17792
  signal
17417
17793
  } = abortControllerRef.current;
17418
- let url = `${apiUrl}/api/v1/namespaces/${(_a2 = pod2.metadata) == null ? void 0 : _a2.namespace}/pods/${(_b2 = pod2.metadata) == null ? void 0 : _b2.name}/log?container=${selectedContainer}&timestamps=true`;
17419
- if (logType === "realtime") {
17420
- url += "&follow=true";
17421
- } else if (logType === "previous") {
17422
- url += "&previous=true";
17423
- }
17424
17794
  fetch(url, {
17425
17795
  signal
17426
- }).then((response) => {
17427
- var _a3;
17796
+ }).then(async (response) => {
17797
+ var _a2;
17428
17798
  if (response.status !== 200) {
17429
17799
  setLogs([]);
17430
17800
  return;
17431
17801
  }
17432
- const reader = (_a3 = response.body) == null ? void 0 : _a3.getReader();
17802
+ const reader = (_a2 = response.body) == null ? void 0 : _a2.getReader();
17433
17803
  if (!reader) {
17434
17804
  return;
17435
17805
  }
@@ -17462,7 +17832,19 @@ var __publicField = (obj, key, value) => {
17462
17832
  };
17463
17833
  reader.read().then(processChunk);
17464
17834
  });
17465
- }, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl]);
17835
+ }, []);
17836
+ const fetchLogs = React.useCallback(async () => {
17837
+ var _a2, _b2;
17838
+ if (!selectedContainer) {
17839
+ return;
17840
+ }
17841
+ const url = `${apiUrl}/api/v1/namespaces/${(_a2 = pod2.metadata) == null ? void 0 : _a2.namespace}/pods/${(_b2 = pod2.metadata) == null ? void 0 : _b2.name}/log?container=${selectedContainer}&timestamps=true`;
17842
+ if (logType === "realtime") {
17843
+ fetchLogsByUrl(`${url}&follow=true`);
17844
+ } else if (logType === "previous") {
17845
+ fetchLogsByUrl(`${url}&previous=true`);
17846
+ }
17847
+ }, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl, fetchLogsByUrl]);
17466
17848
  const stopFetchingLogs = React.useCallback(() => {
17467
17849
  if (abortControllerRef.current) {
17468
17850
  abortControllerRef.current.abort();
@@ -17784,7 +18166,6 @@ var __publicField = (obj, key, value) => {
17784
18166
  const { i18n: i18n2 } = useTranslation();
17785
18167
  const component = React.useContext(ComponentContext);
17786
18168
  const Table$1 = component.Table || Table;
17787
- const [currentPage, setCurrentPage] = React.useState(1);
17788
18169
  const currentSize = 10;
17789
18170
  const columns = React.useMemo(
17790
18171
  () => [
@@ -17841,10 +18222,11 @@ var __publicField = (obj, key, value) => {
17841
18222
  sortable: true,
17842
18223
  sorter: CommonSorter(["state", "running", "startedAt"]),
17843
18224
  width: 120,
17844
- render: (value2) => {
18225
+ render: (_, record) => {
18226
+ const value2 = lodashEs.get(record, ["state", "running", "startedAt"]) || lodashEs.get(record, ["state", "terminated", "startedAt"]);
17845
18227
  if (value2)
17846
18228
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
17847
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "-" });
18229
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
17848
18230
  }
17849
18231
  }
17850
18232
  ],
@@ -17854,6 +18236,15 @@ var __publicField = (obj, key, value) => {
17854
18236
  () => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
17855
18237
  [containerStatuses, initContainerStatuses]
17856
18238
  );
18239
+ const {
18240
+ data: finalData,
18241
+ currentPage,
18242
+ onPageChange,
18243
+ onSorterChange
18244
+ } = useTableData({
18245
+ data: dataSource,
18246
+ columns
18247
+ });
17857
18248
  if (dataSource.length === 0) {
17858
18249
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17859
18250
  WidgetErrorContent,
@@ -17869,14 +18260,15 @@ var __publicField = (obj, key, value) => {
17869
18260
  {
17870
18261
  tableKey: "podContainers",
17871
18262
  loading: false,
17872
- data: dataSource.slice((currentPage - 1) * currentSize, currentPage * currentSize),
18263
+ data: finalData,
17873
18264
  total: dataSource.length,
17874
18265
  columns: addDefaultRenderToColumns(columns),
17875
18266
  rowKey: "containerID",
17876
18267
  error: false,
17877
18268
  defaultSize: currentSize,
17878
18269
  currentPage,
17879
- onPageChange: setCurrentPage,
18270
+ onPageChange,
18271
+ onSorterChange,
17880
18272
  showMenuColumn: false
17881
18273
  }
17882
18274
  );
@@ -18045,11 +18437,11 @@ var __publicField = (obj, key, value) => {
18045
18437
  retry: 1
18046
18438
  },
18047
18439
  errorNotification: () => {
18048
- var _a2;
18440
+ var _a2, _b;
18049
18441
  return {
18050
18442
  message: i18n2.t("dovetail.fail_get_detail", {
18051
- resource: resource == null ? void 0 : resource.name,
18052
- name: (_a2 = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a2.id,
18443
+ resource: (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind,
18444
+ name: (_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id,
18053
18445
  interpolation: { escapeValue: false }
18054
18446
  }),
18055
18447
  description: "Error",
@@ -18057,13 +18449,13 @@ var __publicField = (obj, key, value) => {
18057
18449
  };
18058
18450
  }
18059
18451
  });
18060
- const { isLoading, isError } = queryResult;
18452
+ const { isLoading, isError, data: data2 } = queryResult;
18061
18453
  React.useEffect(() => {
18062
18454
  if (isError && resource) {
18063
18455
  nav.list(resource);
18064
18456
  }
18065
18457
  }, [isError, nav, resource]);
18066
- return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
18458
+ return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 });
18067
18459
  };
18068
18460
  const index_17v8shn = "";
18069
18461
  const WrapperStyle$1 = "w1akirqw";
@@ -18087,431 +18479,110 @@ var __publicField = (obj, key, value) => {
18087
18479
  className: cx_default(eagle.Typo.Display.d2_bold_title, TitleStyle),
18088
18480
  children: [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind, ":", " ", action === "create" ? t2("dovetail.create") : t2("dovetail.edit")]
18089
18481
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {}), props.children, /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, {
18090
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
18091
- type: "primary",
18092
- ...saveButtonProps,
18093
- children: t2("dovetail.save")
18094
- })
18095
- })]
18096
- });
18097
- }
18098
- function WorkloadDropdown(props) {
18099
- const { record, size, children } = props;
18100
- const kit = eagle.useUIKit();
18101
- const { resource } = core.useResource();
18102
- const { mutateAsync } = core.useUpdate();
18103
- const { t: t2 } = useTranslation();
18104
- const { data: canEditData } = core.useCan({
18105
- resource: resource == null ? void 0 : resource.name,
18106
- action: AccessControlAuth.Edit
18107
- });
18108
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(K8sDropdown, { record, size, children: [
18109
- (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18110
- kit.menu.Item,
18111
- {
18112
- onClick: async () => {
18113
- const v = record.redeploy();
18114
- const id = v.id;
18115
- pruneBeforeEdit(v);
18116
- await mutateAsync({
18117
- id,
18118
- resource: (resource == null ? void 0 : resource.name) || "",
18119
- values: v,
18120
- successNotification() {
18121
- return {
18122
- message: t2("dovetail.redeploy_success_toast", {
18123
- kind: record.kind,
18124
- name: record.id,
18125
- interpolation: {
18126
- escapeValue: false
18127
- }
18128
- }),
18129
- type: "success"
18130
- };
18131
- },
18132
- errorNotification() {
18133
- return {
18134
- message: t2("dovetail.redeploy_failed_toast", {
18135
- kind: record.kind,
18136
- name: record.id,
18137
- interpolation: {
18138
- escapeValue: false
18139
- }
18140
- }),
18141
- type: "error"
18142
- };
18143
- }
18144
- });
18145
- },
18146
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Retry16GradientBlueIcon, children: t2("dovetail.redeploy") })
18147
- }
18148
- ) : null,
18149
- children
18150
- ] });
18151
- }
18152
- function ReplicasDropdown(props) {
18153
- const { record, size, children } = props;
18154
- const kit = eagle.useUIKit();
18155
- const { t: t2 } = useTranslation();
18156
- const formRef = React.useRef(null);
18157
- const { action, resource } = core.useResource();
18158
- const isInShowPage = action === "show";
18159
- const { data: canEditData } = core.useCan({
18160
- resource: resource == null ? void 0 : resource.name,
18161
- action: AccessControlAuth.Edit
18162
- });
18163
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(WorkloadDropdown, { record, size, children: [
18164
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
18165
- kit.menu.Item,
18166
- {
18167
- onClick: () => {
18168
- const modalProps = {
18169
- formRef,
18170
- title: t2("dovetail.edit_replicas"),
18171
- renderContent() {
18172
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18173
- WorkloadReplicasForm,
18174
- {
18175
- ref: formRef,
18176
- defaultValue: record.replicas || 0,
18177
- record,
18178
- label: t2("dovetail.pod_replicas_num")
18179
- }
18180
- );
18181
- }
18182
- };
18183
- eagle.pushModal({
18184
- component: EditFieldModal,
18185
- props: modalProps
18186
- });
18187
- },
18188
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_replicas") })
18189
- }
18190
- ),
18191
- children
18192
- ] });
18193
- }
18194
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18195
- function adopt(value2) {
18196
- return value2 instanceof P ? value2 : new P(function(resolve) {
18197
- resolve(value2);
18198
- });
18199
- }
18200
- return new (P || (P = Promise))(function(resolve, reject) {
18201
- function fulfilled(value2) {
18202
- try {
18203
- step(generator.next(value2));
18204
- } catch (e2) {
18205
- reject(e2);
18206
- }
18207
- }
18208
- function rejected(value2) {
18209
- try {
18210
- step(generator["throw"](value2));
18211
- } catch (e2) {
18212
- reject(e2);
18213
- }
18214
- }
18215
- function step(result) {
18216
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18217
- }
18218
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18219
- });
18220
- };
18221
- function useEventCallback(fn) {
18222
- const ref = React.useRef(() => {
18223
- throw new Error("Cannot call an event handler while rendering.");
18224
- });
18225
- useIsomorphicLayoutEffect(() => {
18226
- ref.current = fn;
18227
- }, [fn]);
18228
- return React.useCallback((...args) => ref.current(...args), [ref]);
18229
- }
18230
- function useEventListener(eventName, handler, element, options) {
18231
- const savedHandler = React.useRef(handler);
18232
- useIsomorphicLayoutEffect(() => {
18233
- savedHandler.current = handler;
18234
- }, [handler]);
18235
- React.useEffect(() => {
18236
- var _a;
18237
- const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
18238
- if (!(targetElement && targetElement.addEventListener))
18239
- return;
18240
- const listener = (event2) => savedHandler.current(event2);
18241
- targetElement.addEventListener(eventName, listener, options);
18242
- return () => {
18243
- targetElement.removeEventListener(eventName, listener, options);
18244
- };
18245
- }, [eventName, element, options]);
18246
- }
18247
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18248
- function adopt(value2) {
18249
- return value2 instanceof P ? value2 : new P(function(resolve) {
18250
- resolve(value2);
18251
- });
18252
- }
18253
- return new (P || (P = Promise))(function(resolve, reject) {
18254
- function fulfilled(value2) {
18255
- try {
18256
- step(generator.next(value2));
18257
- } catch (e2) {
18258
- reject(e2);
18259
- }
18260
- }
18261
- function rejected(value2) {
18262
- try {
18263
- step(generator["throw"](value2));
18264
- } catch (e2) {
18265
- reject(e2);
18266
- }
18267
- }
18268
- function step(result) {
18269
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18270
- }
18271
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18272
- });
18273
- };
18274
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
18275
- function useLocalStorage(key2, initialValue) {
18276
- const readValue = React.useCallback(() => {
18277
- if (typeof window === "undefined") {
18278
- return initialValue;
18279
- }
18280
- try {
18281
- const item = window.localStorage.getItem(key2);
18282
- return item ? parseJSON(item) : initialValue;
18283
- } catch (error) {
18284
- console.warn(`Error reading localStorage key “${key2}”:`, error);
18285
- return initialValue;
18286
- }
18287
- }, [initialValue, key2]);
18288
- const [storedValue, setStoredValue] = React.useState(readValue);
18289
- const setValue = useEventCallback((value2) => {
18290
- if (typeof window === "undefined") {
18291
- console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
18292
- }
18293
- try {
18294
- const newValue = value2 instanceof Function ? value2(storedValue) : value2;
18295
- window.localStorage.setItem(key2, JSON.stringify(newValue));
18296
- setStoredValue(newValue);
18297
- window.dispatchEvent(new Event("local-storage"));
18298
- } catch (error) {
18299
- console.warn(`Error setting localStorage key “${key2}”:`, error);
18300
- }
18301
- });
18302
- React.useEffect(() => {
18303
- setStoredValue(readValue());
18304
- }, []);
18305
- const handleStorageChange = React.useCallback((event2) => {
18306
- if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
18307
- return;
18308
- }
18309
- setStoredValue(readValue());
18310
- }, [key2, readValue]);
18311
- useEventListener("storage", handleStorageChange);
18312
- useEventListener("local-storage", handleStorageChange);
18313
- return [storedValue, setValue];
18314
- }
18315
- function parseJSON(value2) {
18316
- try {
18317
- return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
18318
- } catch (_a) {
18319
- console.log("parsing error on", { value: value2 });
18320
- return void 0;
18321
- }
18322
- }
18323
- const GlobalStoreContext = React.createContext({});
18324
- const index_1xad2h9 = "";
18325
- const SelectStyle = "sj0ggy";
18326
- const DropdownStyle = "d1eo8uqs";
18327
- const SearchInputStyle = "s64gojc";
18328
- const SelectContentStyle = "s16fqgtu";
18329
- const TokenStyle = "tgaujbg";
18330
- const CountTokenStyle = "c1vbd54v";
18331
- const SelectOptionGroupStyle = "sxzmtrx";
18332
- const LabelWrapperStyle = "lqrghwd";
18333
- const AllNamespaceOptionStyle = "api7z1z";
18334
- const OptionStyle = "o38b23x";
18335
- const NS_STORE_KEY = "namespace-filter";
18336
- const ALL_NS = "_all";
18337
- const useNamespacesFilter = () => {
18338
- const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18339
- const {
18340
- resource
18341
- } = core.useResource();
18342
- const configs = React.useContext(ConfigsContext);
18343
- if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
18344
- return {
18345
- value: []
18346
- };
18347
- }
18348
- return {
18349
- value: value2
18350
- };
18351
- };
18352
- const NamespacesFilter = ({
18353
- className
18354
- }) => {
18482
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
18483
+ type: "primary",
18484
+ ...saveButtonProps,
18485
+ children: t2("dovetail.save")
18486
+ })
18487
+ })]
18488
+ });
18489
+ }
18490
+ function WorkloadDropdown(props) {
18491
+ const { record, size, children } = props;
18355
18492
  const kit = eagle.useUIKit();
18356
- const {
18357
- t: t2
18358
- } = useTranslation();
18359
- const [search, setSearch] = React.useState("");
18360
- const [tagMaxWidth, setTagMaxWidth] = React.useState("");
18361
- const {
18362
- data: data2,
18363
- isLoading
18364
- } = core.useList({
18365
- resource: "namespaces",
18366
- meta: {
18367
- resourceBasePath: "/api/v1",
18368
- kind: "Namespace"
18369
- },
18370
- pagination: {
18371
- mode: "off"
18372
- }
18493
+ const { resource } = core.useResource();
18494
+ const { mutateAsync } = core.useUpdate();
18495
+ const { t: t2 } = useTranslation();
18496
+ const { data: canEditData } = core.useCan({
18497
+ resource: resource == null ? void 0 : resource.name,
18498
+ action: AccessControlAuth.Edit
18373
18499
  });
18374
- const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18375
- const [open, setOpen] = React.useState(false);
18376
- const debouncedSetSearch = lodashEs.debounce(setSearch, 100);
18377
- const MAX_TAG_COUNT = 8;
18378
- const COUNT_TAG_WIDTH = 22;
18379
- const TAG_GAP = 4;
18380
- const PADDING = 36;
18381
- const hasCountTag = value2.length > MAX_TAG_COUNT;
18382
- const WRAPPER_CLASS = "d2-namespace-select-wrapper";
18383
- const SELECT_CLASS = "d2-namespace-select";
18384
- const calcTagMaxWidth = React.useCallback(() => {
18385
- const wrapper = document.querySelector(`.${WRAPPER_CLASS}`);
18386
- const n2 = Math.min(value2.length, MAX_TAG_COUNT);
18387
- const tagWidth = ((wrapper == null ? void 0 : wrapper.offsetWidth) || 0) / n2;
18388
- const gapsWidth = (Math.min(value2.length, MAX_TAG_COUNT + 1) - 1) * TAG_GAP;
18389
- const paddingAndCountTagWidth = PADDING + (hasCountTag ? COUNT_TAG_WIDTH : 0);
18390
- const perTagMaxWidth = tagWidth - (paddingAndCountTagWidth + gapsWidth) / n2;
18391
- setTagMaxWidth(`${perTagMaxWidth}px`);
18392
- }, [value2, hasCountTag]);
18393
- React.useEffect(() => {
18394
- calcTagMaxWidth();
18395
- }, [calcTagMaxWidth]);
18396
- React.useEffect(() => {
18397
- window.addEventListener("resize", calcTagMaxWidth);
18398
- return () => {
18399
- window.removeEventListener("resize", calcTagMaxWidth);
18400
- };
18401
- }, [calcTagMaxWidth]);
18402
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18403
- className: WRAPPER_CLASS,
18404
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
18405
- loading: isLoading,
18406
- className: cx_default(SelectStyle, SELECT_CLASS, className),
18407
- style: {
18408
- "--tag-max-width": tagMaxWidth
18409
- },
18410
- dropdownClassName: DropdownStyle,
18411
- searchValue: search,
18412
- virtual: false,
18413
- input: {
18414
- value: value2,
18415
- onChange(value22) {
18416
- if (lodashEs.last(value22) === ALL_NS || value22.length === 0) {
18417
- setValue([ALL_NS]);
18418
- } else {
18419
- setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
18420
- }
18421
- }
18422
- },
18423
- dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
18424
- className: SelectContentStyle,
18425
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
18426
- style: {
18427
- width: "100%"
18428
- },
18429
- className: SearchInputStyle,
18430
- onChange: debouncedSetSearch,
18431
- placeholder: t2("dovetail.please_input")
18432
- }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
18433
- }),
18434
- tagRender: ({
18435
- label: label2,
18436
- value: namespaceValue,
18437
- closable,
18438
- onClose
18439
- }) => {
18440
- const isCountToken = label2 !== namespaceValue && typeof label2 === "string";
18441
- const isAll = namespaceValue === ALL_NS;
18442
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18443
- onClick: () => {
18444
- setOpen(!open);
18445
- },
18446
- children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
18447
- style: {
18448
- marginLeft: 8
18500
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(K8sDropdown, { record, size, children: [
18501
+ (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18502
+ kit.menu.Item,
18503
+ {
18504
+ onClick: async () => {
18505
+ const v = record.redeploy();
18506
+ const id = v.id;
18507
+ pruneBeforeEdit(v);
18508
+ await mutateAsync({
18509
+ id,
18510
+ resource: (resource == null ? void 0 : resource.name) || "",
18511
+ values: v,
18512
+ successNotification() {
18513
+ return {
18514
+ message: t2("dovetail.redeploy_success_toast", {
18515
+ kind: record.kind,
18516
+ name: record.id,
18517
+ interpolation: {
18518
+ escapeValue: false
18519
+ }
18520
+ }),
18521
+ type: "success"
18522
+ };
18449
18523
  },
18450
- children: [label2, "..."]
18451
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
18452
- className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
18453
- closable,
18454
- size: "medium",
18455
- onClose,
18456
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18457
- content: isCountToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.tooltip, {
18458
- title: isCountToken ? value2.slice(MAX_TAG_COUNT).map((namespace2, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
18459
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18460
- children: namespace2
18461
- }), index !== value2.length - 1 - MAX_TAG_COUNT ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {
18462
- style: {
18463
- margin: "6px 0",
18464
- borderColor: "rgba(107, 128, 167, 0.60)"
18465
- }
18466
- }) : null]
18467
- })) : null,
18468
- trigger: ["hover"],
18469
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18470
- children: label2.replace(/[\s\.]/g, "")
18471
- })
18472
- }) : label2
18473
- })
18474
- })
18475
- });
18476
- },
18477
- maxTagCount: MAX_TAG_COUNT,
18478
- optionLabelProp: "label",
18479
- showArrow: true,
18480
- showSearch: false,
18481
- open,
18482
- onDropdownVisibleChange: (open2) => {
18483
- setOpen(open2);
18484
- },
18485
- multiple: true,
18486
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18487
- value: "_all",
18488
- label: t2("dovetail.all_namespaces"),
18489
- className: AllNamespaceOptionStyle,
18490
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18491
- content: t2("dovetail.all_namespaces"),
18492
- className: LabelWrapperStyle
18493
- })
18494
- }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
18495
- label: "",
18496
- className: SelectOptionGroupStyle,
18497
- children: data2 == null ? void 0 : data2.data.map((namespace2) => {
18498
- const {
18499
- name: name2
18500
- } = namespace2.metadata;
18501
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18502
- value: name2,
18503
- label: name2,
18504
- className: OptionStyle,
18505
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18506
- content: name2,
18507
- className: LabelWrapperStyle
18508
- })
18509
- }, name2);
18510
- })
18511
- })]
18512
- })
18524
+ errorNotification() {
18525
+ return {
18526
+ message: t2("dovetail.redeploy_failed_toast", {
18527
+ kind: record.kind,
18528
+ name: record.id,
18529
+ interpolation: {
18530
+ escapeValue: false
18531
+ }
18532
+ }),
18533
+ type: "error"
18534
+ };
18535
+ }
18536
+ });
18537
+ },
18538
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Retry16GradientBlueIcon, children: t2("dovetail.redeploy") })
18539
+ }
18540
+ ) : null,
18541
+ children
18542
+ ] });
18543
+ }
18544
+ function ReplicasDropdown(props) {
18545
+ const { record, size, children } = props;
18546
+ const kit = eagle.useUIKit();
18547
+ const { t: t2 } = useTranslation();
18548
+ const formRef = React.useRef(null);
18549
+ const { action, resource } = core.useResource();
18550
+ const isInShowPage = action === "show";
18551
+ const { data: canEditData } = core.useCan({
18552
+ resource: resource == null ? void 0 : resource.name,
18553
+ action: AccessControlAuth.Edit
18513
18554
  });
18514
- };
18555
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(WorkloadDropdown, { record, size, children: [
18556
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
18557
+ kit.menu.Item,
18558
+ {
18559
+ onClick: () => {
18560
+ const modalProps = {
18561
+ formRef,
18562
+ title: t2("dovetail.edit_replicas"),
18563
+ renderContent() {
18564
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18565
+ WorkloadReplicasForm,
18566
+ {
18567
+ ref: formRef,
18568
+ defaultValue: record.replicas || 0,
18569
+ record,
18570
+ label: t2("dovetail.pod_replicas_num")
18571
+ }
18572
+ );
18573
+ }
18574
+ };
18575
+ eagle.pushModal({
18576
+ component: EditFieldModal,
18577
+ props: modalProps
18578
+ });
18579
+ },
18580
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_replicas") })
18581
+ }
18582
+ ),
18583
+ children
18584
+ ] });
18585
+ }
18515
18586
  const index_hp158y = "";
18516
18587
  const ListPageStyle = "laykzsq";
18517
18588
  const ListContentStyle = "l1ng0psc";
@@ -18580,8 +18651,7 @@ var __publicField = (obj, key, value) => {
18580
18651
  useTableParams: {},
18581
18652
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
18582
18653
  tableProps: {
18583
- defaultSize: 50,
18584
- ...props.config.tableProps
18654
+ defaultSize: 50
18585
18655
  },
18586
18656
  formatter,
18587
18657
  Dropdown
@@ -21786,44 +21856,20 @@ var __publicField = (obj, key, value) => {
21786
21856
  _formControl.current.formState = getProxyFormState(formState, control);
21787
21857
  return _formControl.current;
21788
21858
  }
21789
- const RefineFormContent_1tb00bi = "";
21859
+ const RefineFormContent_1in3vad = "";
21790
21860
  const RefineFormContent = (props) => {
21791
- var _a, _b, _c, _d;
21861
+ var _a, _b;
21792
21862
  const {
21793
21863
  config,
21794
21864
  formResult,
21795
- resourceId,
21865
+ action,
21796
21866
  errorMsg
21797
21867
  } = props;
21798
21868
  const {
21799
21869
  control,
21800
21870
  getValues
21801
21871
  } = formResult;
21802
- const action = resourceId ? "edit" : "create";
21803
- const listQuery = core.useList({
21804
- resource: config == null ? void 0 : config.name,
21805
- meta: {
21806
- resourceBasePath: config == null ? void 0 : config.basePath,
21807
- kind: config == null ? void 0 : config.kind
21808
- },
21809
- pagination: {
21810
- mode: "off"
21811
- }
21812
- });
21813
- const showQuery = core.useShow({
21814
- resource: config == null ? void 0 : config.name,
21815
- meta: {
21816
- resourceBasePath: config == null ? void 0 : config.basePath,
21817
- kind: config == null ? void 0 : config.kind
21818
- },
21819
- id: resourceId
21820
- });
21821
- const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
21822
- record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
21823
- records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
21824
- action
21825
- });
21826
- const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
21872
+ const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21827
21873
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21828
21874
  control,
21829
21875
  name: c2.path.join("."),
@@ -21855,7 +21901,6 @@ var __publicField = (obj, key, value) => {
21855
21901
  var _a2;
21856
21902
  const formValue = getValues();
21857
21903
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Fields.String, {
21858
- placeholder: c2.placeholder,
21859
21904
  input: {
21860
21905
  value: value2,
21861
21906
  onChange,
@@ -21883,17 +21928,6 @@ var __publicField = (obj, key, value) => {
21883
21928
  children: value2
21884
21929
  });
21885
21930
  }
21886
- if (c2.helperText) {
21887
- ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
21888
- size: 4,
21889
- direction: "vertical",
21890
- className: "c154n7ie",
21891
- children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
21892
- className: cx_default(eagle.Typo.Footnote.f2_regular, "c1c9j4da"),
21893
- children: c2.helperText
21894
- })]
21895
- });
21896
- }
21897
21931
  if (c2 == null ? void 0 : c2.render) {
21898
21932
  ele = c2.render(value2, onChange, formValue, onBlur, action);
21899
21933
  }
@@ -21911,7 +21945,7 @@ var __publicField = (obj, key, value) => {
21911
21945
  });
21912
21946
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(eagle.Space, {
21913
21947
  direction: "vertical",
21914
- className: "cjxv8cf",
21948
+ className: "c154n7ie",
21915
21949
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
21916
21950
  errorMsgs: errorMsg ? [errorMsg] : [],
21917
21951
  style: {
@@ -22551,6 +22585,7 @@ var __publicField = (obj, key, value) => {
22551
22585
  };
22552
22586
  };
22553
22587
  const useRefineForm = (props) => {
22588
+ var _a;
22554
22589
  const { config, id, refineProps } = props;
22555
22590
  const [responseErrorMsg, setResponseErrorMsg] = React.useState("");
22556
22591
  const i18n2 = useTranslation();
@@ -22583,15 +22618,15 @@ var __publicField = (obj, key, value) => {
22583
22618
  defaultValues: config == null ? void 0 : config.initValue
22584
22619
  });
22585
22620
  React.useEffect(() => {
22586
- var _a, _b;
22587
- const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
22621
+ var _a2, _b;
22622
+ const response = (_a2 = result.refineCore.mutationResult.error) == null ? void 0 : _a2.response;
22588
22623
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
22589
22624
  (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
22590
- var _a2, _b2;
22591
- setResponseErrorMsg(((_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.formatError) == null ? void 0 : _b2.call(_a2, body)) || body.message);
22625
+ var _a3, _b2;
22626
+ setResponseErrorMsg(((_b2 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b2.call(_a3, body)) || body.message);
22592
22627
  });
22593
22628
  }
22594
- }, [config.formConfig, result]);
22629
+ }, [config.formConfig, (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response]);
22595
22630
  return { formResult: result, responseErrorMsg };
22596
22631
  };
22597
22632
  const index_12sfrn = "";
@@ -23117,18 +23152,9 @@ var __publicField = (obj, key, value) => {
23117
23152
  setEditorErrors(errors);
23118
23153
  return;
23119
23154
  }
23120
- try {
23121
- const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23122
- const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23123
- return onFinish(finalValues);
23124
- } catch (error) {
23125
- if (error instanceof Error) {
23126
- if (error.message === "expected a single document in the stream, but found more") {
23127
- setEditorErrors([t2("dovetail.only_support_one_yaml")]);
23128
- return;
23129
- }
23130
- }
23131
- }
23155
+ const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23156
+ const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23157
+ return onFinish(finalValues);
23132
23158
  },
23133
23159
  onKeyUp,
23134
23160
  onValuesChange,
@@ -23350,7 +23376,7 @@ var __publicField = (obj, key, value) => {
23350
23376
  formResult: refineFormResult.formResult,
23351
23377
  config,
23352
23378
  errorMsg: refineFormResult.responseErrorMsg,
23353
- resourceId: id
23379
+ action: id ? "edit" : "create"
23354
23380
  });
23355
23381
  })();
23356
23382
  const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
@@ -23433,7 +23459,7 @@ var __publicField = (obj, key, value) => {
23433
23459
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23434
23460
  config,
23435
23461
  formResult,
23436
- resourceId: id
23462
+ action
23437
23463
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Button, {
23438
23464
  ...saveButtonProps,
23439
23465
  onClick,
@@ -23671,7 +23697,7 @@ var __publicField = (obj, key, value) => {
23671
23697
  const parsed = core.useParsed();
23672
23698
  const nav = core.useNavigation();
23673
23699
  const { queryResult } = core.useShow({ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id });
23674
- const { isLoading } = queryResult;
23700
+ const { isLoading, data: data2 } = queryResult;
23675
23701
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
23676
23702
  antd.Drawer,
23677
23703
  {
@@ -23680,7 +23706,7 @@ var __publicField = (obj, key, value) => {
23680
23706
  onClose: () => nav.goBack(),
23681
23707
  width: "50%",
23682
23708
  visible: !!((_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id),
23683
- children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props })
23709
+ children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 })
23684
23710
  }
23685
23711
  );
23686
23712
  };
@@ -23708,7 +23734,7 @@ var __publicField = (obj, key, value) => {
23708
23734
  }
23709
23735
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
23710
23736
  if (!resource) {
23711
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "-" });
23737
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
23712
23738
  }
23713
23739
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
23714
23740
  ResourceLink,
@@ -23834,11 +23860,7 @@ var __publicField = (obj, key, value) => {
23834
23860
  title: i18n2.t("dovetail.name"),
23835
23861
  sortable: true,
23836
23862
  width: 200,
23837
- sorter: CommonSorter(dataIndex),
23838
- render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
23839
- content: v,
23840
- tooltip: v
23841
- })
23863
+ sorter: CommonSorter(dataIndex)
23842
23864
  };
23843
23865
  };
23844
23866
  const NameSpaceColumnRenderer = (i18n2) => {
@@ -23931,17 +23953,8 @@ var __publicField = (obj, key, value) => {
23931
23953
  display: true,
23932
23954
  dataIndex,
23933
23955
  title: i18n2.t("dovetail.created_time"),
23934
- sortable: true,
23935
23956
  width: 120,
23936
- sorter: (a2, b) => {
23937
- const valA = new Date(lodashExports.get(a2, dataIndex));
23938
- const valB = new Date(lodashExports.get(b, dataIndex));
23939
- if (valA === valB)
23940
- return 0;
23941
- if (valA > valB)
23942
- return 1;
23943
- return -1;
23944
- },
23957
+ sorter: true,
23945
23958
  render: (value2) => {
23946
23959
  return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
23947
23960
  date: new Date(value2)
@@ -24278,7 +24291,7 @@ var __publicField = (obj, key, value) => {
24278
24291
  href: `//${v.servicePort}`,
24279
24292
  target: "_blank",
24280
24293
  children: v.servicePort
24281
- }) : v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
24294
+ }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
24282
24295
  }),
24283
24296
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
24284
24297
  }, v.servicePort));
@@ -24288,89 +24301,6 @@ var __publicField = (obj, key, value) => {
24288
24301
  }
24289
24302
  };
24290
24303
  };
24291
- var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
24292
- ColumnKeys2["age"] = "age";
24293
- ColumnKeys2["name"] = "name";
24294
- ColumnKeys2["namespace"] = "namespace";
24295
- ColumnKeys2["phase"] = "phase";
24296
- ColumnKeys2["replicas"] = "replicas";
24297
- ColumnKeys2["deploymentImage"] = "deploymentImage";
24298
- ColumnKeys2["podImage"] = "podImage";
24299
- return ColumnKeys2;
24300
- })(ColumnKeys || {});
24301
- function addDefaultRenderToColumns(columns) {
24302
- return columns.map((col) => ({
24303
- render(value2) {
24304
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: value2 });
24305
- },
24306
- ...col
24307
- }));
24308
- }
24309
- const useEagleTable = (params) => {
24310
- var _a, _b, _c;
24311
- const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
24312
- const [selectedKeys, setSelectedKeys] = React.useState([]);
24313
- const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
24314
- const { resource } = core.useResource();
24315
- const { value: nsFilters = [] } = useNamespacesFilter();
24316
- const useTableParams = React.useMemo(() => {
24317
- const mergedParams = lodashEs.merge(params.useTableParams, {
24318
- pagination: {
24319
- mode: "off"
24320
- },
24321
- filters: {
24322
- permanent: [
24323
- {
24324
- operator: "or",
24325
- value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
24326
- field: "metadata.namespace",
24327
- operator: "eq",
24328
- value: filter
24329
- }))
24330
- }
24331
- ]
24332
- }
24333
- });
24334
- return mergedParams;
24335
- }, [params.useTableParams, nsFilters]);
24336
- const finalColumns = React.useMemo(
24337
- () => addDefaultRenderToColumns(columns),
24338
- [columns]
24339
- );
24340
- const table = core.useTable(useTableParams);
24341
- const onPageChange = React.useCallback(
24342
- (page) => {
24343
- setCurrentPage(page);
24344
- },
24345
- [setCurrentPage]
24346
- );
24347
- const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
24348
- const data2 = (_b = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.slice(
24349
- (currentPage - 1) * currentSize,
24350
- currentPage * currentSize
24351
- );
24352
- const total = ((_c = table.tableQueryResult.data) == null ? void 0 : _c.data.length) || 0;
24353
- const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
24354
- const finalProps = {
24355
- tableKey: (resource == null ? void 0 : resource.name) || "table",
24356
- loading: table.tableQueryResult.isLoading,
24357
- data: finalDataSource || [],
24358
- columns: finalColumns,
24359
- refetch: () => null,
24360
- error: false,
24361
- rowKey: "id",
24362
- currentPage,
24363
- onPageChange,
24364
- onSelect: (keys) => {
24365
- setSelectedKeys(keys);
24366
- },
24367
- total,
24368
- RowMenu: Dropdown,
24369
- ...tableProps,
24370
- defaultSize: currentSize
24371
- };
24372
- return { tableProps: finalProps, selectedKeys, ...table };
24373
- };
24374
24304
  const styles = "";
24375
24305
  const Dovetail = (props) => {
24376
24306
  const {
@@ -24423,7 +24353,10 @@ var __publicField = (obj, key, value) => {
24423
24353
  options: {
24424
24354
  warnWhenUnsavedChanges: true,
24425
24355
  liveMode: "auto",
24426
- disableTelemetry: true
24356
+ disableTelemetry: true,
24357
+ overtime: {
24358
+ interval: Number.MAX_SAFE_INTEGER
24359
+ }
24427
24360
  },
24428
24361
  accessControlProvider,
24429
24362
  resources: resourcesConfig.map((c2) => {