@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
@@ -6,20 +6,20 @@ var __publicField = (obj, key2, value2) => {
6
6
  };
7
7
  import i18n from "i18next";
8
8
  import * as React from "react";
9
- import React__default, { createElement, isValidElement, cloneElement, Children, createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, useImperativeHandle, memo, PureComponent, useLayoutEffect, forwardRef, Suspense } from "react";
10
- import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useDeleteMany, CanAccess, useCan, useShow, useUpdate, useDataProvider, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, useTable, Refine } from "@refinedev/core";
9
+ import React__default, { createElement, isValidElement, cloneElement, Children, createContext, useContext, useState, useRef, useEffect, useCallback, useMemo, useLayoutEffect, useImperativeHandle, memo, PureComponent, forwardRef, Suspense } from "react";
10
+ import { ResourceContext, matchResourceFromRoute, useResource, useDelete, useNavigation, useBreadcrumb, useList, useParsed, useGo, useCan, useTable, useDeleteMany, CanAccess, useUpdate, useDataProvider, useShow, useRefineContext, useTranslate, useWarnAboutChange, useForm as useForm$2, flattenObjectKeys, pickNotDeprecated, useMenu, Refine } from "@refinedev/core";
11
11
  import { parse, stringify } from "qs";
12
12
  import { useLocation, useHistory, useParams, matchPath, Link, Route, NavLink, Router } from "react-router-dom";
13
- import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Button, Icon as Icon$1, popModal, Loading, Divider, Fields, Space, Form, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
14
- import { PlusAddCreateNew16BoldOntintIcon, EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, EditPen16GradientBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon } from "@cloudtower/icons-react";
15
- import { get as get$3, first, debounce, last, isObject as isObject$4, merge, keyBy } from "lodash-es";
13
+ import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Icon as Icon$1, Button, popModal, Loading, Divider, Fields, Form, Space, Modal, useMessage, ModalStack, KitStoreProvider } from "@cloudtower/eagle";
14
+ import { EditPen16PrimaryIcon, Download16GradientBlueIcon, TrashBinDelete16Icon, MoreEllipsis324BoldSecondaryIcon, MoreEllipsis324BoldBlueIcon, MoreEllipsis316BoldBlueIcon, PlusAddCreateNew16BoldOntintIcon, ArrowChevronLeft16BoldTertiaryIcon, ArrowChevronLeftSmall16BoldBlueIcon, EditPen16GradientBlueIcon, ViewEye16GradientGrayIcon, EntityFilterIgnoreGradient16GrayIcon, RecoverContinue16GradientBlueIcon, SuspendedPause16GradientBlueIcon, Retry16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, Retry16GradientGrayIcon, EditPen16GradientGrayIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, ExclamationErrorCircleFill16RedIcon, Pause16GradientBlueIcon } from "@cloudtower/icons-react";
15
+ import { omit as omit$1, debounce, last, merge, get as get$3, first, isObject as isObject$4, keyBy } from "lodash-es";
16
16
  import yaml from "js-yaml";
17
+ import { paginateData, sortData, dataProvider, liveProvider } from "k8s-api-provider";
17
18
  import * as monaco from "monaco-editor";
18
19
  import { setDiagnosticsOptions } from "monaco-yaml";
19
20
  import ReactDOM from "react-dom";
20
21
  import { useForm as useForm$3 } from "sunflower-antd";
21
22
  import { Drawer } from "antd";
22
- import { dataProvider, liveProvider } from "k8s-api-provider";
23
23
  var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
24
24
  function getDefaultExportFromCjs(x) {
25
25
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -8618,7 +8618,7 @@ function Table(props) {
8618
8618
  } = props;
8619
8619
  const auxiliaryLineRef = useRef(null);
8620
8620
  const wrapperRef = useRef(null);
8621
- const pagination = useMemo(() => ({
8621
+ useMemo(() => ({
8622
8622
  current: currentPage,
8623
8623
  pageSize: defaultSize,
8624
8624
  onChange: onPageChange
@@ -8665,7 +8665,6 @@ function Table(props) {
8665
8665
  tableLayout: "fixed",
8666
8666
  columns: finalColumns,
8667
8667
  dataSource,
8668
- pagination,
8669
8668
  error,
8670
8669
  loading,
8671
8670
  rowKey,
@@ -8683,11 +8682,38 @@ function Table(props) {
8683
8682
  });
8684
8683
  }
8685
8684
  const ComponentContext = createContext({});
8685
+ function useTableData({ data: data2, columns, pageSize = 10 }) {
8686
+ const [currentPage, setCurrentPage] = useState(1);
8687
+ const [sorters, setSorters] = useState([]);
8688
+ const onSorterChange = useCallback((order, key2) => {
8689
+ var _a;
8690
+ const ORDER_MAP = {
8691
+ descend: "desc",
8692
+ ascend: "asc"
8693
+ };
8694
+ const sorters2 = [{
8695
+ field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
8696
+ order: order ? ORDER_MAP[order] : order
8697
+ }];
8698
+ setSorters(sorters2);
8699
+ }, [columns]);
8700
+ return {
8701
+ data: paginateData(
8702
+ {
8703
+ pageSize,
8704
+ current: currentPage
8705
+ },
8706
+ sortData(sorters, data2)
8707
+ ),
8708
+ currentPage,
8709
+ onPageChange: setCurrentPage,
8710
+ onSorterChange
8711
+ };
8712
+ }
8686
8713
  const PodSelectorTable = ({ podSelectors = {} }) => {
8687
8714
  const { t: t2 } = useTranslation();
8688
8715
  const component = useContext(ComponentContext);
8689
8716
  const Table$1 = component.Table || Table;
8690
- const [currentPage, setCurrentPage] = useState(1);
8691
8717
  const currentSize = 10;
8692
8718
  const datas = Object.keys(podSelectors).map((key2) => ({
8693
8719
  id: key2,
@@ -8712,6 +8738,15 @@ const PodSelectorTable = ({ podSelectors = {} }) => {
8712
8738
  width: "50%"
8713
8739
  }
8714
8740
  ];
8741
+ const {
8742
+ data: finalData,
8743
+ currentPage,
8744
+ onPageChange,
8745
+ onSorterChange
8746
+ } = useTableData({
8747
+ data: datas,
8748
+ columns
8749
+ });
8715
8750
  if (datas.length === 0) {
8716
8751
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8717
8752
  WidgetErrorContent,
@@ -8727,14 +8762,15 @@ const PodSelectorTable = ({ podSelectors = {} }) => {
8727
8762
  {
8728
8763
  tableKey: "podSelector",
8729
8764
  loading: false,
8730
- data: datas.slice((currentPage - 1) * currentSize, currentPage * currentSize),
8765
+ data: finalData,
8731
8766
  total: datas.length,
8732
8767
  columns: addDefaultRenderToColumns(columns),
8733
8768
  rowKey: "key",
8734
8769
  empty: t2("dovetail.empty"),
8735
8770
  defaultSize: currentSize,
8736
8771
  currentPage,
8737
- onPageChange: setCurrentPage,
8772
+ onPageChange,
8773
+ onSorterChange,
8738
8774
  showMenuColumn: false
8739
8775
  }
8740
8776
  );
@@ -8743,7 +8779,6 @@ const PortsTable = ({ service }) => {
8743
8779
  const { t: t2 } = useTranslation();
8744
8780
  const component = useContext(ComponentContext);
8745
8781
  const Table$1 = component.Table || Table;
8746
- const [currentPage, setCurrentPage] = useState(1);
8747
8782
  const currentSize = 10;
8748
8783
  const columns = [
8749
8784
  {
@@ -8791,6 +8826,15 @@ const PortsTable = ({ service }) => {
8791
8826
  ...port2,
8792
8827
  id: port2.name || ""
8793
8828
  }));
8829
+ const {
8830
+ data: finalData,
8831
+ currentPage,
8832
+ onPageChange,
8833
+ onSorterChange
8834
+ } = useTableData({
8835
+ data: ports,
8836
+ columns
8837
+ });
8794
8838
  if ((ports == null ? void 0 : ports.length) === 0) {
8795
8839
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
8796
8840
  WidgetErrorContent,
@@ -8806,14 +8850,15 @@ const PortsTable = ({ service }) => {
8806
8850
  {
8807
8851
  tableKey: "ports",
8808
8852
  loading: false,
8809
- data: ports.slice((currentPage - 1) * currentSize, currentPage * currentSize),
8853
+ data: finalData,
8810
8854
  total: ports.length,
8811
8855
  columns: addDefaultRenderToColumns(columns),
8812
8856
  rowKey: "name",
8813
8857
  empty: t2("dovetail.empty"),
8814
8858
  defaultSize: currentSize,
8815
8859
  currentPage,
8816
- onPageChange: setCurrentPage,
8860
+ onPageChange,
8861
+ onSorterChange,
8817
8862
  showMenuColumn: false
8818
8863
  }
8819
8864
  );
@@ -9953,7 +9998,7 @@ const ServiceOutClusterAccessComponent = ({
9953
9998
  children: content || "-"
9954
9999
  });
9955
10000
  };
9956
- const index_10ylmu3 = "";
10001
+ const index_1wlqq0y = "";
9957
10002
  const TagWrapper = "t13a6vox";
9958
10003
  const TagStyle = "t12ikbmp";
9959
10004
  const Tags = (props) => {
@@ -9992,24 +10037,23 @@ const StateTag = ({
9992
10037
  const {
9993
10038
  t: t2
9994
10039
  } = useTranslation();
9995
- const statusMap = {
9996
- updating: "loading",
10040
+ const colorMap = {
10041
+ updating: "blue",
9997
10042
  ready: "green",
9998
10043
  completed: "gray",
9999
10044
  failed: "red",
10000
10045
  suspended: "warning",
10001
- running: "green",
10002
- succeeded: "blue",
10003
- unknown: "gray",
10004
- terminating: "loading",
10005
- pending: "warning",
10046
+ running: "blue",
10047
+ succeeded: "green",
10048
+ unknown: "warning",
10049
+ terminating: "red",
10050
+ pending: "gray",
10006
10051
  waiting: "warning",
10007
10052
  terminated: "red"
10008
10053
  };
10009
10054
  return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.statusCapsule, {
10010
10055
  className: cx_default(className, StateTagStyle, hideBackground && "no-background"),
10011
- color: statusMap[state2] !== "loading" ? statusMap[state2] : void 0,
10012
- loading: statusMap[state2] === "loading",
10056
+ color: colorMap[state2],
10013
10057
  children: t2(`dovetail.${state2 || "updating"}`)
10014
10058
  });
10015
10059
  };
@@ -10127,11 +10171,9 @@ const Time = (props) => {
10127
10171
  });
10128
10172
  };
10129
10173
  const ConditionsTable = ({ conditions = [] }) => {
10130
- const [currentPage, setCurrentPage] = useState(1);
10131
10174
  const { t: t2 } = useTranslation();
10132
10175
  const component = useContext(ComponentContext);
10133
10176
  const Table$1 = component.Table || Table;
10134
- const currentSize = 10;
10135
10177
  const conditionsWithId = addId(conditions, "type");
10136
10178
  const columns = [
10137
10179
  {
@@ -10187,6 +10229,8 @@ const ConditionsTable = ({ conditions = [] }) => {
10187
10229
  width: 403
10188
10230
  }
10189
10231
  ];
10232
+ const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({ data: conditionsWithId, columns });
10233
+ const currentSize = 10;
10190
10234
  if (conditionsWithId.length === 0) {
10191
10235
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10192
10236
  WidgetErrorContent,
@@ -10202,18 +10246,38 @@ const ConditionsTable = ({ conditions = [] }) => {
10202
10246
  {
10203
10247
  tableKey: "condition",
10204
10248
  loading: false,
10205
- data: conditionsWithId.slice((currentPage - 1) * currentSize, currentPage * currentSize),
10249
+ data: finalData,
10206
10250
  total: conditionsWithId.length,
10207
10251
  columns: addDefaultRenderToColumns(columns),
10208
10252
  rowKey: "type",
10209
10253
  empty: t2("dovetail.empty"),
10210
10254
  defaultSize: currentSize,
10211
10255
  currentPage,
10212
- onPageChange: setCurrentPage,
10256
+ onPageChange,
10257
+ onSorterChange,
10213
10258
  showMenuColumn: false
10214
10259
  }
10215
10260
  );
10216
10261
  };
10262
+ function download(filename, content) {
10263
+ const element = document.createElement("a");
10264
+ element.setAttribute(
10265
+ "href",
10266
+ "data:text/plain;charset=utf-8," + encodeURIComponent(content)
10267
+ );
10268
+ element.setAttribute("download", filename);
10269
+ element.style.display = "none";
10270
+ document.body.appendChild(element);
10271
+ element.click();
10272
+ document.body.removeChild(element);
10273
+ }
10274
+ function useDownloadYAML() {
10275
+ return function(options) {
10276
+ const { name: name2, item } = options;
10277
+ const content = yaml.dump(item);
10278
+ download(`${name2}.yaml`, content);
10279
+ };
10280
+ }
10217
10281
  function useEdit() {
10218
10282
  const { resource } = useParsed();
10219
10283
  const go = useGo();
@@ -10292,222 +10356,650 @@ function useOpenForm(options) {
10292
10356
  }
10293
10357
  };
10294
10358
  }
10295
- function CreateButton() {
10296
- var _a;
10359
+ function K8sDropdown(props) {
10360
+ const { record, size = "normal" } = props;
10297
10361
  const kit = useUIKit();
10298
- const { t: t2 } = useTranslation();
10299
- const openForm = useOpenForm();
10300
- const { resource } = useResource();
10301
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
10302
- kit.button,
10303
- {
10304
- prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusAddCreateNew16BoldOntintIcon, {}),
10305
- type: "primary",
10306
- onClick: openForm,
10307
- children: t2("dovetail.create_resource", { resource: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind })
10308
- }
10362
+ const { globalStore } = useGlobalStore();
10363
+ const useResourceResult = useResource();
10364
+ const resource = useResourceResult.resource;
10365
+ const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
10366
+ (resource == null ? void 0 : resource.name) || ""
10309
10367
  );
10310
- }
10311
- const useDeleteManyModal = (resource, ids) => {
10312
- const { mutate } = useDeleteMany();
10313
- const [visible, setVisible] = useState(false);
10314
- const { t: t2 } = useTranslation();
10315
- const modalProps = {
10316
- title: t2("dovetail.delete"),
10317
- okText: t2("dovetail.delete"),
10318
- okButtonProps: {
10319
- danger: true
10320
- },
10321
- cancelText: t2("dovetail.cancel"),
10322
- children: t2("dovetail.confirm_delete_text", {
10323
- target: ids,
10324
- interpolation: { escapeValue: false }
10325
- }),
10326
- onOk() {
10327
- mutate({
10328
- resource,
10329
- ids
10330
- });
10331
- setVisible(false);
10332
- },
10333
- onCancel() {
10334
- setVisible(false);
10335
- }
10336
- };
10337
- return { modalProps, visible, setVisible };
10338
- };
10339
- const DeleteManyButton = (props) => {
10340
- const { resource } = useResource();
10341
- const kit = useUIKit();
10368
+ const download2 = useDownloadYAML();
10342
10369
  const { t: t2 } = useTranslation();
10343
- const { modalProps, visible, setVisible } = useDeleteManyModal(
10344
- (resource == null ? void 0 : resource.name) || "",
10345
- props.ids
10346
- );
10347
- const onClick = useCallback(() => {
10348
- setVisible(true);
10349
- }, [setVisible]);
10370
+ const openForm = useOpenForm({ id: record.id });
10371
+ const isInShowPage = useResourceResult.action === "show";
10372
+ const { data: canEditData } = useCan({
10373
+ resource: resource == null ? void 0 : resource.name,
10374
+ action: AccessControlAuth.Edit
10375
+ });
10376
+ const { data: canDeleteData } = useCan({
10377
+ resource: resource == null ? void 0 : resource.name,
10378
+ action: AccessControlAuth.Delete
10379
+ });
10350
10380
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10351
- /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t2("dovetail.delete") }),
10381
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10382
+ kit.dropdown,
10383
+ {
10384
+ overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
10385
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10386
+ kit.menuItem,
10387
+ {
10388
+ onClick: openForm,
10389
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10390
+ }
10391
+ ),
10392
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
10393
+ kit.menu.Item,
10394
+ {
10395
+ onClick: () => {
10396
+ var _a;
10397
+ if (record.id) {
10398
+ download2({
10399
+ name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
10400
+ item: omit$1((globalStore == null ? void 0 : globalStore.restoreItem(record)) || record, "id")
10401
+ });
10402
+ }
10403
+ },
10404
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10405
+ }
10406
+ ),
10407
+ props.children,
10408
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
10409
+ (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10410
+ kit.menuItem,
10411
+ {
10412
+ danger: true,
10413
+ onClick: () => {
10414
+ openDeleteConfirmModal(record.id);
10415
+ },
10416
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: TrashBinDelete16Icon, children: t2("dovetail.delete") })
10417
+ }
10418
+ ) : null
10419
+ ] }),
10420
+ trigger: ["click"],
10421
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10422
+ kit.button,
10423
+ {
10424
+ type: "quiet",
10425
+ size: size === "large" ? "middle" : "small",
10426
+ prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10427
+ Icon$1,
10428
+ {
10429
+ src: MoreEllipsis324BoldSecondaryIcon,
10430
+ hoverSrc: MoreEllipsis324BoldBlueIcon,
10431
+ iconWidth: 24,
10432
+ iconHeight: 24
10433
+ }
10434
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: MoreEllipsis316BoldBlueIcon })
10435
+ }
10436
+ )
10437
+ }
10438
+ ),
10352
10439
  visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10353
