add deploy mode

pull/289/head
vapao 2021-03-17 09:31:15 +08:00
parent 80e4456dd6
commit 402250f7b1
4 changed files with 17 additions and 4 deletions

View File

@ -42,8 +42,8 @@ class Deploy(models.Model, ModelMixin):
host_ids = models.TextField()
extend = models.CharField(max_length=2, choices=EXTENDS)
is_audit = models.BooleanField()
is_parallel = models.BooleanField(default=True)
rst_notify = models.CharField(max_length=255, null=True)
created_at = models.CharField(max_length=20, default=human_datetime)
created_by = models.ForeignKey(User, models.PROTECT, related_name='+')
updated_at = models.CharField(max_length=20, null=True)

View File

@ -7,7 +7,7 @@ from django.conf import settings
from libs import JsonParser, Argument, json_response
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
from apps.config.models import Config
from apps.app.utils import parse_envs, fetch_versions, remove_repo
from apps.app.utils import fetch_versions, remove_repo
import subprocess
import json
import os
@ -108,6 +108,7 @@ class DeployView(View):
Argument('host_ids', type=list, filter=lambda x: len(x), help='请选择要部署的主机'),
Argument('rst_notify', type=dict, help='请选择发布结果通知方式'),
Argument('extend', filter=lambda x: x in dict(Deploy.EXTENDS), help='请选择发布类型'),
Argument('is_parallel', type=bool, default=True),
Argument('is_audit', type=bool, default=False)
).parse(request.body)
if error is None:

View File

@ -6,7 +6,7 @@
import React, { useEffect, useState } from 'react';
import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';
import { Switch, Form, Input, Select, Button } from 'antd';
import { Switch, Form, Input, Select, Button, Radio } from 'antd';
import envStore from 'pages/config/environment/store';
import Selector from 'pages/host/Selector';
import store from './store';
@ -50,6 +50,12 @@ export default observer(function Ext1Setup1() {
<Input disabled={store.isReadOnly} value={info['git_repo']} onChange={e => info['git_repo'] = e.target.value}
placeholder="请输入Git仓库地址"/>
</Form.Item>
<Form.Item label="发布模式">
<Radio.Group buttonStyle="solid" value={info.is_parallel} onChange={e => info.is_parallel = e.target.value}>
<Radio.Button value={true}>并行</Radio.Button>
<Radio.Button value={false}>串行</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item label="发布审核">
<Switch
disabled={store.isReadOnly}

View File

@ -6,7 +6,7 @@
import React, { useState, useEffect } from 'react';
import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';
import { Form, Switch, Select, Button, Input } from "antd";
import { Form, Switch, Select, Button, Input, Radio } from "antd";
import envStore from 'pages/config/environment/store';
import store from './store';
@ -41,6 +41,12 @@ export default observer(function Ext2Setup1() {
<Link disabled={store.isReadOnly} to="/config/environment">新建环境</Link>
</Form.Item>
</Form.Item>
<Form.Item label="发布模式">
<Radio.Group buttonStyle="solid" value={info.is_parallel} onChange={e => info.is_parallel = e.target.value}>
<Radio.Button value={true}>并行</Radio.Button>
<Radio.Button value={false}>串行</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item label="发布审核">
<Switch
disabled={store.isReadOnly}