diff --git a/console/src/container/admin-home/index.tsx b/console/src/container/admin-home/index.tsx index 640fdf0af3270c2d5b36c954cbd7c555d55c08e7..a53d9df30c1d8a357bc1907c6739a00dc6819cfb 100644 --- a/console/src/container/admin-home/index.tsx +++ b/console/src/container/admin-home/index.tsx @@ -10,7 +10,7 @@ import { IClusterData } from 'types/base-type'; const TabPane = Tabs.TabPane; -const detailUrl ='/admin/cluster_detail?clusterId='; +const detailUrl = '/admin/cluster_detail?clusterId='; const collectionColumns: Array> = [ { @@ -24,7 +24,8 @@ const collectionColumns: Array> = [ key: 'clusterName', sorter: (a: IClusterData, b: IClusterData) => a.clusterName.charCodeAt(0) - b.clusterName.charCodeAt(0), render: (text, record) => { - return {record.clusterName}; + const url = `${detailUrl}${record.clusterId}&clusterName=${record.clusterName}`; + return {record.clusterName}; }, }, { diff --git a/console/src/container/admin-usermanage/index.tsx b/console/src/container/admin-usermanage/index.tsx index ee6007ba1bd242f2b0a294d6eeec6fe7423dad04..7bb4c47c75697cad929347c9783a7eb023b84786 100644 --- a/console/src/container/admin-usermanage/index.tsx +++ b/console/src/container/admin-usermanage/index.tsx @@ -39,10 +39,10 @@ export class UserManage extends SearchAndFilter { public renderColumns = () => { const role = Object.assign({ title: '角色', - key: 'role', - dataIndex: 'role', + key: 'roleName', + dataIndex: 'roleName', filters: users.filterRole, - onFilter: (value: string, record: any) => record.role.indexOf(value) === 0, + onFilter: (value: string, record: any) => record.roleName.indexOf(value) === 0, }, this.renderColumnsFilter('filterVisible')); return [ diff --git a/console/src/container/broker-info/base-info.tsx b/console/src/container/broker-info/base-info.tsx index 514b1e5369d1a7e3525ec640cfee31240d0bb6dc..df26b25abcd1a1ae1f2b35288a4dfc401de29fc8 100644 --- a/console/src/container/broker-info/base-info.tsx +++ b/console/src/container/broker-info/base-info.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import './index.less'; -import { Table, Modal, notification, PaginationConfig, Button } from 'component/antd'; +import { Table, Modal, notification, PaginationConfig, Button, Spin } from 'component/antd'; import { broker, IBroker, IBrokerNetworkInfo, IBrokerPartition } from 'store/broker'; import { observer } from 'mobx-react'; import { StatusGraghCom } from 'component/flow-table'; @@ -49,10 +49,19 @@ export class BrokerList extends SearchAndFilter { const status = Object.assign({ title: '已同步', - dataIndex: 'status', - key: 'status', - filters: [{ text: '是', value: '是' }, { text: '否', value: '否' }], - onFilter: (value: string, record: IBrokerPartition) => record.status === value, + dataIndex: 'underReplicatedPartitionCount', + key: 'underReplicatedPartitionCount', + filters: [{ text: '是', value: '1' }, { text: '否', value: '0' }], + onFilter: (value: string, record: IBrokerPartition) => { + // underReplicatedPartitionCount > 0 表示未同步完成 + const syncStatus = record.underReplicatedPartitionCount ? '0' : '1'; + return syncStatus === value; + }, + render: (text: number) => ( + <> + {text ? '否' : '是'} + + ), }, this.renderColumnsFilter('filterVisible')); return [{ @@ -80,7 +89,8 @@ export class BrokerList extends SearchAndFilter { title: '未同步副本数量', dataIndex: 'notUnderReplicatedPartitionCount', key: 'notUnderReplicatedPartitionCount', - sorter: (a: IBrokerPartition, b: IBrokerPartition) => a.notUnderReplicatedPartitionCount - b.notUnderReplicatedPartitionCount, + sorter: (a: IBrokerPartition, b: IBrokerPartition) => + a.notUnderReplicatedPartitionCount - b.notUnderReplicatedPartitionCount, }, status, region, @@ -205,7 +215,7 @@ export class BrokerList extends SearchAndFilter { const dataPartitions = this.state.searchId !== '' ? broker.partitions.filter((d) => d.brokerId === +this.state.searchId) : broker.partitions; return ( - <> +
  • Broker概览
  • @@ -239,7 +249,7 @@ export class BrokerList extends SearchAndFilter { pagination={pagination} />
- +
); } } diff --git a/console/src/container/modal/leader-rebalance.tsx b/console/src/container/modal/leader-rebalance.tsx index aefbb9787f08809ab95a4611d14e7dc50d7e108b..57d4ff7da760a880d2f6c7f3e16c524dfd2684c8 100644 --- a/console/src/container/modal/leader-rebalance.tsx +++ b/console/src/container/modal/leader-rebalance.tsx @@ -45,14 +45,19 @@ class LeaderRebalance extends React.Component { constructor(props: any) { super(props); const url = Url(); - this.clusterName = decodeURI(atob(url.search.clusterName)); + if (url.search.clusterName) { + this.clusterName = decodeURI(url.search.clusterName); + } this.clusterId = Number(url.search.clusterId); } public handleSubmit = (e: React.MouseEvent) => { e.preventDefault(); - this.setState({ loading: true }); this.props.form.validateFieldsAndScroll((err: any, values: any) => { + if (err) { + return; + } + this.setState({ loading: true }); this.brokerId = Number(values.brokerId); addRebalance({ brokerId: this.brokerId, clusterId: this.clusterId, dimension: 0 }).then(() => { cluster.getRebalance(this.clusterId).then(() => { diff --git a/console/src/store/broker.ts b/console/src/store/broker.ts index 863ac487ba9d369cc25e3bbc5fe93c1bd136f2dc..f09470bfab45c94cd1e68ec6df10bffdb7b432a6 100644 --- a/console/src/store/broker.ts +++ b/console/src/store/broker.ts @@ -35,6 +35,7 @@ export interface IBrokerPartition extends IBroker { leaderCount: number; partitionCount: number; notUnderReplicatedPartitionCount: number; + underReplicatedPartitionCount?: number; regionName: string; bytesInPerSec: number; } @@ -74,6 +75,9 @@ interface IBrokerOption { } class Broker { + @observable + public loading: boolean = false; + @observable public brokerBaseInfo: IBrokerBaseInfo = {} as IBrokerBaseInfo; @@ -119,6 +123,11 @@ class Broker { @observable public BrokerOptions: IValueLabel[] = [{ value: null, label: '请选择Broker' }]; + @action.bound + public setLoading(value: boolean) { + this.loading = value; + } + @action.bound public setBrokerBaseInfo(data: IBrokerBaseInfo) { data.startTime = moment(data.startTime).format('YYYY-MM-DD HH:mm:ss'), @@ -216,7 +225,8 @@ class Broker { } public getBrokerList(clusterId: number) { - getBrokerList(clusterId).then(this.setBrokerList); + this.setLoading(true); + getBrokerList(clusterId).then(this.setBrokerList).finally(() => this.setLoading(false)); } public getBrokerNetwork(clusterId: number) { @@ -224,7 +234,8 @@ class Broker { } public getBrokerPartition(clusterId: number) { - getBrokerPartition(clusterId).then(this.setBrokerPartition); + this.setLoading(true); + getBrokerPartition(clusterId).then(this.setBrokerPartition).finally(() => this.setLoading(false)); } public getOneBrokerNetwork(clusterId: number, brokerId: number) { diff --git a/console/src/store/users.ts b/console/src/store/users.ts index de4012e6465d08d9a1b0e1bee5781fdffda8d0ae..0a74bd39a8e2755ed91ce3f64bbcb4bf8ef80b95 100644 --- a/console/src/store/users.ts +++ b/console/src/store/users.ts @@ -17,7 +17,7 @@ export class Users { @action.bound public setUserData(data: []) { this.userData = data.map((d: any) => { - d.role = this.roleMap[d.role]; + d.roleName = this.roleMap[d.role]; return d; }); }