Fix Bug 2291: No option to update VIM Account in NG-UI
[osm/NG-UI.git] / src / app / utilities / vim-accounts-action / VimAccountsActionComponent.ts
index 57f1f64..14862eb 100644 (file)
@@ -24,8 +24,9 @@ import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
 import { MODALCLOSERESPONSEDATA } from 'CommonModel';
 import { DeleteComponent } from 'DeleteComponent';
 import { NSInstanceDetails } from 'NSInstanceModel';
+import { ResourcesOverviewComponent } from 'ResourcesOverviewComponent';
 import { SharedService } from 'SharedService';
-import { VIMData } from 'VimAccountModel';
+import { VimAccountDetails, VIMData } from 'VimAccountModel';
 
 /**
  * Creating component
@@ -45,7 +46,7 @@ export class VimAccountsActionComponent implements OnInit {
     public injector: Injector;
 
     /** To show Instances running @public */
-    public showMapIcon: boolean =  false;
+    public showMapIcon: boolean = false;
 
     /** To show Details Instances running @public */
     public showInstanceDetails: {}[];
@@ -75,12 +76,15 @@ export class VimAccountsActionComponent implements OnInit {
 
     /** Delete VIM Account @public */
     public deleteVIMAccount(): void {
-        const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, {backdrop: 'static'});
+        // eslint-disable-next-line security/detect-non-literal-fs-filename
+        const modalRef: NgbModalRef = this.modalService.open(DeleteComponent, { backdrop: 'static' });
         modalRef.result.then((result: MODALCLOSERESPONSEDATA) => {
             if (result) {
                 this.sharedService.callData();
             }
-        }).catch();
+        }).catch((): void => {
+            // Catch Navigation Error
+        });
     }
 
     /** On navigate to Info VimAccount @public */
@@ -88,7 +92,7 @@ export class VimAccountsActionComponent implements OnInit {
         this.vimID = this.value.identifier;
         this.router.navigate(['/vim/info', this.vimID]).catch(() => {
             // Catch Navigation Error
-          });
+        });
     }
 
     /** To show the Instances Info for the particular VimAccount @public */
@@ -101,4 +105,19 @@ export class VimAccountsActionComponent implements OnInit {
             }
         });
     }
+
+    /** Show VIM Resources Data @public */
+    public showVIMResources(vimDetails: VimAccountDetails): void {
+        // eslint-disable-next-line security/detect-non-literal-fs-filename
+        const modalRef: NgbModalRef = this.modalService.open(ResourcesOverviewComponent, { backdrop: 'static' });
+        modalRef.componentInstance.resourcesData = vimDetails;
+    }
+
+    /** On navigate to edit VimAccount @public */
+    public editVIM(): void {
+        this.vimID = this.value.identifier;
+        this.router.navigate(['/vim/edit', this.vimID]).catch(() => {
+            // Catch Navigation Error
+        });
+    }
 }