U dashboard statistic improve

pull/220/head
vapao 2020-11-02 16:21:44 +08:00
parent 79ef2c46a9
commit 014ad8ce08
1 changed files with 6 additions and 5 deletions

View File

@ -15,6 +15,7 @@ export default class StatisticCard extends React.Component {
res: {} res: {}
} }
} }
componentDidMount() { componentDidMount() {
http.get('/api/home/statistic/') http.get('/api/home/statistic/')
.then(res => this.setState({res})) .then(res => this.setState({res}))
@ -27,22 +28,22 @@ export default class StatisticCard extends React.Component {
<Row gutter={16} style={{marginBottom: 20}}> <Row gutter={16} style={{marginBottom: 20}}>
<Col span={6}> <Col span={6}>
<Card loading={loading}> <Card loading={loading}>
<Statistic title="应用" value={res.app} suffix="个" /> <Statistic title="应用" value={res.app} formatter={v => <a href="/deploy/app">{v}</a>} suffix="个"/>
</Card> </Card>
</Col> </Col>
<Col span={6}> <Col span={6}>
<Card loading={loading}> <Card loading={loading}>
<Statistic title="主机" value={res.host} suffix="台" /> <Statistic title="主机" value={res.host} formatter={v => <a href="/host">{v}</a>} suffix="台"/>
</Card> </Card>
</Col> </Col>
<Col span={6}> <Col span={6}>
<Card loading={loading}> <Card loading={loading}>
<Statistic title="任务" value={res.task} suffix="个" /> <Statistic title="任务" value={res.task} formatter={v => <a href="/schedule">{v}</a>} suffix="个"/>
</Card> </Card>
</Col> </Col>
<Col span={6}> <Col span={6}>
<Card loading={loading}> <Card loading={loading}>
<Statistic title="监控" value={res['detection']} suffix="项" /> <Statistic title="监控" value={res['detection']} formatter={v => <a href="/monitor">{v}</a>} suffix="项"/>
</Card> </Card>
</Col> </Col>
</Row> </Row>