diff --git a/spug_api/apps/deploy/views.py b/spug_api/apps/deploy/views.py index 2d999e1..6e6bf8a 100644 --- a/spug_api/apps/deploy/views.py +++ b/spug_api/apps/deploy/views.py @@ -105,13 +105,10 @@ class RequestDetailView(View): return json_response(error='为找到指定发布申请') hosts = Host.objects.filter(id__in=json.loads(req.host_ids)) targets = [{'id': x.id, 'title': f'{x.name}({x.hostname}:{x.port})'} for x in hosts] - server_steps, host_steps = [], [] + server_actions, host_actions = [], [] if req.app.extend == '2': - for item in json.loads(req.app.extend_obj.actions): - if item['target'] == 'server': - server_steps.append(item['name']) - else: - host_steps.append(item['name']) + server_actions = json.loads(req.app.extend_obj.server_actions) + host_actions = json.loads(req.app.extend_obj.host_actions) return json_response({ 'app_name': req.app.name, 'env_name': req.app.env.name, @@ -119,8 +116,8 @@ class RequestDetailView(View): 'type': req.type, 'status_alias': req.get_status_display(), 'targets': targets, - 'server_steps': server_steps, - 'host_steps': host_steps + 'server_actions': server_actions, + 'host_actions': host_actions }) def post(self, request, r_id): diff --git a/spug_web/src/pages/deploy/do/Ext2Index.js b/spug_web/src/pages/deploy/do/Ext2Index.js index 0d3a812..67f1f8b 100644 --- a/spug_web/src/pages/deploy/do/Ext2Index.js +++ b/spug_web/src/pages/deploy/do/Ext2Index.js @@ -1,6 +1,6 @@ import React from 'react'; import { observer } from 'mobx-react'; -import { Steps, PageHeader, Spin, Tag, Button, Icon } from 'antd'; +import { Steps, Collapse, PageHeader, Spin, Tag, Button, Icon } from 'antd'; import http from 'libs/http'; import history from 'libs/history'; import styles from './index.module.css'; @@ -8,7 +8,7 @@ import store from './store'; import lds from 'lodash'; @observer -class Ext2Index extends React.Component { +class Ext1Index extends React.Component { constructor(props) { super(props); this.state = { @@ -27,7 +27,7 @@ class Ext2Index extends React.Component { componentWillUnmount() { if (this.socket) this.socket.close(); - store.request = {targets: []}; + store.request = {targets: [], server_actions: [], host_actions: []}; store.outputs = {}; } @@ -84,7 +84,7 @@ class Ext2Index extends React.Component { }; render() { - const {app_name, env_name, status} = store.request; + const {app_name, env_name, status, server_actions, host_actions} = store.request; return ( 发布} onBack={() => history.goBack()}/> -
- + + - -
{lds.get(store.outputs, 'local.data')}
-
+ {server_actions.map((item, index) => ( + + ))} + }> +
{lds.get(store.outputs, 'local.data')}
+ + + + {host_actions.length > 0 && ( + }> + {store.request.targets.map((item, index) => ( + + {item.title} + + + {host_actions.map((item, index) => ( + + ))} + + }> +
{lds.get(store.outputs, `${item.id}.data`)}
+
+ ))} +
+ )} + {host_actions.length === 0 && this.state.fetching === false && ( +
无目标主机动作
+ )}
) } } -export default Ext2Index \ No newline at end of file +export default Ext1Index \ No newline at end of file diff --git a/spug_web/src/pages/deploy/do/index.module.css b/spug_web/src/pages/deploy/do/index.module.css index 96cecb3..c96cab9 100644 --- a/spug_web/src/pages/deploy/do/index.module.css +++ b/spug_web/src/pages/deploy/do/index.module.css @@ -39,6 +39,11 @@ height: 100px; } +.ext2Tips { + color: #888; + margin-top: 30px; +} + pre { margin: 0; } \ No newline at end of file diff --git a/spug_web/src/pages/deploy/do/store.js b/spug_web/src/pages/deploy/do/store.js index 7996e70..2973229 100644 --- a/spug_web/src/pages/deploy/do/store.js +++ b/spug_web/src/pages/deploy/do/store.js @@ -4,6 +4,8 @@ class Store { @observable outputs = {}; @observable request = { targets: [], + host_actions: [], + server_actions: [] }; }