diff --git a/ptools/settings.py b/ptools/settings.py index 493b7cf..b61ff4b 100644 --- a/ptools/settings.py +++ b/ptools/settings.py @@ -207,10 +207,6 @@ SIMPLEUI_CONFIG = { 'name': '更新', 'icon': 'fas fa-code', 'models': [{ - 'name': '重启更新', - 'icon': 'far fa-surprise', - 'url': '/tasks/restart' - }, { 'name': '更新', 'icon': 'far fa-surprise', 'url': '/tasks/update' diff --git a/templates/auto_pt/update.html b/templates/auto_pt/update.html index 810ed57..b39b807 100644 --- a/templates/auto_pt/update.html +++ b/templates/auto_pt/update.html @@ -24,6 +24,7 @@ 重启更新 + 重启
@@ -110,6 +111,43 @@ } , methods: { + do_restart() { + this.$confirm('此操作将重启容器,并更新软件, 是否继续?', '提示', { + confirmButtonText: '确定', + cancelButtonText: '取消', + type: 'warning' + }).then(() => { + axios.get( + "{% url "do_restart" %}" + ).then(res => { + if (res.data.code === 0) { + this.$message({ + type: 'success', + message: res.data.msg + }); + } else { + console.log(res) + this.$message({ + type: 'warning', + message: res.data.msg + }); + } + }).catch(res => { + this.$message({ + type: 'error', + message: "重启失败!" + }); + }) + + }).catch(res => { + {#console.log(res)#} + this.$message({ + type: 'info', + message: '已取消重启' + }); + }); + }, + do_update() { this.$confirm('此操作会拉取软件更新软件,并重启容器,是否继续?', '提示', { confirmButtonText: '确定',