aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-09 18:35:15 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2018-01-09 18:35:15 +0100
commit650cedf181cd8dd8aa36e30999faf2b510090cbd (patch)
tree3b4ad90712f6e3a02a26392b7958a21967fbb31c
parentbe9424dca51112fa4ba3aaa8e1047d58676f10f4 (diff)
Fixed listed sdk in build panel (only installed sdks)v1.0.1
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r--webapp/src/app/pages/build/settings/sdk-select-dropdown.component.ts55
1 files changed, 28 insertions, 27 deletions
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 22ac29d..a9eafe7 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
@@ -18,11 +18,11 @@
import { Component, OnInit, Input } from '@angular/core';
-import { ISdk, SdkService } from '../../../@core-xds/services/sdk.service';
+import { ISdk, SdkService, StatusType } from '../../../@core-xds/services/sdk.service';
@Component({
- selector: 'xds-sdk-select-dropdown',
- template: `
+ selector: 'xds-sdk-select-dropdown',
+ template: `
<div class="form-group">
<label>SDK</label>
<select class="form-control">
@@ -33,30 +33,31 @@ import { ISdk, SdkService } from '../../../@core-xds/services/sdk.service';
})
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) { }
-
- ngOnInit() {
- this.curSdk = this.sdkSvr.getCurrent();
- this.sdkSvr.Sdks$.subscribe((s) => {
- if (s) {
- this.sdks = s;
- if (this.curSdk === null || s.indexOf(this.curSdk) === -1) {
- this.sdkSvr.setCurrent(this.curSdk = s.length ? s[0] : null);
- }
- }
- });
- }
-
- select(s) {
- this.sdkSvr.setCurrent(this.curSdk = s);
- }
+ // 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) { }
+
+ ngOnInit() {
+ this.curSdk = this.sdkSvr.getCurrent();
+ this.sdkSvr.Sdks$.subscribe((s) => {
+ if (s) {
+ // Only list installed SDKs
+ 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);
+ }
+ }
+ });
+ }
+
+ select(s) {
+ this.sdkSvr.setCurrent(this.curSdk = s);
+ }
}