diff --git a/spug_web/src/pages/deploy/do/index.js b/spug_web/src/pages/deploy/do/index.js
index e3b679a..129a5b0 100644
--- a/spug_web/src/pages/deploy/do/index.js
+++ b/spug_web/src/pages/deploy/do/index.js
@@ -1,15 +1,19 @@
import React from 'react';
+import { observer } from 'mobx-react';
import { Steps, Collapse, Icon } from 'antd';
import http from 'libs/http';
import styles from './index.module.css';
import store from './store';
+import lds from 'lodash';
-
+@observer
class Index extends React.Component {
componentDidMount() {
const {id} = this.props.match.params;
http.post(`/api/deploy/request/${id}/`)
- .then(token => {
+ .then(({token, outputs, targets}) => {
+ store.outputs = outputs;
+ store.targets = targets;
this.socket = new WebSocket(`ws://localhost:8000/ws/exec/${token}/`);
this.socket.onopen = () => {
this.socket.send('ok');
@@ -18,17 +22,13 @@ class Index extends React.Component {
if (e.data === 'pong') {
this.socket.send('ping')
} else {
- console.log(JSON.parse(e.data));
- // const {key, data, type, status} = JSON.parse(e.data);
- // if (status !== undefined) {
- // store.outputs[key]['status'] = status
- // } else if (data) {
- // store.outputs[key][type] += data;
- // store.outputs[key]['latest'] = data;
- // if (this.elements[key]) {
- // this.elements[key].scrollIntoView({behavior: 'smooth'})
- // }
- // }
+ const {key, data, step, status} = JSON.parse(e.data);
+ if (data !== undefined) store.outputs[key]['data'] += data;
+ if (step !== undefined) store.outputs[key]['step'] = step;
+ if (status !== undefined) store.outputs[key]['status'] = status;
+ // if (this.elements[key]) {
+ // this.elements[key].scrollIntoView({behavior: 'smooth'})
+ // }
}
}
})
@@ -38,32 +38,54 @@ class Index extends React.Component {
if (this.socket) this.socket.close()
}
+ getStatus = (key, n) => {
+ const step = lds.get(store.outputs, `${key}.step`, 0);
+ const isError = lds.get(store.outputs, `${key}.status`) === 'error';
+ const icon =
{lds.get(store.outputs, 'local.data')}+
{lds.get(store.outputs, `${item.id}.data`)}+