@dovetail-v2/refine 0.0.28 → 0.0.29
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-b459d49b.js → MonacoYamlDiffEditor-37f2db86.js} +1 -1
- package/dist/{index-432360ef.js → index-3716ce7b.js} +39 -34
- package/dist/refine.js +1 -1
- package/dist/refine.umd.cjs +40 -35
- package/lib/src/App.js +0 -2
- package/lib/src/components/ConditionsTable/ConditionsTable.js +2 -2
- package/lib/src/components/CreateButton/index.js +2 -2
- package/lib/src/components/CronJobDropdown/index.js +2 -2
- package/lib/src/components/CronjobJobsTable/index.js +2 -2
- package/lib/src/components/DeleteButton/index.js +2 -2
- package/lib/src/components/DeleteManyButton/index.js +2 -2
- package/lib/src/components/EditField/index.js +3 -3
- package/lib/src/components/ErrorContent/index.js +2 -2
- package/lib/src/components/EventsTable/EventsTable.js +2 -2
- package/lib/src/components/FormLayout/index.js +2 -2
- package/lib/src/components/FormModal/index.js +2 -2
- package/lib/src/components/ImageNames/index.js +2 -2
- package/lib/src/components/IngressRulesTable/IngressRulesTable.js +2 -2
- package/lib/src/components/K8sDropdown/index.js +2 -2
- package/lib/src/components/KeyValueData/index.js +2 -2
- package/lib/src/components/NamespacesFilter/index.js +2 -2
- package/lib/src/components/NetworkPolicyRulesTable/NetworkPolicyRulesTable.js +2 -2
- package/lib/src/components/PodContainersTable/PodContainersTable.js +2 -2
- package/lib/src/components/PodLog/index.js +2 -2
- package/lib/src/components/ResourceCRUD/list/index.js +2 -2
- package/lib/src/components/ShowContent/ShowContent.js +2 -2
- package/lib/src/components/StateTag/StateTag.js +2 -2
- package/lib/src/components/Table/ErrorContent.js +2 -2
- package/lib/src/components/Table/index.js +2 -2
- package/lib/src/components/WorkloadDropdown/index.js +2 -2
- package/lib/src/components/WorkloadPodsTable/WorkloadPodsTable.js +2 -2
- package/lib/src/components/YamlEditor/YamlEditorComponent.js +2 -2
- package/lib/src/components/YamlForm/index.js +2 -2
- package/lib/src/hooks/useDeleteModal/useDeleteManyModal.js +2 -2
- package/lib/src/hooks/useDeleteModal/useDeleteModal.js +2 -2
- package/lib/src/hooks/useEagleForm.js +2 -2
- package/lib/src/hooks/useSubmitForm.js +2 -2
- package/lib/src/i18n.d.ts +1 -0
- package/lib/src/i18n.js +6 -1
- package/lib/src/pages/cronjobs/list/index.js +2 -2
- package/lib/src/pages/cronjobs/show/index.js +2 -2
- package/lib/src/pages/daemonsets/list/index.js +2 -2
- package/lib/src/pages/daemonsets/show/index.js +2 -2
- package/lib/src/pages/deployments/list/index.js +2 -2
- package/lib/src/pages/deployments/show/index.js +2 -2
- package/lib/src/pages/pods/list/index.js +2 -2
- package/lib/src/pages/pods/show/index.js +2 -2
- package/lib/src/pages/statefulsets/list/index.js +2 -2
- package/lib/src/pages/statefulsets/show/index.js +2 -2
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Icon, useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { SuspendedPause16GradientGrayIcon, VmResume16Icon, } from '@cloudtower/icons-react';
|
|
4
4
|
import { useResource, useUpdate } from '@refinedev/core';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
import { pruneBeforeEdit } from '../../utils/k8s';
|
|
7
7
|
import K8sDropdown from '../K8sDropdown';
|
|
8
8
|
export function CronJobDropdown(props) {
|
|
@@ -11,7 +11,7 @@ export function CronJobDropdown(props) {
|
|
|
11
11
|
const kit = useUIKit();
|
|
12
12
|
const { resource } = useResource();
|
|
13
13
|
const { mutate } = useUpdate();
|
|
14
|
-
const { t } =
|
|
14
|
+
const { t } = useD2Translation();
|
|
15
15
|
const suspended = Boolean(spec?.suspend);
|
|
16
16
|
return (_jsx(K8sDropdown, { record: record, children: _jsx(kit.menu.Item, { onClick: () => {
|
|
17
17
|
const v = suspended ? record.resume() : record.suspend();
|
|
@@ -3,8 +3,8 @@ import { useUIKit } from '@cloudtower/eagle';
|
|
|
3
3
|
import { css } from '@linaria/core';
|
|
4
4
|
import { useList } from '@refinedev/core';
|
|
5
5
|
import { useMemo, useState } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import { AgeColumnRenderer, CompletionsCountColumnRenderer, DurationColumnRenderer, NameColumnRenderer, NameSpaceColumnRenderer, StateDisplayColumnRenderer, WorkloadImageColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
7
|
+
import { useD2Translation } from '../../i18n';
|
|
8
8
|
import Table from '../Table';
|
|
9
9
|
import { TableToolBar } from '../Table/TableToolBar';
|
|
10
10
|
function matchOwner(job, owner) {
|
|
@@ -21,7 +21,7 @@ function matchOwner(job, owner) {
|
|
|
21
21
|
return match;
|
|
22
22
|
}
|
|
23
23
|
export const CronjobJobsTable = ({ owner }) => {
|
|
24
|
-
const { i18n } =
|
|
24
|
+
const { i18n } = useD2Translation();
|
|
25
25
|
const kit = useUIKit();
|
|
26
26
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
27
27
|
const [currentPage, setCurrentPage] = useState(1);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { useResource, useParsed } from '@refinedev/core';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
4
|
import { useDeleteModal } from '../../hooks/useDeleteModal';
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
export const DeleteButton = () => {
|
|
7
7
|
const { resource } = useResource();
|
|
8
8
|
const { id } = useParsed();
|
|
9
9
|
const kit = useUIKit();
|
|
10
|
-
const { t } =
|
|
10
|
+
const { t } = useD2Translation();
|
|
11
11
|
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(resource?.name || '');
|
|
12
12
|
return (_jsxs(_Fragment, { children: [_jsx(kit.button, { type: "primary", danger: true, onClick: () => openDeleteConfirmModal(id || ''), children: t('dovetail.delete') }), visible ? _jsx(kit.modal, { ...modalProps }) : null] }));
|
|
13
13
|
};
|
|
@@ -2,12 +2,12 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { useResource } from '@refinedev/core';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { useDeleteManyModal } from '../../hooks/useDeleteModal/useDeleteManyModal';
|
|
6
|
+
import { useD2Translation } from '../../i18n';
|
|
7
7
|
export const DeleteManyButton = props => {
|
|
8
8
|
const { resource } = useResource();
|
|
9
9
|
const kit = useUIKit();
|
|
10
|
-
const { t } =
|
|
10
|
+
const { t } = useD2Translation();
|
|
11
11
|
const { modalProps, visible, setVisible } = useDeleteManyModal(resource?.name || '', props.ids);
|
|
12
12
|
const onClick = useCallback(() => {
|
|
13
13
|
setVisible(true);
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useUIKit, pushModal, popModal } from '@cloudtower/eagle';
|
|
3
3
|
import { css } from '@linaria/core';
|
|
4
4
|
import { useCallback } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { FormErrorAlert } from 'src/components/FormErrorAlert';
|
|
7
6
|
import { useSubmitForm } from 'src/hooks/useSubmitForm';
|
|
7
|
+
import { useD2Translation } from '../../i18n';
|
|
8
8
|
const EditFieldModalStyle = css `
|
|
9
9
|
.ant-modal-content {
|
|
10
10
|
border-radius: 16px;
|
|
@@ -23,7 +23,7 @@ const EditButtonStyle = css `
|
|
|
23
23
|
export function EditFieldModal(props) {
|
|
24
24
|
const { title, formRef: form, renderContent } = props;
|
|
25
25
|
const kit = useUIKit();
|
|
26
|
-
const { i18n } =
|
|
26
|
+
const { i18n } = useD2Translation();
|
|
27
27
|
const { submitting, errorMsgs, reset, onSubmit, } = useSubmitForm({
|
|
28
28
|
formRef: form,
|
|
29
29
|
onSubmitSuccess: popModal
|
|
@@ -37,7 +37,7 @@ export function EditFieldModal(props) {
|
|
|
37
37
|
export function EditField(props) {
|
|
38
38
|
const { modalProps } = props;
|
|
39
39
|
const kit = useUIKit();
|
|
40
|
-
const { i18n } =
|
|
40
|
+
const { i18n } = useD2Translation();
|
|
41
41
|
return (_jsx(kit.button, { className: EditButtonStyle, type: "link", onClick: () => {
|
|
42
42
|
pushModal({
|
|
43
43
|
component: EditFieldModal,
|
|
@@ -3,7 +3,7 @@ import { kitContext, Typo } from '@cloudtower/eagle';
|
|
|
3
3
|
import { cx } from '@linaria/core';
|
|
4
4
|
import { styled } from '@linaria/react';
|
|
5
5
|
import { useContext } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { useD2Translation } from '../../i18n';
|
|
7
7
|
export const ErrorWrapper = styled.div `
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
@@ -27,7 +27,7 @@ export const ErrorContent = styled.div `
|
|
|
27
27
|
const WidgetErrorContent = props => {
|
|
28
28
|
const { refetch, errorText, hiddenRetry } = props;
|
|
29
29
|
const kit = useContext(kitContext);
|
|
30
|
-
const { t } =
|
|
30
|
+
const { t } = useD2Translation();
|
|
31
31
|
return (_jsx(ErrorWrapper, { className: props.className, style: props.style, children: _jsxs(ErrorContent, { children: [_jsx("p", { className: cx(Typo.Label.l1_regular_title, 'title'), children: errorText || t('dovetail.obtain_data_error') }), hiddenRetry ? null : (_jsx(kit.button, { size: "small", type: "ordinary", onClick: e => {
|
|
32
32
|
e.stopPropagation();
|
|
33
33
|
refetch?.();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useList, useParsed } from '@refinedev/core';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
4
|
import { AgeColumnRenderer, CommonSorter, NameSpaceColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
import Table from '../Table';
|
|
7
7
|
export const EventsTable = ({}) => {
|
|
8
|
-
const { i18n } =
|
|
8
|
+
const { i18n } = useD2Translation();
|
|
9
9
|
const [currentPage, setCurrentPage] = useState(1);
|
|
10
10
|
const { data, isLoading } = useList({
|
|
11
11
|
resource: 'events',
|
|
@@ -2,7 +2,7 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useUIKit, Typo } from '@cloudtower/eagle';
|
|
3
3
|
import { css, cx } from '@linaria/core';
|
|
4
4
|
import { useResource } from '@refinedev/core';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
const WrapperStyle = css `
|
|
7
7
|
height: 100%;
|
|
8
8
|
display: flex;
|
|
@@ -15,7 +15,7 @@ function FormLayout(props) {
|
|
|
15
15
|
const { saveButtonProps } = props;
|
|
16
16
|
const kit = useUIKit();
|
|
17
17
|
const { resource, action } = useResource();
|
|
18
|
-
const { t } =
|
|
18
|
+
const { t } = useD2Translation();
|
|
19
19
|
return (_jsxs("div", { className: WrapperStyle, children: [_jsxs("span", { className: cx(Typo.Display.d2_bold_title, TitleStyle), children: [resource?.meta?.kind, ":", ' ', action === 'create' ? t('dovetail.create') : t('dovetail.edit')] }), _jsx(kit.divider, {}), props.children, _jsx(kit.form.Item, { children: _jsx(kit.button, { type: "primary", ...saveButtonProps, children: t('dovetail.save') }) })] }));
|
|
20
20
|
}
|
|
21
21
|
export default FormLayout;
|
|
@@ -4,9 +4,9 @@ import { useUIKit, popModal } from '@cloudtower/eagle';
|
|
|
4
4
|
import { css } from '@linaria/core';
|
|
5
5
|
import { useResource } from '@refinedev/core';
|
|
6
6
|
import { useState, useContext, useCallback, useMemo } from 'react';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
7
|
import YamlForm from 'src/components/YamlForm';
|
|
9
8
|
import ConfigsContext from 'src/contexts/configs';
|
|
9
|
+
import { useD2Translation } from '../../i18n';
|
|
10
10
|
const FullscreenModalStyle = css `
|
|
11
11
|
&.ant-modal.fullscreen {
|
|
12
12
|
.ant-modal-header {
|
|
@@ -24,7 +24,7 @@ const FullscreenModalStyle = css `
|
|
|
24
24
|
`;
|
|
25
25
|
export function FormModal(props) {
|
|
26
26
|
const { resource: resourceFromProps, id, formProps, renderForm } = props;
|
|
27
|
-
const { i18n } =
|
|
27
|
+
const { i18n } = useD2Translation();
|
|
28
28
|
const { resource } = useResource();
|
|
29
29
|
const configs = useContext(ConfigsContext);
|
|
30
30
|
const [saveButtonProps, setSaveButtonProps] = useState({});
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Typo, useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { cx, css } from '@linaria/core';
|
|
4
|
-
import {
|
|
4
|
+
import { useD2Translation } from '../../i18n';
|
|
5
5
|
const MoreTriggerStyle = css `
|
|
6
6
|
color: #bec1d2;
|
|
7
7
|
`;
|
|
8
8
|
export const ImageNames = ({ value }) => {
|
|
9
9
|
const kit = useUIKit();
|
|
10
|
-
const { t } =
|
|
10
|
+
const { t } = useD2Translation();
|
|
11
11
|
return (_jsxs("span", { children: [_jsx("span", { children: value[0] }), value.length > 1 && (_jsx(kit.tooltip, { title: _jsx(_Fragment, { children: value.slice(1).map((name, index) => {
|
|
12
12
|
return _jsx("div", { children: name }, index);
|
|
13
13
|
}) }), children: _jsxs("div", { className: cx(Typo.Label.l4_regular, MoreTriggerStyle), children: ["+", value.length - 1, " ", t('dovetail.more')] }) }))] }));
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { useD2Translation } from '../../i18n';
|
|
5
5
|
import { addId } from '../../utils/addId';
|
|
6
6
|
import { ResourceLink } from '../ResourceLink';
|
|
7
7
|
import ErrorContent from '../Table/ErrorContent';
|
|
8
8
|
export const IngressRulesTable = ({ ingress }) => {
|
|
9
9
|
const kit = useUIKit();
|
|
10
|
-
const { t } =
|
|
10
|
+
const { t } = useD2Translation();
|
|
11
11
|
const rows = useMemo(() => {
|
|
12
12
|
return addId(ingress.flattenedRules, 'fullPath');
|
|
13
13
|
}, [ingress.flattenedRules]);
|
|
@@ -2,11 +2,11 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Icon, useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { EditPen16PrimaryIcon, MoreEllipsis316BoldBlueIcon, TrashBinDelete16Icon, Download16GradientBlueIcon, } from '@cloudtower/icons-react';
|
|
4
4
|
import { useResource } from '@refinedev/core';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { useDeleteModal } from 'src/hooks/useDeleteModal';
|
|
7
6
|
import { useDownloadYAML } from 'src/hooks/useDownloadYAML';
|
|
8
7
|
import { useOpenForm } from 'src/hooks/useOpenForm';
|
|
9
8
|
import { useGlobalStore } from '../../hooks';
|
|
9
|
+
import { useD2Translation } from '../../i18n';
|
|
10
10
|
function K8sDropdown(props) {
|
|
11
11
|
const { record } = props;
|
|
12
12
|
const kit = useUIKit();
|
|
@@ -15,7 +15,7 @@ function K8sDropdown(props) {
|
|
|
15
15
|
const resource = useResourceResult.resource;
|
|
16
16
|
const { modalProps, visible, openDeleteConfirmModal } = useDeleteModal(resource?.name || '');
|
|
17
17
|
const download = useDownloadYAML();
|
|
18
|
-
const { t } =
|
|
18
|
+
const { t } = useD2Translation();
|
|
19
19
|
const openForm = useOpenForm({ id: record.id });
|
|
20
20
|
return (_jsxs(_Fragment, { children: [_jsx(kit.dropdown, { overlay: _jsxs(kit.menu, { children: [_jsx(kit.menuItem, { onClick: openForm, children: _jsx(Icon, { src: EditPen16PrimaryIcon, children: t('dovetail.edit') }) }), _jsx(kit.menuItem, { danger: true, onClick: () => {
|
|
21
21
|
openDeleteConfirmModal(record.id);
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useUIKit, Typo } from '@cloudtower/eagle';
|
|
3
3
|
import { css, cx } from '@linaria/core';
|
|
4
4
|
import { useState } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
const WrapperStyle = css `
|
|
7
7
|
width: 100%;
|
|
8
8
|
`;
|
|
@@ -43,7 +43,7 @@ export function KeyValueData(props) {
|
|
|
43
43
|
const { datas, expandable } = props;
|
|
44
44
|
const [isExpand, setIsExpand] = useState(expandable ? false : true);
|
|
45
45
|
const kit = useUIKit();
|
|
46
|
-
const { t } =
|
|
46
|
+
const { t } = useD2Translation();
|
|
47
47
|
return (_jsxs("div", { className: WrapperStyle, children: [_jsxs("div", { className: HeaderStyle, children: [_jsx("span", { className: HeaderItemStyle, children: Object.keys(datas).length }), _jsx(kit.button, { type: "link", className: ExpandButtonStyle, onClick: () => {
|
|
48
48
|
setIsExpand(!isExpand);
|
|
49
49
|
}, children: isExpand ? t('dovetail.fold') : t('dovetail.expand') })] }), isExpand ? (Object.keys(datas).map(key => (_jsxs("div", { className: ContentBlockStyle, children: [_jsx("span", { className: cx(KeyStyle, Typo.Label.l4_regular), children: key }), _jsx("span", { className: Typo.Label.l4_regular, children: datas[key] })] }, key)))) : null] }));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { useList } from '@refinedev/core';
|
|
4
|
-
import { useTranslation } from 'react-i18next';
|
|
5
4
|
import { useLocalStorage } from 'usehooks-ts';
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
export const NS_STORE_KEY = 'namespace-filter';
|
|
7
7
|
export const ALL_NS = '_all';
|
|
8
8
|
export const useNamespacesFilter = () => {
|
|
@@ -13,7 +13,7 @@ export const useNamespacesFilter = () => {
|
|
|
13
13
|
};
|
|
14
14
|
export const NamespacesFilter = () => {
|
|
15
15
|
const kit = useUIKit();
|
|
16
|
-
const { t } =
|
|
16
|
+
const { t } = useD2Translation();
|
|
17
17
|
const { data } = useList({
|
|
18
18
|
resource: 'namespaces',
|
|
19
19
|
meta: {
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { flatten, get } from 'lodash-es';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
import { addId } from '../../utils/addId';
|
|
7
7
|
import ErrorContent from '../Table/ErrorContent';
|
|
8
8
|
import { Tags } from '../Tags';
|
|
@@ -17,7 +17,7 @@ export const NetworkPolicyRulesTable = ({ ingressOrEgress }) => {
|
|
|
17
17
|
};
|
|
18
18
|
const IngressRuleTable = ({ peers }) => {
|
|
19
19
|
const kit = useUIKit();
|
|
20
|
-
const { t } =
|
|
20
|
+
const { t } = useD2Translation();
|
|
21
21
|
const rows = useMemo(() => {
|
|
22
22
|
const rows = peers?.map(p => {
|
|
23
23
|
return Object.keys(p).map(key => {
|
|
@@ -2,14 +2,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Icon, useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { CheckmarkDoneSuccessCorrect16BoldGreenIcon, XmarkFailed16BoldRedIcon, } from '@cloudtower/icons-react';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import { CommonSorter } from '../../hooks/useEagleTable/columns';
|
|
6
|
+
import { useD2Translation } from '../../i18n';
|
|
7
7
|
import { addId } from '../../utils/addId';
|
|
8
8
|
import { StateTag } from '../StateTag';
|
|
9
9
|
import Time from '../Time';
|
|
10
10
|
export const PodContainersTable = ({ containerStatuses, initContainerStatuses, }) => {
|
|
11
11
|
const kit = useUIKit();
|
|
12
|
-
const { i18n } =
|
|
12
|
+
const { i18n } = useD2Translation();
|
|
13
13
|
const columns = useMemo(() => [
|
|
14
14
|
{
|
|
15
15
|
key: 'state',
|
|
@@ -5,7 +5,7 @@ import { css } from '@linaria/core';
|
|
|
5
5
|
import { LogViewer } from '@patternfly/react-log-viewer';
|
|
6
6
|
import { useDataProvider } from '@refinedev/core';
|
|
7
7
|
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { useD2Translation } from '../../i18n';
|
|
9
9
|
import '@patternfly/react-core/dist/styles/base-no-reset.css';
|
|
10
10
|
const ToolbarStyle = css `
|
|
11
11
|
margin-bottom: 8px;
|
|
@@ -34,7 +34,7 @@ export const PodLog = ({ pod }) => {
|
|
|
34
34
|
const abortControllerRef = useRef(null);
|
|
35
35
|
const dataProvider = useDataProvider();
|
|
36
36
|
const apiUrl = dataProvider()['getApiUrl']();
|
|
37
|
-
const { t } =
|
|
37
|
+
const { t } = useD2Translation();
|
|
38
38
|
useEffect(() => {
|
|
39
39
|
if (!paused && logs.length > 0) {
|
|
40
40
|
setCurrentItemCount(logs.length);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
2
|
import { useEagleTable } from '../../../hooks/useEagleTable';
|
|
4
3
|
import { NameColumnRenderer } from '../../../hooks/useEagleTable/columns';
|
|
4
|
+
import { useD2Translation } from '../../../i18n';
|
|
5
5
|
import { ListPage } from '../../ListPage';
|
|
6
6
|
export function ResourceList(props) {
|
|
7
7
|
const { formatter, name, columns, Dropdown } = props;
|
|
8
|
-
const { i18n } =
|
|
8
|
+
const { i18n } = useD2Translation();
|
|
9
9
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
10
10
|
useTableParams: {},
|
|
11
11
|
columns: [NameColumnRenderer(i18n), ...columns],
|
|
@@ -5,12 +5,12 @@ import { useParsed, useResource, useShow } from '@refinedev/core';
|
|
|
5
5
|
import yaml from 'js-yaml';
|
|
6
6
|
import { get, omit } from 'lodash-es';
|
|
7
7
|
import { useState, useMemo, useCallback } from 'react';
|
|
8
|
-
import { useTranslation } from 'react-i18next';
|
|
9
8
|
import K8sDropdown from 'src/components/K8sDropdown';
|
|
10
9
|
import { KeyValueData } from 'src/components/KeyValueData';
|
|
11
10
|
import MonacoYamlEditor from 'src/components/YamlEditor/MonacoYamlEditor';
|
|
12
11
|
import useK8sYamlEditor from 'src/hooks/useK8sYamlEditor';
|
|
13
12
|
import { useGlobalStore } from '../../hooks';
|
|
13
|
+
import { useD2Translation } from '../../i18n';
|
|
14
14
|
import { StateTag } from '../StateTag';
|
|
15
15
|
import { Tags } from '../Tags';
|
|
16
16
|
import Time from '../Time';
|
|
@@ -60,7 +60,7 @@ export const ShowContent = (props) => {
|
|
|
60
60
|
id: parsed?.params?.id,
|
|
61
61
|
liveMode: mode === Mode.Yaml ? 'off' : 'auto',
|
|
62
62
|
});
|
|
63
|
-
const { t } =
|
|
63
|
+
const { t } = useD2Translation();
|
|
64
64
|
const { fold } = useK8sYamlEditor();
|
|
65
65
|
const { data } = queryResult;
|
|
66
66
|
const schema = useMemo(() => ({}), []);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
|
-
import { useTranslation } from 'react-i18next';
|
|
4
3
|
import { WorkloadState } from '../../constants';
|
|
4
|
+
import { useD2Translation } from '../../i18n';
|
|
5
5
|
export const StateTag = ({ state = WorkloadState.UPDATEING, className }) => {
|
|
6
6
|
const kit = useUIKit();
|
|
7
|
-
const { t } =
|
|
7
|
+
const { t } = useD2Translation();
|
|
8
8
|
const colorMap = {
|
|
9
9
|
updating: 'blue',
|
|
10
10
|
ready: 'green',
|
|
@@ -3,7 +3,7 @@ import { kitContext } from '@cloudtower/eagle';
|
|
|
3
3
|
import { Typo } from '@cloudtower/eagle';
|
|
4
4
|
import { cx, css } from '@linaria/core';
|
|
5
5
|
import { useContext } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { useD2Translation } from '../../i18n';
|
|
7
7
|
export const ErrorWrapper = css `
|
|
8
8
|
display: flex;
|
|
9
9
|
flex-direction: column;
|
|
@@ -27,7 +27,7 @@ export const ErrorContent = css `
|
|
|
27
27
|
const WidgetErrorContent = props => {
|
|
28
28
|
const { refetch } = props;
|
|
29
29
|
const kit = useContext(kitContext);
|
|
30
|
-
const { t } =
|
|
30
|
+
const { t } = useD2Translation();
|
|
31
31
|
return (_jsx("div", { className: ErrorWrapper, style: props.style, children: _jsxs("div", { className: ErrorContent, children: [_jsx("p", { className: cx(Typo.Label.l1_regular_title, 'title'), children: props.errorText || t('dovetail.obtain_data_error') }), refetch ? (_jsx(kit.button, { type: "ordinary", onClick: e => {
|
|
32
32
|
e.stopPropagation();
|
|
33
33
|
refetch?.();
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { css, cx } from '@linaria/core';
|
|
4
4
|
import { useMemo, useRef } from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
import ErrorContent from './ErrorContent';
|
|
7
7
|
import { AuxiliaryLine } from './TableWidgets';
|
|
8
8
|
const TableContainerStyle = css `
|
|
@@ -22,7 +22,7 @@ const TableContainerStyle = css `
|
|
|
22
22
|
`;
|
|
23
23
|
function Table(props) {
|
|
24
24
|
const kit = useUIKit();
|
|
25
|
-
const { t } =
|
|
25
|
+
const { t } = useD2Translation();
|
|
26
26
|
const { loading, error, data: dataSource, rowKey, columns, scroll, currentPage, currentSize, RowMenu, refetch, onSelect, onPageChange, onSizeChange, } = props;
|
|
27
27
|
const auxiliaryLineRef = useRef(null);
|
|
28
28
|
const wrapperRef = useRef(null);
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Icon, useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { DynamicResourceSchedule16BlueIcon } from '@cloudtower/icons-react';
|
|
4
4
|
import { useResource, useUpdate } from '@refinedev/core';
|
|
5
|
-
import {
|
|
5
|
+
import { useD2Translation } from '../../i18n';
|
|
6
6
|
import { pruneBeforeEdit } from '../../utils/k8s';
|
|
7
7
|
import K8sDropdown from '../K8sDropdown';
|
|
8
8
|
export function WorkloadDropdown(props) {
|
|
@@ -10,7 +10,7 @@ export function WorkloadDropdown(props) {
|
|
|
10
10
|
const kit = useUIKit();
|
|
11
11
|
const { resource } = useResource();
|
|
12
12
|
const { mutate } = useUpdate();
|
|
13
|
-
const { t } =
|
|
13
|
+
const { t } = useD2Translation();
|
|
14
14
|
return (_jsx(K8sDropdown, { record: record, children: _jsx(kit.menu.Item, { onClick: () => {
|
|
15
15
|
const v = record.redeploy();
|
|
16
16
|
const id = v.id;
|
|
@@ -3,13 +3,13 @@ import { useUIKit } from '@cloudtower/eagle';
|
|
|
3
3
|
import { css } from '@linaria/core';
|
|
4
4
|
import { useList } from '@refinedev/core';
|
|
5
5
|
import { useMemo, useState } from 'react';
|
|
6
|
-
import { useTranslation } from 'react-i18next';
|
|
7
6
|
import { matchSelector } from 'src/utils/match-selector';
|
|
8
7
|
import { NameColumnRenderer, NodeNameColumnRenderer, RestartCountColumnRenderer, StateDisplayColumnRenderer, WorkloadImageColumnRenderer, } from '../../hooks/useEagleTable/columns';
|
|
8
|
+
import { useD2Translation } from '../../i18n';
|
|
9
9
|
import Table from '../Table';
|
|
10
10
|
import { TableToolBar } from '../Table/TableToolBar';
|
|
11
11
|
export const WorkloadPodsTable = ({ selector, hideToolbar, }) => {
|
|
12
|
-
const { i18n } =
|
|
12
|
+
const { i18n } = useD2Translation();
|
|
13
13
|
const kit = useUIKit();
|
|
14
14
|
const [selectedKeys, setSelectedKeys] = useState([]);
|
|
15
15
|
const [currentPage, setCurrentPage] = useState(1);
|
|
@@ -4,7 +4,7 @@ import { Icon } from '@cloudtower/eagle';
|
|
|
4
4
|
import { ClipboardCopy16GradientGrayIcon, ClipboardCopy16GradientBlueIcon, HierarchyTriangleRight16GrayIcon, HierarchyTriangleRight16BlueIcon, Retry16GradientGrayIcon, Retry16GradientBlueIcon, XmarkFailedSeriousWarningFill16RedIcon, EditPen16GradientGrayIcon, EditPen16GradientBlueIcon, Showdiff16GradientGrayIcon, Showdiff16GradientBlueIcon, } from '@cloudtower/icons-react';
|
|
5
5
|
import { cx } from '@linaria/core';
|
|
6
6
|
import React, { Suspense, useCallback, useRef, useState, useImperativeHandle, forwardRef, } from 'react';
|
|
7
|
-
import {
|
|
7
|
+
import { useD2Translation } from '../../i18n';
|
|
8
8
|
import { Separator } from '../Separator';
|
|
9
9
|
import { ErrorMsgStyle, IconStyle, PlainCodeStyle, TitleStyle, ToolBarStyle, ToolBarHeaderStyle, ErrorIconStyle, WrapperStyle, ErrorWrapperStyle, } from './style';
|
|
10
10
|
const MonacoYamlEditor = React.lazy(() => import('./MonacoYamlEditor'));
|
|
@@ -12,7 +12,7 @@ const MonacoYamlDiffEditor = React.lazy(() => import('./MonacoYamlDiffEditor'));
|
|
|
12
12
|
export const YamlEditorComponent = forwardRef(function YamlEditorComponent(props, ref) {
|
|
13
13
|
const { title, collapsable = true, isDefaultCollapsed, defaultValue = '', height, readOnly, errorMsgs = [], schema, eleRef, className, } = props;
|
|
14
14
|
const kit = useUIKit();
|
|
15
|
-
const { t } =
|
|
15
|
+
const { t } = useD2Translation();
|
|
16
16
|
const [isCollapsed, setIsCollapsed] = useState(collapsable ? isDefaultCollapsed : false);
|
|
17
17
|
const [isDiff, setIsDiff] = useState(false);
|
|
18
18
|
const [value, setValue] = useState(defaultValue);
|
|
@@ -2,7 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
|
|
|
2
2
|
import { useUIKit } from '@cloudtower/eagle';
|
|
3
3
|
import { css } from '@linaria/core';
|
|
4
4
|
import React, { useMemo, useCallback, useEffect } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import ErrorContent from 'src/components/ErrorContent';
|
|
7
6
|
import { FormErrorAlert } from 'src/components/FormErrorAlert';
|
|
8
7
|
import FormLayout from 'src/components/FormLayout';
|
|
@@ -10,6 +9,7 @@ import { YamlEditorComponent } from 'src/components/YamlEditor/YamlEditorCompone
|
|
|
10
9
|
import { BASE_INIT_VALUE } from 'src/constants/k8s';
|
|
11
10
|
import useEagleForm from 'src/hooks/useEagleForm';
|
|
12
11
|
import { getCommonErrors } from 'src/utils/error';
|
|
12
|
+
import { useD2Translation } from '../../i18n';
|
|
13
13
|
const FormStyle = css `
|
|
14
14
|
`;
|
|
15
15
|
const EditorStyle = css `
|
|
@@ -35,7 +35,7 @@ function YamlForm(props) {
|
|
|
35
35
|
initialValuesForCreate: props.initialValues ?? BASE_INIT_VALUE
|
|
36
36
|
});
|
|
37
37
|
const kit = useUIKit();
|
|
38
|
-
const { t, i18n } =
|
|
38
|
+
const { t, i18n } = useD2Translation();
|
|
39
39
|
const responseErrors = errorResponseBody
|
|
40
40
|
? getCommonErrors(errorResponseBody, i18n)
|
|
41
41
|
: [];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { useDeleteMany } from '@refinedev/core';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useD2Translation } from '../../i18n';
|
|
4
4
|
export const useDeleteManyModal = (resource, ids) => {
|
|
5
5
|
const { mutate } = useDeleteMany();
|
|
6
6
|
const [visible, setVisible] = useState(false);
|
|
7
|
-
const { t } =
|
|
7
|
+
const { t } = useD2Translation();
|
|
8
8
|
const modalProps = {
|
|
9
9
|
title: t('dovetail.delete'),
|
|
10
10
|
okText: t('dovetail.delete'),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useDelete, useNavigation } from '@refinedev/core';
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useD2Translation } from '../../i18n';
|
|
4
4
|
export const useDeleteModal = (resource) => {
|
|
5
5
|
const { mutate } = useDelete();
|
|
6
6
|
const [visible, setVisible] = useState(false);
|
|
7
7
|
const navigation = useNavigation();
|
|
8
8
|
const [id, setId] = useState('');
|
|
9
|
-
const { t } =
|
|
9
|
+
const { t } = useD2Translation();
|
|
10
10
|
const modalProps = {
|
|
11
11
|
title: t('dovetail.delete'),
|
|
12
12
|
okText: t('dovetail.delete'),
|
|
@@ -2,17 +2,17 @@ import { useUIKit } from '@cloudtower/eagle';
|
|
|
2
2
|
import { useForm as useFormCore, useWarnAboutChange, pickNotDeprecated, useResource, } from '@refinedev/core';
|
|
3
3
|
import yaml from 'js-yaml';
|
|
4
4
|
import React, { useRef, useState, useMemo } from 'react';
|
|
5
|
-
import { useTranslation } from 'react-i18next';
|
|
6
5
|
import useK8sYamlEditor from 'src/hooks/useK8sYamlEditor';
|
|
7
6
|
import { useSchema } from 'src/hooks/useSchema';
|
|
8
7
|
import { pruneBeforeEdit } from 'src/utils/k8s';
|
|
9
8
|
import { generateYamlBySchema } from 'src/utils/yaml';
|
|
10
9
|
import { useForm as useFormSF } from 'sunflower-antd';
|
|
10
|
+
import { useD2Translation } from '../i18n';
|
|
11
11
|
import { useGlobalStore } from './useGlobalStore';
|
|
12
12
|
const useEagleForm = ({ action, resource, onMutationSuccess: onMutationSuccessProp, onMutationError, submitOnEnter = false, warnWhenUnsavedChanges: warnWhenUnsavedChangesProp, redirect, successNotification, errorNotification, meta, metaData, queryMeta, mutationMeta, liveMode, liveParams, mutationMode, dataProviderName, onLiveEvent, invalidates, undoableTimeout, queryOptions, createMutationOptions, updateMutationOptions, id: idFromProps, overtimeOptions, editorOptions, initialValuesForCreate, } = {}) => {
|
|
13
13
|
const editor = useRef(null);
|
|
14
14
|
const isFoldRef = useRef(false);
|
|
15
|
-
const { t } =
|
|
15
|
+
const { t } = useD2Translation();
|
|
16
16
|
const [enableEditor, setEnableEditor] = useState(false);
|
|
17
17
|
const [isYamlValid, setIsYamlValid] = useState(true);
|
|
18
18
|
const [isSchemaValid, setIsSchemaValid] = useState(true);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
2
|
import { getCommonErrors } from 'src/utils/error';
|
|
3
|
+
import { useD2Translation } from '../i18n';
|
|
4
4
|
export function useSubmitForm(options) {
|
|
5
5
|
const { formRef, onSubmitSuccess } = options;
|
|
6
|
-
const { i18n } =
|
|
6
|
+
const { i18n } = useD2Translation();
|
|
7
7
|
const [submitting, setSubmitting] = useState(false);
|
|
8
8
|
const [errorMsgs, setErrorMsgs] = useState([]);
|
|
9
9
|
const reset = useCallback(() => {
|
package/lib/src/i18n.d.ts
CHANGED
package/lib/src/i18n.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import i18n from 'i18next';
|
|
2
|
-
import { initReactI18next } from 'react-i18next';
|
|
2
|
+
import { initReactI18next, useTranslation } from 'react-i18next';
|
|
3
3
|
import { D2Locales } from 'src/locales';
|
|
4
4
|
export const resources = D2Locales;
|
|
5
5
|
i18n.use(initReactI18next).init({
|
|
@@ -11,4 +11,9 @@ i18n.use(initReactI18next).init({
|
|
|
11
11
|
lng: 'zh-CN',
|
|
12
12
|
nsSeparator: '.',
|
|
13
13
|
});
|
|
14
|
+
export const useD2Translation = () => {
|
|
15
|
+
return useTranslation(undefined, {
|
|
16
|
+
i18n,
|
|
17
|
+
});
|
|
18
|
+
};
|
|
14
19
|
export default i18n;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
2
|
import { CronJobDropdown } from 'src/components/CronJobDropdown';
|
|
4
3
|
import { ListPage } from 'src/components/ListPage';
|
|
5
4
|
import Time from 'src/components/Time';
|
|
6
5
|
import { useEagleTable } from 'src/hooks/useEagleTable';
|
|
7
6
|
import { AgeColumnRenderer, WorkloadImageColumnRenderer, NameColumnRenderer, NameSpaceColumnRenderer, StateDisplayColumnRenderer, } from 'src/hooks/useEagleTable/columns';
|
|
7
|
+
import { useD2Translation } from '../../../i18n';
|
|
8
8
|
export const CronJobList = () => {
|
|
9
|
-
const { i18n } =
|
|
9
|
+
const { i18n } = useD2Translation();
|
|
10
10
|
const { tableProps, selectedKeys } = useEagleTable({
|
|
11
11
|
useTableParams: {},
|
|
12
12
|
columns: [
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useTranslation } from 'react-i18next';
|
|
3
2
|
import { CronJobDropdown } from '../../../components/CronJobDropdown';
|
|
4
3
|
import { PageShow } from '../../../components/PageShow';
|
|
5
4
|
import { ImageField, JobsField } from '../../../components/ShowContent/fields';
|
|
5
|
+
import { useD2Translation } from '../../../i18n';
|
|
6
6
|
export const CronJobShow = () => {
|
|
7
|
-
const { i18n } =
|
|
7
|
+
const { i18n } = useD2Translation();
|
|
8
8
|
return (_jsx(PageShow, { showConfig: {
|
|
9
9
|
groups: [
|
|
10
10
|
{
|