10440
  ] });
10354
- };
10355
- const TableToolBar_4s5vf2 = "";
10356
- const ToolbarWrapperStyle = "t1v3ienx";
10357
- const ToolbarStyle$1 = "tgejfwe";
10358
- const TitleStyle$2 = "tq6dc79";
10359
- const DescriptionStyle = "d1wqyhgc";
10360
- const TableToolBar = ({
10361
- description,
10362
- selectedKeys,
10363
- hideCreate
10364
- }) => {
10365
- var _a;
10366
- const kit = useUIKit();
10367
- const {
10368
- resource
10369
- } = useResource();
10370
- return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10371
- className: cx_default(ToolbarWrapperStyle, "table-toolbar"),
10372
- children: [/* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10373
- className: ToolbarStyle$1,
10374
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10375
- className: cx_default(Typo.Display.d2_regular_title, TitleStyle$2),
10376
- children: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind
10377
- }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10378
- children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
10379
- ids: selectedKeys
10380
- }) : void 0, /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
10381
- resource: resource == null ? void 0 : resource.name,
10382
- action: AccessControlAuth.Create,
10383
- children: !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null
10384
- })]
10385
- })]
10386
- }), description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10387
- className: DescriptionStyle,
10388
- children: description
10389
- }) : null]
10441
+ }
10442
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10443
+ function adopt(value2) {
10444
+ return value2 instanceof P ? value2 : new P(function(resolve) {
10445
+ resolve(value2);
10446
+ });
10447
+ }
10448
+ return new (P || (P = Promise))(function(resolve, reject) {
10449
+ function fulfilled(value2) {
10450
+ try {
10451
+ step(generator.next(value2));
10452
+ } catch (e2) {
10453
+ reject(e2);
10454
+ }
10455
+ }
10456
+ function rejected(value2) {
10457
+ try {
10458
+ step(generator["throw"](value2));
10459
+ } catch (e2) {
10460
+ reject(e2);
10461
+ }
10462
+ }
10463
+ function step(result) {
10464
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10465
+ }
10466
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10390
10467
  });
10391
10468
  };
10392
- const index_6qzjtx = "";
10393
- const WrapperStyle$5 = "w16agr8o";
10394
- function matchOwner(job, owner) {
10395
- var _a;
10396
- let match = false;
10397
- for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
10398
- if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
10399
- match = true;
10400
- }
10401
- }
10402
- return match;
10469
+ function useEventCallback(fn) {
10470
+ const ref = useRef(() => {
10471
+ throw new Error("Cannot call an event handler while rendering.");
10472
+ });
10473
+ useIsomorphicLayoutEffect(() => {
10474
+ ref.current = fn;
10475
+ }, [fn]);
10476
+ return useCallback((...args) => ref.current(...args), [ref]);
10403
10477
  }
10404
- const CronjobJobsTable = ({
10405
- owner,
10406
- hideToolBar
10407
- }) => {
10478
+ function useEventListener(eventName, handler, element, options) {
10479
+ const savedHandler = useRef(handler);
10480
+ useIsomorphicLayoutEffect(() => {
10481
+ savedHandler.current = handler;
10482
+ }, [handler]);
10483
+ useEffect(() => {
10484
+ var _a;
10485
+ const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
10486
+ if (!(targetElement && targetElement.addEventListener))
10487
+ return;
10488
+ const listener = (event2) => savedHandler.current(event2);
10489
+ targetElement.addEventListener(eventName, listener, options);
10490
+ return () => {
10491
+ targetElement.removeEventListener(eventName, listener, options);
10492
+ };
10493
+ }, [eventName, element, options]);
10494
+ }
10495
+ globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
10496
+ function adopt(value2) {
10497
+ return value2 instanceof P ? value2 : new P(function(resolve) {
10498
+ resolve(value2);
10499
+ });
10500
+ }
10501
+ return new (P || (P = Promise))(function(resolve, reject) {
10502
+ function fulfilled(value2) {
10503
+ try {
10504
+ step(generator.next(value2));
10505
+ } catch (e2) {
10506
+ reject(e2);
10507
+ }
10508
+ }
10509
+ function rejected(value2) {
10510
+ try {
10511
+ step(generator["throw"](value2));
10512
+ } catch (e2) {
10513
+ reject(e2);
10514
+ }
10515
+ }
10516
+ function step(result) {
10517
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
10518
+ }
10519
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
10520
+ });
10521
+ };
10522
+ const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
10523
+ function useLocalStorage(key2, initialValue) {
10524
+ const readValue = useCallback(() => {
10525
+ if (typeof window === "undefined") {
10526
+ return initialValue;
10527
+ }
10528
+ try {
10529
+ const item = window.localStorage.getItem(key2);
10530
+ return item ? parseJSON(item) : initialValue;
10531
+ } catch (error) {
10532
+ console.warn(`Error reading localStorage key “${key2}”:`, error);
10533
+ return initialValue;
10534
+ }
10535
+ }, [initialValue, key2]);
10536
+ const [storedValue, setStoredValue] = useState(readValue);
10537
+ const setValue = useEventCallback((value2) => {
10538
+ if (typeof window === "undefined") {
10539
+ console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
10540
+ }
10541
+ try {
10542
+ const newValue = value2 instanceof Function ? value2(storedValue) : value2;
10543
+ window.localStorage.setItem(key2, JSON.stringify(newValue));
10544
+ setStoredValue(newValue);
10545
+ window.dispatchEvent(new Event("local-storage"));
10546
+ } catch (error) {
10547
+ console.warn(`Error setting localStorage key “${key2}”:`, error);
10548
+ }
10549
+ });
10550
+ useEffect(() => {
10551
+ setStoredValue(readValue());
10552
+ }, []);
10553
+ const handleStorageChange = useCallback((event2) => {
10554
+ if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
10555
+ return;
10556
+ }
10557
+ setStoredValue(readValue());
10558
+ }, [key2, readValue]);
10559
+ useEventListener("storage", handleStorageChange);
10560
+ useEventListener("local-storage", handleStorageChange);
10561
+ return [storedValue, setValue];
10562
+ }
10563
+ function parseJSON(value2) {
10564
+ try {
10565
+ return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
10566
+ } catch (_a) {
10567
+ console.log("parsing error on", { value: value2 });
10568
+ return void 0;
10569
+ }
10570
+ }
10571
+ const GlobalStoreContext = createContext({});
10572
+ const index_1uuzt53 = "";
10573
+ const SelectStyle = "sj0ggy";
10574
+ const DropdownStyle = "d1eo8uqs";
10575
+ const SearchInputStyle = "s64gojc";
10576
+ const SelectContentStyle = "s16fqgtu";
10577
+ const TokenStyle = "tgaujbg";
10578
+ const CountTokenStyle = "c1vbd54v";
10579
+ const SelectOptionGroupStyle = "sxzmtrx";
10580
+ const LabelWrapperStyle = "lqrghwd";
10581
+ const AllNamespaceOptionStyle = "api7z1z";
10582
+ const OptionStyle = "o38b23x";
10583
+ const NS_STORE_KEY = "namespace-filter";
10584
+ const ALL_NS = "_all";
10585
+ const useNamespacesFilter = () => {
10586
+ const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10408
10587
  const {
10409
- i18n: i18n2
10410
- } = useTranslation();
10588
+ resource
10589
+ } = useResource();
10590
+ const configs = useContext(ConfigsContext);
10591
+ if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
10592
+ return {
10593
+ value: []
10594
+ };
10595
+ }
10596
+ return {
10597
+ value: value2
10598
+ };
10599
+ };
10600
+ const NamespacesFilter = ({
10601
+ className
10602
+ }) => {
10411
10603
  const kit = useUIKit();
10412
- const [selectedKeys] = useState([]);
10413
- const [currentPage, setCurrentPage] = useState(1);
10414
- const component = useContext(ComponentContext);
10415
- const Table$1 = component.Table || Table;
10416
- const currentSize = 10;
10604
+ const {
10605
+ t: t2
10606
+ } = useTranslation();
10607
+ const [search, setSearch] = useState("");
10417
10608
  const {
10418
10609
  data: data2,
10419
10610
  isLoading
10420
10611
  } = useList({
10421
- resource: "jobs",
10612
+ resource: "namespaces",
10422
10613
  meta: {
10423
- resourceBasePath: "/apis/batch/v1",
10424
- kind: "Job"
10614
+ resourceBasePath: "/api/v1",
10615
+ kind: "Namespace"
10425
10616
  },
10426
10617
  pagination: {
10427
10618
  mode: "off"
10428
10619
  }
10429
10620
  });
10430
- const dataSource = useMemo(() => {
10431
- return data2 == null ? void 0 : data2.data.filter((p) => {
10432
- return owner ? matchOwner(p, owner) : true;
10433
- });
10434
- }, [data2 == null ? void 0 : data2.data, owner]);
10435
- const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
10436
- ...WorkloadImageColumnRenderer(i18n2),
10437
- width: 238
10438
- }, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
10439
- if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
10440
- return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
10441
- errorText: i18n2.t("dovetail.no_resource", {
10442
- kind: " Job"
10443
- }),
10444
- type: ErrorContentType.Card
10445
- });
10446
- }
10447
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10448
- direction: "vertical",
10449
- className: WrapperStyle$5,
10450
- children: [hideToolBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
10451
- selectedKeys,
10452
- hideCreate: true
10453
- }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
10454
- tableKey: "cronjobs",
10455
- loading: isLoading,
10456
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
10457
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
10458
- columns,
10459
- rowKey: "id",
10460
- error: false,
10461
- currentPage,
10462
- onPageChange: (p) => setCurrentPage(p),
10463
- defaultSize: currentSize,
10464
- refetch: () => null,
10465
- showMenuColumn: false
10621
+ const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
10622
+ const debouncedSetSearch = debounce(setSearch, 100);
10623
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
10624
+ loading: isLoading,
10625
+ style: {
10626
+ width: 278
10627
+ },
10628
+ className: cx_default(SelectStyle, className),
10629
+ dropdownClassName: DropdownStyle,
10630
+ searchValue: search,
10631
+ virtual: false,
10632
+ input: {
10633
+ value: value2,
10634
+ onChange(value22) {
10635
+ if (last(value22) === ALL_NS || value22.length === 0) {
10636
+ setValue([ALL_NS]);
10637
+ } else {
10638
+ setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
10639
+ }
10640
+ }
10641
+ },
10642
+ dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10643
+ className: SelectContentStyle,
10644
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
10645
+ style: {
10646
+ width: "100%"
10647
+ },
10648
+ className: SearchInputStyle,
10649
+ onChange: debouncedSetSearch,
10650
+ placeholder: t2("dovetail.please_input")
10651
+ }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
10652
+ }),
10653
+ tagRender: ({
10654
+ label: label2,
10655
+ value: value22,
10656
+ closable,
10657
+ onClose
10658
+ }) => {
10659
+ const isCountToken = label2 !== value22 && typeof label2 === "string";
10660
+ const isAll = value22 === ALL_NS;
10661
+ return isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10662
+ style: {
10663
+ marginLeft: 8
10664
+ },
10665
+ children: label2
10666
+ }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
10667
+ className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
10668
+ closable,
10669
+ size: "medium",
10670
+ onClose,
10671
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10672
+ content: isCountToken ? label2.replace(/[\s\.]/g, "") : label2
10673
+ })
10674
+ });
10675
+ },
10676
+ maxTagCount: 1,
10677
+ optionLabelProp: "label",
10678
+ showArrow: true,
10679
+ showSearch: false,
10680
+ multiple: true,
10681
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10682
+ value: "_all",
10683
+ label: t2("dovetail.all_namespaces"),
10684
+ className: AllNamespaceOptionStyle,
10685
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10686
+ content: t2("dovetail.all_namespaces"),
10687
+ className: LabelWrapperStyle
10688
+ })
10689
+ }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
10690
+ label: "",
10691
+ className: SelectOptionGroupStyle,
10692
+ children: data2 == null ? void 0 : data2.data.map((namespace2) => {
10693
+ const {
10694
+ name: name2
10695
+ } = namespace2.metadata;
10696
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
10697
+ value: name2,
10698
+ label: name2,
10699
+ className: OptionStyle,
10700
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
10701
+ content: name2,
10702
+ className: LabelWrapperStyle
10703
+ })
10704
+ }, name2);
10705
+ })
10466
10706
  })]
10467
10707
  });
10468
10708
  };
10469
- const EventsTable = ({}) => {
10470
- const { i18n: i18n2 } = useTranslation();
10471
- const [currentPage, setCurrentPage] = useState(1);
10472
- const currentSize = 10;
10473
- const { data: data2, isLoading } = useList({
10474
- resource: "events",
10475
- meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
10476
- pagination: {
10477
- mode: "off"
10478
- }
10479
- });
10480
- const parsed = useParsed();
10481
- const columns = useMemo(
10482
- () => [
10483
- {
10484
- key: "type",
10485
- display: true,
10486
- dataIndex: ["type"],
10487
- title: i18n2.t("dovetail.type"),
10488
- sortable: true,
10489
- width: 120,
10490
- render(value2) {
10491
- const colorMap = {
10492
- "Warning": "red",
10493
- "Normal": "green"
10494
- };
10495
- return /* @__PURE__ */ jsxRuntimeExports.jsx(StatusCapsule, { color: colorMap[value2], className: cx_default(StateTagStyle, "no-background"), children: i18n2.t(`dovetail.${value2.toLowerCase()}`) });
10496
- },
10497
- sorter: CommonSorter(["type"])
10498
- },
10499
- {
10500
- key: "reason",
10501
- display: true,
10502
- dataIndex: ["reason"],
10503
- title: i18n2.t("dovetail.reason"),
10504
- sortable: true,
10505
- width: 120,
10506
- sorter: CommonSorter(["reason"])
10709
+ var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
10710
+ ColumnKeys2["age"] = "age";
10711
+ ColumnKeys2["name"] = "name";
10712
+ ColumnKeys2["namespace"] = "namespace";
10713
+ ColumnKeys2["phase"] = "phase";
10714
+ ColumnKeys2["replicas"] = "replicas";
10715
+ ColumnKeys2["deploymentImage"] = "deploymentImage";
10716
+ ColumnKeys2["podImage"] = "podImage";
10717
+ return ColumnKeys2;
10718
+ })(ColumnKeys || {});
10719
+ function addDefaultRenderToColumns(columns) {
10720
+ return columns.map((col) => ({
10721
+ render(value2) {
10722
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10723
+ ValueDisplay,
10724
+ {
10725
+ value: value2
10726
+ }
10727
+ );
10728
+ },
10729
+ ...col
10730
+ }));
10731
+ }
10732
+ const useEagleTable = (params) => {
10733
+ var _a, _b;
10734
+ const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
10735
+ const [selectedKeys, setSelectedKeys] = useState([]);
10736
+ const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
10737
+ const { resource } = useResource();
10738
+ const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
10739
+ const { value: nsFilters = [] } = useNamespacesFilter();
10740
+ const useTableParams = useMemo(() => {
10741
+ const mergedParams = merge(params.useTableParams, {
10742
+ pagination: {
10743
+ pageSize: currentSize,
10744
+ mode: "server"
10507
10745
  },
10508
- {
10509
- key: "note",
10510
- display: true,
10746
+ filters: {
10747
+ permanent: [
10748
+ {
10749
+ operator: "or",
10750
+ value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
10751
+ field: "metadata.namespace",
10752
+ operator: "eq",
10753
+ value: filter
10754
+ }))
10755
+ }
10756
+ ]
10757
+ }
10758
+ });
10759
+ return mergedParams;
10760
+ }, [params.useTableParams, nsFilters, currentSize]);
10761
+ const finalColumns = useMemo(
10762
+ () => addDefaultRenderToColumns(columns),
10763
+ [columns]
10764
+ );
10765
+ const table = useTable(useTableParams);
10766
+ const onPageChange = useCallback(
10767
+ (page) => {
10768
+ var _a2;
10769
+ setCurrentPage(page);
10770
+ (_a2 = table.setCurrent) == null ? void 0 : _a2.call(table, page || 1);
10771
+ },
10772
+ [setCurrentPage, table]
10773
+ );
10774
+ const onSorterChange = useCallback((order, key2) => {
10775
+ var _a2;
10776
+ const ORDER_MAP = {
10777
+ descend: "desc",
10778
+ ascend: "asc"
10779
+ };
10780
+ const sorters = [{
10781
+ field: (_a2 = columns.find((col) => col.key === key2)) == null ? void 0 : _a2.dataIndex,
10782
+ order: order ? ORDER_MAP[order] : order
10783
+ }];
10784
+ table.setSorters(sorters);
10785
+ }, [table, columns]);
10786
+ const data2 = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data;
10787
+ const total = ((_b = table.tableQueryResult.data) == null ? void 0 : _b.total) || 0;
10788
+ const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
10789
+ const finalProps = {
10790
+ tableKey: (resource == null ? void 0 : resource.name) || "table",
10791
+ loading: table.tableQueryResult.isLoading,
10792
+ data: finalDataSource || [],
10793
+ columns: finalColumns,
10794
+ error: false,
10795
+ rowKey: "id",
10796
+ currentPage,
10797
+ defaultSize: currentSize,
10798
+ onPageChange,
10799
+ onSorterChange,
10800
+ onSelect: (keys) => {
10801
+ setSelectedKeys(keys);
10802
+ },
10803
+ total,
10804
+ RowMenu: Dropdown
10805
+ };
10806
+ return { tableProps: finalProps, selectedKeys, ...table };
10807
+ };
10808
+ function CreateButton() {
10809
+ var _a;
10810
+ const kit = useUIKit();
10811
+ const { t: t2 } = useTranslation();
10812
+ const openForm = useOpenForm();
10813
+ const { resource } = useResource();
10814
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
10815
+ kit.button,
10816
+ {
10817
+ prefixIcon: /* @__PURE__ */ jsxRuntimeExports.jsx(PlusAddCreateNew16BoldOntintIcon, {}),
10818
+ type: "primary",
10819
+ onClick: openForm,
10820
+ children: t2("dovetail.create_resource", { resource: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind })
10821
+ }
10822
+ );
10823
+ }
10824
+ const useDeleteManyModal = (resource, ids) => {
10825
+ const { mutate } = useDeleteMany();
10826
+ const [visible, setVisible] = useState(false);
10827
+ const { t: t2 } = useTranslation();
10828
+ const modalProps = {
10829
+ title: t2("dovetail.delete"),
10830
+ okText: t2("dovetail.delete"),
10831
+ okButtonProps: {
10832
+ danger: true
10833
+ },
10834
+ cancelText: t2("dovetail.cancel"),
10835
+ children: t2("dovetail.confirm_delete_text", {
10836
+ target: ids,
10837
+ interpolation: { escapeValue: false }
10838
+ }),
10839
+ onOk() {
10840
+ mutate({
10841
+ resource,
10842
+ ids
10843
+ });
10844
+ setVisible(false);
10845
+ },
10846
+ onCancel() {
10847
+ setVisible(false);
10848
+ }
10849
+ };
10850
+ return { modalProps, visible, setVisible };
10851
+ };
10852
+ const DeleteManyButton = (props) => {
10853
+ const { resource } = useResource();
10854
+ const kit = useUIKit();
10855
+ const { t: t2 } = useTranslation();
10856
+ const { modalProps, visible, setVisible } = useDeleteManyModal(
10857
+ (resource == null ? void 0 : resource.name) || "",
10858
+ props.ids
10859
+ );
10860
+ const onClick = useCallback(() => {
10861
+ setVisible(true);
10862
+ }, [setVisible]);
10863
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10864
+ /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, { type: "primary", danger: true, onClick, children: t2("dovetail.delete") }),
10865
+ visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10866
+ ] });
10867
+ };
10868
+ const TableToolBar_4s5vf2 = "";
10869
+ const ToolbarWrapperStyle = "t1v3ienx";
10870
+ const ToolbarStyle$1 = "tgejfwe";
10871
+ const TitleStyle$2 = "tq6dc79";
10872
+ const DescriptionStyle = "d1wqyhgc";
10873
+ const TableToolBar = ({
10874
+ description,
10875
+ selectedKeys,
10876
+ hideCreate
10877
+ }) => {
10878
+ var _a;
10879
+ const kit = useUIKit();
10880
+ const {
10881
+ resource
10882
+ } = useResource();
10883
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
10884
+ className: cx_default(ToolbarWrapperStyle, "table-toolbar"),
10885
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10886
+ className: ToolbarStyle$1,
10887
+ children: [/* @__PURE__ */ jsxRuntimeExports.jsx("span", {
10888
+ className: cx_default(Typo.Display.d2_regular_title, TitleStyle$2),
10889
+ children: (_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind
10890
+ }), /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10891
+ children: [selectedKeys.length > 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(DeleteManyButton, {
10892
+ ids: selectedKeys
10893
+ }) : void 0, /* @__PURE__ */ jsxRuntimeExports.jsx(CanAccess, {
10894
+ resource: resource == null ? void 0 : resource.name,
10895
+ action: AccessControlAuth.Create,
10896
+ children: !hideCreate ? /* @__PURE__ */ jsxRuntimeExports.jsx(CreateButton, {}) : null
10897
+ })]
10898
+ })]
10899
+ }), description ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
10900
+ className: DescriptionStyle,
10901
+ children: description
10902
+ }) : null]
10903
+ });
10904
+ };
10905
+ const index_6qzjtx = "";
10906
+ const WrapperStyle$5 = "w16agr8o";
10907
+ function matchOwner(job, owner) {
10908
+ var _a;
10909
+ let match = false;
10910
+ for (const o of ((_a = job.metadata) == null ? void 0 : _a.ownerReferences) || []) {
10911
+ if (o.apiVersion === owner.apiVersion && o.kind === owner.kind && o.name === owner.name && job.namespace === owner.namespace) {
10912
+ match = true;
10913
+ }
10914
+ }
10915
+ return match;
10916
+ }
10917
+ const CronjobJobsTable = ({
10918
+ owner,
10919
+ hideToolBar
10920
+ }) => {
10921
+ const {
10922
+ i18n: i18n2
10923
+ } = useTranslation();
10924
+ const kit = useUIKit();
10925
+ const [selectedKeys] = useState([]);
10926
+ const component = useContext(ComponentContext);
10927
+ const Table$1 = component.Table || Table;
10928
+ const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
10929
+ ...WorkloadImageColumnRenderer(i18n2),
10930
+ width: 238
10931
+ }, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
10932
+ const {
10933
+ tableProps
10934
+ } = useEagleTable({
10935
+ columns,
10936
+ useTableParams: {
10937
+ resource: "jobs",
10938
+ meta: {
10939
+ resourceBasePath: "/apis/batch/v1",
10940
+ kind: "Job"
10941
+ }
10942
+ }
10943
+ });
10944
+ const dataSource = useMemo(() => {
10945
+ return tableProps.data.filter((p) => {
10946
+ return owner ? matchOwner(p, owner) : true;
10947
+ });
10948
+ }, [tableProps.data, owner]);
10949
+ if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10950
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
10951
+ errorText: i18n2.t("dovetail.no_resource", {
10952
+ kind: " Job"
10953
+ }),
10954
+ type: ErrorContentType.Card
10955
+ });
10956
+ }
10957
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.space, {
10958
+ direction: "vertical",
10959
+ className: WrapperStyle$5,
10960
+ children: [hideToolBar ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(TableToolBar, {
10961
+ selectedKeys,
10962
+ hideCreate: true
10963
+ }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
10964
+ ...tableProps,
10965
+ tableKey: "cronjobs",
10966
+ showMenuColumn: false
10967
+ })]
10968
+ });
10969
+ };
10970
+ const EventsTable = ({}) => {
10971
+ const { i18n: i18n2 } = useTranslation();
10972
+ const parsed = useParsed();
10973
+ const columns = useMemo(
10974
+ () => [
10975
+ {
10976
+ key: "type",
10977
+ display: true,
10978
+ dataIndex: ["type"],
10979
+ title: i18n2.t("dovetail.type"),
10980
+ sortable: true,
10981
+ width: 120,
10982
+ render(value2) {
10983
+ const colorMap = {
10984
+ "Warning": "red",
10985
+ "Normal": "green"
10986
+ };
10987
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StatusCapsule, { color: colorMap[value2], className: cx_default(StateTagStyle, "no-background"), children: i18n2.t(`dovetail.${value2.toLowerCase()}`) });
10988
+ },
10989
+ sorter: CommonSorter(["type"])
10990
+ },
10991
+ {
10992
+ key: "reason",
10993
+ display: true,
10994
+ dataIndex: ["reason"],
10995
+ title: i18n2.t("dovetail.reason"),
10996
+ sortable: true,
10997
+ width: 120,
10998
+ sorter: CommonSorter(["reason"])
10999
+ },
11000
+ {
11001
+ key: "note",
11002
+ display: true,
10511
11003
  dataIndex: ["note"],
10512
11004
  title: i18n2.t("dovetail.note"),
10513
11005
  sortable: true,
@@ -10518,15 +11010,22 @@ const EventsTable = ({}) => {
10518
11010
  ],
10519
11011
  [i18n2]
10520
11012
  );
11013
+ const { tableProps } = useEagleTable({
11014
+ columns,
11015
+ useTableParams: {
11016
+ resource: "events",
11017
+ meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" }
11018
+ }
11019
+ });
10521
11020
  const component = useContext(ComponentContext);
10522
- const Table$1 = component.Table || Table;
10523
11021
  const dataSource = useMemo(() => {
10524
- return data2 == null ? void 0 : data2.data.filter((d) => {
11022
+ return tableProps.data.filter((d) => {
10525
11023
  const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
10526
11024
  return objectId === parsed.id;
10527
11025
  });
10528
- }, [data2 == null ? void 0 : data2.data, parsed]);
10529
- if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
11026
+ }, [tableProps.data, parsed]);
11027
+ const Table$1 = component.Table || Table;
11028
+ if (!(dataSource == null ? void 0 : dataSource.length) && !tableProps.loading) {
10530
11029
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10531
11030
  WidgetErrorContent,
10532
11031
  {
@@ -10537,17 +11036,8 @@ const EventsTable = ({}) => {
10537
11036
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10538
11037
  Table$1,
10539
11038
  {
11039
+ ...tableProps,
10540
11040
  tableKey: "events",
10541
- loading: isLoading,
10542
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
10543
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
10544
- columns: addDefaultRenderToColumns(columns),
10545
- rowKey: "id",
10546
- error: false,
10547
- currentPage,
10548
- onPageChange: (p) => setCurrentPage(p),
10549
- defaultSize: currentSize,
10550
- refetch: () => null,
10551
11041
  showMenuColumn: false
10552
11042
  }
10553
11043
  );
@@ -10591,7 +11081,6 @@ const IngressRulesTable = ({ ingress }) => {
10591
11081
  }, [ingress.flattenedRules]);
10592
11082
  const component = useContext(ComponentContext);
10593
11083
  const Table$1 = component.Table || Table;
10594
- const [currentPage, setCurrentPage] = useState(1);
10595
11084
  const currentSize = 10;
10596
11085
  const columns = [
10597
11086
  {
@@ -10657,6 +11146,15 @@ const IngressRulesTable = ({ ingress }) => {
10657
11146
  sortable: true
10658
11147
  }
10659
11148
  ];
11149
+ const {
11150
+ data: finalData,
11151
+ currentPage,
11152
+ onPageChange,
11153
+ onSorterChange
11154
+ } = useTableData({
11155
+ columns,
11156
+ data: rows
11157
+ });
10660
11158
  if ((rows == null ? void 0 : rows.length) === 0) {
10661
11159
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
10662
11160
  WidgetErrorContent,
@@ -10672,19 +11170,20 @@ const IngressRulesTable = ({ ingress }) => {
10672
11170
  {
10673
11171
  tableKey: "ingressRules",
10674
11172
  loading: false,
10675
- data: rows.slice((currentPage - 1) * currentSize, currentPage * currentSize),
11173
+ data: finalData,
10676
11174
  total: rows.length,
10677
11175
  columns: addDefaultRenderToColumns(columns),
10678
11176
  rowKey: "pathType",
10679
11177
  empty: t2("dovetail.empty"),
10680
11178
  defaultSize: currentSize,
10681
11179
  currentPage,
10682
- onPageChange: setCurrentPage,
11180
+ onPageChange,
11181
+ onSorterChange,
10683
11182
  showMenuColumn: false
10684
11183
  }
10685
11184
  );
10686
11185
  };
10687
- const KeyValue_q4vd5r = "";
11186
+ const KeyValue_1v1utgj = "";
10688
11187
  const ContentBlockStyle = "c8jy7dc";
10689
11188
  const KeyStyle = "k2sddxl";
10690
11189
  const ValueStyle$2 = "v16vicsr";
@@ -10758,109 +11257,6 @@ function KeyValueAnnotation(props) {
10758
11257
  }) : null]
10759
11258
  });
10760
11259
  }
10761
- function download(filename, content) {
10762
- const element = document.createElement("a");
10763
- element.setAttribute(
10764
- "href",
10765
- "data:text/plain;charset=utf-8," + encodeURIComponent(content)
10766
- );
10767
- element.setAttribute("download", filename);
10768
- element.style.display = "none";
10769
- document.body.appendChild(element);
10770
- element.click();
10771
- document.body.removeChild(element);
10772
- }
10773
- function useDownloadYAML() {
10774
- return function(options) {
10775
- const { name: name2, item } = options;
10776
- console.log("download", item);
10777
- const content = yaml.dump(item);
10778
- download(`${name2}.yaml`, content);
10779
- };
10780
- }
10781
- function K8sDropdown(props) {
10782
- const { record, size = "normal" } = props;
10783
- const kit = useUIKit();
10784
- const { globalStore } = useGlobalStore();
10785
- const useResourceResult = useResource();
10786
- const resource = useResourceResult.resource;
10787
- const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
10788
- (resource == null ? void 0 : resource.name) || ""
10789
- );
10790
- const download2 = useDownloadYAML();
10791
- const { t: t2 } = useTranslation();
10792
- const openForm = useOpenForm({ id: record.id });
10793
- const isInShowPage = useResourceResult.action === "show";
10794
- const { data: canEditData } = useCan({
10795
- resource: resource == null ? void 0 : resource.name,
10796
- action: AccessControlAuth.Edit
10797
- });
10798
- const { data: canDeleteData } = useCan({
10799
- resource: resource == null ? void 0 : resource.name,
10800
- action: AccessControlAuth.Delete
10801
- });
10802
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
10803
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10804
- kit.dropdown,
10805
- {
10806
- overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
10807
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
10808
- kit.menuItem,
10809
- {
10810
- onClick: openForm,
10811
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
10812
- }
10813
- ),
10814
- /* @__PURE__ */ jsxRuntimeExports.jsx(
10815
- kit.menu.Item,
10816
- {
10817
- onClick: () => {
10818
- var _a;
10819
- if (record.id) {
10820
- download2({
10821
- name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
10822
- item: (globalStore == null ? void 0 : globalStore.restoreItem(record)) || record
10823
- });
10824
- }
10825
- },
10826
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
10827
- }
10828
- ),
10829
- props.children,
10830
- (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
10831
- (canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10832
- kit.menuItem,
10833
- {
10834
- danger: true,
10835
- onClick: () => {
10836
- openDeleteConfirmModal(record.id);
10837
- },
10838
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: TrashBinDelete16Icon, children: t2("dovetail.delete") })
10839
- }
10840
- ) : null
10841
- ] }),
10842
- trigger: ["click"],
10843
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(
10844
- kit.button,
10845
- {
10846
- type: "quiet",
10847
- size: size === "large" ? "middle" : "small",
10848
- prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
10849
- Icon$1,
10850
- {
10851
- src: MoreEllipsis324BoldSecondaryIcon,
10852
- hoverSrc: MoreEllipsis324BoldBlueIcon,
10853
- iconWidth: 24,
10854
- iconHeight: 24
10855
- }
10856
- ) : /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: MoreEllipsis316BoldBlueIcon })
10857
- }
10858
- )
10859
- }
10860
- ),
10861
- visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
10862
- ] });
10863
- }
10864
11260
  function Tabs(props) {
10865
11261
  const { tabs, className } = props;
10866
11262
  const kit = useUIKit();
@@ -10904,7 +11300,8 @@ const ShowContent = (props) => {
10904
11300
  const {
10905
11301
  showConfig,
10906
11302
  formatter,
10907
- Dropdown = K8sDropdown
11303
+ Dropdown = K8sDropdown,
11304
+ data: data2
10908
11305
  } = props;
10909
11306
  const kit = useUIKit();
10910
11307
  const parsed = useParsed();
@@ -10912,17 +11309,9 @@ const ShowContent = (props) => {
10912
11309
  resource
10913
11310
  } = useResource();
10914
11311
  const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
10915
- const {
10916
- queryResult
10917
- } = useShow({
10918
- id
10919
- });
10920
11312
  const {
10921
11313
  t: t2
10922
11314
  } = useTranslation();
10923
- const {
10924
- data: data2
10925
- } = queryResult;
10926
11315
  const navigation = useNavigation();
10927
11316
  const go = useGo();
10928
11317
  const openForm = useOpenForm({
@@ -11113,27 +11502,9 @@ const WorkloadPodsTable = ({
11113
11502
  } = useTranslation();
11114
11503
  const kit = useUIKit();
11115
11504
  const [selectedKeys, setSelectedKeys] = useState([]);
11116
- const [currentPage, setCurrentPage] = useState(1);
11117
11505
  const component = useContext(ComponentContext);
11118
11506
  const Table$1 = component.Table || Table;
11119
11507
  const currentSize = 10;
11120
- const {
11121
- data: data2
11122
- } = useList({
11123
- resource: "pods",
11124
- meta: {
11125
- resourceBasePath: "/api/v1",
11126
- kind: "Pod"
11127
- },
11128
- pagination: {
11129
- mode: "off"
11130
- }
11131
- });
11132
- const dataSource = useMemo(() => {
11133
- return data2 == null ? void 0 : data2.data.filter((p) => {
11134
- return selector ? matchSelector(p, selector) : true;
11135
- });
11136
- }, [data2 == null ? void 0 : data2.data, selector]);
11137
11508
  const columns = [NameColumnRenderer(i18n2, "pods"), StateDisplayColumnRenderer(i18n2), {
11138
11509
  key: "ip",
11139
11510
  display: true,
@@ -11142,6 +11513,23 @@ const WorkloadPodsTable = ({
11142
11513
  sortable: true,
11143
11514
  width: 160
11144
11515
  }, NodeNameColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), PodContainersNumColumnRenderer(i18n2), RestartCountColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
11516
+ const {
11517
+ tableProps
11518
+ } = useEagleTable({
11519
+ columns,
11520
+ useTableParams: {
11521
+ resource: "pods",
11522
+ meta: {
11523
+ resourceBasePath: "/api/v1",
11524
+ kind: "Pod"
11525
+ }
11526
+ }
11527
+ });
11528
+ const dataSource = useMemo(() => {
11529
+ return tableProps.data.filter((p) => {
11530
+ return selector ? matchSelector(p, selector) : true;
11531
+ });
11532
+ }, [tableProps.data, selector]);
11145
11533
  if ((dataSource == null ? void 0 : dataSource.length) === 0) {
11146
11534
  return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
11147
11535
  errorText: i18n2.t("dovetail.no_resource", {
@@ -11160,18 +11548,10 @@ const WorkloadPodsTable = ({
11160
11548
  selectedKeys,
11161
11549
  hideCreate: true
11162
11550
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
11551
+ ...tableProps,
11163
11552
  tableKey: "pods",
11164
- loading: !dataSource,
11165
- data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
11166
- total: (dataSource == null ? void 0 : dataSource.length) || 0,
11167
- columns: addDefaultRenderToColumns(columns),
11168
11553
  onSelect: (keys) => setSelectedKeys(keys),
11169
- rowKey: "id",
11170
- error: false,
11171
- currentPage,
11172
- onPageChange: (p) => setCurrentPage(p),
11173
11554
  defaultSize: currentSize,
11174
- refetch: () => null,
11175
11555
  showMenuColumn: false
11176
11556
  })]
11177
11557
  });
@@ -17363,7 +17743,7 @@ const PodLog = ({
17363
17743
  const kit = useUIKit();
17364
17744
  const [selectedContainer, setSelectedContainer] = useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
17365
17745
  const [logs, setLogs] = useState([]);
17366
- const [logType, setLogType] = useState();
17746
+ const [logType, setLogType] = useState("realtime");
17367
17747
  const [currentItemCount, setCurrentItemCount] = useState(0);
17368
17748
  const [paused, setPaused] = useState(false);
17369
17749
  const [wrap2, setWrap] = useState(false);
@@ -17400,30 +17780,20 @@ const PodLog = ({
17400
17780
  }
17401
17781
  }
17402
17782
  };
17403
- const fetchLogs = useCallback(() => {
17404
- var _a2, _b2;
17405
- if (!selectedContainer) {
17406
- return;
17407
- }
17783
+ const fetchLogsByUrl = useCallback(async (url) => {
17408
17784
  abortControllerRef.current = new AbortController();
17409
17785
  const {
17410
17786
  signal
17411
17787
  } = abortControllerRef.current;
17412
- 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`;
17413
- if (logType === "realtime") {
17414
- url += "&follow=true";
17415
- } else if (logType === "previous") {
17416
- url += "&previous=true";
17417
- }
17418
17788
  fetch(url, {
17419
17789
  signal
17420
- }).then((response) => {
17421
- var _a3;
17790
+ }).then(async (response) => {
17791
+ var _a2;
17422
17792
  if (response.status !== 200) {
17423
17793
  setLogs([]);
17424
17794
  return;
17425
17795
  }
17426
- const reader = (_a3 = response.body) == null ? void 0 : _a3.getReader();
17796
+ const reader = (_a2 = response.body) == null ? void 0 : _a2.getReader();
17427
17797
  if (!reader) {
17428
17798
  return;
17429
17799
  }
@@ -17456,7 +17826,19 @@ const PodLog = ({
17456
17826
  };
17457
17827
  reader.read().then(processChunk);
17458
17828
  });
17459
- }, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl]);
17829
+ }, []);
17830
+ const fetchLogs = useCallback(async () => {
17831
+ var _a2, _b2;
17832
+ if (!selectedContainer) {
17833
+ return;
17834
+ }
17835
+ 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`;
17836
+ if (logType === "realtime") {
17837
+ fetchLogsByUrl(`${url}&follow=true`);
17838
+ } else if (logType === "previous") {
17839
+ fetchLogsByUrl(`${url}&previous=true`);
17840
+ }
17841
+ }, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl, fetchLogsByUrl]);
17460
17842
  const stopFetchingLogs = useCallback(() => {
17461
17843
  if (abortControllerRef.current) {
17462
17844
  abortControllerRef.current.abort();
@@ -17778,7 +18160,6 @@ const PodContainersTable = ({
17778
18160
  const { i18n: i18n2 } = useTranslation();
17779
18161
  const component = useContext(ComponentContext);
17780
18162
  const Table$1 = component.Table || Table;
17781
- const [currentPage, setCurrentPage] = useState(1);
17782
18163
  const currentSize = 10;
17783
18164
  const columns = useMemo(
17784
18165
  () => [
@@ -17835,10 +18216,11 @@ const PodContainersTable = ({
17835
18216
  sortable: true,
17836
18217
  sorter: CommonSorter(["state", "running", "startedAt"]),
17837
18218
  width: 120,
17838
- render: (value2) => {
18219
+ render: (_, record) => {
18220
+ const value2 = get$3(record, ["state", "running", "startedAt"]) || get$3(record, ["state", "terminated", "startedAt"]);
17839
18221
  if (value2)
17840
18222
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
17841
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "-" });
18223
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
17842
18224
  }
17843
18225
  }
17844
18226
  ],
@@ -17848,6 +18230,15 @@ const PodContainersTable = ({
17848
18230
  () => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
17849
18231
  [containerStatuses, initContainerStatuses]
17850
18232
  );
18233
+ const {
18234
+ data: finalData,
18235
+ currentPage,
18236
+ onPageChange,
18237
+ onSorterChange
18238
+ } = useTableData({
18239
+ data: dataSource,
18240
+ columns
18241
+ });
17851
18242
  if (dataSource.length === 0) {
17852
18243
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
17853
18244
  WidgetErrorContent,
@@ -17863,14 +18254,15 @@ const PodContainersTable = ({
17863
18254
  {
17864
18255
  tableKey: "podContainers",
17865
18256
  loading: false,
17866
- data: dataSource.slice((currentPage - 1) * currentSize, currentPage * currentSize),
18257
+ data: finalData,
17867
18258
  total: dataSource.length,
17868
18259
  columns: addDefaultRenderToColumns(columns),
17869
18260
  rowKey: "containerID",
17870
18261
  error: false,
17871
18262
  defaultSize: currentSize,
17872
18263
  currentPage,
17873
- onPageChange: setCurrentPage,
18264
+ onPageChange,
18265
+ onSorterChange,
17874
18266
  showMenuColumn: false
17875
18267
  }
17876
18268
  );
@@ -18039,11 +18431,11 @@ const PageShow = (props) => {
18039
18431
  retry: 1
18040
18432
  },
18041
18433
  errorNotification: () => {
18042
- var _a2;
18434
+ var _a2, _b;
18043
18435
  return {
18044
18436
  message: i18n2.t("dovetail.fail_get_detail", {
18045
- resource: resource == null ? void 0 : resource.name,
18046
- name: (_a2 = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a2.id,
18437
+ resource: (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind,
18438
+ name: (_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id,
18047
18439
  interpolation: { escapeValue: false }
18048
18440
  }),
18049
18441
  description: "Error",
@@ -18051,13 +18443,13 @@ const PageShow = (props) => {
18051
18443
  };
18052
18444
  }
18053
18445
  });
18054
- const { isLoading, isError } = queryResult;
18446
+ const { isLoading, isError, data: data2 } = queryResult;
18055
18447
  useEffect(() => {
18056
18448
  if (isError && resource) {
18057
18449
  nav.list(resource);
18058
18450
  }
18059
18451
  }, [isError, nav, resource]);
18060
- return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
18452
+ return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 });
18061
18453
  };
18062
18454
  const index_17v8shn = "";
18063
18455
  const WrapperStyle$1 = "w1akirqw";
@@ -18081,431 +18473,110 @@ function FormLayout(props) {
18081
18473
  className: cx_default(Typo.Display.d2_bold_title, TitleStyle),
18082
18474
  children: [(_a = resource == null ? void 0 : resource.meta) == null ? void 0 : _a.kind, ":", " ", action === "create" ? t2("dovetail.create") : t2("dovetail.edit")]
18083
18475
  }), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {}), props.children, /* @__PURE__ */ jsxRuntimeExports.jsx(kit.form.Item, {
18084
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
18085
- type: "primary",
18086
- ...saveButtonProps,
18087
- children: t2("dovetail.save")
18088
- })
18089
- })]
18090
- });
18091
- }
18092
- function WorkloadDropdown(props) {
18093
- const { record, size, children } = props;
18094
- const kit = useUIKit();
18095
- const { resource } = useResource();
18096
- const { mutateAsync } = useUpdate();
18097
- const { t: t2 } = useTranslation();
18098
- const { data: canEditData } = useCan({
18099
- resource: resource == null ? void 0 : resource.name,
18100
- action: AccessControlAuth.Edit
18101
- });
18102
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(K8sDropdown, { record, size, children: [
18103
- (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18104
- kit.menu.Item,
18105
- {
18106
- onClick: async () => {
18107
- const v = record.redeploy();
18108
- const id = v.id;
18109
- pruneBeforeEdit(v);
18110
- await mutateAsync({
18111
- id,
18112
- resource: (resource == null ? void 0 : resource.name) || "",
18113
- values: v,
18114
- successNotification() {
18115
- return {
18116
- message: t2("dovetail.redeploy_success_toast", {
18117
- kind: record.kind,
18118
- name: record.id,
18119
- interpolation: {
18120
- escapeValue: false
18121
- }
18122
- }),
18123
- type: "success"
18124
- };
18125
- },
18126
- errorNotification() {
18127
- return {
18128
- message: t2("dovetail.redeploy_failed_toast", {
18129
- kind: record.kind,
18130
- name: record.id,
18131
- interpolation: {
18132
- escapeValue: false
18133
- }
18134
- }),
18135
- type: "error"
18136
- };
18137
- }
18138
- });
18139
- },
18140
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: Retry16GradientBlueIcon, children: t2("dovetail.redeploy") })
18141
- }
18142
- ) : null,
18143
- children
18144
- ] });
18145
- }
18146
- function ReplicasDropdown(props) {
18147
- const { record, size, children } = props;
18148
- const kit = useUIKit();
18149
- const { t: t2 } = useTranslation();
18150
- const formRef = useRef(null);
18151
- const { action, resource } = useResource();
18152
- const isInShowPage = action === "show";
18153
- const { data: canEditData } = useCan({
18154
- resource: resource == null ? void 0 : resource.name,
18155
- action: AccessControlAuth.Edit
18156
- });
18157
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(WorkloadDropdown, { record, size, children: [
18158
- isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
18159
- kit.menu.Item,
18160
- {
18161
- onClick: () => {
18162
- const modalProps = {
18163
- formRef,
18164
- title: t2("dovetail.edit_replicas"),
18165
- renderContent() {
18166
- return /* @__PURE__ */ jsxRuntimeExports.jsx(
18167
- WorkloadReplicasForm,
18168
- {
18169
- ref: formRef,
18170
- defaultValue: record.replicas || 0,
18171
- record,
18172
- label: t2("dovetail.pod_replicas_num")
18173
- }
18174
- );
18175
- }
18176
- };
18177
- pushModal({
18178
- component: EditFieldModal,
18179
- props: modalProps
18180
- });
18181
- },
18182
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_replicas") })
18183
- }
18184
- ),
18185
- children
18186
- ] });
18187
- }
18188
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18189
- function adopt(value2) {
18190
- return value2 instanceof P ? value2 : new P(function(resolve) {
18191
- resolve(value2);
18192
- });
18193
- }
18194
- return new (P || (P = Promise))(function(resolve, reject) {
18195
- function fulfilled(value2) {
18196
- try {
18197
- step(generator.next(value2));
18198
- } catch (e2) {
18199
- reject(e2);
18200
- }
18201
- }
18202
- function rejected(value2) {
18203
- try {
18204
- step(generator["throw"](value2));
18205
- } catch (e2) {
18206
- reject(e2);
18207
- }
18208
- }
18209
- function step(result) {
18210
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18211
- }
18212
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18213
- });
18214
- };
18215
- function useEventCallback(fn) {
18216
- const ref = useRef(() => {
18217
- throw new Error("Cannot call an event handler while rendering.");
18218
- });
18219
- useIsomorphicLayoutEffect(() => {
18220
- ref.current = fn;
18221
- }, [fn]);
18222
- return useCallback((...args) => ref.current(...args), [ref]);
18223
- }
18224
- function useEventListener(eventName, handler, element, options) {
18225
- const savedHandler = useRef(handler);
18226
- useIsomorphicLayoutEffect(() => {
18227
- savedHandler.current = handler;
18228
- }, [handler]);
18229
- useEffect(() => {
18230
- var _a;
18231
- const targetElement = (_a = element === null || element === void 0 ? void 0 : element.current) !== null && _a !== void 0 ? _a : window;
18232
- if (!(targetElement && targetElement.addEventListener))
18233
- return;
18234
- const listener = (event2) => savedHandler.current(event2);
18235
- targetElement.addEventListener(eventName, listener, options);
18236
- return () => {
18237
- targetElement.removeEventListener(eventName, listener, options);
18238
- };
18239
- }, [eventName, element, options]);
18240
- }
18241
- globalThis && globalThis.__awaiter || function(thisArg, _arguments, P, generator) {
18242
- function adopt(value2) {
18243
- return value2 instanceof P ? value2 : new P(function(resolve) {
18244
- resolve(value2);
18245
- });
18246
- }
18247
- return new (P || (P = Promise))(function(resolve, reject) {
18248
- function fulfilled(value2) {
18249
- try {
18250
- step(generator.next(value2));
18251
- } catch (e2) {
18252
- reject(e2);
18253
- }
18254
- }
18255
- function rejected(value2) {
18256
- try {
18257
- step(generator["throw"](value2));
18258
- } catch (e2) {
18259
- reject(e2);
18260
- }
18261
- }
18262
- function step(result) {
18263
- result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
18264
- }
18265
- step((generator = generator.apply(thisArg, _arguments || [])).next());
18266
- });
18267
- };
18268
- const useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect;
18269
- function useLocalStorage(key2, initialValue) {
18270
- const readValue = useCallback(() => {
18271
- if (typeof window === "undefined") {
18272
- return initialValue;
18273
- }
18274
- try {
18275
- const item = window.localStorage.getItem(key2);
18276
- return item ? parseJSON(item) : initialValue;
18277
- } catch (error) {
18278
- console.warn(`Error reading localStorage key “${key2}”:`, error);
18279
- return initialValue;
18280
- }
18281
- }, [initialValue, key2]);
18282
- const [storedValue, setStoredValue] = useState(readValue);
18283
- const setValue = useEventCallback((value2) => {
18284
- if (typeof window === "undefined") {
18285
- console.warn(`Tried setting localStorage key “${key2}” even though environment is not a client`);
18286
- }
18287
- try {
18288
- const newValue = value2 instanceof Function ? value2(storedValue) : value2;
18289
- window.localStorage.setItem(key2, JSON.stringify(newValue));
18290
- setStoredValue(newValue);
18291
- window.dispatchEvent(new Event("local-storage"));
18292
- } catch (error) {
18293
- console.warn(`Error setting localStorage key “${key2}”:`, error);
18294
- }
18295
- });
18296
- useEffect(() => {
18297
- setStoredValue(readValue());
18298
- }, []);
18299
- const handleStorageChange = useCallback((event2) => {
18300
- if ((event2 === null || event2 === void 0 ? void 0 : event2.key) && event2.key !== key2) {
18301
- return;
18302
- }
18303
- setStoredValue(readValue());
18304
- }, [key2, readValue]);
18305
- useEventListener("storage", handleStorageChange);
18306
- useEventListener("local-storage", handleStorageChange);
18307
- return [storedValue, setValue];
18308
- }
18309
- function parseJSON(value2) {
18310
- try {
18311
- return value2 === "undefined" ? void 0 : JSON.parse(value2 !== null && value2 !== void 0 ? value2 : "");
18312
- } catch (_a) {
18313
- console.log("parsing error on", { value: value2 });
18314
- return void 0;
18315
- }
18316
- }
18317
- const GlobalStoreContext = createContext({});
18318
- const index_1xad2h9 = "";
18319
- const SelectStyle = "sj0ggy";
18320
- const DropdownStyle = "d1eo8uqs";
18321
- const SearchInputStyle = "s64gojc";
18322
- const SelectContentStyle = "s16fqgtu";
18323
- const TokenStyle = "tgaujbg";
18324
- const CountTokenStyle = "c1vbd54v";
18325
- const SelectOptionGroupStyle = "sxzmtrx";
18326
- const LabelWrapperStyle = "lqrghwd";
18327
- const AllNamespaceOptionStyle = "api7z1z";
18328
- const OptionStyle = "o38b23x";
18329
- const NS_STORE_KEY = "namespace-filter";
18330
- const ALL_NS = "_all";
18331
- const useNamespacesFilter = () => {
18332
- const [value2] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18333
- const {
18334
- resource
18335
- } = useResource();
18336
- const configs = useContext(ConfigsContext);
18337
- if ((resource == null ? void 0 : resource.name) && configs[resource == null ? void 0 : resource.name].hideNamespacesFilter) {
18338
- return {
18339
- value: []
18340
- };
18341
- }
18342
- return {
18343
- value: value2
18344
- };
18345
- };
18346
- const NamespacesFilter = ({
18347
- className
18348
- }) => {
18476
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.button, {
18477
+ type: "primary",
18478
+ ...saveButtonProps,
18479
+ children: t2("dovetail.save")
18480
+ })
18481
+ })]
18482
+ });
18483
+ }
18484
+ function WorkloadDropdown(props) {
18485
+ const { record, size, children } = props;
18349
18486
  const kit = useUIKit();
18350
- const {
18351
- t: t2
18352
- } = useTranslation();
18353
- const [search, setSearch] = useState("");
18354
- const [tagMaxWidth, setTagMaxWidth] = useState("");
18355
- const {
18356
- data: data2,
18357
- isLoading
18358
- } = useList({
18359
- resource: "namespaces",
18360
- meta: {
18361
- resourceBasePath: "/api/v1",
18362
- kind: "Namespace"
18363
- },
18364
- pagination: {
18365
- mode: "off"
18366
- }
18487
+ const { resource } = useResource();
18488
+ const { mutateAsync } = useUpdate();
18489
+ const { t: t2 } = useTranslation();
18490
+ const { data: canEditData } = useCan({
18491
+ resource: resource == null ? void 0 : resource.name,
18492
+ action: AccessControlAuth.Edit
18367
18493
  });
18368
- const [value2, setValue] = useLocalStorage(NS_STORE_KEY, [ALL_NS]);
18369
- const [open, setOpen] = useState(false);
18370
- const debouncedSetSearch = debounce(setSearch, 100);
18371
- const MAX_TAG_COUNT = 8;
18372
- const COUNT_TAG_WIDTH = 22;
18373
- const TAG_GAP = 4;
18374
- const PADDING = 36;
18375
- const hasCountTag = value2.length > MAX_TAG_COUNT;
18376
- const WRAPPER_CLASS = "d2-namespace-select-wrapper";
18377
- const SELECT_CLASS = "d2-namespace-select";
18378
- const calcTagMaxWidth = useCallback(() => {
18379
- const wrapper = document.querySelector(`.${WRAPPER_CLASS}`);
18380
- const n2 = Math.min(value2.length, MAX_TAG_COUNT);
18381
- const tagWidth = ((wrapper == null ? void 0 : wrapper.offsetWidth) || 0) / n2;
18382
- const gapsWidth = (Math.min(value2.length, MAX_TAG_COUNT + 1) - 1) * TAG_GAP;
18383
- const paddingAndCountTagWidth = PADDING + (hasCountTag ? COUNT_TAG_WIDTH : 0);
18384
- const perTagMaxWidth = tagWidth - (paddingAndCountTagWidth + gapsWidth) / n2;
18385
- setTagMaxWidth(`${perTagMaxWidth}px`);
18386
- }, [value2, hasCountTag]);
18387
- useEffect(() => {
18388
- calcTagMaxWidth();
18389
- }, [calcTagMaxWidth]);
18390
- useEffect(() => {
18391
- window.addEventListener("resize", calcTagMaxWidth);
18392
- return () => {
18393
- window.removeEventListener("resize", calcTagMaxWidth);
18394
- };
18395
- }, [calcTagMaxWidth]);
18396
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18397
- className: WRAPPER_CLASS,
18398
- children: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.select, {
18399
- loading: isLoading,
18400
- className: cx_default(SelectStyle, SELECT_CLASS, className),
18401
- style: {
18402
- "--tag-max-width": tagMaxWidth
18403
- },
18404
- dropdownClassName: DropdownStyle,
18405
- searchValue: search,
18406
- virtual: false,
18407
- input: {
18408
- value: value2,
18409
- onChange(value22) {
18410
- if (last(value22) === ALL_NS || value22.length === 0) {
18411
- setValue([ALL_NS]);
18412
- } else {
18413
- setValue(value22.filter((namespace2) => namespace2 !== ALL_NS));
18414
- }
18415
- }
18416
- },
18417
- dropdownRender: (menu) => /* @__PURE__ */ jsxRuntimeExports.jsxs("div", {
18418
- className: SelectContentStyle,
18419
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.searchInput, {
18420
- style: {
18421
- width: "100%"
18422
- },
18423
- className: SearchInputStyle,
18424
- onChange: debouncedSetSearch,
18425
- placeholder: t2("dovetail.please_input")
18426
- }), menu, isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : null]
18427
- }),
18428
- tagRender: ({
18429
- label: label2,
18430
- value: namespaceValue,
18431
- closable,
18432
- onClose
18433
- }) => {
18434
- const isCountToken = label2 !== namespaceValue && typeof label2 === "string";
18435
- const isAll = namespaceValue === ALL_NS;
18436
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18437
- onClick: () => {
18438
- setOpen(!open);
18439
- },
18440
- children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsxs("span", {
18441
- style: {
18442
- marginLeft: 8
18494
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(K8sDropdown, { record, size, children: [
18495
+ (canEditData == null ? void 0 : canEditData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
18496
+ kit.menu.Item,
18497
+ {
18498
+ onClick: async () => {
18499
+ const v = record.redeploy();
18500
+ const id = v.id;
18501
+ pruneBeforeEdit(v);
18502
+ await mutateAsync({
18503
+ id,
18504
+ resource: (resource == null ? void 0 : resource.name) || "",
18505
+ values: v,
18506
+ successNotification() {
18507
+ return {
18508
+ message: t2("dovetail.redeploy_success_toast", {
18509
+ kind: record.kind,
18510
+ name: record.id,
18511
+ interpolation: {
18512
+ escapeValue: false
18513
+ }
18514
+ }),
18515
+ type: "success"
18516
+ };
18443
18517
  },
18444
- children: [label2, "..."]
18445
- }) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
18446
- className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
18447
- closable,
18448
- size: "medium",
18449
- onClose,
18450
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18451
- content: isCountToken ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.tooltip, {
18452
- title: isCountToken ? value2.slice(MAX_TAG_COUNT).map((namespace2, index) => /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, {
18453
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx("div", {
18454
- children: namespace2
18455
- }), index !== value2.length - 1 - MAX_TAG_COUNT ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, {
18456
- style: {
18457
- margin: "6px 0",
18458
- borderColor: "rgba(107, 128, 167, 0.60)"
18459
- }
18460
- }) : null]
18461
- })) : null,
18462
- trigger: ["hover"],
18463
- children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
18464
- children: label2.replace(/[\s\.]/g, "")
18465
- })
18466
- }) : label2
18467
- })
18468
- })
18469
- });
18470
- },
18471
- maxTagCount: MAX_TAG_COUNT,
18472
- optionLabelProp: "label",
18473
- showArrow: true,
18474
- showSearch: false,
18475
- open,
18476
- onDropdownVisibleChange: (open2) => {
18477
- setOpen(open2);
18478
- },
18479
- multiple: true,
18480
- children: [/* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18481
- value: "_all",
18482
- label: t2("dovetail.all_namespaces"),
18483
- className: AllNamespaceOptionStyle,
18484
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18485
- content: t2("dovetail.all_namespaces"),
18486
- className: LabelWrapperStyle
18487
- })
18488
- }, "_all"), /* @__PURE__ */ jsxRuntimeExports.jsx(kit.selectOptGroup, {
18489
- label: "",
18490
- className: SelectOptionGroupStyle,
18491
- children: data2 == null ? void 0 : data2.data.map((namespace2) => {
18492
- const {
18493
- name: name2
18494
- } = namespace2.metadata;
18495
- return /* @__PURE__ */ jsxRuntimeExports.jsx(kit.option, {
18496
- value: name2,
18497
- label: name2,
18498
- className: OptionStyle,
18499
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(kit.overflowTooltip, {
18500
- content: name2,
18501
- className: LabelWrapperStyle
18502
- })
18503
- }, name2);
18504
- })
18505
- })]
18506
- })
18518
+ errorNotification() {
18519
+ return {
18520
+ message: t2("dovetail.redeploy_failed_toast", {
18521
+ kind: record.kind,
18522
+ name: record.id,
18523
+ interpolation: {
18524
+ escapeValue: false
18525
+ }
18526
+ }),
18527
+ type: "error"
18528
+ };
18529
+ }
18530
+ });
18531
+ },
18532
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: Retry16GradientBlueIcon, children: t2("dovetail.redeploy") })
18533
+ }
18534
+ ) : null,
18535
+ children
18536
+ ] });
18537
+ }
18538
+ function ReplicasDropdown(props) {
18539
+ const { record, size, children } = props;
18540
+ const kit = useUIKit();
18541
+ const { t: t2 } = useTranslation();
18542
+ const formRef = useRef(null);
18543
+ const { action, resource } = useResource();
18544
+ const isInShowPage = action === "show";
18545
+ const { data: canEditData } = useCan({
18546
+ resource: resource == null ? void 0 : resource.name,
18547
+ action: AccessControlAuth.Edit
18507
18548
  });
18508
- };
18549
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(WorkloadDropdown, { record, size, children: [
18550
+ isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
18551
+ kit.menu.Item,
18552
+ {
18553
+ onClick: () => {
18554
+ const modalProps = {
18555
+ formRef,
18556
+ title: t2("dovetail.edit_replicas"),
18557
+ renderContent() {
18558
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
18559
+ WorkloadReplicasForm,
18560
+ {
18561
+ ref: formRef,
18562
+ defaultValue: record.replicas || 0,
18563
+ record,
18564
+ label: t2("dovetail.pod_replicas_num")
18565
+ }
18566
+ );
18567
+ }
18568
+ };
18569
+ pushModal({
18570
+ component: EditFieldModal,
18571
+ props: modalProps
18572
+ });
18573
+ },
18574
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_replicas") })
18575
+ }
18576
+ ),
18577
+ children
18578
+ ] });
18579
+ }
18509
18580
  const index_hp158y = "";
