@@ -59,10 +66,10 @@
@@ -90,132 +97,107 @@
// element: 指定用vue来管理页面中的哪个标签区域
el: '#app',
data: {
- update_notes: {{ update_notes|safe }},
- local_logs: {{ local_logs|safe }},
+ update_notes: {{ update_notes | safe }},
+ local_logs: {{ local_logs | safe }} ,
+ local_log: [],
+ update_log:[],
update: false,
- local_log_width: 24
- },
- created() {
- this.update =
- {{ update }}
+ local_log_width:24,
+ },
+ created()
+ {
+ this.update = {{ update }}
- if (this.update) {
- this.local_log_width = 12
+ if (this.update) {
+ this.local_log_width = 12
- }
- this.$message({
- showClose: true,
- message: "{{ update_tips }}",
- type: 'success'
+ }
+ this.$message({
+ showClose: true,
+ message: "{{ update_tips }}",
+ type: 'success'
+ });
+ }
+ ,
+ 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: '已取消重启'
+ });
});
},
- 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)
+ do_update()
+ {
+ this.$confirm('此操作会拉取软件更新软件,新版本不一定稳定,是否继续?', '提示', {
+ confirmButtonText: '确定',
+ cancelButtonText: '取消',
+ type: 'warning'
+ }).then(() => {
+ axios.get(
+ "{% url "do_update" %}"
+ ).then(res => {
+ if (res.data.code === 0) {
+ console.log(res, 1)
+ this.update_log = res.data.data
this.$message({
- type: 'info',
- message: '已取消重启'
+ type: 'success',
+ message: res.data.msg
});
- });
- },
- {#get_update() {#}
- {# axios.get(#}
- {# "{% url "do_get_update" %}"#}
- {# ).then(res => {#}
- {# if (res.data.code === 0) {#}
- {# console.log(res.data)#}
- {# this.update_notes = res.data.data.update_notes#}
- {#this.update_log = true#}
- {# this.local_log_width = 12#}
- {# this.$message({#}
- {# type: 'success',#}
- {# message: res.data.msg#}
- {# });#}
- {# } else {#}
- {# console.log(res)#}
- {# this.$message({#}
- {# type: 'warning',#}
- {# message: res.data.msg#}
- {# });#}
- {# }#}
- {# }).catch(res => {#}
- {# console.log(res)#}
- {# this.$message({#}
- {# type: 'info',#}
- {# message: '获取更新失败!'#}
- {# });#}
- {# });#}
- {#{},#}
- do_update() {
- this.$confirm('此操作会拉取软件更新软件,新版本不一定稳定,是否继续?', '提示', {
- confirmButtonText: '确定',
- cancelButtonText: '取消',
- type: 'warning'
- }).then(() => {
- axios.get(
- "{% url "do_update" %}"
- {#url + '/task/do_restart'#}
- ).then(res => {
- if (res.data.code === 0) {
- console.log(res, 1)
- this.update_note = res.data.data
- this.$message({
- type: 'success',
- message: res.data.msg
- });
- } else {
- console.log(res, 2)
- this.$message({
- type: 'warning',
- message: res.data.msg
- });
- }
- }).catch(res => {
- console.log(res, 3)
- this.$message({
- type: 'error',
- message: "更新失败!"
- });
- })
-
- }).catch(res => {
- console.log(res)
+ } else {
+ console.log(res, 2)
this.$message({
type: 'warning',
- message: '已取消更新'
+ message: res.data.msg
});
+ }
+ }).catch(res => {
+ console.log(res, 3)
+ this.$message({
+ type: 'error',
+ message: "更新失败!"
});
- }
- }
+ })
+
+ }).catch(res => {
+ console.log(res)
+ this.$message({
+ type: 'warning',
+ message: '已取消更新'
+ });
+ });
+ }
+ }
});