Skip to content

Commit 766570d

Browse files
author
dajiangyou
committed
feat: update server details show
1 parent e91c0dd commit 766570d

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "auto-deploy-app",
33
"version": "0.0.1",
4-
"author": "dajiangyou <[email protected]>",
4+
"author": "dajiangyou",
55
"description": "An electron-vue project",
66
"license": null,
77
"main": "./dist/electron/main.js",

src/index.ejs

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
if (process.env.NODE_ENV !== 'development') window.__static = require('path').join(__dirname, '/static').replace(/\\/g, '\\\\')
1919
</script>
2020
<% } %>
21-
2221
<!-- webpack builds are automatically injected -->
2322
</body>
2423
</html>

src/renderer/views/home/ServerList.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
<a-icon title="delete" @click.stop="" type="delete" theme="twoTone" two-tone-color="#F56C6C" />
2222
</a-popconfirm>
2323
</template>
24-
<p>{{ item }}</p>
24+
<template v-for="(val, key) in item">
25+
<p v-if="key === 'name' || key === 'host' || key === 'port'" :key="key" >
26+
{{ key }}:{{ val }}
27+
</p>
28+
</template>
2529
</a-collapse-panel>
2630
</a-collapse>
2731
</a-card>

src/renderer/views/home/TaskCenter.vue

+14-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a-collapse defaultActiveKey="0" v-if="executingTaskList.length > 0">
44
<a-collapse-panel v-for="(item, index) in executingTaskList" :key="index">
55
<template #header>
6-
{{ `Task ${index + 1}` }}
6+
{{ `Task ${item.name}` }}
77
<a-tag :color="taskStatusOptions[item.status].color">
88
{{ taskStatusOptions[item.status].desc }}
99
</a-tag>
@@ -88,8 +88,8 @@ export default {
8888
methods: {
8989
// 处理任务
9090
async handleTask (taskId, task) {
91+
const { name, server, preCommandList, isUpload } = task
9192
try {
92-
const { server, preCommandList, isUpload } = task
9393
this._addTaskLogByTaskId(taskId, '⚡开始执行任务...', 'primary')
9494
const ssh = new NodeSSH()
9595
// ssh connect
@@ -140,7 +140,7 @@ export default {
140140
}
141141
}
142142
}
143-
this._addTaskLogByTaskId(taskId, `🎉恭喜,所有任务已执行完成${server.name}部署成功`, 'success')
143+
this._addTaskLogByTaskId(taskId, `🎉恭喜,所有任务已执行完成${name} 执行成功!`, 'success')
144144
this._changeTaskStatusByTaskId(taskId, 'passed')
145145
// if task in deploy instance list finshed then update status
146146
if (task._id) {
@@ -149,8 +149,13 @@ export default {
149149
status: 'passed'
150150
})
151151
}
152+
// system notification
153+
const myNotification = new Notification('✔ Success', {
154+
body: `🎉恭喜,所有任务已执行完成,${name} 执行成功!`
155+
})
156+
console.log(myNotification)
152157
} catch (error) {
153-
this._addTaskLogByTaskId(taskId, '❌任务执行中发生错误,请修改后再次尝试!', 'error')
158+
this._addTaskLogByTaskId(taskId, `${name} 执行中发生错误,请修改后再次尝试!`, 'error')
154159
this._changeTaskStatusByTaskId(taskId, 'failed')
155160
console.log(error)
156161
// if task in deploy instance list finshed then update status
@@ -160,6 +165,11 @@ export default {
160165
status: 'failed'
161166
})
162167
}
168+
// system notification
169+
const myNotification = new Notification('❌Error', {
170+
body: `${name} 执行中发生错误,请修改后再次尝试!`
171+
})
172+
console.log(myNotification)
163173
}
164174
},
165175
// 保存

0 commit comments

Comments
 (0)