use XappMgrService to replace Catalog and Control
[portal/ric-dashboard.git] / webapp-frontend / src / app / catalog / catalog.component.ts
index f0fcbce..fd28f0a 100644 (file)
  * limitations under the License.
  * ========================LICENSE_END===================================
  */
-import { Component, Inject } from '@angular/core';
+import { Component, OnInit } from '@angular/core';
 import { LocalDataSource } from 'ng2-smart-table';
-import { CatalogService } from '../services/catalog/catalog.service';
+import { XappMgrService } from '../services/xapp-mgr/xapp-mgr.service';
 import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'
 import { NotificationService } from './../services/ui/notification.service'
+import { XMXapp } from '../interfaces/xapp-mgr.types';
 
 @Component({
   selector: 'app-catalog',
   templateUrl: './catalog.component.html',
   styleUrls: ['./catalog.component.css']
 })
-export class CatalogComponent {
+export class CatalogComponent implements OnInit{
 
   settings = {
     hideSubHeader: true,
@@ -62,17 +63,19 @@ export class CatalogComponent {
   source: LocalDataSource = new LocalDataSource();
 
   constructor(
-    private service: CatalogService,
+    private xappMgrSvc: XappMgrService,
     private confirmDialogService: ConfirmDialogService,
-    private notification: NotificationService) {
-    this.service.getAll().subscribe((val: any[]) => this.source.load(val));
+    private notification: NotificationService) { }
+
+  ngOnInit() {
+    this.xappMgrSvc.getAll().subscribe((xapps: XMXapp[]) => this.source.load(xapps));
   }
 
   onDeployxApp(event): void {
     this.confirmDialogService.openConfirmDialog('Are you sure you want to deploy this xApp?')
       .afterClosed().subscribe(res => {
         if (res) {
-          this.service.deployXapp(event.data.name).subscribe(
+          this.xappMgrSvc.deployXapp(event.data.name).subscribe(
             response => {
               switch (response.status) {
                 case 200: