diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-24 14:20:14 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-08-24 14:20:14 +0200 |
commit | 6691c9f7c53dc765b5a333a2db84ce692bd2b44d (patch) | |
tree | 44687208551c15788a9925aee0bdcac0c5e526fa /webapp/src/app/services/config.service.ts | |
parent | 88bd003f0e4d8e460e3cbd3583c94e6b3f82646f (diff) |
Disabled/Greyed project when not usable.
Not usable means sources are out of sync or project is not enable.
Diffstat (limited to 'webapp/src/app/services/config.service.ts')
-rw-r--r-- | webapp/src/app/services/config.service.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/webapp/src/app/services/config.service.ts b/webapp/src/app/services/config.service.ts index f5e353c..4501add 100644 --- a/webapp/src/app/services/config.service.ts +++ b/webapp/src/app/services/config.service.ts @@ -29,6 +29,14 @@ export var ProjectTypes = [ { value: ProjectType.SYNCTHING, display: "Cloud Sync" } ]; +export var ProjectStatus = { + ErrorConfig: "ErrorConfig", + Disable: "Disable", + Enable: "Enable", + Pause: "Pause", + Syncing: "Syncing" +}; + export interface IProject { id?: string; label: string; @@ -37,6 +45,7 @@ export interface IProject { type: ProjectType; status?: string; isInSync?: boolean; + isUsable?: boolean; serverPrjDef?: IXDSFolderConfig; isExpanded?: boolean; visible?: boolean; @@ -144,6 +153,7 @@ export class ConfigService { // XXX for now, only isInSync and status may change this.confStore.projects[i].isInSync = prj.isInSync; this.confStore.projects[i].status = prj.status; + this.confStore.projects[i].isUsable = this._isUsableProject(prj); this.confSubject.next(Object.assign({}, this.confStore)); } }); @@ -359,6 +369,12 @@ export class ConfigService { return this.xdsServerSvr.syncProject(prj.id); } + private _isUsableProject(p) { + return p && p.isInSync && + (p.status === ProjectStatus.Enable) && + (p.status !== ProjectStatus.Syncing); + } + private _getProjectIdx(id: string): number { return this.confStore.projects.findIndex((item) => item.id === id); } @@ -374,6 +390,7 @@ export class ConfigService { type: rPrj.type, status: rPrj.status, isInSync: rPrj.isInSync, + isUsable: this._isUsableProject(rPrj), defaultSdkID: rPrj.defaultSdkID, serverPrjDef: Object.assign({}, rPrj), // do a copy }; |