X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=webapp%2Fsrc%2Fapp%2Fpages%2Fbuild%2Fsettings%2Fsdk-select-dropdown.component.ts;h=47d0900c5633158d9483237645814816aa7a1a3e;hb=135754a4b3ca915f717e79d8f3f4eb29c04195b3;hp=22ac29dcc7ff9388459e8612c8c618bdeaf82238;hpb=a2cc38902ff7528870822110c4f04329a3918564;p=src%2Fxds%2Fxds-agent.git
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..47d0900 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,45 +18,45 @@
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: `
-
`,
})
export class SdkSelectDropdownComponent implements OnInit {
- // FIXME investigate to understand why not working with sdks as input
- //
- // @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);
+ 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);
+ this.curSdk = this.sdkSvr.getCurrent();
+ }
+ }
+ });
+ }
+
+ select() {
+ if (this.curSdk) {
+ this.sdkSvr.setCurrent(this.curSdk);
}
+ }
}