@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
package/dist/refine.umd.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(function(global2, factory) {
|
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd")
|
|
3
|
-
})(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd
|
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("i18next"), require("@refinedev/core"), require("qs"), require("react"), require("react-router-dom"), require("@cloudtower/eagle"), require("@cloudtower/icons-react"), require("lodash-es"), require("js-yaml"), require("k8s-api-provider"), require("monaco-editor"), require("monaco-yaml"), require("react-dom"), require("sunflower-antd"), require("antd")) : typeof define === "function" && define.amd ? define(["exports", "i18next", "@refinedev/core", "qs", "react", "react-router-dom", "@cloudtower/eagle", "@cloudtower/icons-react", "lodash-es", "js-yaml", "k8s-api-provider", "monaco-editor", "monaco-yaml", "react-dom", "sunflower-antd", "antd"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.dovetail = {}, global2.i18n, global2.core, global2.qs, global2.React, global2.reactRouterDom, global2.eagle, global2.iconsReact, global2.lodashEs, global2.yaml, global2.k8sApiProvider, global2.monaco, global2.monacoYaml, global2.ReactDOM, global2.sunflowerAntd, global2.antd));
|
|
3
|
+
})(this, function(exports2, i18n, core, qs, React, reactRouterDom, eagle, iconsReact, lodashEs, yaml, k8sApiProvider, monaco, monacoYaml, ReactDOM, sunflowerAntd, antd) {
|
|
4
4
|
"use strict";var __defProp = Object.defineProperty;
|
|
5
5
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
6
|
var __publicField = (obj, key, value) => {
|
|
@@ -8624,7 +8624,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8624
8624
|
} = props;
|
|
8625
8625
|
const auxiliaryLineRef = React.useRef(null);
|
|
8626
8626
|
const wrapperRef = React.useRef(null);
|
|
8627
|
-
|
|
8627
|
+
React.useMemo(() => ({
|
|
8628
8628
|
current: currentPage,
|
|
8629
8629
|
pageSize: defaultSize,
|
|
8630
8630
|
onChange: onPageChange
|
|
@@ -8671,7 +8671,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8671
8671
|
tableLayout: "fixed",
|
|
8672
8672
|
columns: finalColumns,
|
|
8673
8673
|
dataSource,
|
|
8674
|
-
pagination,
|
|
8675
8674
|
error,
|
|
8676
8675
|
loading,
|
|
8677
8676
|
rowKey,
|
|
@@ -8689,11 +8688,38 @@ var __publicField = (obj, key, value) => {
|
|
|
8689
8688
|
});
|
|
8690
8689
|
}
|
|
8691
8690
|
const ComponentContext = React.createContext({});
|
|
8691
|
+
function useTableData({ data: data2, columns, pageSize = 10, defaultSorters }) {
|
|
8692
|
+
const [currentPage, setCurrentPage] = React.useState(1);
|
|
8693
|
+
const [sorters, setSorters] = React.useState(defaultSorters || []);
|
|
8694
|
+
const onSorterChange = React.useCallback((order, key2) => {
|
|
8695
|
+
var _a;
|
|
8696
|
+
const ORDER_MAP = {
|
|
8697
|
+
descend: "desc",
|
|
8698
|
+
ascend: "asc"
|
|
8699
|
+
};
|
|
8700
|
+
const sorters2 = [{
|
|
8701
|
+
field: (_a = columns.find((col) => col.key === key2)) == null ? void 0 : _a.dataIndex,
|
|
8702
|
+
order: order ? ORDER_MAP[order] : order
|
|
8703
|
+
}];
|
|
8704
|
+
setSorters(sorters2);
|
|
8705
|
+
}, [columns]);
|
|
8706
|
+
return {
|
|
8707
|
+
data: k8sApiProvider.paginateData(
|
|
8708
|
+
{
|
|
8709
|
+
pageSize,
|
|
8710
|
+
current: currentPage
|
|
8711
|
+
},
|
|
8712
|
+
k8sApiProvider.sortData(sorters, data2)
|
|
8713
|
+
),
|
|
8714
|
+
currentPage,
|
|
8715
|
+
onPageChange: setCurrentPage,
|
|
8716
|
+
onSorterChange
|
|
8717
|
+
};
|
|
8718
|
+
}
|
|
8692
8719
|
const PodSelectorTable = ({ podSelectors = {} }) => {
|
|
8693
8720
|
const { t: t2 } = useTranslation();
|
|
8694
8721
|
const component = React.useContext(ComponentContext);
|
|
8695
8722
|
const Table$1 = component.Table || Table;
|
|
8696
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
8697
8723
|
const currentSize = 10;
|
|
8698
8724
|
const datas = Object.keys(podSelectors).map((key2) => ({
|
|
8699
8725
|
id: key2,
|
|
@@ -8718,6 +8744,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8718
8744
|
width: "50%"
|
|
8719
8745
|
}
|
|
8720
8746
|
];
|
|
8747
|
+
const {
|
|
8748
|
+
data: finalData,
|
|
8749
|
+
currentPage,
|
|
8750
|
+
onPageChange,
|
|
8751
|
+
onSorterChange
|
|
8752
|
+
} = useTableData({
|
|
8753
|
+
data: datas,
|
|
8754
|
+
columns
|
|
8755
|
+
});
|
|
8721
8756
|
if (datas.length === 0) {
|
|
8722
8757
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8723
8758
|
WidgetErrorContent,
|
|
@@ -8733,14 +8768,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8733
8768
|
{
|
|
8734
8769
|
tableKey: "podSelector",
|
|
8735
8770
|
loading: false,
|
|
8736
|
-
data:
|
|
8771
|
+
data: finalData,
|
|
8737
8772
|
total: datas.length,
|
|
8738
8773
|
columns: addDefaultRenderToColumns(columns),
|
|
8739
8774
|
rowKey: "key",
|
|
8740
8775
|
empty: t2("dovetail.empty"),
|
|
8741
8776
|
defaultSize: currentSize,
|
|
8742
8777
|
currentPage,
|
|
8743
|
-
onPageChange
|
|
8778
|
+
onPageChange,
|
|
8779
|
+
onSorterChange,
|
|
8744
8780
|
showMenuColumn: false
|
|
8745
8781
|
}
|
|
8746
8782
|
);
|
|
@@ -8749,7 +8785,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8749
8785
|
const { t: t2 } = useTranslation();
|
|
8750
8786
|
const component = React.useContext(ComponentContext);
|
|
8751
8787
|
const Table$1 = component.Table || Table;
|
|
8752
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
8753
8788
|
const currentSize = 10;
|
|
8754
8789
|
const columns = [
|
|
8755
8790
|
{
|
|
@@ -8797,6 +8832,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8797
8832
|
...port2,
|
|
8798
8833
|
id: port2.name || ""
|
|
8799
8834
|
}));
|
|
8835
|
+
const {
|
|
8836
|
+
data: finalData,
|
|
8837
|
+
currentPage,
|
|
8838
|
+
onPageChange,
|
|
8839
|
+
onSorterChange
|
|
8840
|
+
} = useTableData({
|
|
8841
|
+
data: ports,
|
|
8842
|
+
columns
|
|
8843
|
+
});
|
|
8800
8844
|
if ((ports == null ? void 0 : ports.length) === 0) {
|
|
8801
8845
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
8802
8846
|
WidgetErrorContent,
|
|
@@ -8812,14 +8856,15 @@ var __publicField = (obj, key, value) => {
|
|
|
8812
8856
|
{
|
|
8813
8857
|
tableKey: "ports",
|
|
8814
8858
|
loading: false,
|
|
8815
|
-
data:
|
|
8859
|
+
data: finalData,
|
|
8816
8860
|
total: ports.length,
|
|
8817
8861
|
columns: addDefaultRenderToColumns(columns),
|
|
8818
8862
|
rowKey: "name",
|
|
8819
8863
|
empty: t2("dovetail.empty"),
|
|
8820
8864
|
defaultSize: currentSize,
|
|
8821
8865
|
currentPage,
|
|
8822
|
-
onPageChange
|
|
8866
|
+
onPageChange,
|
|
8867
|
+
onSorterChange,
|
|
8823
8868
|
showMenuColumn: false
|
|
8824
8869
|
}
|
|
8825
8870
|
);
|
|
@@ -10133,11 +10178,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10133
10178
|
});
|
|
10134
10179
|
};
|
|
10135
10180
|
const ConditionsTable = ({ conditions = [] }) => {
|
|
10136
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
10137
10181
|
const { t: t2 } = useTranslation();
|
|
10138
10182
|
const component = React.useContext(ComponentContext);
|
|
10139
10183
|
const Table$1 = component.Table || Table;
|
|
10140
|
-
const currentSize = 10;
|
|
10141
10184
|
const conditionsWithId = addId(conditions, "type");
|
|
10142
10185
|
const columns = [
|
|
10143
10186
|
{
|
|
@@ -10193,6 +10236,15 @@ var __publicField = (obj, key, value) => {
|
|
|
10193
10236
|
width: 403
|
|
10194
10237
|
}
|
|
10195
10238
|
];
|
|
10239
|
+
const { data: finalData, currentPage, onPageChange, onSorterChange } = useTableData({
|
|
10240
|
+
data: conditionsWithId,
|
|
10241
|
+
columns,
|
|
10242
|
+
defaultSorters: [{
|
|
10243
|
+
field: "lastUpdateTime",
|
|
10244
|
+
order: "desc"
|
|
10245
|
+
}]
|
|
10246
|
+
});
|
|
10247
|
+
const currentSize = 10;
|
|
10196
10248
|
if (conditionsWithId.length === 0) {
|
|
10197
10249
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10198
10250
|
WidgetErrorContent,
|
|
@@ -10208,18 +10260,38 @@ var __publicField = (obj, key, value) => {
|
|
|
10208
10260
|
{
|
|
10209
10261
|
tableKey: "condition",
|
|
10210
10262
|
loading: false,
|
|
10211
|
-
data:
|
|
10263
|
+
data: finalData,
|
|
10212
10264
|
total: conditionsWithId.length,
|
|
10213
10265
|
columns: addDefaultRenderToColumns(columns),
|
|
10214
10266
|
rowKey: "type",
|
|
10215
10267
|
empty: t2("dovetail.empty"),
|
|
10216
10268
|
defaultSize: currentSize,
|
|
10217
10269
|
currentPage,
|
|
10218
|
-
onPageChange
|
|
10270
|
+
onPageChange,
|
|
10271
|
+
onSorterChange,
|
|
10219
10272
|
showMenuColumn: false
|
|
10220
10273
|
}
|
|
10221
10274
|
);
|
|
10222
10275
|
};
|
|
10276
|
+
function download(filename, content) {
|
|
10277
|
+
const element = document.createElement("a");
|
|
10278
|
+
element.setAttribute(
|
|
10279
|
+
"href",
|
|
10280
|
+
"data:text/plain;charset=utf-8," + encodeURIComponent(content)
|
|
10281
|
+
);
|
|
10282
|
+
element.setAttribute("download", filename);
|
|
10283
|
+
element.style.display = "none";
|
|
10284
|
+
document.body.appendChild(element);
|
|
10285
|
+
element.click();
|
|
10286
|
+
document.body.removeChild(element);
|
|
10287
|
+
}
|
|
10288
|
+
function useDownloadYAML() {
|
|
10289
|
+
return function(options) {
|
|
10290
|
+
const { name: name2, item } = options;
|
|
10291
|
+
const content = yaml.dump(item);
|
|
10292
|
+
download(`${name2}.yaml`, content);
|
|
10293
|
+
};
|
|
10294
|
+
}
|
|
10223
10295
|
function useEdit() {
|
|
10224
10296
|
const { resource } = core.useParsed();
|
|
10225
10297
|
const go = core.useGo();
|
|
@@ -10298,6 +10370,186 @@ var __publicField = (obj, key, value) => {
|
|
|
10298
10370
|
}
|
|
10299
10371
|
};
|
|
10300
10372
|
}
|
|
10373
|
+
function K8sDropdown(props) {
|
|
10374
|
+
const { record, size = "normal" } = props;
|
|
10375
|
+
const kit = eagle.useUIKit();
|
|
10376
|
+
const { globalStore } = useGlobalStore();
|
|
10377
|
+
const useResourceResult = core.useResource();
|
|
10378
|
+
const resource = useResourceResult.resource;
|
|
10379
|
+
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
|
|
10380
|
+
(resource == null ? void 0 : resource.name) || ""
|
|
10381
|
+
);
|
|
10382
|
+
const download2 = useDownloadYAML();
|
|
10383
|
+
const { t: t2 } = useTranslation();
|
|
10384
|
+
const openForm = useOpenForm({ id: record.id });
|
|
10385
|
+
const isInShowPage = useResourceResult.action === "show";
|
|
10386
|
+
const { data: canEditData } = core.useCan({
|
|
10387
|
+
resource: resource == null ? void 0 : resource.name,
|
|
10388
|
+
action: AccessControlAuth.Edit
|
|
10389
|
+
});
|
|
10390
|
+
const { data: canDeleteData } = core.useCan({
|
|
10391
|
+
resource: resource == null ? void 0 : resource.name,
|
|
10392
|
+
action: AccessControlAuth.Delete
|
|
10393
|
+
});
|
|
10394
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
10395
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10396
|
+
kit.dropdown,
|
|
10397
|
+
{
|
|
10398
|
+
overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
|
|
10399
|
+
isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10400
|
+
kit.menuItem,
|
|
10401
|
+
{
|
|
10402
|
+
onClick: openForm,
|
|
10403
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
|
|
10404
|
+
}
|
|
10405
|
+
),
|
|
10406
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10407
|
+
kit.menu.Item,
|
|
10408
|
+
{
|
|
10409
|
+
onClick: () => {
|
|
10410
|
+
var _a;
|
|
10411
|
+
if (record.id) {
|
|
10412
|
+
download2({
|
|
10413
|
+
name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
|
|
10414
|
+
item: lodashEs.omit((globalStore == null ? void 0 : globalStore.restoreItem(record)) || record, "id")
|
|
10415
|
+
});
|
|
10416
|
+
}
|
|
10417
|
+
},
|
|
10418
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
|
|
10419
|
+
}
|
|
10420
|
+
),
|
|
10421
|
+
props.children,
|
|
10422
|
+
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
|
|
10423
|
+
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10424
|
+
kit.menuItem,
|
|
10425
|
+
{
|
|
10426
|
+
danger: true,
|
|
10427
|
+
onClick: () => {
|
|
10428
|
+
openDeleteConfirmModal(record.id);
|
|
10429
|
+
},
|
|
10430
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t2("dovetail.delete") })
|
|
10431
|
+
}
|
|
10432
|
+
) : null
|
|
10433
|
+
] }),
|
|
10434
|
+
trigger: ["click"],
|
|
10435
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10436
|
+
kit.button,
|
|
10437
|
+
{
|
|
10438
|
+
type: "quiet",
|
|
10439
|
+
size: size === "large" ? "middle" : "small",
|
|
10440
|
+
prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10441
|
+
eagle.Icon,
|
|
10442
|
+
{
|
|
10443
|
+
src: iconsReact.MoreEllipsis324BoldSecondaryIcon,
|
|
10444
|
+
hoverSrc: iconsReact.MoreEllipsis324BoldBlueIcon,
|
|
10445
|
+
iconWidth: 24,
|
|
10446
|
+
iconHeight: 24
|
|
10447
|
+
}
|
|
10448
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon })
|
|
10449
|
+
}
|
|
10450
|
+
)
|
|
10451
|
+
}
|
|
10452
|
+
),
|
|
10453
|
+
visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
|
|
10454
|
+
] });
|
|
10455
|
+
}
|
|
10456
|
+
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
10457
|
+
ColumnKeys2["age"] = "age";
|
|
10458
|
+
ColumnKeys2["name"] = "name";
|
|
10459
|
+
ColumnKeys2["namespace"] = "namespace";
|
|
10460
|
+
ColumnKeys2["phase"] = "phase";
|
|
10461
|
+
ColumnKeys2["replicas"] = "replicas";
|
|
10462
|
+
ColumnKeys2["deploymentImage"] = "deploymentImage";
|
|
10463
|
+
ColumnKeys2["podImage"] = "podImage";
|
|
10464
|
+
return ColumnKeys2;
|
|
10465
|
+
})(ColumnKeys || {});
|
|
10466
|
+
function addDefaultRenderToColumns(columns) {
|
|
10467
|
+
return columns.map((col) => ({
|
|
10468
|
+
render(value2) {
|
|
10469
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10470
|
+
ValueDisplay,
|
|
10471
|
+
{
|
|
10472
|
+
value: value2
|
|
10473
|
+
}
|
|
10474
|
+
);
|
|
10475
|
+
},
|
|
10476
|
+
...col
|
|
10477
|
+
}));
|
|
10478
|
+
}
|
|
10479
|
+
const useEagleTable = (params) => {
|
|
10480
|
+
var _a, _b, _c;
|
|
10481
|
+
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
10482
|
+
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
10483
|
+
const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
10484
|
+
const { resource } = core.useResource();
|
|
10485
|
+
const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
|
|
10486
|
+
const useTableParams = React.useMemo(() => {
|
|
10487
|
+
const mergedParams = lodashEs.merge(params.useTableParams, {
|
|
10488
|
+
pagination: {
|
|
10489
|
+
pageSize: currentSize,
|
|
10490
|
+
mode: "server"
|
|
10491
|
+
}
|
|
10492
|
+
});
|
|
10493
|
+
return mergedParams;
|
|
10494
|
+
}, [params.useTableParams, currentSize]);
|
|
10495
|
+
const finalColumns = React.useMemo(
|
|
10496
|
+
() => addDefaultRenderToColumns(columns),
|
|
10497
|
+
[columns]
|
|
10498
|
+
);
|
|
10499
|
+
const table = core.useTable(useTableParams);
|
|
10500
|
+
const onPageChange = React.useCallback(
|
|
10501
|
+
(page) => {
|
|
10502
|
+
var _a2;
|
|
10503
|
+
setCurrentPage(page);
|
|
10504
|
+
(_a2 = table.setCurrent) == null ? void 0 : _a2.call(table, page || 1);
|
|
10505
|
+
},
|
|
10506
|
+
[setCurrentPage, table]
|
|
10507
|
+
);
|
|
10508
|
+
const onSorterChange = React.useCallback((order, key2) => {
|
|
10509
|
+
var _a2;
|
|
10510
|
+
const ORDER_MAP = {
|
|
10511
|
+
descend: "desc",
|
|
10512
|
+
ascend: "asc"
|
|
10513
|
+
};
|
|
10514
|
+
const sorters = [{
|
|
10515
|
+
field: (_a2 = columns.find((col) => col.key === key2)) == null ? void 0 : _a2.dataIndex,
|
|
10516
|
+
order: order ? ORDER_MAP[order] : order
|
|
10517
|
+
}];
|
|
10518
|
+
table.setSorters(sorters);
|
|
10519
|
+
}, [table, columns]);
|
|
10520
|
+
const data2 = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data;
|
|
10521
|
+
const total = ((_b = table.tableQueryResult.data) == null ? void 0 : _b.total) || 0;
|
|
10522
|
+
const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
|
|
10523
|
+
const finalProps = {
|
|
10524
|
+
tableKey: (resource == null ? void 0 : resource.name) || "table",
|
|
10525
|
+
loading: table.tableQueryResult.isLoading,
|
|
10526
|
+
data: finalDataSource || [],
|
|
10527
|
+
columns: finalColumns,
|
|
10528
|
+
error: false,
|
|
10529
|
+
rowKey: "id",
|
|
10530
|
+
currentPage,
|
|
10531
|
+
onPageChange,
|
|
10532
|
+
onSorterChange,
|
|
10533
|
+
onSelect: (keys) => {
|
|
10534
|
+
setSelectedKeys(keys);
|
|
10535
|
+
},
|
|
10536
|
+
total,
|
|
10537
|
+
RowMenu: Dropdown,
|
|
10538
|
+
...tableProps,
|
|
10539
|
+
defaultSize: currentSize
|
|
10540
|
+
};
|
|
10541
|
+
React.useEffect(() => {
|
|
10542
|
+
table.setSorters([{
|
|
10543
|
+
field: "metadata.creationTimestamp",
|
|
10544
|
+
order: "desc"
|
|
10545
|
+
}]);
|
|
10546
|
+
}, []);
|
|
10547
|
+
React.useEffect(() => {
|
|
10548
|
+
setCurrentPage(1);
|
|
10549
|
+
table.setCurrent(1);
|
|
10550
|
+
}, [(_c = params.useTableParams) == null ? void 0 : _c.filters]);
|
|
10551
|
+
return { tableProps: finalProps, selectedKeys, ...table };
|
|
10552
|
+
};
|
|
10301
10553
|
function CreateButton() {
|
|
10302
10554
|
var _a;
|
|
10303
10555
|
const kit = eagle.useUIKit();
|
|
@@ -10411,38 +10663,40 @@ var __publicField = (obj, key, value) => {
|
|
|
10411
10663
|
owner,
|
|
10412
10664
|
hideToolBar
|
|
10413
10665
|
}) => {
|
|
10666
|
+
var _a;
|
|
10414
10667
|
const {
|
|
10415
10668
|
i18n: i18n2
|
|
10416
10669
|
} = useTranslation();
|
|
10417
10670
|
const kit = eagle.useUIKit();
|
|
10418
10671
|
const [selectedKeys] = React.useState([]);
|
|
10419
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
10420
10672
|
const component = React.useContext(ComponentContext);
|
|
10421
10673
|
const Table$1 = component.Table || Table;
|
|
10422
|
-
const currentSize = 10;
|
|
10423
|
-
const {
|
|
10424
|
-
data: data2,
|
|
10425
|
-
isLoading
|
|
10426
|
-
} = core.useList({
|
|
10427
|
-
resource: "jobs",
|
|
10428
|
-
meta: {
|
|
10429
|
-
resourceBasePath: "/apis/batch/v1",
|
|
10430
|
-
kind: "Job"
|
|
10431
|
-
},
|
|
10432
|
-
pagination: {
|
|
10433
|
-
mode: "off"
|
|
10434
|
-
}
|
|
10435
|
-
});
|
|
10436
|
-
const dataSource = React.useMemo(() => {
|
|
10437
|
-
return data2 == null ? void 0 : data2.data.filter((p) => {
|
|
10438
|
-
return owner ? matchOwner(p, owner) : true;
|
|
10439
|
-
});
|
|
10440
|
-
}, [data2 == null ? void 0 : data2.data, owner]);
|
|
10441
10674
|
const columns = [NameColumnRenderer(i18n2, "jobs"), StateDisplayColumnRenderer(i18n2), NameSpaceColumnRenderer(i18n2), {
|
|
10442
10675
|
...WorkloadImageColumnRenderer(i18n2),
|
|
10443
10676
|
width: 238
|
|
10444
10677
|
}, CompletionsCountColumnRenderer(i18n2), DurationColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
|
|
10445
|
-
|
|
10678
|
+
const {
|
|
10679
|
+
tableProps
|
|
10680
|
+
} = useEagleTable({
|
|
10681
|
+
columns,
|
|
10682
|
+
useTableParams: {
|
|
10683
|
+
resource: "jobs",
|
|
10684
|
+
meta: {
|
|
10685
|
+
resourceBasePath: "/apis/batch/v1",
|
|
10686
|
+
kind: "Job"
|
|
10687
|
+
},
|
|
10688
|
+
filters: {
|
|
10689
|
+
permanent: [{
|
|
10690
|
+
field: "",
|
|
10691
|
+
value: "",
|
|
10692
|
+
fn(item) {
|
|
10693
|
+
return owner ? matchOwner(item, owner) : true;
|
|
10694
|
+
}
|
|
10695
|
+
}]
|
|
10696
|
+
}
|
|
10697
|
+
}
|
|
10698
|
+
});
|
|
10699
|
+
if (!((_a = tableProps.data) == null ? void 0 : _a.length) && !tableProps.loading) {
|
|
10446
10700
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
10447
10701
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
10448
10702
|
kind: " Job"
|
|
@@ -10457,33 +10711,17 @@ var __publicField = (obj, key, value) => {
|
|
|
10457
10711
|
selectedKeys,
|
|
10458
10712
|
hideCreate: true
|
|
10459
10713
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
|
|
10714
|
+
...tableProps,
|
|
10460
10715
|
tableKey: "cronjobs",
|
|
10461
|
-
loading: isLoading,
|
|
10462
|
-
data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
|
|
10463
|
-
total: (dataSource == null ? void 0 : dataSource.length) || 0,
|
|
10464
|
-
columns,
|
|
10465
|
-
rowKey: "id",
|
|
10466
|
-
error: false,
|
|
10467
|
-
currentPage,
|
|
10468
|
-
onPageChange: (p) => setCurrentPage(p),
|
|
10469
|
-
defaultSize: currentSize,
|
|
10470
|
-
refetch: () => null,
|
|
10471
10716
|
showMenuColumn: false
|
|
10472
10717
|
})]
|
|
10473
10718
|
});
|
|
10474
10719
|
};
|
|
10475
10720
|
const EventsTable = ({}) => {
|
|
10721
|
+
var _a, _b;
|
|
10476
10722
|
const { i18n: i18n2 } = useTranslation();
|
|
10477
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
10478
|
-
const currentSize = 10;
|
|
10479
|
-
const { data: data2, isLoading } = core.useList({
|
|
10480
|
-
resource: "events",
|
|
10481
|
-
meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
|
|
10482
|
-
pagination: {
|
|
10483
|
-
mode: "off"
|
|
10484
|
-
}
|
|
10485
|
-
});
|
|
10486
10723
|
const parsed = core.useParsed();
|
|
10724
|
+
const [regardingNamespace, regardingName] = (_a = parsed == null ? void 0 : parsed.id) == null ? void 0 : _a.split("/");
|
|
10487
10725
|
const columns = React.useMemo(
|
|
10488
10726
|
() => [
|
|
10489
10727
|
{
|
|
@@ -10524,15 +10762,36 @@ var __publicField = (obj, key, value) => {
|
|
|
10524
10762
|
],
|
|
10525
10763
|
[i18n2]
|
|
10526
10764
|
);
|
|
10765
|
+
const { tableProps } = useEagleTable({
|
|
10766
|
+
columns,
|
|
10767
|
+
tableProps: {
|
|
10768
|
+
defaultSize: 50
|
|
10769
|
+
},
|
|
10770
|
+
useTableParams: {
|
|
10771
|
+
resource: "events",
|
|
10772
|
+
meta: { resourceBasePath: "/apis/events.k8s.io/v1", kind: "Event" },
|
|
10773
|
+
filters: {
|
|
10774
|
+
permanent: [{
|
|
10775
|
+
operator: "and",
|
|
10776
|
+
value: [
|
|
10777
|
+
{
|
|
10778
|
+
field: "regarding.namespace",
|
|
10779
|
+
operator: "eq",
|
|
10780
|
+
value: regardingNamespace
|
|
10781
|
+
},
|
|
10782
|
+
{
|
|
10783
|
+
field: "regarding.name",
|
|
10784
|
+
operator: "eq",
|
|
10785
|
+
value: regardingName
|
|
10786
|
+
}
|
|
10787
|
+
]
|
|
10788
|
+
}]
|
|
10789
|
+
}
|
|
10790
|
+
}
|
|
10791
|
+
});
|
|
10527
10792
|
const component = React.useContext(ComponentContext);
|
|
10528
10793
|
const Table$1 = component.Table || Table;
|
|
10529
|
-
|
|
10530
|
-
return data2 == null ? void 0 : data2.data.filter((d) => {
|
|
10531
|
-
const objectId = `${d.regarding.namespace}/${d.regarding.name}`;
|
|
10532
|
-
return objectId === parsed.id;
|
|
10533
|
-
});
|
|
10534
|
-
}, [data2 == null ? void 0 : data2.data, parsed]);
|
|
10535
|
-
if (!(dataSource == null ? void 0 : dataSource.length) && !isLoading) {
|
|
10794
|
+
if (!((_b = tableProps.data) == null ? void 0 : _b.length) && !tableProps.loading) {
|
|
10536
10795
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10537
10796
|
WidgetErrorContent,
|
|
10538
10797
|
{
|
|
@@ -10543,17 +10802,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10543
10802
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10544
10803
|
Table$1,
|
|
10545
10804
|
{
|
|
10805
|
+
...tableProps,
|
|
10546
10806
|
tableKey: "events",
|
|
10547
|
-
loading: isLoading,
|
|
10548
|
-
data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
|
|
10549
|
-
total: (dataSource == null ? void 0 : dataSource.length) || 0,
|
|
10550
|
-
columns: addDefaultRenderToColumns(columns),
|
|
10551
|
-
rowKey: "id",
|
|
10552
|
-
error: false,
|
|
10553
|
-
currentPage,
|
|
10554
|
-
onPageChange: (p) => setCurrentPage(p),
|
|
10555
|
-
defaultSize: currentSize,
|
|
10556
|
-
refetch: () => null,
|
|
10557
10807
|
showMenuColumn: false
|
|
10558
10808
|
}
|
|
10559
10809
|
);
|
|
@@ -10566,10 +10816,10 @@ var __publicField = (obj, key, value) => {
|
|
|
10566
10816
|
}) => {
|
|
10567
10817
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
10568
10818
|
className: ImageWrapperStyle,
|
|
10569
|
-
children: breakLine ? value2.map((image2) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
|
|
10819
|
+
children: breakLine ? value2.map((image2, index) => /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.OverflowTooltip, {
|
|
10570
10820
|
content: image2,
|
|
10571
10821
|
tooltip: image2
|
|
10572
|
-
}, image2)) : value2.join(", ")
|
|
10822
|
+
}, `${image2}-${index}`)) : value2.join(", ")
|
|
10573
10823
|
});
|
|
10574
10824
|
};
|
|
10575
10825
|
const ResourceLink = (props) => {
|
|
@@ -10597,7 +10847,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10597
10847
|
}, [ingress.flattenedRules]);
|
|
10598
10848
|
const component = React.useContext(ComponentContext);
|
|
10599
10849
|
const Table$1 = component.Table || Table;
|
|
10600
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
10601
10850
|
const currentSize = 10;
|
|
10602
10851
|
const columns = [
|
|
10603
10852
|
{
|
|
@@ -10663,6 +10912,15 @@ var __publicField = (obj, key, value) => {
|
|
|
10663
10912
|
sortable: true
|
|
10664
10913
|
}
|
|
10665
10914
|
];
|
|
10915
|
+
const {
|
|
10916
|
+
data: finalData,
|
|
10917
|
+
currentPage,
|
|
10918
|
+
onPageChange,
|
|
10919
|
+
onSorterChange
|
|
10920
|
+
} = useTableData({
|
|
10921
|
+
columns,
|
|
10922
|
+
data: rows
|
|
10923
|
+
});
|
|
10666
10924
|
if ((rows == null ? void 0 : rows.length) === 0) {
|
|
10667
10925
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10668
10926
|
WidgetErrorContent,
|
|
@@ -10678,14 +10936,15 @@ var __publicField = (obj, key, value) => {
|
|
|
10678
10936
|
{
|
|
10679
10937
|
tableKey: "ingressRules",
|
|
10680
10938
|
loading: false,
|
|
10681
|
-
data:
|
|
10939
|
+
data: finalData,
|
|
10682
10940
|
total: rows.length,
|
|
10683
10941
|
columns: addDefaultRenderToColumns(columns),
|
|
10684
10942
|
rowKey: "pathType",
|
|
10685
10943
|
empty: t2("dovetail.empty"),
|
|
10686
10944
|
defaultSize: currentSize,
|
|
10687
10945
|
currentPage,
|
|
10688
|
-
onPageChange
|
|
10946
|
+
onPageChange,
|
|
10947
|
+
onSorterChange,
|
|
10689
10948
|
showMenuColumn: false
|
|
10690
10949
|
}
|
|
10691
10950
|
);
|
|
@@ -10764,109 +11023,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10764
11023
|
}) : null]
|
|
10765
11024
|
});
|
|
10766
11025
|
}
|
|
10767
|
-
function download(filename, content) {
|
|
10768
|
-
const element = document.createElement("a");
|
|
10769
|
-
element.setAttribute(
|
|
10770
|
-
"href",
|
|
10771
|
-
"data:text/plain;charset=utf-8," + encodeURIComponent(content)
|
|
10772
|
-
);
|
|
10773
|
-
element.setAttribute("download", filename);
|
|
10774
|
-
element.style.display = "none";
|
|
10775
|
-
document.body.appendChild(element);
|
|
10776
|
-
element.click();
|
|
10777
|
-
document.body.removeChild(element);
|
|
10778
|
-
}
|
|
10779
|
-
function useDownloadYAML() {
|
|
10780
|
-
return function(options) {
|
|
10781
|
-
const { name: name2, item } = options;
|
|
10782
|
-
console.log("download", item);
|
|
10783
|
-
const content = yaml.dump(item);
|
|
10784
|
-
download(`${name2}.yaml`, content);
|
|
10785
|
-
};
|
|
10786
|
-
}
|
|
10787
|
-
function K8sDropdown(props) {
|
|
10788
|
-
const { record, size = "normal" } = props;
|
|
10789
|
-
const kit = eagle.useUIKit();
|
|
10790
|
-
const { globalStore } = useGlobalStore();
|
|
10791
|
-
const useResourceResult = core.useResource();
|
|
10792
|
-
const resource = useResourceResult.resource;
|
|
10793
|
-
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(
|
|
10794
|
-
(resource == null ? void 0 : resource.name) || ""
|
|
10795
|
-
);
|
|
10796
|
-
const download2 = useDownloadYAML();
|
|
10797
|
-
const { t: t2 } = useTranslation();
|
|
10798
|
-
const openForm = useOpenForm({ id: record.id });
|
|
10799
|
-
const isInShowPage = useResourceResult.action === "show";
|
|
10800
|
-
const { data: canEditData } = core.useCan({
|
|
10801
|
-
resource: resource == null ? void 0 : resource.name,
|
|
10802
|
-
action: AccessControlAuth.Edit
|
|
10803
|
-
});
|
|
10804
|
-
const { data: canDeleteData } = core.useCan({
|
|
10805
|
-
resource: resource == null ? void 0 : resource.name,
|
|
10806
|
-
action: AccessControlAuth.Delete
|
|
10807
|
-
});
|
|
10808
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
10809
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10810
|
-
kit.dropdown,
|
|
10811
|
-
{
|
|
10812
|
-
overlay: /* @__PURE__ */ jsxRuntimeExports.jsxs(kit.menu, { children: [
|
|
10813
|
-
isInShowPage || (canEditData == null ? void 0 : canEditData.can) === false ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10814
|
-
kit.menuItem,
|
|
10815
|
-
{
|
|
10816
|
-
onClick: openForm,
|
|
10817
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.EditPen16PrimaryIcon, children: t2("dovetail.edit_yaml") })
|
|
10818
|
-
}
|
|
10819
|
-
),
|
|
10820
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10821
|
-
kit.menu.Item,
|
|
10822
|
-
{
|
|
10823
|
-
onClick: () => {
|
|
10824
|
-
var _a;
|
|
10825
|
-
if (record.id) {
|
|
10826
|
-
download2({
|
|
10827
|
-
name: ((_a = record.metadata) == null ? void 0 : _a.name) || record.kind || "",
|
|
10828
|
-
item: (globalStore == null ? void 0 : globalStore.restoreItem(record)) || record
|
|
10829
|
-
});
|
|
10830
|
-
}
|
|
10831
|
-
},
|
|
10832
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.Download16GradientBlueIcon, children: t2("dovetail.download_yaml") })
|
|
10833
|
-
}
|
|
10834
|
-
),
|
|
10835
|
-
props.children,
|
|
10836
|
-
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.divider, { style: { margin: 0 } }) : null,
|
|
10837
|
-
(canDeleteData == null ? void 0 : canDeleteData.can) !== false ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10838
|
-
kit.menuItem,
|
|
10839
|
-
{
|
|
10840
|
-
danger: true,
|
|
10841
|
-
onClick: () => {
|
|
10842
|
-
openDeleteConfirmModal(record.id);
|
|
10843
|
-
},
|
|
10844
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.TrashBinDelete16Icon, children: t2("dovetail.delete") })
|
|
10845
|
-
}
|
|
10846
|
-
) : null
|
|
10847
|
-
] }),
|
|
10848
|
-
trigger: ["click"],
|
|
10849
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10850
|
-
kit.button,
|
|
10851
|
-
{
|
|
10852
|
-
type: "quiet",
|
|
10853
|
-
size: size === "large" ? "middle" : "small",
|
|
10854
|
-
prefixIcon: size === "large" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
10855
|
-
eagle.Icon,
|
|
10856
|
-
{
|
|
10857
|
-
src: iconsReact.MoreEllipsis324BoldSecondaryIcon,
|
|
10858
|
-
hoverSrc: iconsReact.MoreEllipsis324BoldBlueIcon,
|
|
10859
|
-
iconWidth: 24,
|
|
10860
|
-
iconHeight: 24
|
|
10861
|
-
}
|
|
10862
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Icon, { src: iconsReact.MoreEllipsis316BoldBlueIcon })
|
|
10863
|
-
}
|
|
10864
|
-
)
|
|
10865
|
-
}
|
|
10866
|
-
),
|
|
10867
|
-
visible ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.modal, { ...modalProps }) : null
|
|
10868
|
-
] });
|
|
10869
|
-
}
|
|
10870
11026
|
function Tabs(props) {
|
|
10871
11027
|
const { tabs, className } = props;
|
|
10872
11028
|
const kit = eagle.useUIKit();
|
|
@@ -10910,7 +11066,8 @@ var __publicField = (obj, key, value) => {
|
|
|
10910
11066
|
const {
|
|
10911
11067
|
showConfig,
|
|
10912
11068
|
formatter,
|
|
10913
|
-
Dropdown = K8sDropdown
|
|
11069
|
+
Dropdown = K8sDropdown,
|
|
11070
|
+
data: data2
|
|
10914
11071
|
} = props;
|
|
10915
11072
|
const kit = eagle.useUIKit();
|
|
10916
11073
|
const parsed = core.useParsed();
|
|
@@ -10918,17 +11075,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10918
11075
|
resource
|
|
10919
11076
|
} = core.useResource();
|
|
10920
11077
|
const id = (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id;
|
|
10921
|
-
const {
|
|
10922
|
-
queryResult
|
|
10923
|
-
} = core.useShow({
|
|
10924
|
-
id
|
|
10925
|
-
});
|
|
10926
11078
|
const {
|
|
10927
11079
|
t: t2
|
|
10928
11080
|
} = useTranslation();
|
|
10929
|
-
const {
|
|
10930
|
-
data: data2
|
|
10931
|
-
} = queryResult;
|
|
10932
11081
|
const navigation = core.useNavigation();
|
|
10933
11082
|
const go = core.useGo();
|
|
10934
11083
|
const openForm = useOpenForm({
|
|
@@ -11114,32 +11263,15 @@ var __publicField = (obj, key, value) => {
|
|
|
11114
11263
|
selector,
|
|
11115
11264
|
hideToolbar
|
|
11116
11265
|
}) => {
|
|
11266
|
+
var _a;
|
|
11117
11267
|
const {
|
|
11118
11268
|
i18n: i18n2
|
|
11119
11269
|
} = useTranslation();
|
|
11120
11270
|
const kit = eagle.useUIKit();
|
|
11121
11271
|
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
11122
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
11123
11272
|
const component = React.useContext(ComponentContext);
|
|
11124
11273
|
const Table$1 = component.Table || Table;
|
|
11125
11274
|
const currentSize = 10;
|
|
11126
|
-
const {
|
|
11127
|
-
data: data2
|
|
11128
|
-
} = core.useList({
|
|
11129
|
-
resource: "pods",
|
|
11130
|
-
meta: {
|
|
11131
|
-
resourceBasePath: "/api/v1",
|
|
11132
|
-
kind: "Pod"
|
|
11133
|
-
},
|
|
11134
|
-
pagination: {
|
|
11135
|
-
mode: "off"
|
|
11136
|
-
}
|
|
11137
|
-
});
|
|
11138
|
-
const dataSource = React.useMemo(() => {
|
|
11139
|
-
return data2 == null ? void 0 : data2.data.filter((p) => {
|
|
11140
|
-
return selector ? matchSelector(p, selector) : true;
|
|
11141
|
-
});
|
|
11142
|
-
}, [data2 == null ? void 0 : data2.data, selector]);
|
|
11143
11275
|
const columns = [NameColumnRenderer(i18n2, "pods"), StateDisplayColumnRenderer(i18n2), {
|
|
11144
11276
|
key: "ip",
|
|
11145
11277
|
display: true,
|
|
@@ -11148,7 +11280,28 @@ var __publicField = (obj, key, value) => {
|
|
|
11148
11280
|
sortable: true,
|
|
11149
11281
|
width: 160
|
|
11150
11282
|
}, NodeNameColumnRenderer(i18n2), WorkloadImageColumnRenderer(i18n2), PodContainersNumColumnRenderer(i18n2), RestartCountColumnRenderer(i18n2), AgeColumnRenderer(i18n2)];
|
|
11151
|
-
|
|
11283
|
+
const {
|
|
11284
|
+
tableProps
|
|
11285
|
+
} = useEagleTable({
|
|
11286
|
+
columns,
|
|
11287
|
+
useTableParams: {
|
|
11288
|
+
resource: "pods",
|
|
11289
|
+
meta: {
|
|
11290
|
+
resourceBasePath: "/api/v1",
|
|
11291
|
+
kind: "Pod"
|
|
11292
|
+
},
|
|
11293
|
+
filters: {
|
|
11294
|
+
permanent: [{
|
|
11295
|
+
field: "",
|
|
11296
|
+
value: "",
|
|
11297
|
+
fn(item) {
|
|
11298
|
+
return selector ? matchSelector(item, selector) : true;
|
|
11299
|
+
}
|
|
11300
|
+
}]
|
|
11301
|
+
}
|
|
11302
|
+
}
|
|
11303
|
+
});
|
|
11304
|
+
if (((_a = tableProps.data) == null ? void 0 : _a.length) === 0) {
|
|
11152
11305
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(WidgetErrorContent, {
|
|
11153
11306
|
errorText: i18n2.t("dovetail.no_resource", {
|
|
11154
11307
|
kind: ` ${i18n2.t("dovetail.pod")}`
|
|
@@ -11166,18 +11319,10 @@ var __publicField = (obj, key, value) => {
|
|
|
11166
11319
|
selectedKeys,
|
|
11167
11320
|
hideCreate: true
|
|
11168
11321
|
}), /* @__PURE__ */ jsxRuntimeExports.jsx(Table$1, {
|
|
11322
|
+
...tableProps,
|
|
11169
11323
|
tableKey: "pods",
|
|
11170
|
-
loading: !dataSource,
|
|
11171
|
-
data: (dataSource || []).slice((currentPage - 1) * currentSize, currentPage * currentSize),
|
|
11172
|
-
total: (dataSource == null ? void 0 : dataSource.length) || 0,
|
|
11173
|
-
columns: addDefaultRenderToColumns(columns),
|
|
11174
11324
|
onSelect: (keys) => setSelectedKeys(keys),
|
|
11175
|
-
rowKey: "id",
|
|
11176
|
-
error: false,
|
|
11177
|
-
currentPage,
|
|
11178
|
-
onPageChange: (p) => setCurrentPage(p),
|
|
11179
11325
|
defaultSize: currentSize,
|
|
11180
|
-
refetch: () => null,
|
|
11181
11326
|
showMenuColumn: false
|
|
11182
11327
|
})]
|
|
11183
11328
|
});
|
|
@@ -17369,7 +17514,7 @@ var __publicField = (obj, key, value) => {
|
|
|
17369
17514
|
const kit = eagle.useUIKit();
|
|
17370
17515
|
const [selectedContainer, setSelectedContainer] = React.useState(((_b = (_a = pod2.spec) == null ? void 0 : _a.containers[0]) == null ? void 0 : _b.name) || "");
|
|
17371
17516
|
const [logs, setLogs] = React.useState([]);
|
|
17372
|
-
const [logType, setLogType] = React.useState();
|
|
17517
|
+
const [logType, setLogType] = React.useState("realtime");
|
|
17373
17518
|
const [currentItemCount, setCurrentItemCount] = React.useState(0);
|
|
17374
17519
|
const [paused, setPaused] = React.useState(false);
|
|
17375
17520
|
const [wrap2, setWrap] = React.useState(false);
|
|
@@ -17406,30 +17551,20 @@ var __publicField = (obj, key, value) => {
|
|
|
17406
17551
|
}
|
|
17407
17552
|
}
|
|
17408
17553
|
};
|
|
17409
|
-
const
|
|
17410
|
-
var _a2, _b2;
|
|
17411
|
-
if (!selectedContainer) {
|
|
17412
|
-
return;
|
|
17413
|
-
}
|
|
17554
|
+
const fetchLogsByUrl = React.useCallback(async (url) => {
|
|
17414
17555
|
abortControllerRef.current = new AbortController();
|
|
17415
17556
|
const {
|
|
17416
17557
|
signal
|
|
17417
17558
|
} = abortControllerRef.current;
|
|
17418
|
-
let url = `${apiUrl}/api/v1/namespaces/${(_a2 = pod2.metadata) == null ? void 0 : _a2.namespace}/pods/${(_b2 = pod2.metadata) == null ? void 0 : _b2.name}/log?container=${selectedContainer}×tamps=true`;
|
|
17419
|
-
if (logType === "realtime") {
|
|
17420
|
-
url += "&follow=true";
|
|
17421
|
-
} else if (logType === "previous") {
|
|
17422
|
-
url += "&previous=true";
|
|
17423
|
-
}
|
|
17424
17559
|
fetch(url, {
|
|
17425
17560
|
signal
|
|
17426
|
-
}).then((response) => {
|
|
17427
|
-
var
|
|
17561
|
+
}).then(async (response) => {
|
|
17562
|
+
var _a2;
|
|
17428
17563
|
if (response.status !== 200) {
|
|
17429
17564
|
setLogs([]);
|
|
17430
17565
|
return;
|
|
17431
17566
|
}
|
|
17432
|
-
const reader = (
|
|
17567
|
+
const reader = (_a2 = response.body) == null ? void 0 : _a2.getReader();
|
|
17433
17568
|
if (!reader) {
|
|
17434
17569
|
return;
|
|
17435
17570
|
}
|
|
@@ -17462,7 +17597,19 @@ var __publicField = (obj, key, value) => {
|
|
|
17462
17597
|
};
|
|
17463
17598
|
reader.read().then(processChunk);
|
|
17464
17599
|
});
|
|
17465
|
-
}, [
|
|
17600
|
+
}, []);
|
|
17601
|
+
const fetchLogs = React.useCallback(async () => {
|
|
17602
|
+
var _a2, _b2;
|
|
17603
|
+
if (!selectedContainer) {
|
|
17604
|
+
return;
|
|
17605
|
+
}
|
|
17606
|
+
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`;
|
|
17607
|
+
if (logType === "realtime") {
|
|
17608
|
+
fetchLogsByUrl(`${url}&follow=true`);
|
|
17609
|
+
} else if (logType === "previous") {
|
|
17610
|
+
fetchLogsByUrl(`${url}&previous=true`);
|
|
17611
|
+
}
|
|
17612
|
+
}, [(_c = pod2.metadata) == null ? void 0 : _c.namespace, (_d = pod2.metadata) == null ? void 0 : _d.name, selectedContainer, logType, apiUrl, fetchLogsByUrl]);
|
|
17466
17613
|
const stopFetchingLogs = React.useCallback(() => {
|
|
17467
17614
|
if (abortControllerRef.current) {
|
|
17468
17615
|
abortControllerRef.current.abort();
|
|
@@ -17784,7 +17931,6 @@ var __publicField = (obj, key, value) => {
|
|
|
17784
17931
|
const { i18n: i18n2 } = useTranslation();
|
|
17785
17932
|
const component = React.useContext(ComponentContext);
|
|
17786
17933
|
const Table$1 = component.Table || Table;
|
|
17787
|
-
const [currentPage, setCurrentPage] = React.useState(1);
|
|
17788
17934
|
const currentSize = 10;
|
|
17789
17935
|
const columns = React.useMemo(
|
|
17790
17936
|
() => [
|
|
@@ -17841,10 +17987,11 @@ var __publicField = (obj, key, value) => {
|
|
|
17841
17987
|
sortable: true,
|
|
17842
17988
|
sorter: CommonSorter(["state", "running", "startedAt"]),
|
|
17843
17989
|
width: 120,
|
|
17844
|
-
render: (
|
|
17990
|
+
render: (_, record) => {
|
|
17991
|
+
const value2 = lodashEs.get(record, ["state", "running", "startedAt"]) || lodashEs.get(record, ["state", "terminated", "startedAt"]);
|
|
17845
17992
|
if (value2)
|
|
17846
17993
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(Time, { date: new Date(value2) });
|
|
17847
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17994
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
|
|
17848
17995
|
}
|
|
17849
17996
|
}
|
|
17850
17997
|
],
|
|
@@ -17854,6 +18001,19 @@ var __publicField = (obj, key, value) => {
|
|
|
17854
18001
|
() => addId(containerStatuses.concat(initContainerStatuses), "containerID"),
|
|
17855
18002
|
[containerStatuses, initContainerStatuses]
|
|
17856
18003
|
);
|
|
18004
|
+
const {
|
|
18005
|
+
data: finalData,
|
|
18006
|
+
currentPage,
|
|
18007
|
+
onPageChange,
|
|
18008
|
+
onSorterChange
|
|
18009
|
+
} = useTableData({
|
|
18010
|
+
data: dataSource,
|
|
18011
|
+
columns,
|
|
18012
|
+
defaultSorters: [{
|
|
18013
|
+
field: "state.running.startedAt",
|
|
18014
|
+
order: "desc"
|
|
18015
|
+
}]
|
|
18016
|
+
});
|
|
17857
18017
|
if (dataSource.length === 0) {
|
|
17858
18018
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
17859
18019
|
WidgetErrorContent,
|
|
@@ -17869,14 +18029,15 @@ var __publicField = (obj, key, value) => {
|
|
|
17869
18029
|
{
|
|
17870
18030
|
tableKey: "podContainers",
|
|
17871
18031
|
loading: false,
|
|
17872
|
-
data:
|
|
18032
|
+
data: finalData,
|
|
17873
18033
|
total: dataSource.length,
|
|
17874
18034
|
columns: addDefaultRenderToColumns(columns),
|
|
17875
18035
|
rowKey: "containerID",
|
|
17876
18036
|
error: false,
|
|
17877
18037
|
defaultSize: currentSize,
|
|
17878
18038
|
currentPage,
|
|
17879
|
-
onPageChange
|
|
18039
|
+
onPageChange,
|
|
18040
|
+
onSorterChange,
|
|
17880
18041
|
showMenuColumn: false
|
|
17881
18042
|
}
|
|
17882
18043
|
);
|
|
@@ -18045,11 +18206,11 @@ var __publicField = (obj, key, value) => {
|
|
|
18045
18206
|
retry: 1
|
|
18046
18207
|
},
|
|
18047
18208
|
errorNotification: () => {
|
|
18048
|
-
var _a2;
|
|
18209
|
+
var _a2, _b;
|
|
18049
18210
|
return {
|
|
18050
18211
|
message: i18n2.t("dovetail.fail_get_detail", {
|
|
18051
|
-
resource: resource == null ? void 0 : resource.
|
|
18052
|
-
name: (
|
|
18212
|
+
resource: (_a2 = resource == null ? void 0 : resource.meta) == null ? void 0 : _a2.kind,
|
|
18213
|
+
name: (_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id,
|
|
18053
18214
|
interpolation: { escapeValue: false }
|
|
18054
18215
|
}),
|
|
18055
18216
|
description: "Error",
|
|
@@ -18057,13 +18218,13 @@ var __publicField = (obj, key, value) => {
|
|
|
18057
18218
|
};
|
|
18058
18219
|
}
|
|
18059
18220
|
});
|
|
18060
|
-
const { isLoading, isError } = queryResult;
|
|
18221
|
+
const { isLoading, isError, data: data2 } = queryResult;
|
|
18061
18222
|
React.useEffect(() => {
|
|
18062
18223
|
if (isError && resource) {
|
|
18063
18224
|
nav.list(resource);
|
|
18064
18225
|
}
|
|
18065
18226
|
}, [isError, nav, resource]);
|
|
18066
|
-
return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props });
|
|
18227
|
+
return isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 });
|
|
18067
18228
|
};
|
|
18068
18229
|
const index_17v8shn = "";
|
|
18069
18230
|
const WrapperStyle$1 = "w1akirqw";
|
|
@@ -18443,11 +18604,11 @@ var __publicField = (obj, key, value) => {
|
|
|
18443
18604
|
onClick: () => {
|
|
18444
18605
|
setOpen(!open);
|
|
18445
18606
|
},
|
|
18446
|
-
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.
|
|
18607
|
+
children: isAll ? /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
18447
18608
|
style: {
|
|
18448
18609
|
marginLeft: 8
|
|
18449
18610
|
},
|
|
18450
|
-
children:
|
|
18611
|
+
children: label2
|
|
18451
18612
|
}) : /* @__PURE__ */ jsxRuntimeExports.jsx(kit.token, {
|
|
18452
18613
|
className: cx_default(isCountToken ? CountTokenStyle : TokenStyle, isCountToken ? "" : "closable-token"),
|
|
18453
18614
|
closable,
|
|
@@ -18512,6 +18673,21 @@ var __publicField = (obj, key, value) => {
|
|
|
18512
18673
|
})
|
|
18513
18674
|
});
|
|
18514
18675
|
};
|
|
18676
|
+
function useNamespaceFilter() {
|
|
18677
|
+
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
18678
|
+
return {
|
|
18679
|
+
permanent: [
|
|
18680
|
+
{
|
|
18681
|
+
operator: "or",
|
|
18682
|
+
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
18683
|
+
field: "metadata.namespace",
|
|
18684
|
+
operator: "eq",
|
|
18685
|
+
value: filter
|
|
18686
|
+
}))
|
|
18687
|
+
}
|
|
18688
|
+
]
|
|
18689
|
+
};
|
|
18690
|
+
}
|
|
18515
18691
|
const index_hp158y = "";
|
|
18516
18692
|
const ListPageStyle = "laykzsq";
|
|
18517
18693
|
const ListContentStyle = "l1ng0psc";
|
|
@@ -18576,8 +18752,11 @@ var __publicField = (obj, key, value) => {
|
|
|
18576
18752
|
const { formatter, columns, Dropdown, noShow } = props.config;
|
|
18577
18753
|
const { i18n: i18n2 } = useTranslation();
|
|
18578
18754
|
const nameRenderer = noShow ? PlainTextNameColumnRenderer(i18n2) : NameColumnRenderer(i18n2);
|
|
18755
|
+
const filters = useNamespaceFilter();
|
|
18579
18756
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
18580
|
-
useTableParams: {
|
|
18757
|
+
useTableParams: {
|
|
18758
|
+
filters
|
|
18759
|
+
},
|
|
18581
18760
|
columns: [nameRenderer, ...(columns == null ? void 0 : columns()) || []],
|
|
18582
18761
|
tableProps: {
|
|
18583
18762
|
defaultSize: 50,
|
|
@@ -21900,6 +22079,7 @@ var __publicField = (obj, key, value) => {
|
|
|
21900
22079
|
}
|
|
21901
22080
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(eagle.Form.Item, {
|
|
21902
22081
|
label: c2.label,
|
|
22082
|
+
colon: false,
|
|
21903
22083
|
labelCol: {
|
|
21904
22084
|
flex: "0 0 216px"
|
|
21905
22085
|
},
|
|
@@ -23672,7 +23852,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23672
23852
|
const parsed = core.useParsed();
|
|
23673
23853
|
const nav = core.useNavigation();
|
|
23674
23854
|
const { queryResult } = core.useShow({ id: (_a = parsed == null ? void 0 : parsed.params) == null ? void 0 : _a.id });
|
|
23675
|
-
const { isLoading } = queryResult;
|
|
23855
|
+
const { isLoading, data: data2 } = queryResult;
|
|
23676
23856
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23677
23857
|
antd.Drawer,
|
|
23678
23858
|
{
|
|
@@ -23681,7 +23861,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23681
23861
|
onClose: () => nav.goBack(),
|
|
23682
23862
|
width: "50%",
|
|
23683
23863
|
visible: !!((_b = parsed == null ? void 0 : parsed.params) == null ? void 0 : _b.id),
|
|
23684
|
-
children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props })
|
|
23864
|
+
children: isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(kit.loading, {}) : /* @__PURE__ */ jsxRuntimeExports.jsx(ShowContent, { ...props, data: data2 })
|
|
23685
23865
|
}
|
|
23686
23866
|
);
|
|
23687
23867
|
};
|
|
@@ -23709,7 +23889,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23709
23889
|
}
|
|
23710
23890
|
const resource = Object.values(configs).find((c2) => c2.kind === ownerReference.kind);
|
|
23711
23891
|
if (!resource) {
|
|
23712
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23892
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(ValueDisplay, { value: "" });
|
|
23713
23893
|
}
|
|
23714
23894
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
23715
23895
|
ResourceLink,
|
|
@@ -23932,17 +24112,8 @@ var __publicField = (obj, key, value) => {
|
|
|
23932
24112
|
display: true,
|
|
23933
24113
|
dataIndex,
|
|
23934
24114
|
title: i18n2.t("dovetail.created_time"),
|
|
23935
|
-
sortable: true,
|
|
23936
24115
|
width: 120,
|
|
23937
|
-
sorter:
|
|
23938
|
-
const valA = new Date(lodashExports.get(a2, dataIndex));
|
|
23939
|
-
const valB = new Date(lodashExports.get(b, dataIndex));
|
|
23940
|
-
if (valA === valB)
|
|
23941
|
-
return 0;
|
|
23942
|
-
if (valA > valB)
|
|
23943
|
-
return 1;
|
|
23944
|
-
return -1;
|
|
23945
|
-
},
|
|
24116
|
+
sorter: true,
|
|
23946
24117
|
render: (value2) => {
|
|
23947
24118
|
return isRelativeTime ? /* @__PURE__ */ jsxRuntimeExports.jsx(Time, {
|
|
23948
24119
|
date: new Date(value2)
|
|
@@ -23980,7 +24151,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23980
24151
|
};
|
|
23981
24152
|
};
|
|
23982
24153
|
const CompletionsCountColumnRenderer = (i18n2) => {
|
|
23983
|
-
const dataIndex = ["
|
|
24154
|
+
const dataIndex = ["succeeded"];
|
|
23984
24155
|
return {
|
|
23985
24156
|
key: "completions",
|
|
23986
24157
|
display: true,
|
|
@@ -23995,7 +24166,12 @@ var __publicField = (obj, key, value) => {
|
|
|
23995
24166
|
sortable: true,
|
|
23996
24167
|
width: 120,
|
|
23997
24168
|
align: "right",
|
|
23998
|
-
sorter: CommonSorter(dataIndex)
|
|
24169
|
+
sorter: CommonSorter(dataIndex),
|
|
24170
|
+
render: (_, record) => {
|
|
24171
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", {
|
|
24172
|
+
children: record.completionsDisplay
|
|
24173
|
+
});
|
|
24174
|
+
}
|
|
23999
24175
|
};
|
|
24000
24176
|
};
|
|
24001
24177
|
const DurationColumnRenderer = (i18n2) => {
|
|
@@ -24289,91 +24465,6 @@ var __publicField = (obj, key, value) => {
|
|
|
24289
24465
|
}
|
|
24290
24466
|
};
|
|
24291
24467
|
};
|
|
24292
|
-
var ColumnKeys = /* @__PURE__ */ ((ColumnKeys2) => {
|
|
24293
|
-
ColumnKeys2["age"] = "age";
|
|
24294
|
-
ColumnKeys2["name"] = "name";
|
|
24295
|
-
ColumnKeys2["namespace"] = "namespace";
|
|
24296
|
-
ColumnKeys2["phase"] = "phase";
|
|
24297
|
-
ColumnKeys2["replicas"] = "replicas";
|
|
24298
|
-
ColumnKeys2["deploymentImage"] = "deploymentImage";
|
|
24299
|
-
ColumnKeys2["podImage"] = "podImage";
|
|
24300
|
-
return ColumnKeys2;
|
|
24301
|
-
})(ColumnKeys || {});
|
|
24302
|
-
function addDefaultRenderToColumns(columns) {
|
|
24303
|
-
return columns.map((col) => ({
|
|
24304
|
-
render(value2) {
|
|
24305
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
24306
|
-
ValueDisplay,
|
|
24307
|
-
{
|
|
24308
|
-
value: value2
|
|
24309
|
-
}
|
|
24310
|
-
);
|
|
24311
|
-
},
|
|
24312
|
-
...col
|
|
24313
|
-
}));
|
|
24314
|
-
}
|
|
24315
|
-
const useEagleTable = (params) => {
|
|
24316
|
-
var _a, _b, _c;
|
|
24317
|
-
const { columns, tableProps, formatter, Dropdown = K8sDropdown } = params;
|
|
24318
|
-
const [selectedKeys, setSelectedKeys] = React.useState([]);
|
|
24319
|
-
const [currentPage, setCurrentPage] = React.useState((tableProps == null ? void 0 : tableProps.currentPage) || 1);
|
|
24320
|
-
const { resource } = core.useResource();
|
|
24321
|
-
const { value: nsFilters = [] } = useNamespacesFilter();
|
|
24322
|
-
const useTableParams = React.useMemo(() => {
|
|
24323
|
-
const mergedParams = lodashEs.merge(params.useTableParams, {
|
|
24324
|
-
pagination: {
|
|
24325
|
-
mode: "off"
|
|
24326
|
-
},
|
|
24327
|
-
filters: {
|
|
24328
|
-
permanent: [
|
|
24329
|
-
{
|
|
24330
|
-
operator: "or",
|
|
24331
|
-
value: nsFilters.filter((filter) => filter !== ALL_NS).map((filter) => ({
|
|
24332
|
-
field: "metadata.namespace",
|
|
24333
|
-
operator: "eq",
|
|
24334
|
-
value: filter
|
|
24335
|
-
}))
|
|
24336
|
-
}
|
|
24337
|
-
]
|
|
24338
|
-
}
|
|
24339
|
-
});
|
|
24340
|
-
return mergedParams;
|
|
24341
|
-
}, [params.useTableParams, nsFilters]);
|
|
24342
|
-
const finalColumns = React.useMemo(
|
|
24343
|
-
() => addDefaultRenderToColumns(columns),
|
|
24344
|
-
[columns]
|
|
24345
|
-
);
|
|
24346
|
-
const table = core.useTable(useTableParams);
|
|
24347
|
-
const onPageChange = React.useCallback(
|
|
24348
|
-
(page) => {
|
|
24349
|
-
setCurrentPage(page);
|
|
24350
|
-
},
|
|
24351
|
-
[setCurrentPage]
|
|
24352
|
-
);
|
|
24353
|
-
const currentSize = (tableProps == null ? void 0 : tableProps.defaultSize) || 10;
|
|
24354
|
-
const data2 = (_b = (_a = table.tableQueryResult.data) == null ? void 0 : _a.data) == null ? void 0 : _b.slice((currentPage - 1) * currentSize, currentPage * currentSize);
|
|
24355
|
-
const total = ((_c = table.tableQueryResult.data) == null ? void 0 : _c.data.length) || 0;
|
|
24356
|
-
const finalDataSource = formatter ? data2 == null ? void 0 : data2.map(formatter) : data2;
|
|
24357
|
-
const finalProps = {
|
|
24358
|
-
tableKey: (resource == null ? void 0 : resource.name) || "table",
|
|
24359
|
-
loading: table.tableQueryResult.isLoading,
|
|
24360
|
-
data: finalDataSource || [],
|
|
24361
|
-
columns: finalColumns,
|
|
24362
|
-
refetch: () => null,
|
|
24363
|
-
error: false,
|
|
24364
|
-
rowKey: "id",
|
|
24365
|
-
currentPage,
|
|
24366
|
-
onPageChange,
|
|
24367
|
-
onSelect: (keys) => {
|
|
24368
|
-
setSelectedKeys(keys);
|
|
24369
|
-
},
|
|
24370
|
-
total,
|
|
24371
|
-
RowMenu: Dropdown,
|
|
24372
|
-
...tableProps,
|
|
24373
|
-
defaultSize: currentSize
|
|
24374
|
-
};
|
|
24375
|
-
return { tableProps: finalProps, selectedKeys, ...table };
|
|
24376
|
-
};
|
|
24377
24468
|
const styles = "";
|
|
24378
24469
|
const Dovetail = (props) => {
|
|
24379
24470
|
const {
|
|
@@ -24426,7 +24517,10 @@ var __publicField = (obj, key, value) => {
|
|
|
24426
24517
|
options: {
|
|
24427
24518
|
warnWhenUnsavedChanges: true,
|
|
24428
24519
|
liveMode: "auto",
|
|
24429
|
-
disableTelemetry: true
|
|
24520
|
+
disableTelemetry: true,
|
|
24521
|
+
overtime: {
|
|
24522
|
+
interval: Number.MAX_SAFE_INTEGER
|
|
24523
|
+
}
|
|
24430
24524
|
},
|
|
24431
24525
|
accessControlProvider,
|
|
24432
24526
|
resources: resourcesConfig.map((c2) => {
|