Closed SDK modal install window on early error.
[src/xds/xds-agent.git] / webapp / src / app / pages / sdks / sdk-management / sdk-management.component.ts
index 68620a1..6e9b81b 100644 (file)
@@ -1,6 +1,6 @@
 /**
 * @license
-* Copyright (C) 2017 "IoT.bzh"
+* Copyright (C) 2017-2018 "IoT.bzh"
 * Author Sebastien Douheret <sebastien@iot.bzh>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
@@ -141,15 +141,20 @@ export class SdkManagementComponent implements OnInit {
 
       modal.result.then(res => {
         if (res === 'yes') {
-          // Request installation
-          this.sdkSvr.install(sdk).subscribe(r => { }, err => this.alert.error(err));
-
           const modalInstall = this.modalService.open(SdkInstallComponent, {
             size: 'lg',
             backdrop: 'static',
             container: 'nb-layout',
           });
           modalInstall.componentInstance.sdk = sdk;
+
+          // Request installation
+          this.sdkSvr.install(sdk).subscribe(
+            r => { },
+            err => {
+              modalInstall.dismiss('SDK install failure');
+              this.alert.error(err);
+            });
         }
       });