summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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);
+ }
}