diff --git a/web/src/components/kibana/console/components/CommonCommandModal.tsx b/web/src/components/kibana/console/components/CommonCommandModal.tsx index f74ad35b..83b68e08 100644 --- a/web/src/components/kibana/console/components/CommonCommandModal.tsx +++ b/web/src/components/kibana/console/components/CommonCommandModal.tsx @@ -2,6 +2,7 @@ import React, { useState, useCallback } from "react"; import { Modal, Form, Input, Tag } from "antd"; import { PlusOutlined } from "@ant-design/icons"; +import { formatMessage } from "umi/locale"; interface ITagGeneratorProps { value?: Array; @@ -61,7 +62,7 @@ export const TagGenerator = ({ value = [], onChange }: ITagGeneratorProps) => { )} {!inputVisible && ( - 新建标签 + {formatMessage({ id: "command.btn.newtag" })} )} @@ -86,21 +87,21 @@ const CommonCommandModal = Form.create()((props: ICommonCommandModalProps) => { return (
- + {form.getFieldDecorator("title", { rules: [{ required: true, message: "请输入标题" }], })()} - + {form.getFieldDecorator("tag")()} diff --git a/web/src/components/kibana/console/components/ConsoleMenu.tsx b/web/src/components/kibana/console/components/ConsoleMenu.tsx index 9cb7f19a..643f0f3f 100644 --- a/web/src/components/kibana/console/components/ConsoleMenu.tsx +++ b/web/src/components/kibana/console/components/ConsoleMenu.tsx @@ -30,14 +30,20 @@ * GitHub history for details. */ -import React, { Component } from 'react'; -import { EuiIcon, EuiContextMenuPanel, EuiContextMenuItem, EuiPopover } from '@elastic/eui'; -import { ESRequestParams } from '../entities/es_request'; -import {notification} from 'antd'; +import React, { Component } from "react"; +import { + EuiIcon, + EuiContextMenuPanel, + EuiContextMenuItem, + EuiPopover, +} from "@elastic/eui"; +import { ESRequestParams } from "../entities/es_request"; +import { notification } from "antd"; -import CommonCommandModal from './CommonCommandModal'; -import {saveCommonCommand} from '../modules/es'; -import {pushCommand} from '../modules/mappings/mappings'; +import CommonCommandModal from "./CommonCommandModal"; +import { saveCommonCommand } from "../modules/es"; +import { pushCommand } from "../modules/mappings/mappings"; +import { formatMessage } from "umi/locale"; interface Props { getCurl: () => Promise; @@ -57,7 +63,7 @@ export default class ConsoleMenu extends Component { super(props); this.state = { - curlCode: '', + curlCode: "", isPopoverOpen: false, modalVisible: false, }; @@ -74,14 +80,14 @@ export default class ConsoleMenu extends Component { try { await this.copyText(this.state.curlCode); notification.open({ - message: 'Request copied as cURL', - placement: 'bottomRight' + message: "Request copied as cURL", + placement: "bottomRight", }); } catch (e) { notification.error({ - message: 'Could not copy request as cURL', - placement: 'bottomRight' - }); + message: "Could not copy request as cURL", + placement: "bottomRight", + }); } } @@ -90,7 +96,7 @@ export default class ConsoleMenu extends Component { await window.navigator.clipboard.writeText(text); return; } - throw new Error('Could not copy to clipboard!'); + throw new Error("Could not copy to clipboard!"); } onButtonClick = () => { @@ -111,7 +117,7 @@ export default class ConsoleMenu extends Component { if (!documentation) { return; } - window.open(documentation, '_blank'); + window.open(documentation, "_blank"); }; autoIndent = (event: React.MouseEvent) => { @@ -122,7 +128,7 @@ export default class ConsoleMenu extends Component { saveAsCommonCommand = () => { this.setState({ isPopoverOpen: false, - modalVisible: true + modalVisible: true, }); }; @@ -137,14 +143,14 @@ export default class ConsoleMenu extends Component { requests, }; const result = await (await saveCommonCommand(reqBody))?.json(); - if(result.error){ + if (result.error) { notification.error({ - message: result.error + message: result.error, }); - }else{ + } else { this.handleClose(); notification.success({ - message:'保存成功' + message: "保存成功", }); pushCommand(result); } @@ -152,40 +158,36 @@ export default class ConsoleMenu extends Component { render() { const button = ( - ); const items = [ - - 自动缩进 + + {formatMessage({ id: "console.menu.auto_indent" })} , - 保存为常用命令 + {formatMessage({ id: "console.menu.save_as_command" })} , ]; - if(window.navigator?.clipboard){ - items.unshift( { - this.closePopover(); - this.copyAsCurl(); - }} - > - 复制为curl命令 - ) + if (window.navigator?.clipboard) { + items.unshift( + { + this.closePopover(); + this.copyAsCurl(); + }} + > + {formatMessage({ id: "console.menu.copy_as_curl" })} + + ); } return ( @@ -200,7 +202,12 @@ export default class ConsoleMenu extends Component { > - {this.state.modalVisible && } + {this.state.modalVisible && ( + + )} ); } diff --git a/web/src/locales/en-US.js b/web/src/locales/en-US.js index 36ea53c4..0d57fa00 100644 --- a/web/src/locales/en-US.js +++ b/web/src/locales/en-US.js @@ -1,6 +1,7 @@ import alert from "./en-US/alert"; import console from "./en-US/console"; import cluster from "./en-US/cluster"; +import command from "./en-US/command"; export default { "navBar.lang": "Languages", @@ -77,9 +78,13 @@ export default { "form.button.cancel": "Cancel", "form.button.collapse": "Collapse", "form.button.advanced": "Advanced", + "form.button.regist": "Regist", "table.field.operation": "Operation", "form.button.next": "Next", "form.button.pre": "Previous", + "form.button.goback": "Back", + "form.button.reset": "Reset", + "form.label.search-keyword": "Keyword", "component.globalHeader.search": "Search", "component.globalHeader.search.example1": "Search example 1", @@ -422,4 +427,5 @@ export default { ...alert, ...console, ...cluster, + ...command, }; diff --git a/web/src/locales/en-US/cluster.js b/web/src/locales/en-US/cluster.js index ffe38043..6ae7cd00 100644 --- a/web/src/locales/en-US/cluster.js +++ b/web/src/locales/en-US/cluster.js @@ -1,9 +1,11 @@ export default { "cluster.manage.title": "CLUSTERS", "cluster.manage.description": - "集群管理可以帮助您快速接入不同版本的 Elasticsearch 集群,以及删除和修改集群配置。", + "Cluster management can help you quickly access different versions of Elasticsearch clusters, as well as delete and modify cluster configurations.", "cluster.manage.label.cluster_name": "Cluster Name", + "cluster.manage.label.cluster_host": "Cluster Host", "cluster.manage.btn.regist": "Regist Cluster", + "cluster.manage.btn.try_connect": "Try Connect", "cluster.manage.table.column.name": "Name", "cluster.manage.table.column.health": "Health", "cluster.manage.table.column.version": "Version", @@ -15,7 +17,9 @@ export default { "cluster.manage.monitored.on": "ON", "cluster.manage.monitored.off": "OFF", "cluster.regist.title": "REGIST CLUSTER", - "cluster.regist.description": "输入集群地址和身份验证信息分步创建集群。", + "cluster.edit.title": "EDIT CLUSTER", + "cluster.regist.description": + "Enter the cluster address and authentication information to create a cluster step by step.", "cluster.regist.step.connect.title": "Connect", "cluster.regist.step.confirm.title": "Confirm", "cluster.regist.step.complete.title": "Complete", diff --git a/web/src/locales/en-US/command.js b/web/src/locales/en-US/command.js new file mode 100644 index 00000000..12cdbe82 --- /dev/null +++ b/web/src/locales/en-US/command.js @@ -0,0 +1,14 @@ +export default { + "command.table.field.name": "Name", + "command.table.field.tag": "Tag", + "command.table.field.content": "Content", + "command.manage.edit.title": "Command", + "command.btn.newtag": "Add New Tag", + "command.manage.save.title": "Save As Command", + "command.manage.title": "COMMANDS", + "command.manage.description": + "Commonly used commands can help you save frequently used requests and load them quickly through the LOAD command in the development tool.", + "console.menu.copy_as_curl": "Copy As Curl", + "console.menu.auto_indent": "Auto Indent", + "console.menu.save_as_command": "Save As Command", +}; diff --git a/web/src/locales/zh-CN.js b/web/src/locales/zh-CN.js index 27dee964..ac7879e5 100644 --- a/web/src/locales/zh-CN.js +++ b/web/src/locales/zh-CN.js @@ -1,6 +1,7 @@ import alert from "./zh-CN/alert"; import console from "./zh-CN/console"; import cluster from "./zh-CN/cluster"; +import command from "./zh-CN/command"; export default { "navBar.lang": "语言", @@ -83,9 +84,13 @@ export default { "form.button.cancel": "取消", "form.button.collapse": "收起", "form.button.advanced": "高级", + "form.button.regist": "注册", "table.field.operation": "操作", "form.button.next": "下一步", "form.button.pre": "上一步", + "form.button.goback": "返回", + "form.button.reset": "重置", + "form.label.search-keyword": "观检测", "component.globalHeader.search": "站内搜索", "component.globalHeader.search.example1": "搜索提示一", @@ -420,4 +425,5 @@ export default { ...alert, ...console, ...cluster, + ...command, }; diff --git a/web/src/locales/zh-CN/cluster.js b/web/src/locales/zh-CN/cluster.js index d1773b4c..7b810924 100644 --- a/web/src/locales/zh-CN/cluster.js +++ b/web/src/locales/zh-CN/cluster.js @@ -4,17 +4,20 @@ export default { "集群管理可以帮助您快速接入不同版本的 Elasticsearch 集群,以及删除和修改集群配置。", "cluster.manage.label.cluster_name": "集群名称", "cluster.manage.btn.regist": "注册集群", + "cluster.manage.btn.try_connect": "测试连接", "cluster.manage.table.column.name": "集群名称", "cluster.manage.table.column.health": "集群状态", "cluster.manage.table.column.version": "程序版本", "cluster.manage.table.column.node_count": "节点数", "cluster.manage.table.column.endpoint": "集群地址", - "cluster.manage.table.column.monitored": "监控启用状态", + "cluster.manage.label.cluster_host": "集群主机", + "cluster.manage.table.column.monitored": "监控启用", "cluster.manage.table.column.operation": "操作", "cluster.manage.table.column.description": "描述", "cluster.manage.monitored.on": "启用", "cluster.manage.monitored.off": "关闭", "cluster.regist.title": "集群注册", + "cluster.edit.title": "修改集群配置", "cluster.regist.description": "输入集群地址和身份验证信息分步创建集群。", "cluster.regist.step.connect.title": "连接", "cluster.regist.step.confirm.title": "确认", diff --git a/web/src/locales/zh-CN/command.js b/web/src/locales/zh-CN/command.js new file mode 100644 index 00000000..4d16e780 --- /dev/null +++ b/web/src/locales/zh-CN/command.js @@ -0,0 +1,14 @@ +export default { + "command.table.field.name": "名称", + "command.table.field.tag": "标签", + "command.table.field.content": "内容", + "command.manage.edit.title": "常用命令", + "command.btn.newtag": "新建标签", + "command.manage.save.title": "保存为常用命令", + "command.manage.title": "常用命令管理", + "command.manage.description": + "常用命令可以帮助您保存常用的请求,并且在开发工具里面通过 LOAD 命令快速地加载。", + "console.menu.copy_as_curl": "复制为Curl命令", + "console.menu.auto_indent": "自动缩进", + "console.menu.save_as_command": "保存为常用命令", +}; diff --git a/web/src/pages/System/Cluster/Form.js b/web/src/pages/System/Cluster/Form.js index 9722bbbd..51683fa8 100644 --- a/web/src/pages/System/Cluster/Form.js +++ b/web/src/pages/System/Cluster/Form.js @@ -16,6 +16,7 @@ import styles from "./Form.less"; import { connect } from "dva"; import NewCluster from "./Step"; import PageHeaderWrapper from "@/components/PageHeaderWrapper"; +import { formatMessage } from "umi/locale"; @Form.create() @connect(({ clusterConfig }) => ({ @@ -176,7 +177,12 @@ class ClusterForm extends React.Component { return ( - 返回 + {formatMessage({ + id: "form.button.goback", + })} , ]} >
- + {getFieldDecorator("name", { initialValue: editValue.name, rules: [ @@ -201,7 +213,11 @@ class ClusterForm extends React.Component { ], })()} - + {getFieldDecorator("host", { initialValue: editValue.host, rules: [ @@ -234,7 +250,11 @@ class ClusterForm extends React.Component { /> )} - + {this.state.needAuth === true ? (
- + {getFieldDecorator("username", { initialValue: editValue.basic_auth?.username, rules: [], })()} - + {getFieldDecorator("password", { initialValue: editValue.basic_auth?.password, rules: [], @@ -265,10 +294,14 @@ class ClusterForm extends React.Component { initialValue: editValue.order || 0, })()} */} - + {getFieldDecorator("description", { initialValue: editValue.description, - })()} + })()} {/* {getFieldDecorator('enabled', { @@ -279,7 +312,11 @@ class ClusterForm extends React.Component { unCheckedChildren={} />)} */} - + {getFieldDecorator("monitored", { valuePropName: "checked", initialValue: @@ -295,10 +332,17 @@ class ClusterForm extends React.Component { diff --git a/web/src/pages/System/Command/Index.js b/web/src/pages/System/Command/Index.js index 588bb8f0..c48d1574 100644 --- a/web/src/pages/System/Command/Index.js +++ b/web/src/pages/System/Command/Index.js @@ -44,10 +44,7 @@ const { TabPane } = Tabs; const content = (
-

- 常用命令可以帮助您保存常用的请求,并且在开发工具里面通过 LOAD - 命令快速地加载。 -

+

{formatMessage({ id: "command.manage.description" })}

); @@ -75,7 +72,7 @@ class Index extends PureComponent { }; columns = [ { - title: "名称", + title: formatMessage({ id: "command.table.field.name" }), dataIndex: "title", render: (text, record) => ( { return (val || []).join(","); }, }, { - title: "操作", + title: formatMessage({ id: "table.field.operation" }), render: (text, record) => ( this.handleDeleteClick(record.id)} > - 删除 + {formatMessage({ id: "form.button.delete" })} ), @@ -268,7 +265,7 @@ class Index extends PureComponent { return ( @@ -278,22 +275,24 @@ class Index extends PureComponent {
- + {getFieldDecorator("keyword")( - + )} @@ -326,7 +325,7 @@ class Index extends PureComponent { { this.setState({ @@ -339,7 +338,7 @@ class Index extends PureComponent {
-
标题:
+
{formatMessage({ id: "command.table.field.name" })}:
-
标签:
+
{formatMessage({ id: "command.table.field.tag" })}:
*/}
-
内容:
+
{formatMessage({ id: "command.table.field.content" })}:
{this.buildRawCommonCommandRequest(editingCommand)} @@ -385,7 +384,7 @@ class Index extends PureComponent {