细化安装提示信息

Change-Id: I1ab6f89e7bacaac59a7c06e8fa5fd7ef3625c0a3
This commit is contained in:
dinglili 2024-08-19 14:58:22 +08:00 committed by wangpenglong
parent de1b20dd1f
commit f446299b47
2 changed files with 131 additions and 5 deletions

View File

@ -262,11 +262,14 @@ class deployWindow {
console.log("end:" + key); console.log("end:" + key);
//检查某个开发场景的软件包是否全部安装成功 //检查某个开发场景的软件包是否全部安装成功
let tmp = this.getNameFromKey(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); writeKeyJson.push(key);
showContext += tmp + "安装成功\n"; showContext += "<span class='installedHighlight'>" + tmp + "安装成功</span><br>";
} else { } else if (installflag === 0) {
showContext += tmp + "安装失败\n"; showContext += "<span class='FailPartHighlight'>" + tmp + "安装部分成功</span><br>";
} else if (installflag === -1) {
showContext += "<span class='depfailHighlight'>" + tmp + "安装失败</span><br>";
} }
} }
if (writeKeyJson.length > 0) { if (writeKeyJson.length > 0) {
@ -294,7 +297,26 @@ class deployWindow {
console.log("receive: kylinide.installWizard.cancelInstall") console.log("receive: kylinide.installWizard.cancelInstall")
if (msg.type == "cancelinstall") { if (msg.type == "cancelinstall") {
let showContext = ''; 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 += "<span class='installedHighlight'>" + tmp + "安装成功</span><br>";
} else if (installflag === 0) {
showContext += "<span class='FailPartHighlight'>" + tmp + "安装部分成功</span><br>";
} else if (installflag === -1) {
showContext += "<span class='depfailHighlight'>" + tmp + "安装失败</span><br>";
}
}
if (writeKeyJson.length > 0) {
ipcRenderer.send("kylinide.installWizard.init", { type: "writeKey", keys: writeKeyJson });
}
showContext += "点击结束按钮退出开发环境快速部署\n" showContext += "点击结束按钮退出开发环境快速部署\n"
let allSuccess = this.checkAllInstalledSucc(this.extInstallState); let allSuccess = this.checkAllInstalledSucc(this.extInstallState);
if (!allSuccess) { if (!allSuccess) {
@ -405,6 +427,8 @@ class deployWindow {
goFinish(showContext: string, useFinishHtml: boolean, success: boolean) { goFinish(showContext: string, useFinishHtml: boolean, success: boolean) {
this.finishFlag = 0; this.finishFlag = 0;
let preFinish = document.getElementById("finishPage"); let preFinish = document.getElementById("finishPage");
showContext += "点击右上角切换输出按钮查看安装列表详情";
if (useFinishHtml) { if (useFinishHtml) {
let text = preFinish!.innerHTML; let text = preFinish!.innerHTML;
text += showContext; text += showContext;
@ -412,6 +436,7 @@ class deployWindow {
} else { } else {
preFinish!.innerHTML = showContext; preFinish!.innerHTML = showContext;
} }
preFinish!.style.display = 'block'; preFinish!.style.display = 'block';
document.getElementById("installLogPre")!.style.display = 'none'; document.getElementById("installLogPre")!.style.display = 'none';
document.getElementById("detailInstallPre")!.style.display = 'none'; document.getElementById("detailInstallPre")!.style.display = 'none';
@ -1157,6 +1182,7 @@ class deployWindow {
} }
return name; return name;
} }
//获取开发场景安装状态 //获取开发场景安装状态
checkKeyInstalledSucc(key: any, configList: any, extInstallState: any) { checkKeyInstalledSucc(key: any, configList: any, extInstallState: any) {
let flagjson = 0; let flagjson = 0;
@ -1184,6 +1210,100 @@ class deployWindow {
return true; 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) { checkAllInstalledSucc(extInstallState: any) {
let flag = 0; let flag = 0;

View File

@ -1072,6 +1072,12 @@ pre .downloadHighlight::before {
margin-right: 5px; margin-right: 5px;
} }
pre .FailPartHighlight::before {
content: "\237B";
/* Unicode对号字符 */
color: yellow;
margin-right: 5px;
}
/* Unicode实心圆圈字符 */ /* Unicode实心圆圈字符 */
/* pre .startHighlight::before { /* pre .startHighlight::before {
content: "\25CF"; content: "\25CF";