summaryrefslogtreecommitdiffstats
path: root/webapp
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-10-03 11:46:00 +0200
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-10-03 11:53:51 +0200
commit319bdec474f655f415609c76a8e3b50b1d0b9aa4 (patch)
tree56b2d795b58c79bd9719d593e40ea73ceb7afa08 /webapp
parent635a25c98bb606d987fcd55cf697ea9f4a0b38b2 (diff)
Fixed 'Unknown sdkid' error in dashboard
Steps to reproduce problem: - open XDS dashboard, - display SDKs page list (click on SDKs in the left panel) - display Build page (click on Build in the left panel) - keep selected Project and SDK and just click on Build button - error 'Unknown sdkid' must be displayed Problem partially comes from the fact that default/current sdk in sdk.service is the first sdk and not the first Installed sdk. Change-Id: I21b9310e8ad67ff71afb5b704b39f5f98bc8707b Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'webapp')
-rw-r--r--webapp/src/app/@core-xds/services/sdk.service.ts3
-rw-r--r--webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts13
2 files changed, 8 insertions, 8 deletions
diff --git a/webapp/src/app/@core-xds/services/sdk.service.ts b/webapp/src/app/@core-xds/services/sdk.service.ts
index f854744..f7e8c2f 100644
--- a/webapp/src/app/@core-xds/services/sdk.service.ts
+++ b/webapp/src/app/@core-xds/services/sdk.service.ts
@@ -103,7 +103,8 @@ export class SdkService {
// TODO: get previous val from xds-config service / cookie
if (this._sdksList.length > 0) {
- this.current = this._sdksList[0];
+ const installedSdks = this._sdksList.filter(sd => sd.status === StatusType.INSTALLED);
+ this.current = installedSdks.length > 0 ? installedSdks[0] : this._sdksList[0];
this.curSdkSubject.next(this.current);
}
diff --git a/webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts b/webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts
index a9eafe7..64de039 100644
--- a/webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts
+++ b/webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts
@@ -25,19 +25,15 @@ import { ISdk, SdkService, StatusType } from '../../../@core-xds/services/sdk.se
template: `
<div class="form-group">
<label>SDK</label>
- <select class="form-control">
- <option *ngFor="let sdk of sdks" (click)="select(sdk)">{{sdk.name}}</option>
+ <select class="form-control" [(ngModel)]="curSdk" (click)="select()">
+ <option *ngFor="let sdk of sdks" [ngValue]="sdk">{{sdk.name}}</option>
</select>
</div>
`,
})
export class SdkSelectDropdownComponent implements OnInit {
- // FIXME investigate to understand why not working with sdks as input
- // <xds-sdk-select-dropdown [sdks]="(sdks$ | async)"></xds-sdk-select-dropdown>
- // @Input() sdks: ISdk[];
sdks: ISdk[];
-
curSdk: ISdk;
constructor(private sdkSvr: SdkService) { }
@@ -50,13 +46,16 @@ export class SdkSelectDropdownComponent implements OnInit {
this.sdks = s.filter(ss => ss.status === StatusType.INSTALLED);
if (this.curSdk === null || s.indexOf(this.curSdk) === -1) {
this.sdkSvr.setCurrent(this.curSdk = this.sdks.length ? this.sdks[0] : null);
+ this.curSdk = this.sdkSvr.getCurrent();
}
}
});
}
select(s) {
- this.sdkSvr.setCurrent(this.curSdk = s);
+ if (this.curSdk) {
+ this.sdkSvr.setCurrent(this.curSdk);
+ }
}
}