Commit 6a4f6518 authored by wudizhanche1000's avatar wudizhanche1000

安装完成更新界面

parent 32be85f0
......@@ -136,9 +136,11 @@ export class AppDetailComponent implements OnInit {
(error)=> {
},
()=> {
currentApp.status.status = "waiting";
this.ref.detectChanges();
// 避免安装过快
if (currentApp.status.status === "downloading") {
currentApp.status.status = "waiting";
this.ref.detectChanges();
}
});
await Promise.all(downloadApps.map((app)=> {
return this.downloadService.getComplete(app)
......@@ -146,7 +148,11 @@ export class AppDetailComponent implements OnInit {
return this.installService.add(completeApp, options);
});
}));
console.log("before")
await this.installService.getComplete(currentApp);
console.log("install complete");
currentApp.status.status = "ready";
this.ref.detectChanges();
} catch (e) {
new Notification(currentApp.name, {body: "下载失败"});
}
......
import {App} from "./app";
/**
* Created by zh99998 on 16/9/6.
*/
......@@ -5,6 +6,7 @@ export class AppLocal {
path: string;
version: string;
files: Map<string,string>;
action: Map<string,{execute: string, args: string[], env: {}, open: App}>;
update(local) {
this.path = local.path;
......
This diff is collapsed.
......@@ -41,7 +41,12 @@ export class InstallService {
}
getComplete(app: App): Promise<App> {
return null;
return new Promise((resolve, reject)=> {
this.eventEmitter.once(app.id, (complete)=> {
console.log("receive ",app.id);
resolve();
});
});
}
extract(file: string, destPath: string) {
......@@ -151,7 +156,6 @@ export class InstallService {
destPath = path.join(options.installLibrary, app.id);
await this.createDirectory(destPath);
}
this.installQueue.delete(app);
await this.extract(packagePath, destPath);
await this.postInstall(app, destPath);
let local = new AppLocal();
......@@ -160,6 +164,9 @@ export class InstallService {
local.version = app.version;
app.local = local;
this.saveAppLocal(app);
console.log("send ",app.id);
this.eventEmitter.emit(app.id, 'install complete');
this.installQueue.delete(app);
this.installingQueue.delete(app);
if (this.installQueue.size > 0) {
await this.doInstall()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment