U 删除发布配置将自动清理其关联的数据文件

pull/137/head
vapao 2020-06-24 00:26:10 +08:00
parent 153a39b4a2
commit 67c2940e5b
2 changed files with 6 additions and 1 deletions

View File

@ -3,11 +3,14 @@
# Released under the AGPL-3.0 License.
from django.views.generic import View
from django.db.models import F
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
import subprocess
import json
import os
class AppView(View):
@ -145,6 +148,8 @@ class DeployView(View):
).parse(request.GET)
if error is None:
Deploy.objects.filter(pk=form.id).delete()
repo_dir = os.path.join(settings.REPOS_DIR, str(form.id))
subprocess.Popen(f'rm -rf {repo_dir} {repo_dir + "_*"}', shell=True)
return json_response(error=error)

View File

@ -67,7 +67,7 @@ class ComTable extends React.Component {
handleDeployDelete = (text) => {
Modal.confirm({
title: '删除确认',
content: `确定要删除【${lds.get(envStore.idMap, `${text.env_id}.name`)}】的发布配置?`,
content: `删除发布配置将会影响基于该配置所创建发布申请的发布和回滚功能,确定要删除【${lds.get(envStore.idMap, `${text.env_id}.name`)}】的发布配置?`,
onOk: () => {
return http.delete('/api/app/deploy/', {params: {id: text.id}})
.then(() => {