mirror of https://github.com/openspug/spug
A web improve user experience
parent
a0658906ab
commit
03db8ac644
|
@ -6,8 +6,12 @@ import zhCN from 'antd/es/locale/zh_CN';
|
||||||
import history from 'libs/history';
|
import history from 'libs/history';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
import App from './App';
|
import App from './App';
|
||||||
|
import moment from 'moment';
|
||||||
|
import 'moment/locale/zh-cn';
|
||||||
import * as serviceWorker from './serviceWorker';
|
import * as serviceWorker from './serviceWorker';
|
||||||
|
|
||||||
|
moment.locale('zh-cn');
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<ConfigProvider locale={zhCN}>
|
<ConfigProvider locale={zhCN}>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Modal, Form, Tabs } from 'antd';
|
import { Modal, Form, Tabs, Spin } from 'antd';
|
||||||
import { StatisticsCard } from 'components';
|
import { StatisticsCard } from 'components';
|
||||||
import http from 'libs/http';
|
import http from 'libs/http';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
|
import moment from 'moment';
|
||||||
|
|
||||||
class ComForm extends React.Component {
|
class ComForm extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -36,23 +37,25 @@ class ComForm extends React.Component {
|
||||||
title="任务执行详情"
|
title="任务执行详情"
|
||||||
onCancel={() => store.infoVisible = false}
|
onCancel={() => store.infoVisible = false}
|
||||||
footer={null}>
|
footer={null}>
|
||||||
<StatisticsCard loading={this.state.loading}>
|
<Spin spinning={this.state.loading}>
|
||||||
<StatisticsCard.Item title="执行成功" value={<span style={{color: '#3f8600'}}>{success}</span>}/>
|
<StatisticsCard loading={this.state.loading}>
|
||||||
<StatisticsCard.Item title="执行失败" value={<span style={{color: '#cf1322'}}>{failure}</span>}/>
|
<StatisticsCard.Item title="执行成功" value={<span style={{color: '#3f8600'}}>{success}</span>}/>
|
||||||
<StatisticsCard.Item bordered={false} title="平均耗时(秒)" value={<span style={{color: ''}}>{duration}</span>}/>
|
<StatisticsCard.Item title="执行失败" value={<span style={{color: '#cf1322'}}>{failure}</span>}/>
|
||||||
</StatisticsCard>
|
<StatisticsCard.Item bordered={false} title="平均耗时(秒)" value={<span style={{color: ''}}>{duration}</span>}/>
|
||||||
{outputs && (
|
</StatisticsCard>
|
||||||
<Tabs tabPosition="left" defaultActiveKey="0" style={{width: 700, height: 350, margin: 'auto'}}>
|
{outputs && (
|
||||||
{outputs.map((item, index) => (
|
<Tabs tabPosition="left" defaultActiveKey="0" style={{width: 700, height: 350, margin: 'auto'}}>
|
||||||
<Tabs.TabPane key={`${index}`} tab={item.name}>
|
{outputs.map((item, index) => (
|
||||||
<div>执行时间: {run_time}</div>
|
<Tabs.TabPane key={`${index}`} tab={item.name}>
|
||||||
<div style={{marginTop: 5}}>运行耗时: {item.duration} s</div>
|
<div>执行时间: {run_time}({moment(run_time).fromNow()})</div>
|
||||||
<div style={{marginTop: 5}}>返回状态: {item.code}</div>
|
<div style={{marginTop: 5}}>运行耗时: {item.duration} s</div>
|
||||||
<div style={{marginTop: 5}}>执行输出: <pre style={preStyle}>{item.output}</pre></div>
|
<div style={{marginTop: 5}}>返回状态: {item.code}</div>
|
||||||
</Tabs.TabPane>
|
<div style={{marginTop: 5}}>执行输出: <pre style={preStyle}>{item.output}</pre></div>
|
||||||
))}
|
</Tabs.TabPane>
|
||||||
</Tabs>
|
))}
|
||||||
)}
|
</Tabs>
|
||||||
|
)}
|
||||||
|
</Spin>
|
||||||
</Modal>
|
</Modal>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import http from 'libs/http';
|
||||||
import store from './store';
|
import store from './store';
|
||||||
import { LinkButton } from "components";
|
import { LinkButton } from "components";
|
||||||
import Info from './Info';
|
import Info from './Info';
|
||||||
|
import moment from "moment";
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class ComTable extends React.Component {
|
class ComTable extends React.Component {
|
||||||
|
@ -54,6 +55,7 @@ class ComTable extends React.Component {
|
||||||
}, {
|
}, {
|
||||||
title: '最近时间',
|
title: '最近时间',
|
||||||
dataIndex: 'latest_run_time',
|
dataIndex: 'latest_run_time',
|
||||||
|
render: value => value ? moment(value).fromNow() : 'N/A'
|
||||||
}, {
|
}, {
|
||||||
title: '描述信息',
|
title: '描述信息',
|
||||||
dataIndex: 'desc',
|
dataIndex: 'desc',
|
||||||
|
@ -63,7 +65,7 @@ class ComTable extends React.Component {
|
||||||
width: 180,
|
width: 180,
|
||||||
render: info => (
|
render: info => (
|
||||||
<span>
|
<span>
|
||||||
<LinkButton onClick={() => store.showInfo(info)}>详情</LinkButton>
|
<LinkButton disabled={!info['latest_run_time']} onClick={() => store.showInfo(info)}>详情</LinkButton>
|
||||||
<Divider type="vertical"/>
|
<Divider type="vertical"/>
|
||||||
<LinkButton onClick={() => store.showForm(info)}>编辑</LinkButton>
|
<LinkButton onClick={() => store.showForm(info)}>编辑</LinkButton>
|
||||||
<Divider type="vertical"/>
|
<Divider type="vertical"/>
|
||||||
|
|
Loading…
Reference in New Issue