From af6862532eb0d0778f7b668e72914e337611696e Mon Sep 17 00:00:00 2001 From: mizy <1060950782@163.com> Date: Tue, 27 Dec 2022 14:46:08 +0800 Subject: [PATCH] fix: overview service --- src/config/locale/en-US/common.json | 101 +++++++++--------- src/config/locale/zh-CN/common.json | 101 +++++++++--------- .../LeaderDistribution/index.less | 11 +- .../LeaderDistribution/index.tsx | 13 ++- src/pages/ServiceManage/Overview/index.tsx | 26 +++-- .../PartitionDistribution/index.tsx | 2 +- 6 files changed, 137 insertions(+), 117 deletions(-) diff --git a/src/config/locale/en-US/common.json b/src/config/locale/en-US/common.json index 087d2f5c..fc5706d0 100644 --- a/src/config/locale/en-US/common.json +++ b/src/config/locale/en-US/common.json @@ -1,51 +1,52 @@ { - "account": "Account Login", - "login": "Log In", - "logout": "Logout", - "username": "Please enter user name", - "password": "Please enter password", - "rememberPassword": "Remember password", - "version": "Version", - "dashboard": "Dashboard", - "machine": "Machine", - "service": "Service", - "serviceManagement": "Management", - "serviceInfo": "Service Info", - "partitionInfo": "Partition Info", - "config": "Config", - "longTermTask": "Long-term Task", - "metric": "Metric", - "lineChart": "Line Chart", - "barChart": "Bar Chart", - "view": "View", - "set": "Set up", - "cancel": "Cancel", - "confirm": "Confirm", - "overview": "Overview", - "baseLine": "Base Line", - "succeed": "Succeed", - "editBaseLine": "Edit Base Line", - "baseLineTip": "Please enter a number greater than 0", - "unit": "Unit", - "detail": "Detail", - "help": "Help", - "manual": "User Manual", - "forum": "Forum", - "forumLink": "https://discuss.nebula-graph.io/", - "configTip": "Please enter a configuration name", - "all": "All", - "metricLabel": "instance", - "updateFrequency": "refresh frequency", - "overviewInfo": "Info Overview", - "nebulaVersion": { - "enterprise": "Enterprise", - "community": "Community" - }, - "noData": "No Data", - "powerInfo": "Powered by NebulaGraph", - "configServer": { - "host": "Graphd IP address", - "port": "Port" - }, - "addhostSuccess": "{host} add host success" -} + "account": "Account Login", + "login": "Log In", + "logout": "Logout", + "username": "Please enter user name", + "password": "Please enter password", + "rememberPassword": "Remember password", + "version": "Version", + "dashboard": "Dashboard", + "machine": "Machine", + "service": "Service", + "serviceManagement": "Management", + "serviceInfo": "Service Info", + "partitionInfo": "Partition Info", + "config": "Config", + "longTermTask": "Long-term Task", + "metric": "Metric", + "lineChart": "Line Chart", + "barChart": "Bar Chart", + "view": "View", + "set": "Set up", + "cancel": "Cancel", + "confirm": "Confirm", + "overview": "Overview", + "baseLine": "Base Line", + "succeed": "Succeed", + "editBaseLine": "Edit Base Line", + "baseLineTip": "Please enter a number greater than 0", + "unit": "Unit", + "detail": "Detail", + "help": "Help", + "manual": "User Manual", + "forum": "Forum", + "forumLink": "https://discuss.nebula-graph.io/", + "configTip": "Please enter a configuration name", + "all": "All", + "metricLabel": "instance", + "updateFrequency": "refresh frequency", + "overviewInfo": "Info Overview", + "nebulaVersion": { + "enterprise": "Enterprise", + "community": "Community" + }, + "noData": "No Data", + "powerInfo": "Powered by NebulaGraph", + "configServer": { + "host": "Graphd IP address", + "port": "Port" + }, + "addhostSuccess": "{host} add host success", + "successDelay": "Success, Please refresh the page later to view" +} \ No newline at end of file diff --git a/src/config/locale/zh-CN/common.json b/src/config/locale/zh-CN/common.json index 99fa2161..e761f2cd 100644 --- a/src/config/locale/zh-CN/common.json +++ b/src/config/locale/zh-CN/common.json @@ -1,51 +1,52 @@ { - "account": "账户登录", - "login": "登录", - "logout": "登出", - "username": "请输入用户名", - "password": "请输入密码", - "rememberPassword": "记住密码", - "version": "版本", - "dashboard": "看板", - "machine": "机器", - "service": "服务", - "serviceManagement": "管理", - "serviceInfo": "服务信息", - "partitionInfo": "分片信息", - "config": "配置", - "longTermTask": "长时任务", - "metric": "指标", - "lineChart": "折线图", - "barChart": "柱状图", - "view": "查看", - "set": "设置", - "cancel": "取消", - "confirm": "确认", - "overview": "概览", - "baseLine": "基线", - "succeed": "成功", - "editBaseLine": "编辑基线", - "baseLineTip": "请输入大于0的值", - "unit": "单位", - "detail": "详情", - "help": "帮助", - "manual": "使用手册", - "forum": "求助论坛", - "forumLink": "https://discuss.nebula-graph.com.cn/", - "all": "全部", - "updateFrequency": "更新频率", - "configTip": "请输入配置名进行搜索", - "metricLabel": "实例", - "overviewInfo": "信息总览", - "nebulaVersion": { - "enterprise": "企业版", - "community": "社区版" - }, - "noData": "没有数据", - "powerInfo": "版权归 NebulaGraph 所有", - "configServer": { - "host": "Graphd IP 地址", - "port": "端口号" - }, - "addhostSuccess": "{host} add host 成功" -} + "account": "账户登录", + "login": "登录", + "logout": "登出", + "username": "请输入用户名", + "password": "请输入密码", + "rememberPassword": "记住密码", + "version": "版本", + "dashboard": "看板", + "machine": "机器", + "service": "服务", + "serviceManagement": "管理", + "serviceInfo": "服务信息", + "partitionInfo": "分片信息", + "config": "配置", + "longTermTask": "长时任务", + "metric": "指标", + "lineChart": "折线图", + "barChart": "柱状图", + "view": "查看", + "set": "设置", + "cancel": "取消", + "confirm": "确认", + "overview": "概览", + "baseLine": "基线", + "succeed": "成功", + "editBaseLine": "编辑基线", + "baseLineTip": "请输入大于0的值", + "unit": "单位", + "detail": "详情", + "help": "帮助", + "manual": "使用手册", + "forum": "求助论坛", + "forumLink": "https://discuss.nebula-graph.com.cn/", + "all": "全部", + "updateFrequency": "更新频率", + "configTip": "请输入配置名进行搜索", + "metricLabel": "实例", + "overviewInfo": "信息总览", + "nebulaVersion": { + "enterprise": "企业版", + "community": "社区版" + }, + "noData": "没有数据", + "powerInfo": "版权归 NebulaGraph 所有", + "configServer": { + "host": "Graphd IP 地址", + "port": "端口号" + }, + "addhostSuccess": "{host} add host 成功", + "successDelay": "操作成功,请稍后刷新页面查看" +} \ No newline at end of file diff --git a/src/pages/ServiceManage/LeaderDistribution/index.less b/src/pages/ServiceManage/LeaderDistribution/index.less index 47b55e1e..5bb73f06 100644 --- a/src/pages/ServiceManage/LeaderDistribution/index.less +++ b/src/pages/ServiceManage/LeaderDistribution/index.less @@ -3,14 +3,21 @@ .leader-content { padding: 50px 90px; + .nebula-chart{ + display: flex; + align-items: center; + } .leader-table { margin-top: 55px; width: 100%; .distribution-table{ max-height: 300px; - display: block; - word-break: break-word; + display: flex; + flex-wrap: wrap; overflow: auto; + >pre{ + margin:0 5px; + } } } diff --git a/src/pages/ServiceManage/LeaderDistribution/index.tsx b/src/pages/ServiceManage/LeaderDistribution/index.tsx index 94ec2bde..bf83d9d1 100644 --- a/src/pages/ServiceManage/LeaderDistribution/index.tsx +++ b/src/pages/ServiceManage/LeaderDistribution/index.tsx @@ -62,11 +62,12 @@ const LeaderDistribution: React.FC = (props: IProps) => { const getStorageInfo = async () => { const res = await props.asyncGetHostsInfo(); + console.log(res) const data = res.map((item: any) => ({ - name: item.Host, + name: item.Host+':'+item.Port, count: item['Leader count'], distribution: item['Leader distribution'], - })); + })).sort((a, b) => a.name > b.name ? 1 : -1); setData(data); }; @@ -94,7 +95,7 @@ const LeaderDistribution: React.FC = (props: IProps) => { if (compare(formatVersion(cluster?.version || DEFAULT_VERSION), 'v3.0.0', '<')) { code = await props.asyncExecNGQL('BALANCE LEADER'); if (code === 0) { - message.success(intl.get('common.succeed')); + message.success(intl.get('common.successDelay')); getStorageInfo(); } } else { @@ -106,7 +107,7 @@ const LeaderDistribution: React.FC = (props: IProps) => { modalHandler.current?.hide(); const code = await props.asyncExecNGQL('SUBMIT JOB BALANCE LEADER'); if (code === 0) { - message.success(intl.get('common.succeed')); + message.success(intl.get('common.successDelay')); getStorageInfo(); } }; @@ -124,7 +125,9 @@ const LeaderDistribution: React.FC = (props: IProps) => { title: intl.get('service.leaderDistribute'), dataIndex: 'distribution', render: distribution => ( -
{distribution}
+
+ {distribution.split(',').map(each =>
{each.trim(' ')}
)} +
), }, ]; diff --git a/src/pages/ServiceManage/Overview/index.tsx b/src/pages/ServiceManage/Overview/index.tsx index a33c2a97..a64d75e2 100644 --- a/src/pages/ServiceManage/Overview/index.tsx +++ b/src/pages/ServiceManage/Overview/index.tsx @@ -87,7 +87,7 @@ const Overview: React.FC = (props: IProps) => { const balanceData = async () => { const code = await props.asyncExecNGQL('submit job balance data'); if (code === 0) { - message.success(intl.get('common.succeed')); + message.success(intl.get('common.successDelay')); props.asyncGetServices(); } }; @@ -102,14 +102,22 @@ const Overview: React.FC = (props: IProps) => { }; const handleHostChange = async host => { - const code = await props.asyncExecNGQL( - `submit job balance data remove ${host}`, - ); - if (code === 0) { - message.success(intl.get('common.succeed')); - props.asyncGetServices(); - } - handleModalClose(); + AntModal.confirm({ + content: intl.get('common.confirmAction'), + okText: intl.get('common.confirm'), + cancelText: intl.get('common.cancel'), + onOk: async () => { + const code = await props.asyncExecNGQL( + `submit job balance data remove ${host}`, + ); + if (code === 0) { + message.success(intl.get('common.successDelay')); + props.asyncGetServices(); + } + handleModalClose(); + } + }); + }; const handleModalShow = async () => { diff --git a/src/pages/ServiceManage/PartitionDistribution/index.tsx b/src/pages/ServiceManage/PartitionDistribution/index.tsx index c82e5b70..e94f8bc1 100644 --- a/src/pages/ServiceManage/PartitionDistribution/index.tsx +++ b/src/pages/ServiceManage/PartitionDistribution/index.tsx @@ -101,7 +101,7 @@ class PartitionDistribution extends React.Component { const data = Object.keys(groupRes).map(item => ({ name: item, count: groupRes[item], - })); + })).sort((a, b) => b.name < a.name ? 1 : -1); this.setState({ data }, this.updateChart); };