Fixing vTR dashboard

Change-Id: I4183b2303708484288eebc8f32e319f0d9b07a42
diff --git a/.gitignore b/.gitignore
index a016a1e..e9377cc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,5 @@
 xos/gui/node_modules/
 xos/gui/.tmp/
 xos/gui/typings/
+xos/gui/dist/
 npm-debug.log
diff --git a/xos/gui/conf/webpack-dist.conf.js b/xos/gui/conf/webpack-dist.conf.js
index 36fbd97..7dfebfa 100755
--- a/xos/gui/conf/webpack-dist.conf.js
+++ b/xos/gui/conf/webpack-dist.conf.js
@@ -105,7 +105,10 @@
       '.web.js',
       '.js',
       '.ts'
-    ]
+    ],
+    alias: {
+      "ngprogress": path.resolve(__dirname, '../node_modules/ngprogress/build/ngProgress.js')
+    }
   },
   entry: {
     app: `./${conf.path.src('index')}`,
diff --git a/xos/gui/package.json b/xos/gui/package.json
index 00b888b..69ce745 100644
--- a/xos/gui/package.json
+++ b/xos/gui/package.json
@@ -115,4 +115,4 @@
       "xo-space/esnext"
     ]
   }
-}
\ No newline at end of file
+}
diff --git a/xos/gui/src/app/components/vtr/vtr-dashboard.ts b/xos/gui/src/app/components/vtr/vtr-dashboard.ts
index 5cec27b..eb8abec 100644
--- a/xos/gui/src/app/components/vtr/vtr-dashboard.ts
+++ b/xos/gui/src/app/components/vtr/vtr-dashboard.ts
@@ -30,7 +30,8 @@
   public truckroll: any;
   public loader: boolean;
   public error: string;
-  private tenants = [];
+
+  private services = [];
   private Truckroll;
 
   constructor(
@@ -45,15 +46,14 @@
     this.XosModelStore.query('CordSubscriberRoot', '/volt/cordsubscriberroots')
       .subscribe(
         res => {
-          console.log(res);
           this.subscribers = res;
         }
       );
 
-    this.XosModelStore.query('Tenant')
+    this.XosModelStore.query('VTRService')
       .subscribe(
         res => {
-          this.tenants = res;
+          this.services = res;
         }
       );
   }
@@ -69,8 +69,7 @@
     delete this.error;
 
     this.truckroll.target_type = this.getSubscriberContentTypeId(this.truckroll.target_id);
-    
-    this.truckroll.subscriber_tenant_id = this.getVsgTenantForSubscriber(this.truckroll.target_id);
+    this.truckroll.owner_id = this.getServiceInstanceOwnerId();
 
     console.log(this.truckroll);
 
@@ -82,16 +81,14 @@
     });
   };
 
-  private getVsgTenantForSubscriber(subscriberId: number): number {
-    const voltTenant = _.find(this.tenants, {subscriber_root_id: subscriberId});
-    const vsgTenant = _.find(this.tenants, {subscriber_tenant_id: voltTenant.id});
-    return vsgTenant.id;
-  }
-
   private getSubscriberContentTypeId(subscriberId: number) {
     return _.find(this.subscribers, {id: subscriberId}).self_content_type_id;
   }
 
+  private getServiceInstanceOwnerId(): number {
+    return this.services[0].id;
+  }
+
   private waitForTest(id: number) {
 
         this.Truckroll.get({id: id}).$promise
@@ -107,13 +104,14 @@
           // or
           // if is synced
           if (
-              testResult.backend_status.indexOf('2') >= 0 ||
-              testResult.backend_status.indexOf('1') >= 0 ||
+              testResult.backend_code == 2 ||
+              testResult.backend_code == 1 ||
+              angular.isDefined(testResult.result) ||
               testResult.is_synced
             ) {
             this.truckroll = angular.copy(testResult);
             this.loader = false;
-            // this.Truckroll.delete({id: id});
+            this.Truckroll.delete({id: id});
           }
           // else keep polling
           else {