mirror of
https://gitee.com/wonderful-code/buildadmin
synced 2024-11-21 22:55:36 +00:00
fix(Terminal):修复开始执行命令时可能刷新页面的问题
This commit is contained in:
parent
9c7c24d0fb
commit
226ddadbd1
@ -80,9 +80,11 @@ export const useTerminal = defineStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function taskCompleted(idx: number) {
|
function taskCompleted(idx: number) {
|
||||||
if (typeof state.taskList[idx].callback != 'function') {
|
// 命令执行完毕,重新打开热更新
|
||||||
return
|
if (import.meta.hot) import.meta.hot.send('custom:open-hot', { type: 'terminal' })
|
||||||
}
|
|
||||||
|
if (typeof state.taskList[idx].callback != 'function') return
|
||||||
|
|
||||||
const status = state.taskList[idx].status
|
const status = state.taskList[idx].status
|
||||||
if (status == taskStatus.Failed || status == taskStatus.Unknown) {
|
if (status == taskStatus.Failed || status == taskStatus.Unknown) {
|
||||||
state.taskList[idx].callback(taskStatus.Failed)
|
state.taskList[idx].callback(taskStatus.Failed)
|
||||||
@ -179,6 +181,9 @@ export const useTerminal = defineStore(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function startEventSource(taskKey: number) {
|
function startEventSource(taskKey: number) {
|
||||||
|
// 命令执行期间禁用热更新
|
||||||
|
if (import.meta.hot) import.meta.hot.send('custom:close-hot', { type: 'terminal' })
|
||||||
|
|
||||||
window.eventSource = new EventSource(
|
window.eventSource = new EventSource(
|
||||||
buildTerminalUrl(state.taskList[taskKey].command, state.taskList[taskKey].uuid, state.taskList[taskKey].extend)
|
buildTerminalUrl(state.taskList[taskKey].command, state.taskList[taskKey].uuid, state.taskList[taskKey].extend)
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user