Skip to content

Commit

Permalink
[ISSES#1469] add cluster delete button (#6170)
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZQ001010 authored Jun 28, 2021
1 parent 01e3352 commit e0efe71
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 3 deletions.
4 changes: 4 additions & 0 deletions console-ui/src/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ const I18N_CONF = {
pubNoData: 'No results found.',
nodeState: 'NodeState',
extendInfo: 'NodeMetaData',
operation: 'Operation',
leave: 'Leave',
confirm: 'Confirm',
confirmTxt: 'Confirm that you want to go offline this cluster node?',
},
EditClusterDialog: {
updateCluster: 'Update Cluster',
Expand Down
4 changes: 4 additions & 0 deletions console-ui/src/locales/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,10 @@ const I18N_CONF = {
pubNoData: '没有数据',
nodeState: '节点状态',
extendInfo: '节点元数据',
operation: '操作',
leave: '下线',
confirm: '确认',
confirmTxt: '确认要下线此集群节点?',
},
EditClusterDialog: {
updateCluster: '更新集群',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,19 @@ import {
Button,
Field,
Tag,
Icon,
Collapse,
Form,
Grid,
Input,
Loading,
Pagination,
Table,
Dialog,
ConfigProvider,
} from '@alifd/next';
import { request } from '../../../globalLib';
import RegionGroup from '../../../components/RegionGroup';
import axios from 'axios';

import './ClusterNodeList.scss';

Expand Down Expand Up @@ -102,6 +103,39 @@ class ClusterNodeList extends React.Component {
});
}

leave(nodes) {
this.openLoading();
axios
.post('v1/core/cluster/server/leave', nodes)
.then(() => {
this.queryClusterStateList();
this.closeLoading();
})
.catch(() => {
this.queryClusterStateList();
this.closeLoading();
});
}

showLeaveDialog(value) {
const { locale = {} } = this.props;
Dialog.confirm({
title: locale.confirm,
content: locale.confirmTxt,
onOk: () => this.leave([value]),
onCancel: () => {},
});
}

renderCol(value, index, record) {
const { locale = {} } = this.props;
return (
<Button onClick={this.showLeaveDialog.bind(this, value)} type="primary" warning>
{locale.leave}
</Button>
);
}

getQueryLater = () => {
setTimeout(() => this.queryClusterStateList());
};
Expand Down Expand Up @@ -178,7 +212,7 @@ class ClusterNodeList extends React.Component {
locale={{ empty: pubNoData }}
getRowProps={row => this.rowColor(row)}
>
<Column title={locale.nodeIp} dataIndex="address" width="30%" />
<Column title={locale.nodeIp} dataIndex="address" width="20%" />
<Column
title={locale.nodeState}
dataIndex="state"
Expand Down Expand Up @@ -215,7 +249,7 @@ class ClusterNodeList extends React.Component {
<Column
title={locale.extendInfo}
dataIndex="extendInfo"
width="50%"
width="30%"
cell={function(value, index, record) {
function showCollapse() {
const collapse = (
Expand All @@ -235,6 +269,12 @@ class ClusterNodeList extends React.Component {
return showCollapse();
}}
/>
<Column
title={locale.operation}
dataIndex="address"
width="20%"
cell={this.renderCol.bind(this)}
/>
</Table>
</Col>
</Row>
Expand Down

0 comments on commit e0efe71

Please sign in to comment.