diff --git a/spug_web/src/pages/schedule/Info.js b/spug_web/src/pages/schedule/Info.js new file mode 100644 index 0000000..31a4ee3 --- /dev/null +++ b/spug_web/src/pages/schedule/Info.js @@ -0,0 +1,61 @@ +import React from 'react'; +import { Modal, Form, Tabs } from 'antd'; +import { StatisticsCard } from 'components'; +import http from 'libs/http'; +import store from './store'; + +class ComForm extends React.Component { + constructor(props) { + super(props); + this.state = { + loading: true, + info: {} + } + } + + componentDidMount() { + http.get(`/api/schedule/${store.record.id}/`) + .then(info => this.setState({info})) + .finally(() => this.setState({loading: false})) + } + + render() { + const {run_time, success, failure, duration, outputs} = this.state.info; + const preStyle = { + marginTop: 5, + backgroundColor: '#eee', + borderRadius: 5, + padding: 10, + maxHeight: 215, + }; + return ( + store.infoVisible = false} + footer={null}> + + {success}}/> + {failure}}/> + {duration}}/> + + {outputs && ( + + {outputs.map((item, index) => ( + +
执行时间: {run_time}
+
运行耗时: {item.duration} s
+
返回状态: {item.code}
+
执行输出:
{item.output}
+
+ ))} +
+ )} +
+ ) + } +} + +export default Form.create()(ComForm) \ No newline at end of file diff --git a/spug_web/src/pages/schedule/Table.js b/spug_web/src/pages/schedule/Table.js index a23777c..861d91e 100644 --- a/spug_web/src/pages/schedule/Table.js +++ b/spug_web/src/pages/schedule/Table.js @@ -5,6 +5,7 @@ import ComForm from './Form'; import http from 'libs/http'; import store from './store'; import { LinkButton } from "components"; +import Info from './Info'; @observer class ComTable extends React.Component { @@ -62,7 +63,7 @@ class ComTable extends React.Component { width: 180, render: info => ( - store.showForm(info)}>详情 + store.showInfo(info)}>详情 store.showForm(info)}>编辑 @@ -127,6 +128,7 @@ class ComTable extends React.Component { {store.formVisible && } + {store.infoVisible && } ) } diff --git a/spug_web/src/pages/schedule/store.js b/spug_web/src/pages/schedule/store.js index c5276a2..0cbd2a5 100644 --- a/spug_web/src/pages/schedule/store.js +++ b/spug_web/src/pages/schedule/store.js @@ -8,6 +8,7 @@ class Store { @observable targets = [undefined]; @observable isFetching = false; @observable formVisible = false; + @observable infoVisible = false; @observable f_status; @observable f_name; @@ -28,6 +29,11 @@ class Store { this.record = info }; + showInfo = (info = {}) => { + this.infoVisible = true; + this.record = info + }; + addTarget = () => { this.targets.push(undefined) };