18510
18581
  const ListPageStyle = "laykzsq";
18511
18582
  const ListContentStyle = "l1ng0psc";
@@ -18574,8 +18645,7 @@ function ResourceList(props) {
18574
18645
  useTableParams: {},
18575
18646
  columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
18576
18647
  tableProps: {
18577
- defaultSize: 50,
18578
- ...props.config.tableProps
18648
+ defaultSize: 50
18579
18649
  },
18580
18650
  formatter,
18581
18651
  Dropdown
@@ -21780,44 +21850,20 @@ function useForm$1(props = {}) {
21780
21850
  _formControl.current.formState = getProxyFormState(formState, control);
21781
21851
  return _formControl.current;
21782
21852
  }
21783
- const RefineFormContent_1tb00bi = "";
21853
+ const RefineFormContent_1in3vad = "";
21784
21854
  const RefineFormContent = (props) => {
21785
- var _a, _b, _c, _d;
21855
+ var _a, _b;
21786
21856
  const {
21787
21857
  config,
21788
21858
  formResult,
21789
- resourceId,
21859
+ action,
21790
21860
  errorMsg
21791
21861
  } = props;
21792
21862
  const {
21793
21863
  control,
21794
21864
  getValues
21795
21865
  } = formResult;
21796
- const action = resourceId ? "edit" : "create";
21797
- const listQuery = useList({
21798
- resource: config == null ? void 0 : config.name,
21799
- meta: {
21800
- resourceBasePath: config == null ? void 0 : config.basePath,
21801
- kind: config == null ? void 0 : config.kind
21802
- },
21803
- pagination: {
21804
- mode: "off"
21805
- }
21806
- });
21807
- const showQuery = useShow({
21808
- resource: config == null ? void 0 : config.name,
21809
- meta: {
21810
- resourceBasePath: config == null ? void 0 : config.basePath,
21811
- kind: config == null ? void 0 : config.kind
21812
- },
21813
- id: resourceId
21814
- });
21815
- const formFieldsConfig = (_d = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _d.call(_a, {
21816
- record: (_b = showQuery.queryResult.data) == null ? void 0 : _b.data,
21817
- records: ((_c = listQuery.data) == null ? void 0 : _c.data) || [],
21818
- action
21819
- });
21820
- const fields = formFieldsConfig == null ? void 0 : formFieldsConfig.map((c2) => {
21866
+ const fields = (_b = (_a = config == null ? void 0 : config.formConfig) == null ? void 0 : _a.fields) == null ? void 0 : _b.map((c2) => {
21821
21867
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Controller, {
21822
21868
  control,
21823
21869
  name: c2.path.join("."),
@@ -21849,7 +21895,6 @@ const RefineFormContent = (props) => {
21849
21895
  var _a2;
21850
21896
  const formValue = getValues();
21851
21897
  let ele = /* @__PURE__ */ jsxRuntimeExports.jsx(Fields.String, {
21852
- placeholder: c2.placeholder,
21853
21898
  input: {
21854
21899
  value: value2,
21855
21900
  onChange,
@@ -21877,17 +21922,6 @@ const RefineFormContent = (props) => {
21877
21922
  children: value2
21878
21923
  });
21879
21924
  }
21880
- if (c2.helperText) {
21881
- ele = /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
21882
- size: 4,
21883
- direction: "vertical",
21884
- className: "c154n7ie",
21885
- children: [ele, /* @__PURE__ */ jsxRuntimeExports.jsx("div", {
21886
- className: cx_default(Typo.Footnote.f2_regular, "c1c9j4da"),
21887
- children: c2.helperText
21888
- })]
21889
- });
21890
- }
21891
21925
  if (c2 == null ? void 0 : c2.render) {
21892
21926
  ele = c2.render(value2, onChange, formValue, onBlur, action);
21893
21927
  }
@@ -21905,7 +21939,7 @@ const RefineFormContent = (props) => {
21905
21939
  });
21906
21940
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, {
21907
21941
  direction: "vertical",
21908
- className: "cjxv8cf",
21942
+ className: "c154n7ie",
21909
21943
  children: [fields, /* @__PURE__ */ jsxRuntimeExports.jsx(FormErrorAlert, {
21910
21944
  errorMsgs: errorMsg ? [errorMsg] : [],
21911
21945
  style: {
@@ -22545,6 +22579,7 @@ const useForm = ({
22545
22579
  };
22546
22580
  };
22547
22581
  const useRefineForm = (props) => {
22582
+ var _a;
22548
22583
  const { config, id, refineProps } = props;
22549
22584
  const [responseErrorMsg, setResponseErrorMsg] = useState("");
22550
22585
  const i18n2 = useTranslation();
@@ -22577,15 +22612,15 @@ const useRefineForm = (props) => {
22577
22612
  defaultValues: config == null ? void 0 : config.initValue
22578
22613
  });
22579
22614
  useEffect(() => {
22580
- var _a, _b;
22581
- const response = (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response;
22615
+ var _a2, _b;
22616
+ const response = (_a2 = result.refineCore.mutationResult.error) == null ? void 0 : _a2.response;
22582
22617
  if (response && !(response == null ? void 0 : response.bodyUsed)) {
22583
22618
  (_b = response.json) == null ? void 0 : _b.call(response).then((body) => {
22584
- var _a2, _b2;
22585
- setResponseErrorMsg(((_b2 = (_a2 = config.formConfig) == null ? void 0 : _a2.formatError) == null ? void 0 : _b2.call(_a2, body)) || body.message);
22619
+ var _a3, _b2;
22620
+ setResponseErrorMsg(((_b2 = (_a3 = config.formConfig) == null ? void 0 : _a3.formatError) == null ? void 0 : _b2.call(_a3, body)) || body.message);
22586
22621
  });
22587
22622
  }
22588
- }, [config.formConfig, result]);
22623
+ }, [config.formConfig, (_a = result.refineCore.mutationResult.error) == null ? void 0 : _a.response]);
22589
22624
  return { formResult: result, responseErrorMsg };
22590
22625
  };
22591
22626
  const index_12sfrn = "";
@@ -22596,7 +22631,7 @@ const Separator = () => {
22596
22631
  });
22597
22632
  };
22598
22633
  const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
22599
- const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-edd70925.js"));
22634
+ const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-a06e0978.js"));
22600
22635
  const YamlEditorComponent = forwardRef(
22601
22636
  function YamlEditorComponent2(props, ref) {
22602
22637
  const {
@@ -23111,18 +23146,9 @@ const useYamlForm = ({
23111
23146
  setEditorErrors(errors);
23112
23147
  return;
23113
23148
  }
23114
- try {
23115
- const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23116
- const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23117
- return onFinish(finalValues);
23118
- } catch (error) {
23119
- if (error instanceof Error) {
23120
- if (error.message === "expected a single document in the stream, but found more") {
23121
- setEditorErrors([t2("dovetail.only_support_one_yaml")]);
23122
- return;
23123
- }
23124
- }
23125
- }
23149
+ const objectValues = editor.current ? yaml.load(((_a2 = editor.current) == null ? void 0 : _a2.getEditorValue()) || "") : values;
23150
+ const finalValues = (transformApplyValues == null ? void 0 : transformApplyValues(objectValues)) || objectValues;
23151
+ return onFinish(finalValues);
23126
23152
  },
23127
23153
  onKeyUp,
23128
23154
  onValuesChange,
@@ -23344,7 +23370,7 @@ function FormModal(props) {
23344
23370
  formResult: refineFormResult.formResult,
23345
23371
  config,
23346
23372
  errorMsg: refineFormResult.responseErrorMsg,
23347
- resourceId: id
23373
+ action: id ? "edit" : "create"
23348
23374
  });
23349
23375
  })();
23350
23376
  const saveButtonProps = isYamlForm ? yamlSaveButtonProps : refineFormResult.formResult.saveButtonProps;
@@ -23427,7 +23453,7 @@ const RefineFormPage = (props) => {
23427
23453
  children: [/* @__PURE__ */ jsxRuntimeExports.jsx(RefineFormContent, {
23428
23454
  config,
23429
23455
  formResult,
23430
- resourceId: id
23456
+ action
23431
23457
  }), ";", /* @__PURE__ */ jsxRuntimeExports.jsx(Button, {
23432
23458
  ...saveButtonProps,
23433
23459
  onClick,
@@ -23665,7 +23691,7 @@ const DrawerShow = (props) => {
23665
23691
  const parsed = useParsed();
23666
23692
  const nav = useNavigation();
23667
23693
  const { queryResult } = useShow({ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id });
23668
- const { isLoading } = queryResult;
23694
+ const { isLoading, data: data2 } = queryResult;
23669
23695
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
23670
23696
  Drawer,
23671
23697
  {
@@ -23674,7 +23700,7 @@ const DrawerShow = (props) => {
23674
23700
  onClose: () => nav.goBack(),
23675
23701
  width: "50%",
23676
23702
  visible: !!((_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id),
23677
- children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props })
23703
+ children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 })
23678
23704
  }
23679
23705
  );
23680
23706
  };
@@ -23702,7 +23728,7 @@ const ReferenceLink = (props) => {
23702
23728
  }
23703
23729
  const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
23704
23730
  if (!resource) {
23705
- return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "-" });
23731
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
23706
23732
  }
23707
23733
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
23708
23734
  ResourceLink,
@@ -23828,11 +23854,7 @@ const PlainTextNameColumnRenderer = (i18n2) => {
23828
23854
  title: i18n2.t("dovetail.name"),
23829
23855
  sortable: true,
23830
23856
  width: 200,
23831
- sorter: CommonSorter(dataIndex),
23832
- render: (v) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
23833
- content: v,
23834
- tooltip: v
23835
- })
23857
+ sorter: CommonSorter(dataIndex)
23836
23858
  };
23837
23859
  };
23838
23860
  const NameSpaceColumnRenderer = (i18n2) => {
@@ -23925,17 +23947,8 @@ const AgeColumnRenderer = (i18n2, config, {
23925
23947
  display: true,
23926
23948
  dataIndex,
23927
23949
  title: i18n2.t("dovetail.created_time"),
23928
- sortable: true,
23929
23950
  width: 120,
23930
- sorter: (a2, b) => {
23931
- const valA = new Date(lodashExports.get(a2, dataIndex));
23932
- const valB = new Date(lodashExports.get(b, dataIndex));
23933
- if (valA === valB)
23934
- return 0;
23935
- if (valA > valB)
23936
- return 1;
23937
- return -1;
23938
- },
23951
+ sorter: true,
23939
23952
  render: (value2) => {
23940
23953
  return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
23941
23954
  date: new Date(value2)
@@ -24272,7 +24285,7 @@ const PortMappingColumnRenderer = (i18n2) => {
24272
24285
  href: `//${v.servicePort}`,
24273
24286
  target: "_blank",
24274
24287
  children: v.servicePort
24275
- }) : v.servicePort, " ", "> ", v.targetPort, "/", v.protocol]
24288
+ }) : v.servicePort, " > ", v.targetPort, "/", v.protocol]
24276
24289
  }),
24277
24290
  tooltip: `${v.servicePort} > ${v.targetPort}/${v.protocol}`
24278
24291
  }, v.servicePort));
