Skip to content

Commit

Permalink
fix: overview service
Browse files Browse the repository at this point in the history
  • Loading branch information
mizy committed Dec 27, 2022
1 parent ffe0a38 commit af68625
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 117 deletions.
101 changes: 51 additions & 50 deletions src/config/locale/en-US/common.json
Original file line number Diff line number Diff line change
@@ -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"
}
101 changes: 51 additions & 50 deletions src/config/locale/zh-CN/common.json
Original file line number Diff line number Diff line change
@@ -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": "操作成功,请稍后刷新页面查看"
}
11 changes: 9 additions & 2 deletions src/pages/ServiceManage/LeaderDistribution/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

Expand Down
13 changes: 8 additions & 5 deletions src/pages/ServiceManage/LeaderDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,12 @@ const LeaderDistribution: React.FC<IProps> = (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);
};

Expand Down Expand Up @@ -94,7 +95,7 @@ const LeaderDistribution: React.FC<IProps> = (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 {
Expand All @@ -106,7 +107,7 @@ const LeaderDistribution: React.FC<IProps> = (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();
}
};
Expand All @@ -124,7 +125,9 @@ const LeaderDistribution: React.FC<IProps> = (props: IProps) => {
title: intl.get('service.leaderDistribute'),
dataIndex: 'distribution',
render: distribution => (
<div className="distribution-table">{distribution}</div>
<div className="distribution-table">
{distribution.split(',').map(each => <pre>{each.trim(' ')}</pre>)}
</div>
),
},
];
Expand Down
26 changes: 17 additions & 9 deletions src/pages/ServiceManage/Overview/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ const Overview: React.FC<IProps> = (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();
}
};
Expand All @@ -102,14 +102,22 @@ const Overview: React.FC<IProps> = (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 () => {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/ServiceManage/PartitionDistribution/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ class PartitionDistribution extends React.Component<IProps, IState> {
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);
};

Expand Down

0 comments on commit af68625

Please sign in to comment.