mirror of https://github.com/openspug/spug
U 删除发布配置将自动清理其关联的数据文件
parent
153a39b4a2
commit
67c2940e5b
|
@ -3,11 +3,14 @@
|
||||||
# Released under the AGPL-3.0 License.
|
# Released under the AGPL-3.0 License.
|
||||||
from django.views.generic import View
|
from django.views.generic import View
|
||||||
from django.db.models import F
|
from django.db.models import F
|
||||||
|
from django.conf import settings
|
||||||
from libs import JsonParser, Argument, json_response
|
from libs import JsonParser, Argument, json_response
|
||||||
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
|
from apps.app.models import App, Deploy, DeployExtend1, DeployExtend2
|
||||||
from apps.config.models import Config
|
from apps.config.models import Config
|
||||||
from apps.app.utils import parse_envs, fetch_versions, remove_repo
|
from apps.app.utils import parse_envs, fetch_versions, remove_repo
|
||||||
|
import subprocess
|
||||||
import json
|
import json
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
class AppView(View):
|
class AppView(View):
|
||||||
|
@ -145,6 +148,8 @@ class DeployView(View):
|
||||||
).parse(request.GET)
|
).parse(request.GET)
|
||||||
if error is None:
|
if error is None:
|
||||||
Deploy.objects.filter(pk=form.id).delete()
|
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)
|
return json_response(error=error)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ComTable extends React.Component {
|
||||||
handleDeployDelete = (text) => {
|
handleDeployDelete = (text) => {
|
||||||
Modal.confirm({
|
Modal.confirm({
|
||||||
title: '删除确认',
|
title: '删除确认',
|
||||||
content: `确定要删除【${lds.get(envStore.idMap, `${text.env_id}.name`)}】的发布配置?`,
|
content: `删除发布配置将会影响基于该配置所创建发布申请的发布和回滚功能,确定要删除【${lds.get(envStore.idMap, `${text.env_id}.name`)}】的发布配置?`,
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
return http.delete('/api/app/deploy/', {params: {id: text.id}})
|
return http.delete('/api/app/deploy/', {params: {id: text.id}})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|
Loading…
Reference in New Issue