@@ -24282,89 +24295,6 @@ const PortMappingColumnRenderer = (i18n2) => {
24282
24295
  }
24283
24296
  };
24284
24297
  };
24285
- var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
24286
- ColumnKeys2["age"] = "age";
24287
- ColumnKeys2["name"] = "name";
24288
- ColumnKeys2["namespace"] = "namespace";
24289
- ColumnKeys2["phase"] = "phase";
24290
- ColumnKeys2["replicas"] = "replicas";
24291
- ColumnKeys2["deploymentImage"] = "deploymentImage";
24292
- ColumnKeys2["podImage"] = "podImage";
24293
- return ColumnKeys2;
24294
- })(ColumnKeys || {});
24295
- function addDefaultRenderToColumns(columns) {
24296
- return columns.map((col) => ({
24297
- render(value2) {
24298
- return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: value2 });
24299
- },
24300
- ...col
24301
- }));
24302
- }
24303
- const useEagleTable = (params) => {
24304
- var _a, _b, _c;
24305
- const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
24306
- const [selectedKeys, setSelectedKeys] = useState([]);
24307
- const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
24308
- const { resource } = useResource();
24309
- const { value: nsFilters = [] } = useNamespacesFilter();
24310
- const useTableParams = useMemo(() => {
24311
- const mergedParams = merge(params.useTableParams, {
24312
- pagination: {
24313
- mode: "off"
24314
- },
24315
- filters: {
24316
- permanent: [
24317
- {
24318
- operator: "or",
24319
- value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
24320
- field: "metadata.namespace",
24321
- operator: "eq",
24322
- value: filter
24323
- }))
24324
- }
24325
- ]
24326
- }
24327
- });
24328
- return mergedParams;
24329
- }, [params.useTableParams, nsFilters]);
24330
- const finalColumns = useMemo(
24331
- () => addDefaultRenderToColumns(columns),
24332
- [columns]
24333
- );
24334
- const table = useTable(useTableParams);
24335
- const onPageChange = useCallback(
24336
- (page) => {
24337
- setCurrentPage(page);
24338
- },
24339
- [setCurrentPage]
24340
- );
24341
- const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
24342
- const data2 = (_b = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.slice(
24343
- (currentPage - 1) * currentSize,
24344
- currentPage * currentSize
24345
- );
24346
- const total = ((_c = table.tableQueryResult.data) == null ? void 0 : _c.data.length) || 0;
24347
- const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
24348
- const finalProps = {
24349
- tableKey: (resource == null ? void 0 : resource.name) || "table",
24350
- loading: table.tableQueryResult.isLoading,
24351
- data: finalDataSource || [],
24352
- columns: finalColumns,
24353
- refetch: () => null,
24354
- error: false,
24355
- rowKey: "id",
24356
- currentPage,
24357
- onPageChange,
24358
- onSelect: (keys) => {
24359
- setSelectedKeys(keys);
24360
- },
24361
- total,
24362
- RowMenu: Dropdown,
24363
- ...tableProps,
24364
- defaultSize: currentSize
24365
- };
24366
- return { tableProps: finalProps, selectedKeys, ...table };
24367
- };
24368
24298
  const styles = "";
24369
24299
  const Dovetail = (props) => {
24370
24300
  const {
@@ -24417,7 +24347,10 @@ const Dovetail = (props) => {
24417
24347
  options: {
24418
24348
  warnWhenUnsavedChanges: true,
24419
24349
  liveMode: "auto",
24420
- disableTelemetry: true
24350
+ disableTelemetry: true,
24351
+ overtime: {
24352
+ interval: Number.MAX_SAFE_INTEGER
24353
+ }
24421
24354
  },
24422
24355
  accessControlProvider,
24423
24356
  resources: resourcesConfig.map((c2) => {