From 9e942f12b5be01f28c32017f60ffa8196776e40d Mon Sep 17 00:00:00 2001 From: dinglili Date: Tue, 16 Jul 2024 16:41:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=82=B9=E5=87=BB=E5=8F=96?= =?UTF-8?q?=E6=B6=88,=E4=B8=8D=E8=BE=93=E5=85=A5=E5=AF=86=E7=A0=81,?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=98=BE=E7=A4=BA=E8=BF=9B=E5=BA=A6=E4=B8=8D?= =?UTF-8?q?=E5=88=B0100%;=E5=AE=89=E8=A3=85=E5=A4=B1=E8=B4=A5,=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E8=BF=9B=E5=BA=A6=E6=9D=A1=E9=A2=9C=E8=89=B2=E4=B8=BA?= =?UTF-8?q?=E7=BA=A2=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../deploy/deployWindow-dev.html | 2 +- .../electron-sandbox/deploy/deployWindow.html | 2 +- .../deploy/deployWindowMain.ts | 51 +++++++++++-------- .../electron-sandbox/deploy/media/deploy.css | 6 +++ .../issue/electron-main/deployMainService.ts | 7 +-- 5 files changed, 43 insertions(+), 25 deletions(-) diff --git a/src/vs/code/electron-sandbox/deploy/deployWindow-dev.html b/src/vs/code/electron-sandbox/deploy/deployWindow-dev.html index 1c2875a5..93b0fd10 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindow-dev.html +++ b/src/vs/code/electron-sandbox/deploy/deployWindow-dev.html @@ -144,6 +144,7 @@ 00.00%
+
@@ -174,7 +175,6 @@
-
diff --git a/src/vs/code/electron-sandbox/deploy/deployWindow.html b/src/vs/code/electron-sandbox/deploy/deployWindow.html index b09fb501..64e02374 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindow.html +++ b/src/vs/code/electron-sandbox/deploy/deployWindow.html @@ -145,6 +145,7 @@ 00.00%
+
@@ -175,7 +176,6 @@
-
diff --git a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts index 803a5300..b30576dc 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts +++ b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts @@ -19,7 +19,6 @@ class deployWindow { onlineUpdateConfigRadio: HTMLElement | null = null; nextBtn: HTMLButtonElement | null; prevBtn: HTMLButtonElement | null; - cancelBtn: HTMLButtonElement | null; onlineInstallTabArray: string[] = ["homepage", "waitTab", "onlineInstallTab1", "onlineInstallTab2", "onlineInstallTab3", "onlineInstallTab4"]; onlineInstallTabArrayIndex = 0; @@ -262,7 +261,7 @@ class deployWindow { console.log("end:" + key); //检查某个开发场景的软件包是否全部安装成功 let tmp = this.getNameFromKey(key); - if (this.checkInstalledSucc(key, this.configList, this.extInstallState)) { + if (this.checkKeyInstalledSucc(key, this.configList, this.extInstallState)) { writeKeyJson.push(key); showContext += tmp + "安装成功\n"; } else { @@ -273,8 +272,8 @@ class deployWindow { ipcRenderer.send("kylinide.installWizard.init", { type: "writeKey", keys: writeKeyJson }); } showContext += "点击结束按钮退出开发环境快速部署\n" - - this.goFinish(showContext, false, true); + let allSuccess = this.checkAllInstalledSucc(this.extInstallState); + this.goFinish(showContext, false, allSuccess); console.log("安装结束:成功"); } } @@ -296,7 +295,10 @@ class deployWindow { let showContext = ''; showContext += "取消安装\n"; showContext += "点击结束按钮退出开发环境快速部署\n" - this.goFinish(showContext, false, false); + let allSuccess = this.checkAllInstalledSucc(this.extInstallState); + if (!allSuccess) { + this.goFinish(showContext, true, allSuccess); + } console.log("安装结束:取消"); } }; @@ -305,8 +307,9 @@ class deployWindow { if (msg.type == "pkgNotAuth") { let showContext = ''; showContext += "授权失败,结束安装\n"; - showContext += "点击结束按钮退出开发环境快速部署\n" + showContext += "点击结束按钮退出开发环境快速部署\n"; this.goFinish(showContext, true, false); + console.log("安装结束:授权失败") } }; @@ -332,7 +335,6 @@ class deployWindow { this.onlineUpdateConfigRadio = document.getElementById("onlineUpdateConfig"); this.nextBtn = document.getElementById("nextStep") as HTMLButtonElement; this.prevBtn = document.getElementById("prevStep") as HTMLButtonElement; - this.cancelBtn = document.getElementById('cancel') as HTMLButtonElement; this.showTab(this.currentTab); this.removeAllListeners(); this.registerEventListener(); @@ -420,11 +422,16 @@ class deployWindow { var style = document.createElement('style'); style.textContent = ".progress-view::-webkit-progress-value { background-color: #1AC465; }"; document.head.appendChild(style); + } else { + document.getElementById("progressInfoFinishFail")!.style.display = 'inline-block'; + // 选择包含进度条的元素,并设置伪元素样式 + var style = document.createElement('style'); + style.textContent = ".progress-view::-webkit-progress-value { background-color: red; }"; + document.head.appendChild(style); } this.nextBtn!.innerText = "结束"; this.nextBtn!.disabled = false; - this.cancelBtn!.disabled = true; this.logShow = 0; ipcRenderer.send("kylinide.installWizard.removeFileLister", { type: "extFile" }); ipcRenderer.send("kylinide.installWizard.removeFileLister", { type: "pkgFile" }); @@ -552,6 +559,7 @@ class deployWindow { document.getElementsByClassName("progressinfoValue")[0].innerHTML = "0%"; document.getElementById("progressInfoCancel")!.style.display = 'inline-block'; document.getElementById("progressInfoFinish")!.style.display = 'none'; + document.getElementById("progressInfoFinishFail")!.style.display = 'none'; let extPreElement = document.getElementById("extInstallLogPre"); extPreElement!.innerHTML = ""; @@ -658,8 +666,6 @@ class deployWindow { this.prevBtn!.disabled = true; this.nextBtn!.disabled = true; this.nextBtn!.innerHTML = "结束"; - this.cancelBtn!.innerText = "取消"; - // this.cancelBtn!.style.display = "inline"; } } } @@ -735,7 +741,6 @@ class deployWindow { if (this.onlineInstallRadio instanceof HTMLInputElement && this.onlineInstallRadio!.checked && this.onlineInstallTabArray[this.onlineInstallTabArrayIndex] == "onlineInstallTab4" && this.finishFlag !== 0 - // && this.cancelBtn!.disabled == false ) { ipcRenderer.send('kylinide.installWizard.show', { type: "info", message: "正在进行安装操作,若关闭窗口,则需先点击取消按钮中断安装过程。", title: "提示" }); //检查是否有进程正在安装,如果是,则提醒用户先点击取消安装,停止后台程序。然后再关闭程序 @@ -782,13 +787,6 @@ class deployWindow { ipcRenderer.send('kylinide.installWizard.msg.process', { type: "cancel" }); console.log("render send kylinide.installWizard.msg.process:cancel"); }); - this.cancelBtn!.addEventListener('click', () => { - console.log('click cancel'); - // ipcRenderer.removeAllListeners('kylinide.installWizard.msg'); - ipcRenderer.send('kylinide.installWizard.msg.process', { type: "cancel" }); - console.log("render send kylinide.installWizard.msg.process:cancel"); - }); - /** * 安装界面:安装详情显示/隐藏切换按钮 */ @@ -1142,7 +1140,8 @@ class deployWindow { } return name; } - checkInstalledSucc(key: any, configList: any, extInstallState: any) { + //获取开发场景安装状态 + checkKeyInstalledSucc(key: any, configList: any, extInstallState: any) { let flagjson = 0; for (let depname in configList[key]['pkg-list']['deb']) { if (extInstallState.get(depname) != 12) { @@ -1167,6 +1166,19 @@ class deployWindow { return true; } } + //检查是否所有的软件包,插件,脚本均已成功 + checkAllInstalledSucc(extInstallState: any) { + let flag = 0; + for (let value of extInstallState.values()) { + if (value != 12 && value != 15) { + flag++; + break; + } + } + return flag > 0 ? false : true; + } + + //发送执行脚本请求 checkScripts(msg: any) { @@ -1179,7 +1191,6 @@ class deployWindow { depList: this.depList, script: obj }; - // console.log('renderer send kylinide.installWizard.msg.process', JSON.stringify(installMsg)); ipcRenderer.send("kylinide.installWizard.msg.process", installMsg); } else if (msg.type === "depInstallFail") { this.extInstallState.set(obj['file_name'], 16); diff --git a/src/vs/code/electron-sandbox/deploy/media/deploy.css b/src/vs/code/electron-sandbox/deploy/media/deploy.css index abcf1dc0..a442f792 100644 --- a/src/vs/code/electron-sandbox/deploy/media/deploy.css +++ b/src/vs/code/electron-sandbox/deploy/media/deploy.css @@ -883,6 +883,12 @@ input[readonly] { margin: 0px; padding: 0px; } +.progressInfoFinishFail:before{ + content: "\2717"; + color: red; + margin: 0px; + padding: 0px; +} .progress-view { height: 4px; diff --git a/src/vs/platform/issue/electron-main/deployMainService.ts b/src/vs/platform/issue/electron-main/deployMainService.ts index 3a5d8182..0db3738c 100644 --- a/src/vs/platform/issue/electron-main/deployMainService.ts +++ b/src/vs/platform/issue/electron-main/deployMainService.ts @@ -365,10 +365,11 @@ export class DeployMainService implements IDeployMainService { } } else if (msg.type == "cancel") { + this.logger.info("用户点击取消安装按钮"); //1.结束监听 //2.结束正在执行的进程,下载,插件安装,软件包安装 if (this.installProcessId && this.installProcessId.pid && this.installProcessId.exitCode == null && this.flagPkexec == 0) { - this.println("取消安装before"); + this.logger.info("取消依赖包安装"); // var killcommand = `pkexec sudo pkill -TERM -P ${installProcessId.pid}`; var killcommand = `pkexec sudo pkill -f 'bash ${this.installConfig}/install.sh'`; const sudokill = spawn(killcommand, { shell: true, stdio: 'inherit' }); @@ -424,13 +425,13 @@ export class DeployMainService implements IDeployMainService { } } else if (msg.type === 'extFile') { if (this.extlogFsWatcher) { - this.logger.info("关闭插件日志文件监听"); + this.logger.info("关闭插件安装日志文件监听"); this.extlogFsWatcher.close(); this.extlogFsWatcher = null; } } else if (msg.type === 'pkgFile') { if (this.pkglogFsWatcher) { - this.logger.info("关闭软件包日志文件监听"); + this.logger.info("关闭软件包安装日志文件监听"); this.pkglogFsWatcher.close(); this.pkglogFsWatcher = null; }