diff --git a/spug_api/apps/app/models.py b/spug_api/apps/app/models.py index 4d61a1d..d69b3c7 100644 --- a/spug_api/apps/app/models.py +++ b/spug_api/apps/app/models.py @@ -98,6 +98,7 @@ class DeployExtend2(models.Model, ModelMixin): deploy = models.OneToOneField(Deploy, primary_key=True, on_delete=models.CASCADE) server_actions = models.TextField() host_actions = models.TextField() + require_upload = models.BooleanField(default=False) def to_dict(self, *args, **kwargs): tmp = super().to_dict(*args, **kwargs) diff --git a/spug_api/apps/app/views.py b/spug_api/apps/app/views.py index 0a51643..412f386 100644 --- a/spug_api/apps/app/views.py +++ b/spug_api/apps/app/views.py @@ -151,6 +151,7 @@ class DeployView(View): return json_response(error=error) if len(extend_form.server_actions) + len(extend_form.host_actions) == 0: return json_response(error='请至少设置一个执行的动作') + extend_form.require_upload = any(x.get('src_mode') == '1' for x in extend_form.host_actions) extend_form.server_actions = json.dumps(extend_form.server_actions) extend_form.host_actions = json.dumps(extend_form.host_actions) if form.id: diff --git a/spug_web/src/pages/deploy/request/Ext2Form.js b/spug_web/src/pages/deploy/request/Ext2Form.js index 828d00b..82dc47b 100644 --- a/spug_web/src/pages/deploy/request/Ext2Form.js +++ b/spug_web/src/pages/deploy/request/Ext2Form.js @@ -69,7 +69,7 @@ export default observer(function () { return false } - const {app_host_ids, deploy_id, type} = store.record; + const {app_host_ids, deploy_id, type, require_upload} = store.record; return ( - - - {fileList.length === 0 ? : null} - - + {require_upload && ( + + + {fileList.length === 0 ? : null} + + + )} {host_ids.length > 0 && `已选择 ${host_ids.length} 台(可选${app_host_ids.length})`} diff --git a/spug_web/src/pages/deploy/request/store.js b/spug_web/src/pages/deploy/request/store.js index 0948112..660e821 100644 --- a/spug_web/src/pages/deploy/request/store.js +++ b/spug_web/src/pages/deploy/request/store.js @@ -32,9 +32,9 @@ class Store { if (this.f_app_id) data = data.filter(x => x.app_id === this.f_app_id) if (this.f_env_id) data = data.filter(x => x.env_id === this.f_env_id) if (this.f_s_date) data = data.filter(x => { - const date = x.created_at.substr(0, 10); - return date >= this.f_s_date && date <= this.f_e_date - }) + const date = x.created_at.substr(0, 10); + return date >= this.f_s_date && date <= this.f_e_date + }) if (this.f_status !== 'all') { if (this.f_status === '99') { data = data.filter(x => ['-1', '2'].includes(x.status)) @@ -84,7 +84,8 @@ class Store { }; confirmAdd = (deploy) => { - this.record = {deploy_id: deploy.id, app_host_ids: deploy.host_ids}; + const {id, host_ids, require_upload} = deploy; + this.record = {deploy_id: id, app_host_ids: host_ids, require_upload}; if (deploy.extend === '1') { this.ext1Visible = true } else {