Skip to content

Commit

Permalink
remove umijs formatMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
HSunboy committed Nov 23, 2023
1 parent 4534317 commit 3c37966
Show file tree
Hide file tree
Showing 33 changed files with 133 additions and 169 deletions.
10 changes: 5 additions & 5 deletions src/component/DDLResultSetFilter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import { FilterOutlined } from '@ant-design/icons';
import { Button, Checkbox, Input, Popover } from 'antd';
import { Component } from 'react';
import { formatMessage, FormattedMessage } from '@umijs/max';
// @ts-ignore
import { CheckboxValueType } from 'antd/lib/checkbox/Group';
import styles from './index.less';
import { formatMessage } from '@/util/intl';

export default class DDLResultSetFilter extends Component<
{
Expand Down Expand Up @@ -141,18 +141,18 @@ export default class DDLResultSetFilter extends Component<
<div className={styles.footer}>
<span>
<span className={styles.select} onClick={this.handleSelectAll}>
<FormattedMessage id="app.button.selectAll" />
{formatMessage({ id: 'app.button.selectAll' })}
</span>
<span className={styles.deselect} onClick={this.handleDeselectAll}>
<FormattedMessage id="app.button.deselectAll" />
{formatMessage({ id: 'app.button.deselectAll' })}
</span>
</span>
<span>
<Button size="small" style={{ marginRight: 8 }} onClick={this.handleCancel}>
<FormattedMessage id="app.button.cancel" />
{formatMessage({ id: 'app.button.cancel' })}
</Button>
<Button size="small" type="primary" onClick={this.handleSubmit}>
<FormattedMessage id="app.button.ok" />
{formatMessage({ id: 'app.button.ok' })}
</Button>
</span>
</div>
Expand Down
9 changes: 3 additions & 6 deletions src/component/ExecuteSQLModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import { formatMessage } from '@/util/intl';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { FormattedMessage } from '@umijs/max';
// compatible
import { runSQLLint } from '@/common/network/sql';
import { ConnectionMode } from '@/d.ts';
Expand Down Expand Up @@ -146,15 +145,13 @@ const ExecuteSQLModal: React.FC<IProps> = (props) => {
);
}}
>
<Button>
<FormattedMessage id="app.button.copy" />
</Button>
<Button>{formatMessage({ id: 'app.button.copy' })}</Button>
</CopyToClipboard>,
<Button key="back" onClick={onCancel}>
<FormattedMessage id="app.button.cancel" />
{formatMessage({ id: 'app.button.cancel' })}
</Button>,
<Button key="submit" type="primary" onClick={handleSubmit} loading={loading}>
<FormattedMessage id="app.button.execute" />
{formatMessage({ id: 'app.button.execute' })}
</Button>,
].filter(Boolean)}
>
Expand Down
6 changes: 3 additions & 3 deletions src/component/LockResultSetHint/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

import { CloseOutlined } from '@ant-design/icons';
import { Component } from 'react';
import { FormattedMessage } from '@umijs/max';
// @ts-ignore
import styles from './index.less';
import { formatMessage } from '@/util/intl';

