3
3
<a-collapse defaultActiveKey =" 0" v-if =" executingTaskList.length > 0" >
4
4
<a-collapse-panel v-for =" (item, index) in executingTaskList" :key =" index" >
5
5
<template #header >
6
- {{ `Task ${index + 1 }` }}
6
+ {{ `Task ${item.name }` }}
7
7
<a-tag :color =" taskStatusOptions[item.status].color" >
8
8
{{ taskStatusOptions[item.status].desc }}
9
9
</a-tag >
@@ -88,8 +88,8 @@ export default {
88
88
methods: {
89
89
// 处理任务
90
90
async handleTask (taskId , task ) {
91
+ const { name , server , preCommandList , isUpload } = task
91
92
try {
92
- const { server , preCommandList , isUpload } = task
93
93
this ._addTaskLogByTaskId (taskId, ' ⚡开始执行任务...' , ' primary' )
94
94
const ssh = new NodeSSH ()
95
95
// ssh connect
@@ -140,7 +140,7 @@ export default {
140
140
}
141
141
}
142
142
}
143
- this ._addTaskLogByTaskId (taskId, ` 🎉恭喜,所有任务已执行完成! ${ server . name } 部署成功 ` , ' success' )
143
+ this ._addTaskLogByTaskId (taskId, ` 🎉恭喜,所有任务已执行完成, ${ name} 执行成功! ` , ' success' )
144
144
this ._changeTaskStatusByTaskId (taskId, ' passed' )
145
145
// if task in deploy instance list finshed then update status
146
146
if (task ._id ) {
@@ -149,8 +149,13 @@ export default {
149
149
status: ' passed'
150
150
})
151
151
}
152
+ // system notification
153
+ const myNotification = new Notification (' ✔ Success' , {
154
+ body: ` 🎉恭喜,所有任务已执行完成,${ name} 执行成功!`
155
+ })
156
+ console .log (myNotification)
152
157
} catch (error) {
153
- this ._addTaskLogByTaskId (taskId, ' ❌任务执行中发生错误 ,请修改后再次尝试!' , ' error' )
158
+ this ._addTaskLogByTaskId (taskId, ` ❌ ${ name } 执行中发生错误 ,请修改后再次尝试!` , ' error' )
154
159
this ._changeTaskStatusByTaskId (taskId, ' failed' )
155
160
console .log (error)
156
161
// if task in deploy instance list finshed then update status
@@ -160,6 +165,11 @@ export default {
160
165
status: ' failed'
161
166
})
162
167
}
168
+ // system notification
169
+ const myNotification = new Notification (' ❌Error' , {
170
+ body: ` ❌ ${ name} 执行中发生错误,请修改后再次尝试!`
171
+ })
172
+ console .log (myNotification)
163
173
}
164
174
},
165
175
// 保存
0 commit comments