From 60c65f2110f65221bc3a71b2887667e78c53c53e Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Wed, 22 Mar 2017 17:44:16 +0000
Subject: [PATCH] #3527 fix - Added pack/license actions and a lot of bugfixing

---
 securis/src/main/webapp/src/app/forms/pack.form.component.ts |   24 ++++++++++++++++++++----
 1 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/securis/src/main/webapp/src/app/forms/pack.form.component.ts b/securis/src/main/webapp/src/app/forms/pack.form.component.ts
index 0ac5044..9b7c195 100644
--- a/securis/src/main/webapp/src/app/forms/pack.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/pack.form.component.ts
@@ -1,7 +1,7 @@
 import { Http } from '@angular/http';
 import { ToastsManager } from 'ng2-toastr/ng2-toastr';
 
-import { PacksService, PACK_STATUS } from '../resources/packs';
+import { PacksService, PACK_STATUS, PACK_ACTIONS } from '../resources/packs';
 import { LicenseTypesService } from '../resources/license_types';
 import { LocaleService } from '../common/i18n';
 import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
@@ -21,7 +21,7 @@
 
   organizations : IComboOption[];
   licensetypes : IComboOption[];
-  
+  pack_menu_options = PACK_ACTIONS;
   constructor(private http: Http,
               private licenseTypes: LicenseTypesService,
               private packs: PacksService,
@@ -65,11 +65,27 @@
         );
   }
 
+  packAction(action: string) {
+    return this.packs[action](this.data.id).subscribe(
+      (actionResponse : any) => {
+        this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
+        this.reload();
+      },
+      (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
+    );
+  }
+
   changeOrg(event: any) {
-    console.log(event);
     console.log(this.data.organization_id);
   } 
-  
+
+  canBeDeleted(event: any) : boolean{
+    return !this.isNew && this.packs.isActionAvailable('delete', this.data);
+  } 
+
+  convertToEpoch(str: string) : number {
+    return new Date(str).getTime();
+  }
 
   ngAfterViewInit(): void {
     this.init();

--
Gitblit v1.3.2