mirror of https://github.com/openspug/spug
				
				
				
			U dashboard statistic improve
							parent
							
								
									79ef2c46a9
								
							
						
					
					
						commit
						014ad8ce08
					
				| 
						 | 
				
			
			@ -4,7 +4,7 @@
 | 
			
		|||
 * Released under the AGPL-3.0 License.
 | 
			
		||||
 */
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import {Statistic, Card, Row, Col} from 'antd';
 | 
			
		||||
import { Statistic, Card, Row, Col } from 'antd';
 | 
			
		||||
import { http } from 'libs';
 | 
			
		||||
 | 
			
		||||
export default class StatisticCard extends React.Component {
 | 
			
		||||
| 
						 | 
				
			
			@ -15,6 +15,7 @@ export default class StatisticCard extends React.Component {
 | 
			
		|||
      res: {}
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  componentDidMount() {
 | 
			
		||||
    http.get('/api/home/statistic/')
 | 
			
		||||
      .then(res => this.setState({res}))
 | 
			
		||||
| 
						 | 
				
			
			@ -27,22 +28,22 @@ export default class StatisticCard extends React.Component {
 | 
			
		|||
      <Row gutter={16} style={{marginBottom: 20}}>
 | 
			
		||||
        <Col span={6}>
 | 
			
		||||
          <Card loading={loading}>
 | 
			
		||||
            <Statistic title="应用" value={res.app} suffix="个" />
 | 
			
		||||
            <Statistic title="应用" value={res.app} formatter={v => <a href="/deploy/app">{v}</a>} suffix="个"/>
 | 
			
		||||
          </Card>
 | 
			
		||||
        </Col>
 | 
			
		||||
        <Col span={6}>
 | 
			
		||||
          <Card loading={loading}>
 | 
			
		||||
            <Statistic title="主机" value={res.host} suffix="台" />
 | 
			
		||||
            <Statistic title="主机" value={res.host} formatter={v => <a href="/host">{v}</a>} suffix="台"/>
 | 
			
		||||
          </Card>
 | 
			
		||||
        </Col>
 | 
			
		||||
        <Col span={6}>
 | 
			
		||||
          <Card loading={loading}>
 | 
			
		||||
            <Statistic title="任务" value={res.task} suffix="个" />
 | 
			
		||||
            <Statistic title="任务" value={res.task} formatter={v => <a href="/schedule">{v}</a>} suffix="个"/>
 | 
			
		||||
          </Card>
 | 
			
		||||
        </Col>
 | 
			
		||||
        <Col span={6}>
 | 
			
		||||
          <Card loading={loading}>
 | 
			
		||||
            <Statistic title="监控" value={res['detection']} suffix="项" />
 | 
			
		||||
            <Statistic title="监控" value={res['detection']} formatter={v => <a href="/monitor">{v}</a>} suffix="项"/>
 | 
			
		||||
          </Card>
 | 
			
		||||
        </Col>
 | 
			
		||||
      </Row>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue