From f446299b4785415c3a1c7732526f8a7cc0a1af20 Mon Sep 17 00:00:00 2001 From: dinglili Date: Mon, 19 Aug 2024 14:58:22 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=86=E5=8C=96=E5=AE=89=E8=A3=85=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I1ab6f89e7bacaac59a7c06e8fa5fd7ef3625c0a3 --- .../deploy/deployWindowMain.ts | 130 +++++++++++++++++- .../electron-sandbox/deploy/media/deploy.css | 6 + 2 files changed, 131 insertions(+), 5 deletions(-) diff --git a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts index 4e91a1fc..7fa81dca 100644 --- a/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts +++ b/src/vs/code/electron-sandbox/deploy/deployWindowMain.ts @@ -262,11 +262,14 @@ class deployWindow { console.log("end:" + key); //检查某个开发场景的软件包是否全部安装成功 let tmp = this.getNameFromKey(key); - if (this.checkKeyInstalledSucc(key, this.configList, this.extInstallState)) { + let installflag = this.checkKeyInstalledInfo(key, this.configList, this.extInstallState); + if (installflag === 1) { writeKeyJson.push(key); - showContext += tmp + "安装成功\n"; - } else { - showContext += tmp + "安装失败\n"; + showContext += "" + tmp + "安装成功
"; + } else if (installflag === 0) { + showContext += "" + tmp + "安装部分成功
"; + } else if (installflag === -1) { + showContext += "" + tmp + "安装失败
"; } } if (writeKeyJson.length > 0) { @@ -294,7 +297,26 @@ class deployWindow { console.log("receive: kylinide.installWizard.cancelInstall") if (msg.type == "cancelinstall") { let showContext = ''; - showContext += "取消安装\n"; + showContext += "取消安装,中断安装过程\n"; + //检查安装情况 + let writeKeyJson = []; + for (let key in this.configList) { + console.log("end:" + key); + //检查某个开发场景的软件包是否全部安装成功,或者部分安装成功,或者全部安装失败 + let tmp = this.getNameFromKey(key); + let installflag = this.checkKeyInstalledInfo(key, this.configList, this.extInstallState); + if (installflag === 1) { + writeKeyJson.push(key); + showContext += "" + tmp + "安装成功
"; + } else if (installflag === 0) { + showContext += "" + tmp + "安装部分成功
"; + } else if (installflag === -1) { + showContext += "" + tmp + "安装失败
"; + } + } + if (writeKeyJson.length > 0) { + ipcRenderer.send("kylinide.installWizard.init", { type: "writeKey", keys: writeKeyJson }); + } showContext += "点击结束按钮退出开发环境快速部署\n" let allSuccess = this.checkAllInstalledSucc(this.extInstallState); if (!allSuccess) { @@ -405,6 +427,8 @@ class deployWindow { goFinish(showContext: string, useFinishHtml: boolean, success: boolean) { this.finishFlag = 0; let preFinish = document.getElementById("finishPage"); + showContext += "点击右上角切换输出按钮查看安装列表详情"; + if (useFinishHtml) { let text = preFinish!.innerHTML; text += showContext; @@ -412,6 +436,7 @@ class deployWindow { } else { preFinish!.innerHTML = showContext; } + preFinish!.style.display = 'block'; document.getElementById("installLogPre")!.style.display = 'none'; document.getElementById("detailInstallPre")!.style.display = 'none'; @@ -1157,6 +1182,7 @@ class deployWindow { } return name; } + //获取开发场景安装状态 checkKeyInstalledSucc(key: any, configList: any, extInstallState: any) { let flagjson = 0; @@ -1184,6 +1210,100 @@ class deployWindow { return true; } } + //检查某个开发场景是否全部安装成功 + //return -1: 全部失败 + // 0:部分失败 + // 1:全部成功 + checkKeyInstalledInfo(key: any, configList: any, extInstallState: any) { + let flagVSIX = this.checkKeyInstalledVSIX(key, configList, extInstallState); + let flagSoft = this.checkKeyInstalledSoft(key, configList, extInstallState); + let flagScript = this.checkKeyInstalledScript(key, configList, extInstallState); + if (flagVSIX === 1 && flagSoft === 1 && flagScript === 1) { + return 1; + } else if (flagVSIX === -1 && flagSoft === -1 && flagScript === -1) { + return -1; + } else return 0; + } + //检查某个开发场景的系统基础软件是否全部安装成功 + //return -1: 全部失败 + // 0:部分失败 + // 1:全部成功 + + checkKeyInstalledScript(key: any, configList: any, extInstallState: any) { + let flagFail = 0; + let flagSucc = 0; + //检查某个开发场景的脚本是否全部安装成功 + for (let scriptname of configList[key]['script-list']) { + if (extInstallState.get(scriptname['file_name']) != 15) { + flagFail++; + } else { + flagSucc++; + } + } + if (flagFail === 0 && flagSucc >= 0) { + this.reloadWindowFlag = 1; + return 1; + } + if (flagFail > 0 && flagSucc === 0) { + return -1; + } else { + this.reloadWindowFlag = 1; + return 0; + } + + } + //检查某个开发场景的系统基础软件是否全部安装成功 + //return -1: 全部失败 + // 0:部分失败 + // 1:全部成功 + checkKeyInstalledSoft(key: any, configList: any, extInstallState: any) { + let flagFail = 0;//失败 + let flagSucc = 0; + for (let depname in configList[key]['pkg-list']['deb']) { + if (extInstallState.get(depname) != 12) { + flagFail++; + } else { + flagSucc++; + } + } + if (flagFail === 0 && flagSucc >= 0) { + this.reloadWindowFlag = 1; + return 1; + } + if (flagFail > 0 && flagSucc === 0) { + return -1; + } else { + this.reloadWindowFlag = 1; + return 0; + } + + } + + //检查某个开发场景的插件列表是否全部安装成功 + //return -1: 全部失败 + // 0:部分失败 + // 1:全部成功 + checkKeyInstalledVSIX(key: any, configList: any, extInstallState: any) { + let flagFail = 0;//失败 + let flagSucc = 0; + for (let extname of configList[key]['ext-list']) { + if (extInstallState.get(extname) != 12) { + flagFail++; + } else { + flagSucc++; + } + } + if (flagFail === 0 && flagSucc >= 0) { + this.reloadWindowFlag = 1; + return 1; + } + if (flagFail > 0 && flagSucc === 0) { + return -1; + } else { + this.reloadWindowFlag = 1; + return 0; + } + } //检查是否所有的软件包,插件,脚本均已成功 checkAllInstalledSucc(extInstallState: any) { let flag = 0; diff --git a/src/vs/code/electron-sandbox/deploy/media/deploy.css b/src/vs/code/electron-sandbox/deploy/media/deploy.css index a442f792..6ee714bd 100644 --- a/src/vs/code/electron-sandbox/deploy/media/deploy.css +++ b/src/vs/code/electron-sandbox/deploy/media/deploy.css @@ -1072,6 +1072,12 @@ pre .downloadHighlight::before { margin-right: 5px; } +pre .FailPartHighlight::before { + content: "\237B"; + /* Unicode对号字符 */ + color: yellow; + margin-right: 5px; +} /* Unicode实心圆圈字符 */ /* pre .startHighlight::before { content: "\25CF";