1. 重构更新页面3

This commit is contained in:
ngfchl
2022-09-05 21:49:30 +08:00
parent f7259f7538
commit ee8000fbd8
2 changed files with 38 additions and 4 deletions

View File

@@ -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'

View File

@@ -24,6 +24,7 @@
</span>
<span style="float: right;margin-top: -10px">
<el-button slot="reference" type="danger" @click="do_update" v-if="{{ restart }}">重启更新</el-button>
<el-button slot="reference" type="danger" @click="do_restart" v-else>重启</el-button>
</span>
</div>
<div class="text item">
@@ -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: '确定',