Files
ptools/templates/auto_pt/restart.html
2022-08-24 16:04:12 +08:00

83 lines
2.7 KiB
HTML

{% load static %}
<!-- 引入样式 -->
<link rel="stylesheet" href="{% static 'admin/simpleui-x/elementui/theme-chalk/index.css' %}">
<!-- 引入组件库 -->
<div id="app">
<el-card class="box-card">
<div slot="header" class="clearfix">
<span>更新日志</span>
<span style="float: right;margin-top: -10px">
<el-button type="danger" @click="do_restart">重启更新</el-button>
</span>
</div>
<div class="text item">
{{ update_notes|safe }}
</div>
</el-card>
{# href='javascript:(confirm("确定重启?"))?location="/tasks/restart":location="/"'#}
</div>
<script src="{% static 'admin/simpleui-x/js/vue.min.js' %}"></script>
<script src="{% static 'admin/simpleui-x/elementui/index.js' %}"></script>
<script src="{% static 'admin/simpleui-x/js/axios.min.js' %}"></script>
<script type="text/javascript">
// 配置对象 options
const vm = new Vue({
// 配置选项(option)
// element: 指定用vue来管理页面中的哪个标签区域
el: '#app',
data: {
update_note: ''
},
created: function () {
{#this.data.update_note = converter.makeHtml({{ update_notes }});#}
},
methods: {
do_restart() {
this.$confirm('此操作将重启容器,并更新软件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
axios.get(
"{% url "do_restart" %}"
{#url + '/task/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: '已取消重启'
});
});
}
}
});
</script>