export class LockResultSetHint extends Component<{
onClose(): void;
Expand All @@ -37,11 +37,11 @@ export class LockResultSetHint extends Component<{
return (
<div className={styles.wrapper}>
<header className={styles.header}>
<FormattedMessage id="workspace.window.sql.record.notify.title" />
{formatMessage({ id: 'workspace.window.sql.record.notify.title' })}
<CloseOutlined onClick={onClose} />
</header>
<div className={styles.desc}>
<FormattedMessage id="workspace.window.sql.record.notify.desc" />
{formatMessage({ id: 'workspace.window.sql.record.notify.desc' })}
</div>
</div>
);
Expand Down
4 changes: 2 additions & 2 deletions src/component/PartitionRange/DragableRange.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import Icon, { DeleteOutlined } from '@ant-design/icons';
import { Col, Input, Row } from 'antd';
import React from 'react';
import { FormattedMessage } from '@umijs/max';
// @ts-ignore
import classNames from 'classnames';
import { ISinglePartitionRule } from '.';
Expand All @@ -26,6 +25,7 @@ import styles from './index.less';
// @ts-ignore
import DragSvg from '@/svgr/drag.svg';
import PartitionValueInput from './PartitionValueInput';
import { formatMessage } from '@/util/intl';

export interface IDragableParamProps extends IDragable {
deletable: boolean;
Expand Down Expand Up @@ -124,7 +124,7 @@ class DragableRule extends React.PureComponent<{ props: IDragableParamProps }> {
<Icon component={DragSvg} className={styles.dragHandler} />
</span>
<span className="ant-form-item-required">
<FormattedMessage id="workspace.window.createTable.partition.name" />
{formatMessage({ id: 'workspace.window.createTable.partition.name' })}
</span>
<Input
value={rule.name}
Expand Down
4 changes: 2 additions & 2 deletions src/component/PartitionRange/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { Component } from 'react';
import { formatMessage, FormattedMessage } from '@umijs/max';

import { DeleteOutlined, PlusOutlined } from '@ant-design/icons';
// compatible
Expand All @@ -25,6 +24,7 @@ import update from 'immutability-helper';
import PartitionValueInput from './PartitionValueInput';
// @ts-ignore
import styles from './index.less';
import { formatMessage } from '@/util/intl';

export interface ISinglePartitionRule {
name: string;
Expand Down Expand Up @@ -188,7 +188,7 @@ export default class PartitionRange extends Component<IProps> {
size="small"
onClick={this.handleAdd}
>
<FormattedMessage id="workspace.window.createTable.partition.button.add" />
{formatMessage({ id: 'workspace.window.createTable.partition.button.add' })}
</Button>
</>
);
Expand Down
5 changes: 2 additions & 3 deletions src/component/Task/ExportTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ import { selectFolder } from '@/util/client';
import { isClient } from '@/util/env';
import { formatMessage } from '@/util/intl';
import { safeParseJson } from '@/util/utils';
import { FormattedMessage } from '@umijs/max';
import { Alert, Button, Checkbox, Drawer, message, Modal, Space, Tooltip } from 'antd';
import { inject, observer } from 'mobx-react';
import React from 'react';
Expand Down Expand Up @@ -395,7 +394,7 @@ class CreateModal extends React.Component<IProps, IState> {
marginRight: 8,
}}
>
<FormattedMessage id="app.button.cancel" />
{formatMessage({ id: 'app.button.cancel' })}
</Button>
{prevStep ? (
<Button
Expand Down Expand Up @@ -433,7 +432,7 @@ class CreateModal extends React.Component<IProps, IState> {
) : null}
{!nextStep ? (
<Button loading={submitting} onClick={this.submit} type="primary">
<FormattedMessage id="workspace.header.tools.export" />
{formatMessage({ id: 'workspace.header.tools.export' })}
</Button>
) : null}
</Space>
Expand Down
3 changes: 1 addition & 2 deletions src/component/Task/ImportTask/CreateModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { formatBytes, safeParseJson } from '@/util/utils';
import { Alert, Button, Checkbox, Drawer, message, Modal, Space, Tooltip } from 'antd';
import { inject, observer } from 'mobx-react';
import React from 'react';
import { FormattedMessage } from '@umijs/max';
import ImportForm from './ImportForm';
import CsvProvider from './ImportForm/CsvProvider';
import FormConfigContext from './ImportForm/FormConfigContext';
Expand Down Expand Up @@ -555,7 +554,7 @@ class CreateModal extends React.Component<IProps, IState> {
marginRight: 8,
}}
>
<FormattedMessage id="app.button.cancel" />
{formatMessage({ id: 'app.button.cancel' })}
</Button>
{prevStep ? (
<Button
Expand Down
6 changes: 2 additions & 4 deletions src/component/ViewColumn/DragableViewColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,13 @@
import Icon, { CloseCircleFilled } from '@ant-design/icons';
import { Col, Input, Row } from 'antd';
import React from 'react';
import { FormattedMessage } from '@umijs/max';
// @ts-ignore
import { IPLParam } from '@/d.ts';
import classNames from 'classnames';
import { IViewParam } from '.';
import Dragable, { IDragable } from '../Dragable';
import styles from './index.less';
// @ts-ignore
import DragSvg from '@/svgr/drag.svg';
import { formatMessage } from '@/util/intl';

export interface IDragableViewParamProps extends IDragable {
rule: Partial<IViewParam>;
Expand Down Expand Up @@ -62,7 +60,7 @@ const DragableViewColumn = ({ props }: { props: IDragableViewParamProps }) => {
<span style={{ marginRight: 8 }}>
<Icon component={DragSvg} className={styles.dragHandler} />
</span>
<FormattedMessage id="workspace.window.createView.columnName" />
{formatMessage({ id: 'workspace.window.createView.columnName' })}
<Input
value={rule.paramName}
style={{ flex: 1 }}
Expand Down
5 changes: 2 additions & 3 deletions src/component/ViewColumn/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
import { PlusOutlined } from '@ant-design/icons';
import { Button } from 'antd';
import { Component } from 'react';
import { FormattedMessage } from '@umijs/max';
// @ts-ignore
import update from 'immutability-helper';
import DragableViewColumn from './DragableViewColumn';
import styles from './index.less';
import { formatMessage } from '@/util/intl';

let dragIdxGenerator = 1;

Expand Down Expand Up @@ -108,7 +107,7 @@ export default class ViewColumn extends Component<IProps> {
<>
<div className={styles.list}>{value && value.map(this.renderSingleRule)}</div>
<Button icon={<PlusOutlined />} size="small" onClick={this.handleAdd}>
<FormattedMessage id="workspace.window.createView.button.addColumn" />
{formatMessage({ id: 'workspace.window.createView.button.addColumn' })}
</Button>
</>
);
Expand Down
8 changes: 4 additions & 4 deletions src/component/WindowManager/factory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { IPage } from '@/d.ts';
import { QuestionCircleFilled } from '@ant-design/icons';
import { Button, Modal } from 'antd';
import { Component, ReactNode } from 'react';
import { FormattedMessage } from '@umijs/max';

import styles from './index.less';
import { formatMessage } from '@/util/intl';

export default function withConfirmModal(WrappedComponent: any) {
return class extends Component<
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function withConfirmModal(WrappedComponent: any) {
public readonly state = {
unsavedModalTitle: '',
unsavedModalContent: '',
unsavedModalSaveButtonText: <FormattedMessage id="app.button.save" />,
unsavedModalSaveButtonText: formatMessage({ id: 'app.button.save' }),
disableUnsavedModalCloseUnsaveButton: false,
closeImmediately: false,
};
Expand Down Expand Up @@ -136,11 +136,11 @@ export default function withConfirmModal(WrappedComponent: any) {
footer={[
!disableUnsavedModalCloseUnsaveButton && (
<Button key="close" onClick={() => onCloseUnsavedModal(pageKey)}>
<FormattedMessage id="app.button.dontsave" />
{formatMessage({ id: 'app.button.dontsave' })}
</Button>
),
<Button key="back" onClick={onCancelUnsavedModal}>
<FormattedMessage id="app.button.cancel" />
{formatMessage({ id: 'app.button.cancel' })}
</Button>,
<Button
key="submit"
Expand Down
19 changes: 3 additions & 16 deletions src/component/helpDoc/doc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/

import { formatMessage } from '@/util/intl';
import { FormattedMessage } from '@umijs/max';
const dataArchiveVariablesDoc = formatMessage({
id: 'odc.src.component.helpDoc.DefineVariablesSetTime',
}); //'定义变量、设置时间偏移量并在下文的过滤条件中引用'
Expand All @@ -34,21 +33,9 @@ export default {
}
</p>
),
connectType: () => (
<p>
<FormattedMessage id="portal.connection.form.connectType.desc" />
</p>
),
dbMode: () => (
<p>
<FormattedMessage id="portal.connection.form.mode.desc" />
</p>
),
configUrl: () => (
<p>
<FormattedMessage id="portal.connection.form.configUrl.desc" />
</p>
),
connectType: () => <p>{formatMessage({ id: 'portal.connection.form.connectType.desc' })}</p>,
dbMode: () => <p>{formatMessage({ id: 'portal.connection.form.mode.desc' })}</p>,
configUrl: () => <p>{formatMessage({ id: 'portal.connection.form.configUrl.desc' })}</p>,
sessionTimeTip: (
<p>
{formatMessage({
Expand Down
7 changes: 3 additions & 4 deletions src/page/Login/components/LoginModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@
import { LockOutlined, UserOutlined } from '@ant-design/icons';
import { inject, observer } from 'mobx-react';
import { Component } from 'react';
import { formatMessage, FormattedMessage } from '@umijs/max';
// compatible
import ChangePasswordModal from '@/component/ChangePasswordModal';
import { IUser } from '@/d.ts';
import { UserStore } from '@/store/login';
import { getLocalImg } from '@/util/intl';
import { formatMessage, getLocalImg } from '@/util/intl';
import { Alert, Button, Form, Input, message } from 'antd';
import RegisterModal from '../RegisterModal';
import styles from './index.less';
Expand Down Expand Up @@ -156,14 +155,14 @@ class LoginModal extends Component<
className={styles.bottomButton}
onClick={() => this.setState({ showChangePasswordModal: true })}
>
<FormattedMessage id="login.button.changePassword" />
{formatMessage({ id: 'login.button.changePassword' })}
</a>
<span className={styles.divider} />
<a
className={styles.bottomButton}
onClick={() => this.setState({ showRegisterModal: true })}
>
<FormattedMessage id="login.button.register" />
{formatMessage({ id: 'login.button.register' })}
</a>
</div>
<ChangePasswordModal
Expand Down
4 changes: 2 additions & 2 deletions src/page/Workspace/components/CreateTableColumnForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ import { SyncOutlined } from '@ant-design/icons';
import { RowsChangeData } from '@oceanbase-odc/ob-react-data-grid';
import memoizeOne from 'memoize-one';
import { Component } from 'react';
import { formatMessage, FormattedMessage } from '@umijs/max';
import EditableTable, { RowType } from '../EditableTable';
import { WrapAutoCompleteEditor } from '../EditableTable/Editors/AutoComplete';
import { TextEditor } from '../EditableTable/Editors/TextEditor';
import styles from './index.less';
import { formatMessage } from '@/util/intl';

const ToolbarButton = Toolbar.Button;

Expand Down Expand Up @@ -167,7 +167,7 @@ export default class CreateTableColumnForm extends Component<
<Toolbar>
{allowRefresh && (
<ToolbarButton
text={<FormattedMessage id="workspace.window.session.button.refresh" />}
text={formatMessage({ id: 'workspace.window.session.button.refresh' })}
icon={<SyncOutlined />}
onClick={this.handleRefreshColumn}
/>
Expand Down
Loading

0 comments on commit 3c37966

Please sign in to comment.