@dovetail-v2/refine 0.0.45 → 0.0.46-alpha.1
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.
- package/dist/{MonacoYamlDiffEditor-0046c95b.js → MonacoYamlDiffEditor-a0787f8d.js} +2 -2
- package/dist/{index-15e1d63d.js → index-9a6fb2d3.js} +444 -350
- package/dist/refine.js +3 -3
- package/dist/refine.umd.cjs +440 -346
- package/lib/src/components/ModalContextProvider/index.d.ts +12 -0
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +2 -1
- package/lib/src/components/ShowContent/ShowContent.d.ts +2 -0
- package/lib/src/components/Table/index.d.ts +2 -0
- package/lib/src/components/YamlForm/index.d.ts +4 -0
- package/lib/src/hooks/useDownloadYAML.d.ts +1 -1
- package/lib/src/hooks/useEagleForm.d.ts +2 -1
- package/lib/src/hooks/useEagleTable/columns.d.ts +1 -1
- package/lib/src/hooks/useModal.d.ts +0 -0
- package/lib/src/hooks/useNamespaceFilter.d.ts +5 -0
- package/lib/src/hooks/useTableData.d.ts +20 -0
- package/lib/src/model/cronjob-model.d.ts +9 -0
- package/lib/src/model/index.d.ts +6 -0
- package/lib/src/model/job-model.d.ts +10 -0
- package/lib/src/model/pod-metrics-model.d.ts +7 -0
- package/lib/src/model/pod-model.d.ts +15 -0
- package/lib/src/model/resource-model.d.ts +17 -0
- package/lib/src/model/workload-model.d.ts +17 -0
- package/lib/src/types/metric.d.ts +25 -0
- package/package.json +2 -2
- package/lib/src/App.js +0 -91
- package/lib/src/Dovetail.js +0 -45
- package/lib/src/components/Breadcrumb/index.js +0 -20
- package/lib/src/components/ConditionsTable/ConditionsTable.js +0 -56
- package/lib/src/components/ConditionsTable/index.js +0 -1
- package/lib/src/components/CreateButton/index.js +0 -10
- package/lib/src/components/CronJobDropdown/index.js +0 -26
- package/lib/src/components/CronjobJobsTable/index.js +0 -49
- package/lib/src/components/DeleteButton/index.js +0 -13
- package/lib/src/components/DeleteManyButton/index.js +0 -16
- package/lib/src/components/DrawerShow/DrawerShow.js +0 -13
- package/lib/src/components/DrawerShow/index.js +0 -1
- package/lib/src/components/EditButton/index.js +0 -13
- package/lib/src/components/EditField/index.js +0 -47
- package/lib/src/components/ErrorContent/index.js +0 -36
- package/lib/src/components/EventsTable/EventsTable.js +0 -59
- package/lib/src/components/EventsTable/index.js +0 -1
- package/lib/src/components/Form/KeyValueListWidget.js +0 -56
- package/lib/src/components/Form/MetadataForm.js +0 -9
- package/lib/src/components/Form/NameInputWidget.js +0 -50
- package/lib/src/components/Form/NamespaceSelectWidget.js +0 -21
- package/lib/src/components/Form/index.js +0 -4
- package/lib/src/components/Form/widget.js +0 -1
- package/lib/src/components/FormErrorAlert/index.js +0 -8
- package/lib/src/components/FormLayout/index.js +0 -21
- package/lib/src/components/FormModal/index.js +0 -51
- package/lib/src/components/ImageNames/index.js +0 -14
- package/lib/src/components/IngressRulesComponent/index.js +0 -11
- package/lib/src/components/IngressRulesTable/IngressRulesTable.js +0 -51
- package/lib/src/components/IngressRulesTable/index.js +0 -1
- package/lib/src/components/K8sDropdown/index.js +0 -31
- package/lib/src/components/KeyValue/KeyValue.js +0 -27
- package/lib/src/components/KeyValue/index.js +0 -1
- package/lib/src/components/KeyValueData/index.js +0 -50
- package/lib/src/components/Layout/index.js +0 -39
- package/lib/src/components/ListPage/index.js +0 -25
- package/lib/src/components/Menu/index.js +0 -36
- package/lib/src/components/NamespacesFilter/index.js +0 -34
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +0 -77
- package/lib/src/components/NetworkPolicyRulesTable/index.js +0 -1
- package/lib/src/components/PageShow/PageShow.js +0 -11
- package/lib/src/components/PageShow/index.js +0 -1
- package/lib/src/components/PodContainersTable/PodContainersTable.js +0 -78
- package/lib/src/components/PodContainersTable/index.js +0 -1
- package/lib/src/components/PodLog/index.js +0 -136
- package/lib/src/components/ReferenceLink/index.js +0 -17
- package/lib/src/components/RefineForm/RefineFormContent.d.ts +0 -10
- package/lib/src/components/RefineForm/RefineFormModal.d.ts +0 -8
- package/lib/src/components/RefineForm/RefineFormPage.d.ts +0 -7
- package/lib/src/components/RefineForm/index.d.ts +0 -3
- package/lib/src/components/RefineForm/type.d.ts +0 -20
- package/lib/src/components/RefineForm/useRefineForm.d.ts +0 -10
- package/lib/src/components/ResourceCRUD/ResourceCRUD.js +0 -15
- package/lib/src/components/ResourceCRUD/create/index.js +0 -13
- package/lib/src/components/ResourceCRUD/index.js +0 -4
- package/lib/src/components/ResourceCRUD/list/index.js +0 -19
- package/lib/src/components/ResourceCRUD/show/index.js +0 -6
- package/lib/src/components/ResourceLink/index.js +0 -21
- package/lib/src/components/ResourceUsageBar/index.js +0 -81
- package/lib/src/components/Separator/index.js +0 -11
- package/lib/src/components/ShowContent/ShowContent.js +0 -157
- package/lib/src/components/ShowContent/fields.js +0 -157
- package/lib/src/components/ShowContent/index.js +0 -2
- package/lib/src/components/StateTag/StateTag.js +0 -22
- package/lib/src/components/StateTag/index.js +0 -1
- package/lib/src/components/Table/ErrorContent.js +0 -36
- package/lib/src/components/Table/TableToolBar.js +0 -14
- package/lib/src/components/Table/TableWidgets.js +0 -28
- package/lib/src/components/Table/index.js +0 -69
- package/lib/src/components/Tags/index.js +0 -22
- package/lib/src/components/Time/index.js +0 -14
- package/lib/src/components/WorkloadDropdown/index.js +0 -24
- package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +0 -39
- package/lib/src/components/WorkloadPodsTable/index.js +0 -1
- package/lib/src/components/WorkloadReplicas/index.js +0 -50
- package/lib/src/components/YamlEditor/MonacoYamlDiffEditor.js +0 -34
- package/lib/src/components/YamlEditor/MonacoYamlEditor.js +0 -149
- package/lib/src/components/YamlEditor/YamlEditorComponent.js +0 -90
- package/lib/src/components/YamlEditor/index.js +0 -1
- package/lib/src/components/YamlEditor/style.js +0 -102
- package/lib/src/components/YamlEditor/yaml.worker.js +0 -1
- package/lib/src/components/YamlForm/index.js +0 -61
- package/lib/src/components/index.js +0 -38
- package/lib/src/constants/index.js +0 -2
- package/lib/src/constants/k8s.js +0 -203
- package/lib/src/constants/state.js +0 -15
- package/lib/src/contexts/component.js +0 -3
- package/lib/src/contexts/configs.js +0 -3
- package/lib/src/contexts/global-store.js +0 -3
- package/lib/src/contexts/index.js +0 -3
- package/lib/src/hooks/index.js +0 -7
- package/lib/src/hooks/useDeleteModal/index.js +0 -1
- package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +0 -31
- package/lib/src/hooks/useDeleteModal/useDeleteModal.js +0 -38
- package/lib/src/hooks/useDownloadYAML.js +0 -10
- package/lib/src/hooks/useEagleForm.js +0 -177
- package/lib/src/hooks/useEagleTable/columns.js +0 -246
- package/lib/src/hooks/useEagleTable/index.js +0 -2
- package/lib/src/hooks/useEagleTable/useEagleTable.js +0 -63
- package/lib/src/hooks/useEdit.js +0 -19
- package/lib/src/hooks/useGlobalStore.js +0 -5
- package/lib/src/hooks/useK8sYamlEditor.js +0 -37
- package/lib/src/hooks/useOpenForm.js +0 -43
- package/lib/src/hooks/useSchema.js +0 -37
- package/lib/src/hooks/useSubmitForm.js +0 -42
- package/lib/src/i18n.js +0 -19
- package/lib/src/index.js +0 -13
- package/lib/src/locales/en-US/dovetail.json +0 -18
- package/lib/src/locales/en-US/index.js +0 -4
- package/lib/src/locales/index.js +0 -6
- package/lib/src/locales/zh-CN/dovetail.json +0 -91
- package/lib/src/locales/zh-CN/index.js +0 -4
- package/lib/src/main.js +0 -12
- package/lib/src/models/cronjob-model.js +0 -32
- package/lib/src/models/daemonset-model.js +0 -17
- package/lib/src/models/deployment-model.js +0 -17
- package/lib/src/models/event-model.js +0 -11
- package/lib/src/models/index.js +0 -14
- package/lib/src/models/ingress-model.js +0 -24
- package/lib/src/models/job-model.js +0 -56
- package/lib/src/models/network-policy-model.js +0 -10
- package/lib/src/models/pod-metrics-model.js +0 -34
- package/lib/src/models/pod-model.js +0 -78
- package/lib/src/models/resource-model.js +0 -34
- package/lib/src/models/server-instance-model.d.ts +0 -10
- package/lib/src/models/service-model.js +0 -17
- package/lib/src/models/statefulset-model.js +0 -17
- package/lib/src/models/types/index.js +0 -1
- package/lib/src/models/types/metric.js +0 -1
- package/lib/src/models/workload-base-model.js +0 -22
- package/lib/src/models/workload-model.js +0 -51
- package/lib/src/pages/configmaps/index.js +0 -15
- package/lib/src/pages/cronjobs/create/index.js +0 -6
- package/lib/src/pages/cronjobs/index.js +0 -3
- package/lib/src/pages/cronjobs/list/index.js +0 -42
- package/lib/src/pages/cronjobs/show/index.js +0 -16
- package/lib/src/pages/daemonsets/create/index.js +0 -6
- package/lib/src/pages/daemonsets/index.js +0 -3
- package/lib/src/pages/daemonsets/list/index.js +0 -32
- package/lib/src/pages/daemonsets/show/index.js +0 -16
- package/lib/src/pages/deployments/create/index.js +0 -7
- package/lib/src/pages/deployments/index.js +0 -3
- package/lib/src/pages/deployments/list/index.js +0 -26
- package/lib/src/pages/deployments/show/index.js +0 -16
- package/lib/src/pages/ingresses/index.js +0 -26
- package/lib/src/pages/jobs/index.js +0 -34
- package/lib/src/pages/networkPolicies/index.js +0 -67
- package/lib/src/pages/pods/create/index.js +0 -6
- package/lib/src/pages/pods/index.js +0 -3
- package/lib/src/pages/pods/list/index.js +0 -81
- package/lib/src/pages/pods/show/index.js +0 -54
- package/lib/src/pages/secrets/index.js +0 -15
- package/lib/src/pages/services/index.js +0 -26
- package/lib/src/pages/statefulsets/create/index.js +0 -6
- package/lib/src/pages/statefulsets/index.js +0 -3
- package/lib/src/pages/statefulsets/list/index.js +0 -26
- package/lib/src/pages/statefulsets/show/index.js +0 -16
- package/lib/src/plugins/index.js +0 -3
- package/lib/src/plugins/model-plugin.js +0 -46
- package/lib/src/plugins/relation-plugin.js +0 -81
- package/lib/src/plugins/type.js +0 -1
- package/lib/src/providers/index.js +0 -1
- package/lib/src/providers/router-provider/index.js +0 -100
- package/lib/src/types/index.js +0 -1
- package/lib/src/types/resource.js +0 -12
- package/lib/src/utils/addId.js +0 -8
- package/lib/src/utils/download.js +0 -9
- package/lib/src/utils/error.js +0 -53
- package/lib/src/utils/form.js +0 -9
- package/lib/src/utils/k8s.js +0 -6
- package/lib/src/utils/labels.js +0 -15
- package/lib/src/utils/match-selector.js +0 -12
- package/lib/src/utils/openapi.js +0 -33
- package/lib/src/utils/schema.js +0 -117
- package/lib/src/utils/selector.js +0 -12
- package/lib/src/utils/string.js +0 -6
- package/lib/src/utils/time.js +0 -46
- package/lib/src/utils/unit.js +0 -69
- package/lib/src/utils/yaml.js +0 -44
- package/lib/vite.config.js +0 -60
|
@@ -7,19 +7,19 @@ var __publicField = (obj, key2, value2) => {
|
|
|
7
7
|
import i18n from "i18next";
|
|
8
8
|
import * as React from "react";
|
|
9
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,
|
|
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,
|
|
14
|
-
import {
|
|
15
|
-
import { get as get$3, first, debounce, last, isObject as isObject$4,
|
|
13
|
+
import { Typo, Tag, useUIKit, kitContext, Link as Link$1, OverflowTooltip, Tooltip, StatusCapsule, pushModal, Icon as Icon$1, Button, popModal, Loading, Divider, Fields, Space, Form, 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, merge, get as get$3, first, debounce, last, 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
|
-
|
|
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, defaultSorters }) {
|
|
8686
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
8687
|
+
const [sorters, setSorters] = useState(defaultSorters || []);
|
|
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:
|
|
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
|
|
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:
|
|
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
|
|
8860
|
+
onPageChange,
|
|
8861
|
+
onSorterChange,
|
|
8817
8862
|
showMenuColumn: false
|
|
8818
8863
|
}
|
|
8819
8864
|
);
|
|
@@ -10127,11 +10172,9 @@ const Time = (props) => {
|
|
|
10127
10172
|
});
|
|
10128
10173
|
};
|
|
10129
10174
|
const ConditionsTable = ({ conditions = [] }) => {
|
|
10130
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
10131
10175
|
const { t: t2 } = useTranslation();
|
|
10132
10176
|
const component = useContext(ComponentContext);
|
|
10133
10177
|
const Table$1 = component.Table || Table;
|
|
10134
|
-
const currentSize = 10;
|
|
10135
10178
|
const conditionsWithId = addId(conditions, "type");
|
|
10136
10179
|
const columns = [
|
|
10137
10180
|
{
|
|
@@ -10187,6 +10230,15 @@ const ConditionsTable = ({ conditions = [] }) => {
|
|
|
10187
10230
|
width: 403
|
|
10188
10231
|
}
|
|
10189
10232
|
];
|
|
10233
|
+
const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({
|
|
10234
|
+
data: conditionsWithId,
|
|
10235
|
+
columns,
|
|
10236
|
+
defaultSorters: [{
|
|
10237
|
+
field: "lastUpdateTime",
|
|
10238
|
+
order: "desc"
|
|
10239
|
+
}]
|
|
10240
|
+
});
|
|
10241
|
+
const currentSize = 10;
|
|
10190
10242
|
if (conditionsWithId.length === 0) {
|
|
10191
10243
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10192
10244
|
WidgetErrorContent,
|
|
@@ -10202,18 +10254,38 @@ const ConditionsTable = ({ conditions = [] }) => {
|
|
|
10202
10254
|
{
|
|
10203
10255
|
tableKey: "condition",
|
|
10204
10256
|
loading: false,
|
|
10205
|
-
data:
|
|
10257
|
+
data: finalData,
|
|
10206
10258
|
total: conditionsWithId.length,
|
|
10207
10259
|
columns: addDefaultRenderToColumns(columns),
|
|
10208
10260
|
rowKey: "type",
|
|
10209
10261
|
empty: t2("dovetail.empty"),
|
|
10210
10262
|
defaultSize: currentSize,
|
|
10211
10263
|
currentPage,
|
|
10212
|
-
onPageChange
|
|
10264
|
+
onPageChange,
|
|
10265
|
+
onSorterChange,
|
|
10213
10266
|
showMenuColumn: false
|
|
10214
10267
|
}
|
|
10215
10268
|
);
|
|
10216
10269
|
};
|
|
10270
|
+
function download(filename, content) {
|
|
10271
|
+
const element = document.createElement("a");
|
|
10272
|
+
element.setAttribute(
|
|
10273
|
+
"href",
|
|
10274
|
+
"data:text/plain;charset=utf-8," + encodeURIComponent(content)
|
|
10275
|
+
);
|
|
10276
|
+
element.setAttribute("download", filename);
|
|
10277
|
+
element.style.display = "none";
|
|
10278
|
+
document.body.appendChild(element);
|
|
10279
|
+
element.click();
|
|
10280
|
+
document.body.removeChild(element);
|
|
10281
|
+
}
|
|
10282
|
+
function useDownloadYAML() {
|
|
10283
|
+
return function(options) {
|
|
10284
|
+
const { name: name2, item } = options;
|
|
10285
|
+
const content = yaml.dump(item);
|
|
10286
|
+
download(`${name2}.yaml`, content);
|
|
10287
|
+
};
|
|
10288
|
+
}
|
|
10217
10289
|
function useEdit() {
|
|
10218
10290
|
const { resource } = useParsed();
|
|
10219
10291
|
const go = useGo();
|
|
@@ -10292,6 +10364,186 @@ function useOpenForm(options) {
|
|
|
10292
10364
|
}
|
|
10293
10365
|
};
|
|
10294
10366
|
}
|
|
10367
|
+
function K8sDropdown(props) {
|
|
10368
|
+
const { record, size = "normal" } = props;
|
|
10369
|
+
const kit = useUIKit();
|
|
10370
|
+
const { globalStore } = useGlobalStore();
|
|
10371
|
+
const useResourceResult = useResource();
|
|
10372
|
+
const resource = useResourceResult.resource;
|
|
10373
|
+
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
|
|
10374
|
+
(resource == null ? void 0 : resource.name) || ""
|
|
10375
|
+
);
|
|
10376
|
+
const download2 = useDownloadYAML();
|
|
10377
|
+
const { t: t2 } = useTranslation();
|
|
10378
|
+
const openForm = useOpenForm({ id: record.id });
|
|
10379
|
+
const isInShowPage = useResourceResult.action === "show";
|
|
10380
|
+
const { data: canEditData } = useCan({
|
|
10381
|
+
resource: resource == null ? void 0 : resource.name,
|
|
10382
|
+
action: AccessControlAuth.Edit
|
|
10383
|
+
});
|
|
10384
|
+
const { data: canDeleteData } = useCan({
|
|
10385
|
+
resource: resource == null ? void 0 : resource.name,
|
|
10386
|
+
action: AccessControlAuth.Delete
|
|
10387
|
+
});
|
|
10388
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
10389
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10390
|
+
kit.dropdown,
|
|
10391
|
+
{
|
|
10392
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
|
|
10393
|
+
isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10394
|
+
kit.menuItem,
|
|
10395
|
+
{
|
|
10396
|
+
onClick: openForm,
|
|
10397
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
|
|
10398
|
+
}
|
|
10399
|
+
),
|
|
10400
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10401
|
+
kit.menu.Item,
|
|
10402
|
+
{
|
|
10403
|
+
onClick: () => {
|
|
10404
|
+
var _a;
|
|
10405
|
+
if (record.id) {
|
|
10406
|
+
download2({
|
|
10407
|
+
name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
|
|
10408
|
+
item: omit$1((globalStore == null ? void 0 : globalStore.restoreItem(record)) || record, "id")
|
|
10409
|
+
});
|
|
10410
|
+
}
|
|
10411
|
+
},
|
|
10412
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
|
|
10413
|
+
}
|
|
10414
|
+
),
|
|
10415
|
+
props.children,
|
|
10416
|
+
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
|
|
10417
|
+
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10418
|
+
kit.menuItem,
|
|
10419
|
+
{
|
|
10420
|
+
danger: true,
|
|
10421
|
+
onClick: () => {
|
|
10422
|
+
openDeleteConfirmModal(record.id);
|
|
10423
|
+
},
|
|
10424
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: TrashBinDelete16Icon, children: t2("dovetail.delete") })
|
|
10425
|
+
}
|
|
10426
|
+
) : null
|
|
10427
|
+
] }),
|
|
10428
|
+
trigger: ["click"],
|
|
10429
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10430
|
+
kit.button,
|
|
10431
|
+
{
|
|
10432
|
+
type: "quiet",
|
|
10433
|
+
size: size === "large" ? "middle" : "small",
|
|
10434
|
+
prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10435
|
+
Icon$1,
|
|
10436
|
+
{
|
|
10437
|
+
src: MoreEllipsis324BoldSecondaryIcon,
|
|
10438
|
+
hoverSrc: MoreEllipsis324BoldBlueIcon,
|
|
10439
|
+
iconWidth: 24,
|
|
10440
|
+
iconHeight: 24
|
|
10441
|
+
}
|
|
10442
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { src: MoreEllipsis316BoldBlueIcon })
|
|
10443
|
+
}
|
|
10444
|
+
)
|
|
10445
|
+
}
|
|
10446
|
+
),
|
|
10447
|
+
visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
|
|
10448
|
+
] });
|
|
10449
|
+
}
|
|
10450
|
+
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
10451
|
+
ColumnKeys2["age"] = "age";
|
|
10452
|
+
ColumnKeys2["name"] = "name";
|
|
10453
|
+
ColumnKeys2["namespace"] = "namespace";
|
|
10454
|
+
ColumnKeys2["phase"] = "phase";
|
|
10455
|
+
ColumnKeys2["replicas"] = "replicas";
|
|
10456
|
+
ColumnKeys2["deploymentImage"] = "deploymentImage";
|
|
10457
|
+
ColumnKeys2["podImage"] = "podImage";
|
|
10458
|
+
return ColumnKeys2;
|
|
10459
|
+
})(ColumnKeys || {});
|
|
10460
|
+
function addDefaultRenderToColumns(columns) {
|
|
10461
|
+
return columns.map((col) => ({
|
|
10462
|
+
render(value2) {
|
|
10463
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10464
|
+
ValueDisplay,
|
|
10465
|
+
{
|
|
10466
|
+
value: value2
|
|
10467
|
+
}
|
|
10468
|
+
);
|
|
10469
|
+
},
|
|
10470
|
+
...col
|
|
10471
|
+
}));
|
|
10472
|
+
}
|
|
10473
|
+
const useEagleTable = (params) => {
|
|
10474
|
+
var _a, _b, _c;
|
|
10475
|
+
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
10476
|
+
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
10477
|
+
const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
10478
|
+
const { resource } = useResource();
|
|
10479
|
+
const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
|
|
10480
|
+
const useTableParams = useMemo(() => {
|
|
10481
|
+
const mergedParams = merge(params.useTableParams, {
|
|
10482
|
+
pagination: {
|
|
10483
|
+
pageSize: currentSize,
|
|
10484
|
+
mode: "server"
|
|
10485
|
+
}
|
|
10486
|
+
});
|
|
10487
|
+
return mergedParams;
|
|
10488
|
+
}, [params.useTableParams, currentSize]);
|
|
10489
|
+
const finalColumns = useMemo(
|
|
10490
|
+
() => addDefaultRenderToColumns(columns),
|
|
10491
|
+
[columns]
|
|
10492
|
+
);
|
|
10493
|
+
const table = useTable(useTableParams);
|
|
10494
|
+
const onPageChange = useCallback(
|
|
10495
|
+
(page) => {
|
|
10496
|
+
var _a2;
|
|
10497
|
+
setCurrentPage(page);
|
|
10498
|
+
(_a2 = table.setCurrent) == null ? void 0 : _a2.call(table, page || 1);
|
|
10499
|
+
},
|
|
10500
|
+
[setCurrentPage, table]
|
|
10501
|
+
);
|
|
10502
|
+
const onSorterChange = useCallback((order, key2) => {
|
|
10503
|
+
var _a2;
|
|
10504
|
+
const ORDER_MAP = {
|
|
10505
|
+
descend: "desc",
|
|
10506
|
+
ascend: "asc"
|
|
10507
|
+
};
|
|
10508
|
+
const sorters = [{
|
|
10509
|
+
field: (_a2 = columns.find((col) => col.key === key2)) == null ? void 0 : _a2.dataIndex,
|
|
10510
|
+
order: order ? ORDER_MAP[order] : order
|
|
10511
|
+
}];
|
|
10512
|
+
table.setSorters(sorters);
|
|
10513
|
+
}, [table, columns]);
|
|
10514
|
+
const data2 = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data;
|
|
10515
|
+
const total = ((_b = table.tableQueryResult.data) == null ? void 0 : _b.total) || 0;
|
|
10516
|
+
const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
|
|
10517
|
+
const finalProps = {
|
|
10518
|
+
tableKey: (resource == null ? void 0 : resource.name) || "table",
|
|
10519
|
+
loading: table.tableQueryResult.isLoading,
|
|
10520
|
+
data: finalDataSource || [],
|
|
10521
|
+
columns: finalColumns,
|
|
10522
|
+
error: false,
|
|
10523
|
+
rowKey: "id",
|
|
10524
|
+
currentPage,
|
|
10525
|
+
onPageChange,
|
|
10526
|
+
onSorterChange,
|
|
10527
|
+
onSelect: (keys) => {
|
|
10528
|
+
setSelectedKeys(keys);
|
|
10529
|
+
},
|
|
10530
|
+
total,
|
|
10531
|
+
RowMenu: Dropdown,
|
|
10532
|
+
...tableProps,
|
|
10533
|
+
defaultSize: currentSize
|
|
10534
|
+
};
|
|
10535
|
+
useEffect(() => {
|
|
10536
|
+
table.setSorters([{
|
|
10537
|
+
field: "metadata.creationTimestamp",
|
|
10538
|
+
order: "desc"
|
|
10539
|
+
}]);
|
|
10540
|
+
}, []);
|
|
10541
|
+
useEffect(() => {
|
|
10542
|
+
setCurrentPage(1);
|
|
10543
|
+
table.setCurrent(1);
|
|
10544
|
+
}, [(_c = params.useTableParams) == null ? void 0 : _c.filters]);
|
|
10545
|
+
return { tableProps: finalProps, selectedKeys, ...table };
|
|
10546
|
+
};
|
|
10295
10547
|
function CreateButton() {
|
|
10296
10548
|
var _a;
|
|
10297
10549
|
const kit = useUIKit();
|
|
@@ -10405,38 +10657,40 @@ const CronjobJobsTable = ({
|
|
|
10405
10657
|
owner,
|
|
10406
10658
|
hideToolBar
|
|
10407
10659
|
}) => {
|
|
10660
|
+
var _a;
|
|
10408
10661
|
const {
|
|
10409
10662
|
i18n: i18n2
|
|
10410
10663
|
} = useTranslation();
|
|
10411
10664
|
const kit = useUIKit();
|
|
10412
10665
|
const [selectedKeys] = useState([]);
|
|
10413
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
10414
10666
|
const component = useContext(ComponentContext);
|
|
10415
10667
|
const Table$1 = component.Table || Table;
|
|
10416
|
-
const currentSize = 10;
|
|
10417
|
-
const {
|
|
10418
|
-
data: data2,
|
|
10419
|
-
isLoading
|
|
10420
|
-
} = useList({
|
|
10421
|
-
resource: "jobs",
|
|
10422
|
-
meta: {
|
|
10423
|
-
resourceBasePath: "/apis/batch/v1",
|
|
10424
|
-
kind: "Job"
|
|
10425
|
-
},
|
|
10426
|
-
pagination: {
|
|
10427
|
-
mode: "off"
|
|
10428
|
-
}
|
|
10429
|
-
});
|
|
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
10668
|
const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
|
|
10436
10669
|
...WorkloadImageColumnRenderer(i18n2),
|
|
10437
10670
|
width: 238
|
|
10438
10671
|
}, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
|
|
10439
|
-
|
|
10672
|
+
const {
|
|
10673
|
+
tableProps
|
|
10674
|
+
} = useEagleTable({
|
|
10675
|
+
columns,
|
|
10676
|
+
useTableParams: {
|
|
10677
|
+
resource: "jobs",
|
|
10678
|
+
meta: {
|
|
10679
|
+
resourceBasePath: "/apis/batch/v1",
|
|
10680
|
+
kind: "Job"
|
|
10681
|
+
},
|
|
10682
|
+
filters: {
|
|
10683
|
+
permanent: [{
|
|
10684
|
+
field: "",
|
|
10685
|
+
value: "",
|
|
10686
|
+
fn(item) {
|
|
10687
|
+
return owner ? matchOwner(item, owner) : true;
|
|
10688
|
+
}
|
|
10689
|
+
}]
|
|
10690
|
+
}
|
|
10691
|
+
}
|
|
10692
|
+
});
|
|
10693
|
+
if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
|
|
10440
10694
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
10441
10695
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
10442
10696
|
kind: " Job"
|
|
@@ -10451,33 +10705,17 @@ const CronjobJobsTable = ({
|
|
|
10451
10705
|
selectedKeys,
|
|
10452
10706
|
hideCreate: true
|
|
10453
10707
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
|
|
10708
|
+
...tableProps,
|
|
10454
10709
|
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
10710
|
showMenuColumn: false
|
|
10466
10711
|
})]
|
|
10467
10712
|
});
|
|
10468
10713
|
};
|
|
10469
10714
|
const EventsTable = ({}) => {
|
|
10715
|
+
var _a, _b;
|
|
10470
10716
|
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
10717
|
const parsed = useParsed();
|
|
10718
|
+
const [regardingNamespace, regardingName] = (_a = parsed == null ? void 0 : parsed.id) == null ? void 0 : _a.split("/");
|
|
10481
10719
|
const columns = useMemo(
|
|
10482
10720
|
() => [
|
|
10483
10721
|
{
|
|
@@ -10518,15 +10756,36 @@ const EventsTable = ({}) => {
|
|
|
10518
10756
|
],
|
|
10519
10757
|
[i18n2]
|
|
10520
10758
|
);
|
|
10759
|
+
const { tableProps } = useEagleTable({
|
|
10760
|
+
columns,
|
|
10761
|
+
tableProps: {
|
|
10762
|
+
defaultSize: 50
|
|
10763
|
+
},
|
|
10764
|
+
useTableParams: {
|
|
10765
|
+
resource: "events",
|
|
10766
|
+
meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
|
|
10767
|
+
filters: {
|
|
10768
|
+
permanent: [{
|
|
10769
|
+
operator: "and",
|
|
10770
|
+
value: [
|
|
10771
|
+
{
|
|
10772
|
+
field: "regarding.namespace",
|
|
10773
|
+
operator: "eq",
|
|
10774
|
+
value: regardingNamespace
|
|
10775
|
+
},
|
|
10776
|
+
{
|
|
10777
|
+
field: "regarding.name",
|
|
10778
|
+
operator: "eq",
|
|
10779
|
+
value: regardingName
|
|
10780
|
+
}
|
|
10781
|
+
]
|
|
10782
|
+
}]
|
|
10783
|
+
}
|
|
10784
|
+
}
|
|
10785
|
+
});
|
|
10521
10786
|
const component = useContext(ComponentContext);
|
|
10522
10787
|
const Table$1 = component.Table || Table;
|
|
10523
|
-
|
|
10524
|
-
return data2 == null ? void 0 : data2.data.filter((d) => {
|
|
10525
|
-
const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
|
|
10526
|
-
return objectId === parsed.id;
|
|
10527
|
-
});
|
|
10528
|
-
}, [data2 == null ? void 0 : data2.data, parsed]);
|
|
10529
|
-
if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
|
|
10788
|
+
if (!((_b = tableProps.data) == null ? void 0 : _b.length) && !tableProps.loading) {
|
|
10530
10789
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10531
10790
|
WidgetErrorContent,
|
|
10532
10791
|
{
|
|
@@ -10537,17 +10796,8 @@ const EventsTable = ({}) => {
|
|
|
10537
10796
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10538
10797
|
Table$1,
|
|
10539
10798
|
{
|
|
10799
|
+
...tableProps,
|
|
10540
10800
|
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
10801
|
showMenuColumn: false
|
|
10552
10802
|
}
|
|
10553
10803
|
);
|
|
@@ -10560,10 +10810,10 @@ const ImageNames = ({
|
|
|
10560
10810
|
}) => {
|
|
10561
10811
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
10562
10812
|
className: ImageWrapperStyle,
|
|
10563
|
-
children: breakLine ? value2.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
|
|
10813
|
+
children: breakLine ? value2.map((image2, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(OverflowTooltip, {
|
|
10564
10814
|
content: image2,
|
|
10565
10815
|
tooltip: image2
|
|
10566
|
-
}, image2)) : value2.join(", ")
|
|
10816
|
+
}, `${image2}-${index}`)) : value2.join(", ")
|
|
10567
10817
|
});
|
|
10568
10818
|
};
|
|
10569
10819
|
const ResourceLink = (props) => {
|
|
@@ -10591,7 +10841,6 @@ const IngressRulesTable = ({ ingress }) => {
|
|
|
10591
10841
|
}, [ingress.flattenedRules]);
|
|
10592
10842
|
const component = useContext(ComponentContext);
|
|
10593
10843
|
const Table$1 = component.Table || Table;
|
|
10594
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
10595
10844
|
const currentSize = 10;
|
|
10596
10845
|
const columns = [
|
|
10597
10846
|
{
|
|
@@ -10657,6 +10906,15 @@ const IngressRulesTable = ({ ingress }) => {
|
|
|
10657
10906
|
sortable: true
|
|
10658
10907
|
}
|
|
10659
10908
|
];
|
|
10909
|
+
const {
|
|
10910
|
+
data: finalData,
|
|
10911
|
+
currentPage,
|
|
10912
|
+
onPageChange,
|
|
10913
|
+
onSorterChange
|
|
10914
|
+
} = useTableData({
|
|
10915
|
+
columns,
|
|
10916
|
+
data: rows
|
|
10917
|
+
});
|
|
10660
10918
|
if ((rows == null ? void 0 : rows.length) === 0) {
|
|
10661
10919
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10662
10920
|
WidgetErrorContent,
|
|
@@ -10672,14 +10930,15 @@ const IngressRulesTable = ({ ingress }) => {
|
|
|
10672
10930
|
{
|
|
10673
10931
|
tableKey: "ingressRules",
|
|
10674
10932
|
loading: false,
|
|
10675
|
-
data:
|
|
10933
|
+
data: finalData,
|
|
10676
10934
|
total: rows.length,
|
|
10677
10935
|
columns: addDefaultRenderToColumns(columns),
|
|
10678
10936
|
rowKey: "pathType",
|
|
10679
10937
|
empty: t2("dovetail.empty"),
|
|
10680
10938
|
defaultSize: currentSize,
|
|
10681
10939
|
currentPage,
|
|
10682
|
-
onPageChange
|
|
10940
|
+
onPageChange,
|
|
10941
|
+
onSorterChange,
|
|
10683
10942
|
showMenuColumn: false
|
|
10684
10943
|
}
|
|
10685
10944
|
);
|
|
@@ -10758,109 +11017,6 @@ function KeyValueAnnotation(props) {
|
|
|
10758
11017
|
}) : null]
|
|
10759
11018
|
});
|
|
10760
11019
|
}
|
|
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
11020
|
function Tabs(props) {
|
|
10865
11021
|
const { tabs, className } = props;
|
|
10866
11022
|
const kit = useUIKit();
|
|
@@ -10904,7 +11060,8 @@ const ShowContent = (props) => {
|
|
|
10904
11060
|
const {
|
|
10905
11061
|
showConfig,
|
|
10906
11062
|
formatter,
|
|
10907
|
-
Dropdown = K8sDropdown
|
|
11063
|
+
Dropdown = K8sDropdown,
|
|
11064
|
+
data: data2
|
|
10908
11065
|
} = props;
|
|
10909
11066
|
const kit = useUIKit();
|
|
10910
11067
|
const parsed = useParsed();
|
|
@@ -10912,17 +11069,9 @@ const ShowContent = (props) => {
|
|
|
10912
11069
|
resource
|
|
10913
11070
|
} = useResource();
|
|
10914
11071
|
const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
|
|
10915
|
-
const {
|
|
10916
|
-
queryResult
|
|
10917
|
-
} = useShow({
|
|
10918
|
-
id
|
|
10919
|
-
});
|
|
10920
11072
|
const {
|
|
10921
11073
|
t: t2
|
|
10922
11074
|
} = useTranslation();
|
|
10923
|
-
const {
|
|
10924
|
-
data: data2
|
|
10925
|
-
} = queryResult;
|
|
10926
11075
|
const navigation = useNavigation();
|
|
10927
11076
|
const go = useGo();
|
|
10928
11077
|
const openForm = useOpenForm({
|
|
@@ -11108,32 +11257,15 @@ const WorkloadPodsTable = ({
|
|
|
11108
11257
|
selector,
|
|
11109
11258
|
hideToolbar
|
|
11110
11259
|
}) => {
|
|
11260
|
+
var _a;
|
|
11111
11261
|
const {
|
|
11112
11262
|
i18n: i18n2
|
|
11113
11263
|
} = useTranslation();
|
|
11114
11264
|
const kit = useUIKit();
|
|
11115
11265
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
11116
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
11117
11266
|
const component = useContext(ComponentContext);
|
|
11118
11267
|
const Table$1 = component.Table || Table;
|
|
11119
11268
|
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
11269
|
const columns = [NameColumnRenderer(i18n2, "pods"), StateDisplayColumnRenderer(i18n2), {
|
|
11138
11270
|
key: "ip",
|
|
11139
11271
|
display: true,
|
|
@@ -11142,7 +11274,28 @@ const WorkloadPodsTable = ({
|
|
|
11142
11274
|
sortable: true,
|
|
11143
11275
|
width: 160
|
|
11144
11276
|
}, NodeNameColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), PodContainersNumColumnRenderer(i18n2), RestartCountColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
|
|
11145
|
-
|
|
11277
|
+
const {
|
|
11278
|
+
tableProps
|
|
11279
|
+
} = useEagleTable({
|
|
11280
|
+
columns,
|
|
11281
|
+
useTableParams: {
|
|
11282
|
+
resource: "pods",
|
|
11283
|
+
meta: {
|
|
11284
|
+
resourceBasePath: "/api/v1",
|
|
11285
|
+
kind: "Pod"
|
|
11286
|
+
},
|
|
11287
|
+
filters: {
|
|
11288
|
+
permanent: [{
|
|
11289
|
+
field: "",
|
|
11290
|
+
value: "",
|
|
11291
|
+
fn(item) {
|
|
11292
|
+
return selector ? matchSelector(item, selector) : true;
|
|
11293
|
+
}
|
|
11294
|
+
}]
|
|
11295
|
+
}
|
|
11296
|
+
}
|
|
11297
|
+
});
|
|
11298
|
+
if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
|
|
11146
11299
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
11147
11300
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
11148
11301
|
kind: ` ${i18n2.t("dovetail.pod")}`
|
|
@@ -11160,18 +11313,10 @@ const WorkloadPodsTable = ({
|
|
|
11160
11313
|
selectedKeys,
|
|
11161
11314
|
hideCreate: true
|
|
11162
11315
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
|
|
11316
|
+
...tableProps,
|
|
11163
11317
|
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
11318
|
onSelect: (keys) => setSelectedKeys(keys),
|
|
11169
|
-
rowKey: "id",
|
|
11170
|
-
error: false,
|
|
11171
|
-
currentPage,
|
|
11172
|
-
onPageChange: (p) => setCurrentPage(p),
|
|
11173
11319
|
defaultSize: currentSize,
|
|
11174
|
-
refetch: () => null,
|
|
11175
11320
|
showMenuColumn: false
|
|
11176
11321
|
})]
|
|
11177
11322
|
});
|
|
@@ -17363,7 +17508,7 @@ const PodLog = ({
|
|
|
17363
17508
|
const kit = useUIKit();
|
|
17364
17509
|
const [selectedContainer, setSelectedContainer] = useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
|
|
17365
17510
|
const [logs, setLogs] = useState([]);
|
|
17366
|
-
const [logType, setLogType] = useState();
|
|
17511
|
+
const [logType, setLogType] = useState("realtime");
|
|
17367
17512
|
const [currentItemCount, setCurrentItemCount] = useState(0);
|
|
17368
17513
|
const [paused, setPaused] = useState(false);
|
|
17369
17514
|
const [wrap2, setWrap] = useState(false);
|
|
@@ -17400,30 +17545,20 @@ const PodLog = ({
|
|
|
17400
17545
|
}
|
|
17401
17546
|
}
|
|
17402
17547
|
};
|
|
17403
|
-
const
|
|
17404
|
-
var _a2, _b2;
|
|
17405
|
-
if (!selectedContainer) {
|
|
17406
|
-
return;
|
|
17407
|
-
}
|
|
17548
|
+
const fetchLogsByUrl = useCallback(async (url) => {
|
|
17408
17549
|
abortControllerRef.current = new AbortController();
|
|
17409
17550
|
const {
|
|
17410
17551
|
signal
|
|
17411
17552
|
} = 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}×tamps=true`;
|
|
17413
|
-
if (logType === "realtime") {
|
|
17414
|
-
url += "&follow=true";
|
|
17415
|
-
} else if (logType === "previous") {
|
|
17416
|
-
url += "&previous=true";
|
|
17417
|
-
}
|
|
17418
17553
|
fetch(url, {
|
|
17419
17554
|
signal
|
|
17420
|
-
}).then((response) => {
|
|
17421
|
-
var
|
|
17555
|
+
}).then(async (response) => {
|
|
17556
|
+
var _a2;
|
|
17422
17557
|
if (response.status !== 200) {
|
|
17423
17558
|
setLogs([]);
|
|
17424
17559
|
return;
|
|
17425
17560
|
}
|
|
17426
|
-
const reader = (
|
|
17561
|
+
const reader = (_a2 = response.body) == null ? void 0 : _a2.getReader();
|
|
17427
17562
|
if (!reader) {
|
|
17428
17563
|
return;
|
|
17429
17564
|
}
|
|
@@ -17456,7 +17591,19 @@ const PodLog = ({
|
|
|
17456
17591
|
};
|
|
17457
17592
|
reader.read().then(processChunk);
|
|
17458
17593
|
});
|
|
17459
|
-
}, [
|
|
17594
|
+
}, []);
|
|
17595
|
+
const fetchLogs = useCallback(async () => {
|
|
17596
|
+
var _a2, _b2;
|
|
17597
|
+
if (!selectedContainer) {
|
|
17598
|
+
return;
|
|
17599
|
+
}
|
|
17600
|
+
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}×tamps=true`;
|
|
17601
|
+
if (logType === "realtime") {
|
|
17602
|
+
fetchLogsByUrl(`${url}&follow=true`);
|
|
17603
|
+
} else if (logType === "previous") {
|
|
17604
|
+
fetchLogsByUrl(`${url}&previous=true`);
|
|
17605
|
+
}
|
|
17606
|
+
}, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl, fetchLogsByUrl]);
|
|
17460
17607
|
const stopFetchingLogs = useCallback(() => {
|
|
17461
17608
|
if (abortControllerRef.current) {
|
|
17462
17609
|
abortControllerRef.current.abort();
|
|
@@ -17778,7 +17925,6 @@ const PodContainersTable = ({
|
|
|
17778
17925
|
const { i18n: i18n2 } = useTranslation();
|
|
17779
17926
|
const component = useContext(ComponentContext);
|
|
17780
17927
|
const Table$1 = component.Table || Table;
|
|
17781
|
-
const [currentPage, setCurrentPage] = useState(1);
|
|
17782
17928
|
const currentSize = 10;
|
|
17783
17929
|
const columns = useMemo(
|
|
17784
17930
|
() => [
|
|
@@ -17835,10 +17981,11 @@ const PodContainersTable = ({
|
|
|
17835
17981
|
sortable: true,
|
|
17836
17982
|
sorter: CommonSorter(["state", "running", "startedAt"]),
|
|
17837
17983
|
width: 120,
|
|
17838
|
-
render: (
|
|
17984
|
+
render: (_, record) => {
|
|
17985
|
+
const value2 = get$3(record, ["state", "running", "startedAt"]) || get$3(record, ["state", "terminated", "startedAt"]);
|
|
17839
17986
|
if (value2)
|
|
17840
17987
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
|
|
17841
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17988
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
|
|
17842
17989
|
}
|
|
17843
17990
|
}
|
|
17844
17991
|
],
|
|
@@ -17848,6 +17995,19 @@ const PodContainersTable = ({
|
|
|
17848
17995
|
() => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
|
|
17849
17996
|
[containerStatuses, initContainerStatuses]
|
|
17850
17997
|
);
|
|
17998
|
+
const {
|
|
17999
|
+
data: finalData,
|
|
18000
|
+
currentPage,
|
|
18001
|
+
onPageChange,
|
|
18002
|
+
onSorterChange
|
|
18003
|
+
} = useTableData({
|
|
18004
|
+
data: dataSource,
|
|
18005
|
+
columns,
|
|
18006
|
+
defaultSorters: [{
|
|
18007
|
+
field: "state.running.startedAt",
|
|
18008
|
+
order: "desc"
|
|
18009
|
+
}]
|
|
18010
|
+
});
|
|
17851
18011
|
if (dataSource.length === 0) {
|
|
17852
18012
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17853
18013
|
WidgetErrorContent,
|
|
@@ -17863,14 +18023,15 @@ const PodContainersTable = ({
|
|
|
17863
18023
|
{
|
|
17864
18024
|
tableKey: "podContainers",
|
|
17865
18025
|
loading: false,
|
|
17866
|
-
data:
|
|
18026
|
+
data: finalData,
|
|
17867
18027
|
total: dataSource.length,
|
|
17868
18028
|
columns: addDefaultRenderToColumns(columns),
|
|
17869
18029
|
rowKey: "containerID",
|
|
17870
18030
|
error: false,
|
|
17871
18031
|
defaultSize: currentSize,
|
|
17872
18032
|
currentPage,
|
|
17873
|
-
onPageChange
|
|
18033
|
+
onPageChange,
|
|
18034
|
+
onSorterChange,
|
|
17874
18035
|
showMenuColumn: false
|
|
17875
18036
|
}
|
|
17876
18037
|
);
|
|
@@ -18039,11 +18200,11 @@ const PageShow = (props) => {
|
|
|
18039
18200
|
retry: 1
|
|
18040
18201
|
},
|
|
18041
18202
|
errorNotification: () => {
|
|
18042
|
-
var _a2;
|
|
18203
|
+
var _a2, _b;
|
|
18043
18204
|
return {
|
|
18044
18205
|
message: i18n2.t("dovetail.fail_get_detail", {
|
|
18045
|
-
resource: resource == null ? void 0 : resource.
|
|
18046
|
-
name: (
|
|
18206
|
+
resource: (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind,
|
|
18207
|
+
name: (_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id,
|
|
18047
18208
|
interpolation: { escapeValue: false }
|
|
18048
18209
|
}),
|
|
18049
18210
|
description: "Error",
|
|
@@ -18051,13 +18212,13 @@ const PageShow = (props) => {
|
|
|
18051
18212
|
};
|
|
18052
18213
|
}
|
|
18053
18214
|
});
|
|
18054
|
-
const { isLoading, isError } = queryResult;
|
|
18215
|
+
const { isLoading, isError, data: data2 } = queryResult;
|
|
18055
18216
|
useEffect(() => {
|
|
18056
18217
|
if (isError && resource) {
|
|
18057
18218
|
nav.list(resource);
|
|
18058
18219
|
}
|
|
18059
18220
|
}, [isError, nav, resource]);
|
|
18060
|
-
return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
|
|
18221
|
+
return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 });
|
|
18061
18222
|
};
|
|
18062
18223
|
const index_17v8shn = "";
|
|
18063
18224
|
const WrapperStyle$1 = "w1akirqw";
|
|
@@ -18437,11 +18598,11 @@ const NamespacesFilter = ({
|
|
|
18437
18598
|
onClick: () => {
|
|
18438
18599
|
setOpen(!open);
|
|
18439
18600
|
},
|
|
18440
|
-
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.
|
|
18601
|
+
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18441
18602
|
style: {
|
|
18442
18603
|
marginLeft: 8
|
|
18443
18604
|
},
|
|
18444
|
-
children:
|
|
18605
|
+
children: label2
|
|
18445
18606
|
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
18446
18607
|
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
18447
18608
|
closable,
|
|
@@ -18506,6 +18667,21 @@ const NamespacesFilter = ({
|
|
|
18506
18667
|
})
|
|
18507
18668
|
});
|
|
18508
18669
|
};
|
|
18670
|
+
function useNamespaceFilter() {
|
|
18671
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
18672
|
+
return {
|
|
18673
|
+
permanent: [
|
|
18674
|
+
{
|
|
18675
|
+
operator: "or",
|
|
18676
|
+
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
18677
|
+
field: "metadata.namespace",
|
|
18678
|
+
operator: "eq",
|
|
18679
|
+
value: filter
|
|
18680
|
+
}))
|
|
18681
|
+
}
|
|
18682
|
+
]
|
|
18683
|
+
};
|
|
18684
|
+
}
|
|
18509
18685
|
const index_hp158y = "";
|
|
18510
18686
|
const ListPageStyle = "laykzsq";
|
|
18511
18687
|
const ListContentStyle = "l1ng0psc";
|
|
@@ -18570,8 +18746,11 @@ function ResourceList(props) {
|
|
|
18570
18746
|
const { formatter, columns, Dropdown, noShow } = props.config;
|
|
18571
18747
|
const { i18n: i18n2 } = useTranslation();
|
|
18572
18748
|
const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
|
|
18749
|
+
const filters = useNamespaceFilter();
|
|
18573
18750
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
18574
|
-
useTableParams: {
|
|
18751
|
+
useTableParams: {
|
|
18752
|
+
filters
|
|
18753
|
+
},
|
|
18575
18754
|
columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
|
|
18576
18755
|
tableProps: {
|
|
18577
18756
|
defaultSize: 50,
|
|
@@ -21894,6 +22073,7 @@ const RefineFormContent = (props) => {
|
|
|
21894
22073
|
}
|
|
21895
22074
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Form.Item, {
|
|
21896
22075
|
label: c2.label,
|
|
22076
|
+
colon: false,
|
|
21897
22077
|
labelCol: {
|
|
21898
22078
|
flex: "0 0 216px"
|
|
21899
22079
|
},
|
|
@@ -22597,7 +22777,7 @@ const Separator = () => {
|
|
|
22597
22777
|
});
|
|
22598
22778
|
};
|
|
22599
22779
|
const MonacoYamlEditor = React__default.lazy(() => Promise.resolve().then(() => MonacoYamlEditor$2));
|
|
22600
|
-
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-
|
|
22780
|
+
const MonacoYamlDiffEditor = React__default.lazy(() => import("./MonacoYamlDiffEditor-a0787f8d.js"));
|
|
22601
22781
|
const YamlEditorComponent = forwardRef(
|
|
22602
22782
|
function YamlEditorComponent2(props, ref) {
|
|
22603
22783
|
const {
|
|
@@ -23666,7 +23846,7 @@ const DrawerShow = (props) => {
|
|
|
23666
23846
|
const parsed = useParsed();
|
|
23667
23847
|
const nav = useNavigation();
|
|
23668
23848
|
const { queryResult } = useShow({ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id });
|
|
23669
|
-
const { isLoading } = queryResult;
|
|
23849
|
+
const { isLoading, data: data2 } = queryResult;
|
|
23670
23850
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23671
23851
|
Drawer,
|
|
23672
23852
|
{
|
|
@@ -23675,7 +23855,7 @@ const DrawerShow = (props) => {
|
|
|
23675
23855
|
onClose: () => nav.goBack(),
|
|
23676
23856
|
width: "50%",
|
|
23677
23857
|
visible: !!((_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id),
|
|
23678
|
-
children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props })
|
|
23858
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 })
|
|
23679
23859
|
}
|
|
23680
23860
|
);
|
|
23681
23861
|
};
|
|
@@ -23703,7 +23883,7 @@ const ReferenceLink = (props) => {
|
|
|
23703
23883
|
}
|
|
23704
23884
|
const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
|
|
23705
23885
|
if (!resource) {
|
|
23706
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23886
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
|
|
23707
23887
|
}
|
|
23708
23888
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23709
23889
|
ResourceLink,
|
|
@@ -23926,17 +24106,8 @@ const AgeColumnRenderer = (i18n2, config, {
|
|
|
23926
24106
|
display: true,
|
|
23927
24107
|
dataIndex,
|
|
23928
24108
|
title: i18n2.t("dovetail.created_time"),
|
|
23929
|
-
sortable: true,
|
|
23930
24109
|
width: 120,
|
|
23931
|
-
sorter:
|
|
23932
|
-
const valA = new Date(lodashExports.get(a2, dataIndex));
|
|
23933
|
-
const valB = new Date(lodashExports.get(b, dataIndex));
|
|
23934
|
-
if (valA === valB)
|
|
23935
|
-
return 0;
|
|
23936
|
-
if (valA > valB)
|
|
23937
|
-
return 1;
|
|
23938
|
-
return -1;
|
|
23939
|
-
},
|
|
24110
|
+
sorter: true,
|
|
23940
24111
|
render: (value2) => {
|
|
23941
24112
|
return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
|
|
23942
24113
|
date: new Date(value2)
|
|
@@ -23974,7 +24145,7 @@ const RestartCountColumnRenderer = (i18n2) => {
|
|
|
23974
24145
|
};
|
|
23975
24146
|
};
|
|
23976
24147
|
const CompletionsCountColumnRenderer = (i18n2) => {
|
|
23977
|
-
const dataIndex = ["
|
|
24148
|
+
const dataIndex = ["succeeded"];
|
|
23978
24149
|
return {
|
|
23979
24150
|
key: "completions",
|
|
23980
24151
|
display: true,
|
|
@@ -23989,7 +24160,12 @@ const CompletionsCountColumnRenderer = (i18n2) => {
|
|
|
23989
24160
|
sortable: true,
|
|
23990
24161
|
width: 120,
|
|
23991
24162
|
align: "right",
|
|
23992
|
-
sorter: CommonSorter(dataIndex)
|
|
24163
|
+
sorter: CommonSorter(dataIndex),
|
|
24164
|
+
render: (_, record) => {
|
|
24165
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
24166
|
+
children: record.completionsDisplay
|
|
24167
|
+
});
|
|
24168
|
+
}
|
|
23993
24169
|
};
|
|
23994
24170
|
};
|
|
23995
24171
|
const DurationColumnRenderer = (i18n2) => {
|
|
@@ -24283,91 +24459,6 @@ const PortMappingColumnRenderer = (i18n2) => {
|
|
|
24283
24459
|
}
|
|
24284
24460
|
};
|
|
24285
24461
|
};
|
|
24286
|
-
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
24287
|
-
ColumnKeys2["age"] = "age";
|
|
24288
|
-
ColumnKeys2["name"] = "name";
|
|
24289
|
-
ColumnKeys2["namespace"] = "namespace";
|
|
24290
|
-
ColumnKeys2["phase"] = "phase";
|
|
24291
|
-
ColumnKeys2["replicas"] = "replicas";
|
|
24292
|
-
ColumnKeys2["deploymentImage"] = "deploymentImage";
|
|
24293
|
-
ColumnKeys2["podImage"] = "podImage";
|
|
24294
|
-
return ColumnKeys2;
|
|
24295
|
-
})(ColumnKeys || {});
|
|
24296
|
-
function addDefaultRenderToColumns(columns) {
|
|
24297
|
-
return columns.map((col) => ({
|
|
24298
|
-
render(value2) {
|
|
24299
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
24300
|
-
ValueDisplay,
|
|
24301
|
-
{
|
|
24302
|
-
value: value2
|
|
24303
|
-
}
|
|
24304
|
-
);
|
|
24305
|
-
},
|
|
24306
|
-
...col
|
|
24307
|
-
}));
|
|
24308
|
-
}
|
|
24309
|
-
const useEagleTable = (params) => {
|
|
24310
|
-
var _a, _b, _c;
|
|
24311
|
-
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
24312
|
-
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
24313
|
-
const [currentPage, setCurrentPage] = useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
24314
|
-
const { resource } = useResource();
|
|
24315
|
-
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
24316
|
-
const useTableParams = useMemo(() => {
|
|
24317
|
-
const mergedParams = merge(params.useTableParams, {
|
|
24318
|
-
pagination: {
|
|
24319
|
-
mode: "off"
|
|
24320
|
-
},
|
|
24321
|
-
filters: {
|
|
24322
|
-
permanent: [
|
|
24323
|
-
{
|
|
24324
|
-
operator: "or",
|
|
24325
|
-
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
24326
|
-
field: "metadata.namespace",
|
|
24327
|
-
operator: "eq",
|
|
24328
|
-
value: filter
|
|
24329
|
-
}))
|
|
24330
|
-
}
|
|
24331
|
-
]
|
|
24332
|
-
}
|
|
24333
|
-
});
|
|
24334
|
-
return mergedParams;
|
|
24335
|
-
}, [params.useTableParams, nsFilters]);
|
|
24336
|
-
const finalColumns = useMemo(
|
|
24337
|
-
() => addDefaultRenderToColumns(columns),
|
|
24338
|
-
[columns]
|
|
24339
|
-
);
|
|
24340
|
-
const table = useTable(useTableParams);
|
|
24341
|
-
const onPageChange = useCallback(
|
|
24342
|
-
(page) => {
|
|
24343
|
-
setCurrentPage(page);
|
|
24344
|
-
},
|
|
24345
|
-
[setCurrentPage]
|
|
24346
|
-
);
|
|
24347
|
-
const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
|
|
24348
|
-
const data2 = (_b = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.slice((currentPage - 1) * currentSize, currentPage * currentSize);
|
|
24349
|
-
const total = ((_c = table.tableQueryResult.data) == null ? void 0 : _c.data.length) || 0;
|
|
24350
|
-
const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
|
|
24351
|
-
const finalProps = {
|
|
24352
|
-
tableKey: (resource == null ? void 0 : resource.name) || "table",
|
|
24353
|
-
loading: table.tableQueryResult.isLoading,
|
|
24354
|
-
data: finalDataSource || [],
|
|
24355
|
-
columns: finalColumns,
|
|
24356
|
-
refetch: () => null,
|
|
24357
|
-
error: false,
|
|
24358
|
-
rowKey: "id",
|
|
24359
|
-
currentPage,
|
|
24360
|
-
onPageChange,
|
|
24361
|
-
onSelect: (keys) => {
|
|
24362
|
-
setSelectedKeys(keys);
|
|
24363
|
-
},
|
|
24364
|
-
total,
|
|
24365
|
-
RowMenu: Dropdown,
|
|
24366
|
-
...tableProps,
|
|
24367
|
-
defaultSize: currentSize
|
|
24368
|
-
};
|
|
24369
|
-
return { tableProps: finalProps, selectedKeys, ...table };
|
|
24370
|
-
};
|
|
24371
24462
|
const styles = "";
|
|
24372
24463
|
const Dovetail = (props) => {
|
|
24373
24464
|
const {
|
|
@@ -24420,7 +24511,10 @@ const Dovetail = (props) => {
|
|
|
24420
24511
|
options: {
|
|
24421
24512
|
warnWhenUnsavedChanges: true,
|
|
24422
24513
|
liveMode: "auto",
|
|
24423
|
-
disableTelemetry: true
|
|
24514
|
+
disableTelemetry: true,
|
|
24515
|
+
overtime: {
|
|
24516
|
+
interval: Number.MAX_SAFE_INTEGER
|
|
24517
|
+
}
|
|
24424
24518
|
},
|
|
24425
24519
|
accessControlProvider,
|
|
24426
24520
|
resources: resourcesConfig.map((c2) => {
|