diff --git a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts index 7fa81dca..aa61b25d 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts +++ b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts @@ -267,7 +267,7 @@ class deployWindow { writeKeyJson.push(key); showContext += "" + tmp + "安装成功
"; } else if (installflag === 0) { - showContext += "" + tmp + "安装部分成功
"; + showContext += "" + tmp + "未全部安装成功
"; } else if (installflag === -1) { showContext += "" + tmp + "安装失败
"; } @@ -309,7 +309,7 @@ class deployWindow { writeKeyJson.push(key); showContext += "" + tmp + "安装成功
"; } else if (installflag === 0) { - showContext += "" + tmp + "安装部分成功
"; + showContext += "" + tmp + "未全部安装成功
"; } else if (installflag === -1) { showContext += "" + tmp + "安装失败
"; } @@ -427,7 +427,7 @@ class deployWindow { goFinish(showContext: string, useFinishHtml: boolean, success: boolean) { this.finishFlag = 0; let preFinish = document.getElementById("finishPage"); - showContext += "点击右上角切换输出按钮查看安装列表详情"; + showContext += "点击右上方切换输出按钮查看安装列表详情"; if (useFinishHtml) { let text = preFinish!.innerHTML; @@ -464,6 +464,7 @@ class deployWindow { ipcRenderer.send("kylinide.installWizard.removeFileLister", { type: "extFile" }); ipcRenderer.send("kylinide.installWizard.removeFileLister", { type: "pkgFile" }); ipcRenderer.send("kylinide.installWizard.removeFileLister", { type: "installFile" }); + ipcRenderer.send("kylinide.installWizard.finish", { type: "finish" }); this.removeAllListeners(); } diff --git a/src/vs/platform/issue/electron-main/deployMainService.ts b/src/vs/platform/issue/electron-main/deployMainService.ts index 4d4d2649..ef1bd012 100644 --- a/src/vs/platform/issue/electron-main/deployMainService.ts +++ b/src/vs/platform/issue/electron-main/deployMainService.ts @@ -57,6 +57,35 @@ import { AbortController } from "@azure/abort-controller"; // } type IStrictWindowState = Required>; +export const enum DeployMainPhase { + // 未开始 + None = 0, + //开始 + Starting = 1, + /** + * 首页 + */ + HomePage = 2, + + /** + *安装页面 + */ + InstallPage = 3, + + /** + * 取消安装 + */ + Cancel = 4, + /** + * 安装结束 + */ + Finish = 5, + /** + * 窗口关闭 + */ + Close = 6 + +} export class DeployMainService implements IDeployMainService { @@ -67,6 +96,7 @@ export class DeployMainService implements IDeployMainService { private DeployWindow: BrowserWindow | null = null; private deployWindowrParentWindow: BrowserWindow | null = null; + private selectObject = { dirPath: "", updateFlag: false, @@ -97,6 +127,9 @@ export class DeployMainService implements IDeployMainService { installProcessId: ChildProcess | null = null; cancelInstallProcessId: ChildProcess | null = null; cancelFlag = false; + phase: DeployMainPhase; + + offset = 0; resultIndex = 0; @@ -132,6 +165,7 @@ export class DeployMainService implements IDeployMainService { this.localConfigObject = { depConfigInfo: "", res: 0, g_index_Object: {}, osinfo: "", localConfigMatch: 0, osrelease: "", supportList: [] }; this.updateConfigObject = { res: 0, g_index_Object: {}, osinfo: "", ConfigMatch: 0, base_url: "", depConfigInfo: "", osrelease: "", supportList: [] }; this.updateConfigDir = installUtils.installConfigDirPre() + "/" + installUtils.getDateDir(); + this.phase = DeployMainPhase.None; this.reset(); this.logger = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/instguide.log")); this.loggerExt = this.loggerMainService.createLogger(URI.file(this.installConfig + "/log/extdetail.log")); @@ -218,6 +252,12 @@ export class DeployMainService implements IDeployMainService { }; + listenerFinish = (event: IpcMainEvent, msg: any) => { + if (msg.type === 'finish') { + this.phase = DeployMainPhase.Finish; + } + }; + listenerInstallProcess = async (event: IpcMainEvent, msg: any) => { if (msg.type === 'installExt') { @@ -259,6 +299,8 @@ export class DeployMainService implements IDeployMainService { } } else if (msg.type === 'installPkg') { + this.phase = DeployMainPhase.InstallPage; + this.logger.info("开始安装操作InstallPage"); // const extlogFile = this.installConfig + '/log/extInstall.log'; // this.backupLogFile(extlogFile) const extlogFile0 = this.installConfig + '/log/extInstall.1.log'; @@ -415,6 +457,8 @@ export class DeployMainService implements IDeployMainService { this.logger.error("取消安装授权失败:", code); } else { this.cancelFlag = true; + this.phase = DeployMainPhase.Cancel; + this.logger.info("取消安装操作Cancel"); if (this.DeployWindow) { this.DeployWindow.webContents.send("kylinide.installWizard.removeFileLister", { type: 'installFile' }); this.DeployWindow.webContents.send("kylinide.installWizard.removeFileLister", { type: 'extFile' }); @@ -432,10 +476,11 @@ export class DeployMainService implements IDeployMainService { this.logger.info('kill Exit code:cancelinstallprocessid:', code); }); } else { - this.logger.info("取消安装"); this.controller.abort(); this.cancelFlag = true; + this.phase = DeployMainPhase.Cancel; this.installQueue?.splice(0); + this.logger.info("取消安装操作Cancel"); //结束插件下载及安装 if (this.DeployWindow) { this.DeployWindow.webContents.send("kylinide.installWizard.cancelInstall", { type: 'cancelinstall' }); @@ -981,6 +1026,7 @@ export class DeployMainService implements IDeployMainService { validatedIpcMain.removeListener('kylinide.installWizard.init', this.listenerWriteSelectJson); validatedIpcMain.removeListener('kylinide.installWizard.reloadwindow', this.listenerReloadWindow); validatedIpcMain.removeListener('kylinide.installWizard.downloadExt', this.handleDownExten); + validatedIpcMain.on('kylinide.installWizard.finish', this.listenerFinish); } private registerListeners(): void { this.logger.info("注册监听器"); @@ -993,6 +1039,7 @@ export class DeployMainService implements IDeployMainService { validatedIpcMain.on('kylinide.installWizard.removeFileLister', this.listenerRemoveFileLister); validatedIpcMain.on('kylinide.installWizard.init', this.listenerWriteSelectJson); validatedIpcMain.on('kylinide.installWizard.reloadwindow', this.listenerReloadWindow); + validatedIpcMain.on('kylinide.installWizard.finish', this.listenerFinish); //handle从渲染进程发送的消息 validatedIpcMain.handle('kylinide.installWizard.init.configVersify', this.handleInitConfigVersify); @@ -1217,7 +1264,8 @@ export class DeployMainService implements IDeployMainService { this.deployWindowrParentWindow = BrowserWindow.getFocusedWindow(); this.reset(); - + this.logger.info("开始创建界面Starting"); + this.phase = DeployMainPhase.Starting; const data = {} as DeployData; const DeployDisposables = new DisposableStore(); const deployWindowConfigUrl = DeployDisposables.add(this.protocolMainService.createIPCObjectUrl()); @@ -1242,13 +1290,30 @@ export class DeployMainService implements IDeployMainService { } this.DeployWindow.webContents.on('did-finish-load', () => { if (this.DeployWindow) { - this.logger.info("窗口加载完成"); + this.logger.info("窗口加载完成,显示首页HomePage", "send kylinide.installWizard.initdata"); this.DeployWindow.webContents.send('kylinide.installWizard.initdata', initData);; this.DeployWindow.show(); + this.phase = DeployMainPhase.HomePage; } }); - this.DeployWindow.on('close', () => { + this.DeployWindow.on('close', e => { + this.logger.info("接收到关闭窗口的信号"); + this.logger.info("检查是否能够关闭窗口"); + if (this.phase === DeployMainPhase.InstallPage) { + this.logger.info("安装未结束,请先点击取消,然后关闭窗口"); + e.preventDefault(); + if (this.DeployWindow) { + this.DeployWindow.show(); + dialog.showMessageBox(this.DeployWindow, { + type: 'info', + title: "提示", + message: "开发环境快速部署功能正在进行安装操作...", + detail: '请先点击开发环境快速部署右上方取消按钮,然后再关闭窗口' + }) + } + return; + } this.logger.info("关闭窗口"); this.DeployWindow = null; try { @@ -1256,7 +1321,7 @@ export class DeployMainService implements IDeployMainService { } catch { this.logger.info("deployDisposables.dispose"); } - + this.phase = DeployMainPhase.Close; resolve(void 0); }); this.deployWindowrParentWindow?.on('close', () => {