import * as React from 'react'; import { Table, Tabs, PaginationConfig } from 'component/antd'; import { observer } from 'mobx-react'; import urlQuery from 'store/url-query'; import { controller } from 'store/controller'; import { SearchAndFilter } from 'container/cluster-topic'; import moment from 'moment'; const TabPane = Tabs.TabPane; const columns = [ { title: 'BrokerId', dataIndex: 'brokerId', key: 'brokerId', sorter: (a: any, b: any) => a.brokerNum - b.brokerNum, }, { title: 'host', key: 'host', dataIndex: 'host', render: (r: string, t: any) => { return ( {r} ); }, }, { title: '版本', dataIndex: 'controllerVersion', key: 'controllerVersion', }, { title: '变更时间', dataIndex: 'controllerTimestamp', key: 'controllerTimestamp', sorter: (a: any, b: any) => a.controllerTimestamp - b.updacontrollerTimestampteTime, render: (t: number) => moment(t).format('YYYY-MM-DD HH:mm:ss'), }, ]; const pagination: PaginationConfig = { position: 'bottom', showQuickJumper: true, pageSize: 10, showTotal: (total) => `共 ${total} 条`, }; @observer export class AdminController extends SearchAndFilter { public state = { searchKey: '', }; public componentDidMount() { controller.getController(urlQuery.clusterId); } public renderController() { if (!controller.data) return null; const data = controller.data.filter((d) => d.host.includes(this.state.searchKey)); return ( ); } public render() { return ( <> {this.renderController()} ); } }