import * as React from 'react'; import './index.less'; import { Table, Tabs, ColumnProps, PaginationConfig } from 'component/antd'; import { modal } from 'store'; import { cluster } from 'store/cluster'; import { observer } from 'mobx-react'; import { IClusterData } from 'types/base-type'; const TabPane = Tabs.TabPane; const detailUrl = '/admin/cluster_detail?clusterId='; const collectionColumns: Array> = [ { title: '集群ID', dataIndex: 'clusterId', key: 'clusterId', sorter: (a: IClusterData, b: IClusterData) => a.clusterId - b.clusterId, }, { title: '集群名称', key: 'clusterName', sorter: (a: IClusterData, b: IClusterData) => a.clusterName.charCodeAt(0) - b.clusterName.charCodeAt(0), render: (text, record) => { const url = `${detailUrl}${record.clusterId}&clusterName=${record.clusterName}`; return {record.clusterName}; }, }, { title: 'Topic 数', key: 'topicNum', sorter: (a: IClusterData, b: IClusterData) => a.topicNum - b.topicNum, render: (text, record) => { return {record.topicNum}; }, }, { title: 'Broker 数量', dataIndex: 'brokerNum', key: 'brokerNum', sorter: (a: IClusterData, b: IClusterData) => a.brokerNum - b.brokerNum, render: (text, record) => { return ( {record.brokerNum} ); }, }, { title: 'ConsumerGroup 数', key: 'consumerGroupNum', sorter: (a: IClusterData, b: IClusterData) => a.consumerGroupNum - b.consumerGroupNum, render: (text, record) => { return {record.consumerGroupNum}; }, }, { title: 'Region 数', key: 'regionNum', sorter: (a: IClusterData, b: IClusterData) => a.regionNum - b.regionNum, render: (text, record) => { return {record.regionNum}; }, }, { title: 'ControllerID', key: 'controllerId', sorter: (a: IClusterData, b: IClusterData) => a.controllerId - b.controllerId, render: (text, record) => { return {record.controllerId}; }, }, { title: '操作', dataIndex: 'operation', key: 'operation', render: (text, record) => { return ( 修改 ); }, }, ]; const pagination: PaginationConfig = { position: 'bottom', showQuickJumper: true, pageSize: 10, showTotal: (total) => `共 ${total} 条`, }; @observer export class AdminHome extends React.Component { public renderList() { return ( ); } public componentDidMount() { cluster.getClusters(); cluster.getKafkaVersions(); } public render() { return ( <> {this.renderList()} ); } }