@dovetail-v2/refine 0.0.47 → 0.0.48-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{MonacoYamlDiffEditor-9ad1c844.js → MonacoYamlDiffEditor-ed04648b.js} +1 -1
- package/dist/{index-1a40b2a8.js → index-04f52e89.js} +328 -321
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +327 -320
- package/lib/src/components/ModalContextProvider/index.d.ts +12 -0
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.d.ts +2 -1
- package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.d.ts +0 -1
- package/lib/src/components/YamlForm/index.d.ts +4 -0
- package/lib/src/hooks/useEagleForm.d.ts +2 -1
- package/lib/src/hooks/useModal.d.ts +0 -0
- package/lib/src/hooks/useNamespaceFilter.d.ts +5 -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/lib/src/utils/match-selector.d.ts +1 -1
- 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
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PageShow } from '../../../components/PageShow';
|
|
3
|
-
import { ConditionsField, EventsTableTabField, ImageField, PodsField, ReplicaField, } from '../../../components/ShowContent/fields';
|
|
4
|
-
import { WorkloadDropdown } from '../../../components/WorkloadDropdown';
|
|
5
|
-
import { useD2Translation } from '../../../i18n';
|
|
6
|
-
export const DeploymentShow = () => {
|
|
7
|
-
const { i18n } = useD2Translation();
|
|
8
|
-
return (_jsx(PageShow, { showConfig: {
|
|
9
|
-
groups: [
|
|
10
|
-
{
|
|
11
|
-
fields: [ImageField(i18n), ReplicaField(i18n)],
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
tabs: [PodsField(), ConditionsField(i18n), EventsTableTabField(i18n)],
|
|
15
|
-
}, Dropdown: WorkloadDropdown }));
|
|
16
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { IngressRulesTableTabField } from '../../components';
|
|
2
|
-
import K8sDropdown from '../../components/K8sDropdown';
|
|
3
|
-
import { INGRESS_INIT_VALUE } from '../../constants/k8s';
|
|
4
|
-
import { AgeColumnRenderer, IngressDefaultBackendColumnRenderer, IngressRulesColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
5
|
-
import { RESOURCE_GROUP, FormType } from '../../types';
|
|
6
|
-
export const IngressConfig = (i18n) => ({
|
|
7
|
-
name: 'ingresses',
|
|
8
|
-
kind: 'Ingress',
|
|
9
|
-
basePath: '/apis/networking.k8s.io/v1',
|
|
10
|
-
apiVersion: 'networking.k8s.io/v1',
|
|
11
|
-
label: 'Ingresses',
|
|
12
|
-
parent: RESOURCE_GROUP.NETWORK,
|
|
13
|
-
columns: () => [
|
|
14
|
-
IngressDefaultBackendColumnRenderer(i18n),
|
|
15
|
-
IngressRulesColumnRenderer(i18n),
|
|
16
|
-
AgeColumnRenderer(i18n),
|
|
17
|
-
],
|
|
18
|
-
showConfig: () => ({
|
|
19
|
-
descriptions: [],
|
|
20
|
-
groups: [],
|
|
21
|
-
tabs: [IngressRulesTableTabField(i18n)],
|
|
22
|
-
}),
|
|
23
|
-
initValue: INGRESS_INIT_VALUE,
|
|
24
|
-
Dropdown: K8sDropdown,
|
|
25
|
-
formType: FormType.MODAL,
|
|
26
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { FormType } from 'src/types';
|
|
2
|
-
import K8sDropdown from '../../components/K8sDropdown';
|
|
3
|
-
import { ConditionsField, ImageField, PodsField, StartTimeField, } from '../../components/ShowContent';
|
|
4
|
-
import { JOB_INIT_VALUE } from '../../constants/k8s';
|
|
5
|
-
import { AgeColumnRenderer, WorkloadImageColumnRenderer, DurationColumnRenderer, CompletionsCountColumnRenderer, StateDisplayColumnRenderer, WorkloadRestartsColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
6
|
-
import { RESOURCE_GROUP } from '../../types';
|
|
7
|
-
export const JobConfig = (i18n) => ({
|
|
8
|
-
name: 'jobs',
|
|
9
|
-
kind: 'Job',
|
|
10
|
-
basePath: '/apis/batch/v1',
|
|
11
|
-
apiVersion: 'batch/v1',
|
|
12
|
-
label: 'Jobs',
|
|
13
|
-
parent: RESOURCE_GROUP.WORKLOAD,
|
|
14
|
-
columns: () => [
|
|
15
|
-
StateDisplayColumnRenderer(i18n),
|
|
16
|
-
WorkloadImageColumnRenderer(i18n),
|
|
17
|
-
CompletionsCountColumnRenderer(i18n),
|
|
18
|
-
WorkloadRestartsColumnRenderer(i18n),
|
|
19
|
-
DurationColumnRenderer(i18n),
|
|
20
|
-
AgeColumnRenderer(i18n),
|
|
21
|
-
],
|
|
22
|
-
showConfig: () => ({
|
|
23
|
-
descriptions: [],
|
|
24
|
-
groups: [
|
|
25
|
-
{
|
|
26
|
-
fields: [StartTimeField(i18n), ImageField(i18n)],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
tabs: [PodsField(), ConditionsField(i18n)],
|
|
30
|
-
}),
|
|
31
|
-
initValue: JOB_INIT_VALUE,
|
|
32
|
-
Dropdown: K8sDropdown,
|
|
33
|
-
formType: FormType.MODAL,
|
|
34
|
-
});
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Tags } from '../../components';
|
|
3
|
-
import K8sDropdown from '../../components/K8sDropdown';
|
|
4
|
-
import { NetworkPolicyRulesTable } from '../../components/NetworkPolicyRulesTable';
|
|
5
|
-
import { NETWORK_POLICY_INIT_VALUE } from '../../constants/k8s';
|
|
6
|
-
import { AgeColumnRenderer } from '../../hooks/useEagleTable/columns';
|
|
7
|
-
import { RESOURCE_GROUP, FormType } from '../../types';
|
|
8
|
-
export const NetworkPolicyConfig = (i18n) => ({
|
|
9
|
-
name: 'networkpolicies',
|
|
10
|
-
kind: 'NetworkPolicy',
|
|
11
|
-
basePath: '/apis/networking.k8s.io/v1',
|
|
12
|
-
apiVersion: 'networking.k8s.io/v1',
|
|
13
|
-
label: 'NetworkPolicies',
|
|
14
|
-
parent: RESOURCE_GROUP.NETWORK,
|
|
15
|
-
columns: () => [
|
|
16
|
-
{
|
|
17
|
-
key: 'podSelector',
|
|
18
|
-
display: true,
|
|
19
|
-
dataIndex: ['spec', 'podSelector', 'matchLabels'],
|
|
20
|
-
title: 'Pod Selector',
|
|
21
|
-
sortable: false,
|
|
22
|
-
render(matchLabels) {
|
|
23
|
-
return _jsx(Tags, { value: matchLabels });
|
|
24
|
-
},
|
|
25
|
-
},
|
|
26
|
-
AgeColumnRenderer(i18n),
|
|
27
|
-
],
|
|
28
|
-
showConfig: () => ({
|
|
29
|
-
descriptions: [],
|
|
30
|
-
groups: [
|
|
31
|
-
{
|
|
32
|
-
fields: [
|
|
33
|
-
{
|
|
34
|
-
key: 'podSelector',
|
|
35
|
-
title: 'Pod Selector',
|
|
36
|
-
path: ['spec', 'podSelector'],
|
|
37
|
-
col: 12,
|
|
38
|
-
renderContent: podSelector => {
|
|
39
|
-
return _jsx(Tags, { value: podSelector.matchLabels });
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
],
|
|
43
|
-
},
|
|
44
|
-
],
|
|
45
|
-
tabs: [
|
|
46
|
-
{
|
|
47
|
-
key: 'Ingress',
|
|
48
|
-
title: 'Ingress Rules',
|
|
49
|
-
path: ['spec', 'ingress'],
|
|
50
|
-
renderContent: ingress => {
|
|
51
|
-
return (_jsx(NetworkPolicyRulesTable, { ingressOrEgress: ingress }));
|
|
52
|
-
},
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
key: 'Egress',
|
|
56
|
-
title: 'Egress Rules',
|
|
57
|
-
path: ['spec', 'egress'],
|
|
58
|
-
renderContent: egress => {
|
|
59
|
-
return (_jsx(NetworkPolicyRulesTable, { ingressOrEgress: egress }));
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
initValue: NETWORK_POLICY_INIT_VALUE,
|
|
65
|
-
Dropdown: K8sDropdown,
|
|
66
|
-
formType: FormType.MODAL,
|
|
67
|
-
});
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useList } from '@refinedev/core';
|
|
3
|
-
import { compact } from 'lodash-es';
|
|
4
|
-
import { useMemo } from 'react';
|
|
5
|
-
import { ListPage } from '../../../components/ListPage';
|
|
6
|
-
import { useEagleTable } from '../../../hooks/useEagleTable';
|
|
7
|
-
import { AgeColumnRenderer, WorkloadImageColumnRenderer, NameColumnRenderer, NameSpaceColumnRenderer, CommonSorter, RestartCountColumnRenderer, NodeNameColumnRenderer, StateDisplayColumnRenderer, PodWorkloadColumnRenderer, } from '../../../hooks/useEagleTable/columns';
|
|
8
|
-
import { useD2Translation } from '../../../i18n';
|
|
9
|
-
export const PodList = () => {
|
|
10
|
-
const { i18n } = useD2Translation();
|
|
11
|
-
const { data: metricsData } = useList({
|
|
12
|
-
resource: 'podMetrics',
|
|
13
|
-
meta: {
|
|
14
|
-
resourceBasePath: '/apis/metrics.k8s.io/v1beta1',
|
|
15
|
-
kind: 'PodMetrics',
|
|
16
|
-
k8sResource: 'pods',
|
|
17
|
-
},
|
|
18
|
-
});
|
|
19
|
-
const metricsMap = useMemo(() => {
|
|
20
|
-
return (metricsData?.data || []).reduce((prev, cur) => {
|
|
21
|
-
prev[cur.id] = cur;
|
|
22
|
-
return prev;
|
|
23
|
-
}, {});
|
|
24
|
-
}, [metricsData]);
|
|
25
|
-
const supportMetrics = Boolean(metricsData);
|
|
26
|
-
const { tableProps, selectedKeys } = useEagleTable({
|
|
27
|
-
useTableParams: {},
|
|
28
|
-
columns: compact([
|
|
29
|
-
StateDisplayColumnRenderer(i18n),
|
|
30
|
-
NameColumnRenderer(i18n),
|
|
31
|
-
NameSpaceColumnRenderer(i18n),
|
|
32
|
-
WorkloadImageColumnRenderer(i18n),
|
|
33
|
-
{
|
|
34
|
-
key: 'readyDisplay',
|
|
35
|
-
display: true,
|
|
36
|
-
dataIndex: ['readyDisplay'],
|
|
37
|
-
title: 'Ready',
|
|
38
|
-
sortable: true,
|
|
39
|
-
sorter: CommonSorter(['readyDisplay']),
|
|
40
|
-
},
|
|
41
|
-
RestartCountColumnRenderer(i18n),
|
|
42
|
-
NodeNameColumnRenderer(i18n),
|
|
43
|
-
PodWorkloadColumnRenderer(i18n),
|
|
44
|
-
supportMetrics && {
|
|
45
|
-
key: 'memory_usage',
|
|
46
|
-
display: true,
|
|
47
|
-
dataIndex: ['spec'],
|
|
48
|
-
title: '内存',
|
|
49
|
-
sortable: false,
|
|
50
|
-
align: 'right',
|
|
51
|
-
render(value, record) {
|
|
52
|
-
return metricsMap[record.id]?.usage.memory.si;
|
|
53
|
-
},
|
|
54
|
-
},
|
|
55
|
-
supportMetrics && {
|
|
56
|
-
key: 'cpu_usage',
|
|
57
|
-
display: true,
|
|
58
|
-
dataIndex: ['spec'],
|
|
59
|
-
title: 'CPU',
|
|
60
|
-
sortable: false,
|
|
61
|
-
align: 'right',
|
|
62
|
-
render(value, record) {
|
|
63
|
-
return metricsMap[record.id]?.usage.cpu.si;
|
|
64
|
-
},
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
key: 'ip',
|
|
68
|
-
display: true,
|
|
69
|
-
dataIndex: ['status', 'podIP'],
|
|
70
|
-
title: 'IP',
|
|
71
|
-
sortable: true,
|
|
72
|
-
sorter: CommonSorter(['status', 'podIP']),
|
|
73
|
-
},
|
|
74
|
-
AgeColumnRenderer(i18n),
|
|
75
|
-
]),
|
|
76
|
-
tableProps: {
|
|
77
|
-
currentSize: 10,
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
return _jsx(ListPage, { title: "Pod", selectedKeys: selectedKeys, tableProps: tableProps });
|
|
81
|
-
};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { PodLog } from 'src/components/PodLog';
|
|
3
|
-
import { PageShow } from '../../../components/PageShow';
|
|
4
|
-
import { PodContainersTable } from '../../../components/PodContainersTable';
|
|
5
|
-
import { ConditionsField } from '../../../components/ShowContent/fields';
|
|
6
|
-
import { useD2Translation } from '../../../i18n';
|
|
7
|
-
export const PodShow = () => {
|
|
8
|
-
const { i18n } = useD2Translation();
|
|
9
|
-
return (_jsx(PageShow, { showConfig: {
|
|
10
|
-
groups: [{
|
|
11
|
-
fields: [
|
|
12
|
-
{
|
|
13
|
-
key: 'podIp',
|
|
14
|
-
title: 'Pod IP',
|
|
15
|
-
path: ['status', 'podIP'],
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
key: 'Workload',
|
|
19
|
-
title: i18n.t('dovetail.workload'),
|
|
20
|
-
path: ['metadata', 'ownerReferences', '0', 'name'],
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
key: 'Node',
|
|
24
|
-
title: i18n.t('dovetail.node_name'),
|
|
25
|
-
path: ['spec', 'nodeName'],
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
key: 'readyDisplay',
|
|
29
|
-
title: 'Ready',
|
|
30
|
-
path: ['readyDisplay'],
|
|
31
|
-
},
|
|
32
|
-
]
|
|
33
|
-
}],
|
|
34
|
-
tabs: [
|
|
35
|
-
{
|
|
36
|
-
key: 'container',
|
|
37
|
-
title: i18n.t('dovetail.container'),
|
|
38
|
-
path: [],
|
|
39
|
-
renderContent: (_, record) => {
|
|
40
|
-
return (_jsx(PodContainersTable, { containerStatuses: record.status?.containerStatuses || [], initContainerStatuses: record.status?.initContainerStatuses || [] }));
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
ConditionsField(i18n),
|
|
44
|
-
{
|
|
45
|
-
key: 'log',
|
|
46
|
-
title: i18n.t('dovetail.log'),
|
|
47
|
-
path: [],
|
|
48
|
-
renderContent: (_, record) => {
|
|
49
|
-
return _jsx(PodLog, { pod: record });
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
],
|
|
53
|
-
} }));
|
|
54
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { SecretDataField } from '../../components/ShowContent';
|
|
2
|
-
import { AgeColumnRenderer } from '../../hooks/useEagleTable/columns';
|
|
3
|
-
import { RESOURCE_GROUP } from '../../types';
|
|
4
|
-
export const SecretsConfig = (i18n) => ({
|
|
5
|
-
name: 'secrets',
|
|
6
|
-
kind: 'Secret',
|
|
7
|
-
basePath: '/api/v1',
|
|
8
|
-
apiVersion: 'v1',
|
|
9
|
-
parent: RESOURCE_GROUP.STORAGE,
|
|
10
|
-
label: 'Secrets',
|
|
11
|
-
columns: () => [AgeColumnRenderer(i18n)],
|
|
12
|
-
showConfig: () => ({
|
|
13
|
-
tabs: [SecretDataField(i18n)],
|
|
14
|
-
}),
|
|
15
|
-
});
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { ConditionsField, ServiceTypeField, ClusterIpField, SessionAffinityField, ServicePodsField, } from '../../components/ShowContent';
|
|
2
|
-
import { SERVICE_INIT_VALUE } from '../../constants';
|
|
3
|
-
import { AgeColumnRenderer, ServiceTypeColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
4
|
-
import { RESOURCE_GROUP } from '../../types';
|
|
5
|
-
export const ServicesConfig = (i18n) => ({
|
|
6
|
-
name: 'services',
|
|
7
|
-
kind: 'Service',
|
|
8
|
-
basePath: '/api/v1',
|
|
9
|
-
apiVersion: 'v1',
|
|
10
|
-
label: 'Services',
|
|
11
|
-
parent: RESOURCE_GROUP.NETWORK,
|
|
12
|
-
columns: () => [ServiceTypeColumnRenderer(i18n), AgeColumnRenderer(i18n)],
|
|
13
|
-
showConfig: () => ({
|
|
14
|
-
groups: [
|
|
15
|
-
{
|
|
16
|
-
fields: [
|
|
17
|
-
ServiceTypeField(i18n),
|
|
18
|
-
ClusterIpField(i18n),
|
|
19
|
-
SessionAffinityField(i18n),
|
|
20
|
-
],
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
tabs: [ServicePodsField(), ConditionsField(i18n)],
|
|
24
|
-
}),
|
|
25
|
-
initValue: SERVICE_INIT_VALUE,
|
|
26
|
-
});
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import YamlForm from 'src/components/YamlForm';
|
|
3
|
-
import { STATEFULSET_INIT_VALUE } from 'src/constants/k8s';
|
|
4
|
-
export const StatefulSetForm = () => {
|
|
5
|
-
return _jsx(YamlForm, { initialValues: STATEFULSET_INIT_VALUE });
|
|
6
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ListPage } from 'src/components/ListPage';
|
|
3
|
-
import { WorkloadDropdown } from 'src/components/WorkloadDropdown';
|
|
4
|
-
import { useEagleTable } from 'src/hooks/useEagleTable';
|
|
5
|
-
import { AgeColumnRenderer, WorkloadImageColumnRenderer, NameColumnRenderer, NameSpaceColumnRenderer, StateDisplayColumnRenderer, ReplicasColumnRenderer, WorkloadRestartsColumnRenderer, } from 'src/hooks/useEagleTable/columns';
|
|
6
|
-
import { useD2Translation } from '../../../i18n';
|
|
7
|
-
export const StatefulSetList = () => {
|
|
8
|
-
const { i18n } = useD2Translation();
|
|
9
|
-
const { tableProps, selectedKeys } = useEagleTable({
|
|
10
|
-
useTableParams: {},
|
|
11
|
-
columns: [
|
|
12
|
-
StateDisplayColumnRenderer(i18n),
|
|
13
|
-
NameColumnRenderer(i18n),
|
|
14
|
-
NameSpaceColumnRenderer(i18n),
|
|
15
|
-
WorkloadImageColumnRenderer(i18n),
|
|
16
|
-
WorkloadRestartsColumnRenderer(i18n),
|
|
17
|
-
ReplicasColumnRenderer(i18n),
|
|
18
|
-
AgeColumnRenderer(i18n),
|
|
19
|
-
],
|
|
20
|
-
tableProps: {
|
|
21
|
-
currentSize: 10,
|
|
22
|
-
},
|
|
23
|
-
Dropdown: WorkloadDropdown,
|
|
24
|
-
});
|
|
25
|
-
return (_jsx(ListPage, { title: "StatefulSet", selectedKeys: selectedKeys, tableProps: tableProps }));
|
|
26
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { WorkloadDropdown } from 'src/components/WorkloadDropdown';
|
|
3
|
-
import { PageShow } from '../../../components/PageShow';
|
|
4
|
-
import { ConditionsField, ImageField, PodsField, ReplicaField, } from '../../../components/ShowContent/fields';
|
|
5
|
-
import { useD2Translation } from '../../../i18n';
|
|
6
|
-
export const StatefulSetShow = () => {
|
|
7
|
-
const { i18n } = useD2Translation();
|
|
8
|
-
return (_jsx(PageShow, { showConfig: {
|
|
9
|
-
groups: [
|
|
10
|
-
{
|
|
11
|
-
fields: [ImageField(i18n), ReplicaField(i18n)],
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
tabs: [PodsField(), ConditionsField(i18n)],
|
|
15
|
-
}, Dropdown: WorkloadDropdown }));
|
|
16
|
-
};
|
package/lib/src/plugins/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { CronJobModel, DaemonSetModel, DeploymentModel, EventModel, IngressModel, JobModel, PodModel, ResourceModel, StatefulSetModel, NetworkPolicyModel, } from '../models';
|
|
2
|
-
const ModelMap = {
|
|
3
|
-
Deployment: DeploymentModel,
|
|
4
|
-
DaemonSet: DaemonSetModel,
|
|
5
|
-
StatefulSet: StatefulSetModel,
|
|
6
|
-
CronJob: CronJobModel,
|
|
7
|
-
Job: JobModel,
|
|
8
|
-
Pod: PodModel,
|
|
9
|
-
Event: EventModel,
|
|
10
|
-
Ingress: IngressModel,
|
|
11
|
-
NetworkPolicy: NetworkPolicyModel,
|
|
12
|
-
};
|
|
13
|
-
class ModelPlugin {
|
|
14
|
-
_globalStore;
|
|
15
|
-
init(globalStore) {
|
|
16
|
-
this._globalStore = globalStore;
|
|
17
|
-
}
|
|
18
|
-
async processData(res) {
|
|
19
|
-
const { kind, apiVersion } = res;
|
|
20
|
-
const items = await Promise.all(res.items.map(item => {
|
|
21
|
-
const newItem = { ...item };
|
|
22
|
-
newItem.kind = kind.replace(/List$/g, '');
|
|
23
|
-
newItem.apiVersion = apiVersion;
|
|
24
|
-
return this.processItem(newItem);
|
|
25
|
-
}));
|
|
26
|
-
return {
|
|
27
|
-
...res,
|
|
28
|
-
items,
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
async processItem(item) {
|
|
32
|
-
const Model = ModelMap[item.kind] || ResourceModel;
|
|
33
|
-
const result = new Model(item, this._globalStore);
|
|
34
|
-
await result.init();
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
restoreData(res) {
|
|
38
|
-
const newRes = { ...res };
|
|
39
|
-
newRes.items = res.items.map(item => this.restoreItem(item));
|
|
40
|
-
return res;
|
|
41
|
-
}
|
|
42
|
-
restoreItem(item) {
|
|
43
|
-
return item._rawYaml;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export const modelPlugin = new ModelPlugin();
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { omit } from 'lodash';
|
|
2
|
-
class RelationPlugin {
|
|
3
|
-
globalStore;
|
|
4
|
-
init(globalStore) {
|
|
5
|
-
this.globalStore = globalStore;
|
|
6
|
-
}
|
|
7
|
-
async processData(res) {
|
|
8
|
-
const { kind, apiVersion } = res;
|
|
9
|
-
const items = await Promise.all(res.items.map(item => this.processItem({
|
|
10
|
-
// TODO: unify this with data-provider getOne method
|
|
11
|
-
kind: kind.replace(/List$/g, ''),
|
|
12
|
-
apiVersion,
|
|
13
|
-
...omit(item, ['apiVersion', 'kind']),
|
|
14
|
-
})));
|
|
15
|
-
return {
|
|
16
|
-
...res,
|
|
17
|
-
items,
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
async processItem(item) {
|
|
21
|
-
this.processPodSelector(item);
|
|
22
|
-
return item;
|
|
23
|
-
}
|
|
24
|
-
restoreData(res) {
|
|
25
|
-
res.items = res.items.map(item => this.restoreItem(item));
|
|
26
|
-
return res;
|
|
27
|
-
}
|
|
28
|
-
restoreItem(item) {
|
|
29
|
-
return {
|
|
30
|
-
...item,
|
|
31
|
-
metadata: omit(item.metadata, 'relations'),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
processPodSelector(item) {
|
|
35
|
-
const { spec, kind } = item;
|
|
36
|
-
const selector = spec?.selector;
|
|
37
|
-
if (!selector) {
|
|
38
|
-
return item;
|
|
39
|
-
}
|
|
40
|
-
// TODO: also check apiVersion along with kind
|
|
41
|
-
if (!kind ||
|
|
42
|
-
![
|
|
43
|
-
'Deployment',
|
|
44
|
-
'DaemonSet',
|
|
45
|
-
'StatefulSet',
|
|
46
|
-
'ReplicaSet',
|
|
47
|
-
'Job',
|
|
48
|
-
'Service',
|
|
49
|
-
].includes(kind)) {
|
|
50
|
-
return item;
|
|
51
|
-
}
|
|
52
|
-
// empty selector or legacy resources like Service
|
|
53
|
-
if (!selector.matchLabels && !selector.matchExpressions) {
|
|
54
|
-
selector.matchLabels = {};
|
|
55
|
-
for (const key of Object.keys(selector)) {
|
|
56
|
-
if (key === 'matchLabels') {
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
selector.matchLabels[key] = selector[key];
|
|
60
|
-
delete selector[key];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
this.appendRelation(item, {
|
|
64
|
-
kind: 'Pod',
|
|
65
|
-
apiVersion: 'v1',
|
|
66
|
-
type: kind === 'Service' ? 'selects' : 'creates',
|
|
67
|
-
selector,
|
|
68
|
-
inbound: false,
|
|
69
|
-
});
|
|
70
|
-
return item;
|
|
71
|
-
}
|
|
72
|
-
appendRelation(item, relation) {
|
|
73
|
-
const metadata = item.metadata;
|
|
74
|
-
if (!metadata.relations) {
|
|
75
|
-
metadata.relations = [];
|
|
76
|
-
}
|
|
77
|
-
metadata.relations.push(relation);
|
|
78
|
-
return item;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
export const relationPlugin = new RelationPlugin();
|
package/lib/src/plugins/type.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { routerProvider } from './router-provider';
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react-hooks/rules-of-hooks */
|
|
3
|
-
import { matchResourceFromRoute, ResourceContext, } from '@refinedev/core';
|
|
4
|
-
import { parse, stringify } from 'qs';
|
|
5
|
-
import React from 'react';
|
|
6
|
-
import { useCallback, useContext } from 'react';
|
|
7
|
-
import { useHistory, useLocation, Link, matchPath, useParams } from 'react-router-dom';
|
|
8
|
-
export const stringifyConfig = {
|
|
9
|
-
addQueryPrefix: true,
|
|
10
|
-
skipNulls: true,
|
|
11
|
-
arrayFormat: 'indices',
|
|
12
|
-
encode: false,
|
|
13
|
-
encodeValuesOnly: true,
|
|
14
|
-
};
|
|
15
|
-
export const convertToNumberIfPossible = (value) => {
|
|
16
|
-
if (typeof value === 'undefined') {
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
const num = Number(value);
|
|
20
|
-
if (`${num}` === value) {
|
|
21
|
-
return num;
|
|
22
|
-
}
|
|
23
|
-
return value;
|
|
24
|
-
};
|
|
25
|
-
export const routerProvider = {
|
|
26
|
-
go: () => {
|
|
27
|
-
const { search: existingSearch, hash: existingHash } = useLocation();
|
|
28
|
-
const history = useHistory();
|
|
29
|
-
const fn = useCallback(({ to, type, query, hash, options: { keepQuery, keepHash } = {} }) => {
|
|
30
|
-
/** Construct query params */
|
|
31
|
-
const urlQuery = {
|
|
32
|
-
...(keepQuery &&
|
|
33
|
-
existingSearch &&
|
|
34
|
-
parse(existingSearch, { ignoreQueryPrefix: true })),
|
|
35
|
-
...query,
|
|
36
|
-
};
|
|
37
|
-
if (urlQuery.to) {
|
|
38
|
-
urlQuery.to = encodeURIComponent(`${urlQuery.to}`);
|
|
39
|
-
}
|
|
40
|
-
const hasUrlQuery = Object.keys(urlQuery).length > 0;
|
|
41
|
-
/** Get hash */
|
|
42
|
-
const urlHash = `#${(hash || (keepHash && existingHash) || '').replace(/^#/, '')}`;
|
|
43
|
-
const hasUrlHash = urlHash.length > 1;
|
|
44
|
-
const urlTo = to || '';
|
|
45
|
-
const fullPath = `${urlTo}${hasUrlQuery ? stringify(urlQuery, stringifyConfig) : ''}${hasUrlHash ? urlHash : ''}`;
|
|
46
|
-
if (type === 'path') {
|
|
47
|
-
return fullPath;
|
|
48
|
-
}
|
|
49
|
-
/** Navigate to the url */
|
|
50
|
-
return history[type || 'push'](fullPath);
|
|
51
|
-
}, [existingHash, existingSearch, history]);
|
|
52
|
-
return fn;
|
|
53
|
-
},
|
|
54
|
-
back: () => {
|
|
55
|
-
const history = useHistory();
|
|
56
|
-
const fn = useCallback(() => {
|
|
57
|
-
history.go(-1);
|
|
58
|
-
}, [history]);
|
|
59
|
-
return fn;
|
|
60
|
-
},
|
|
61
|
-
parse: () => {
|
|
62
|
-
let params = useParams();
|
|
63
|
-
const { pathname, search } = useLocation();
|
|
64
|
-
const { resources } = useContext(ResourceContext);
|
|
65
|
-
const { resource, action, matchedRoute } = React.useMemo(() => {
|
|
66
|
-
return matchResourceFromRoute(pathname, resources);
|
|
67
|
-
}, [resources, pathname]);
|
|
68
|
-
// params is empty when useParams is used in a component that is not a child of a Route
|
|
69
|
-
if (Object.entries(params).length === 0 && matchedRoute) {
|
|
70
|
-
params = matchPath(matchedRoute, pathname)?.params || {};
|
|
71
|
-
}
|
|
72
|
-
const fn = useCallback(() => {
|
|
73
|
-
const parsedSearch = parse(search, { ignoreQueryPrefix: true });
|
|
74
|
-
const combinedParams = {
|
|
75
|
-
...params,
|
|
76
|
-
...parsedSearch,
|
|
77
|
-
};
|
|
78
|
-
const response = {
|
|
79
|
-
...(resource && { resource }),
|
|
80
|
-
...(action && { action }),
|
|
81
|
-
...(parsedSearch?.id && { id: decodeURIComponent(parsedSearch.id) }),
|
|
82
|
-
// ...(params?.action && { action: params.action }), // lets see if there is a need for this
|
|
83
|
-
pathname,
|
|
84
|
-
params: {
|
|
85
|
-
...combinedParams,
|
|
86
|
-
current: convertToNumberIfPossible(combinedParams.current),
|
|
87
|
-
pageSize: convertToNumberIfPossible(combinedParams.pageSize),
|
|
88
|
-
to: combinedParams.to
|
|
89
|
-
? decodeURIComponent(combinedParams.to)
|
|
90
|
-
: undefined,
|
|
91
|
-
},
|
|
92
|
-
};
|
|
93
|
-
return response;
|
|
94
|
-
}, [pathname, search, params, resource, action]);
|
|
95
|
-
return fn;
|
|
96
|
-
},
|
|
97
|
-
Link: React.forwardRef(function RefineLink(props, ref) {
|
|
98
|
-
return _jsx(Link, { ...props, ref: ref });
|
|
99
|
-
}),
|
|
100
|
-
};
|
package/lib/src/types/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './resource';
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export var RESOURCE_GROUP;
|
|
2
|
-
(function (RESOURCE_GROUP) {
|
|
3
|
-
RESOURCE_GROUP["WORKLOAD"] = "WORKLOAD";
|
|
4
|
-
RESOURCE_GROUP["STORAGE"] = "STORAGE";
|
|
5
|
-
RESOURCE_GROUP["NETWORK"] = "NETWORK";
|
|
6
|
-
RESOURCE_GROUP["CLUSTER"] = "CLUSTER";
|
|
7
|
-
})(RESOURCE_GROUP || (RESOURCE_GROUP = {}));
|
|
8
|
-
export var FormType;
|
|
9
|
-
(function (FormType) {
|
|
10
|
-
FormType["PAGE"] = "PAGE";
|
|
11
|
-
FormType["MODAL"] = "MODAL";
|
|
12
|
-
})(FormType || (FormType = {}));
|