Fix ssh command when execited with a wget pipe
[src/xds/xds-server.git] / webapp / src / app / sdks / sdkSelectDropdown.component.ts
index 5122cd2..a2fe37a 100644 (file)
@@ -1,6 +1,6 @@
 import { Component, Input } from "@angular/core";
 
-import { ISdk, SdkService } from "../common/sdk.service";
+import { ISdk, SdkService } from "../services/sdk.service";
 
 @Component({
     selector: 'sdk-select-dropdown',
@@ -29,15 +29,19 @@ export class SdkSelectDropdownComponent {
     constructor(private sdkSvr: SdkService) { }
 
     ngOnInit() {
+        this.curSdk = this.sdkSvr.getCurrent();
         this.sdkSvr.Sdks$.subscribe((s) => {
-            this.sdks = s;
-            this.curSdk = this.sdks.length ? this.sdks[0] : null;
-            this.sdkSvr.setCurrent(this.curSdk);
+            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);
+        this.sdkSvr.setCurrent(this.curSdk = s);
     }
 }