From f11e78dacb3bbf45988a5002bed3bf8e7f97d043 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Mon, 17 Apr 2017 15:36:47 +0000
Subject: [PATCH] #3529 fix - Fixed cancel an delete commands on licenses

---
 /dev/null                                                         |  337 ------------------------------------------
 securis/src/main/webapp/src/app/common/utils.ts                   |   35 ++--
 securis/src/main/webapp/src/app/resources/licenses.ts             |   16 +
 securis/src/main/java/net/curisit/securis/GzipFilter.java         |    6 
 securis/src/main/webapp/src/app/resources/base.ts                 |    6 
 securis/src/main/webapp/src/app/listing/license.list.component.ts |   37 +++-
 securis/src/main/webapp/src/app/forms/pack.form.component.ts      |    2 
 securis/src/main/webapp/src/app/forms/license.form.component.ts   |   35 +++
 securis/src/main/webapp/src/app/listing/pack.list.component.ts    |    2 
 9 files changed, 91 insertions(+), 385 deletions(-)

diff --git a/securis/src/main/java/net/curisit/securis/GzipFilter.java b/securis/src/main/java/net/curisit/securis/GzipFilter.java
index cf0a51a..6e448d9 100644
--- a/securis/src/main/java/net/curisit/securis/GzipFilter.java
+++ b/securis/src/main/java/net/curisit/securis/GzipFilter.java
@@ -10,7 +10,6 @@
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.annotation.WebFilter;
-import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.logging.log4j.LogManager;
@@ -20,6 +19,7 @@
 @WebFilter(urlPatterns = "*.gz")
 public class GzipFilter implements Filter {
 
+	@SuppressWarnings("unused")
 	private static final Logger LOG = LogManager.getLogger(GzipFilter.class);
 
 	@Override
@@ -28,10 +28,10 @@
 
 	@Override
 	public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain fc) throws IOException, ServletException {
-		HttpServletRequest req = (HttpServletRequest) sreq;
+		//HttpServletRequest req = (HttpServletRequest) sreq;
 		HttpServletResponse res = (HttpServletResponse) sres;
 		res.addHeader("Content-Encoding", "gzip");
-		LOG.info("Content served as gzip: {}", req.getRequestURI());
+		// LOG.info("Content served as gzip: {}", req.getRequestURI());
 		fc.doFilter(sreq, sres);
 	}
 
diff --git a/securis/src/main/webapp/jspm.config.OK.js b/securis/src/main/webapp/jspm.config.OK.js
deleted file mode 100644
index 059029b..0000000
--- a/securis/src/main/webapp/jspm.config.OK.js
+++ /dev/null
@@ -1,337 +0,0 @@
-SystemJS.config({
-  nodeConfig: {
-    "paths": {
-      "github:": "jspm_packages/github/",
-      "npm:": "jspm_packages/npm/",
-      "app/": "src/app/"
-    }
-  },
-  devConfig: {
-    "map": {
-      "plugin-typescript": "github:frankwallis/plugin-typescript@7.0.6",
-      "typescript": "npm:typescript@2.2.2",
-      "child_process": "npm:jspm-nodelibs-child_process@0.2.1",
-      "module": "npm:jspm-nodelibs-module@0.2.1",
-      "net": "npm:jspm-nodelibs-net@0.2.1"
-    },
-    "packages": {
-      "npm:source-map-support@0.4.14": {
-        "map": {
-          "source-map": "npm:source-map@0.5.6"
-        }
-      },
-      "npm:typescript@2.2.2": {
-        "map": {
-          "source-map-support": "npm:source-map-support@0.4.14"
-        }
-      }
-    }
-  },
-  packages: {
-    'environments': {
-      defaultExtension: 'js'
-    },
-    'app': {
-      defaultExtension: 'js'
-    },
-    'main': {
-      main: 'main.js',
-      defaultExtension: 'js'
-    }
-  },
-  map: {
-    "@angular/animations/browser": "npm:@angular/animations@4.0.2/bundles/animations-browser.umd.min.js",
-    "@angular/platform-browser/animations": "npm:@angular/platform-browser@4.0.2/bundles/platform-browser-animations.umd.min.js",
-    'main': 'src',
-    'app': 'src/app'
-  }
-});
-
-SystemJS.config({
-  packageConfigPaths: [
-    "github:*/*.json",
-    "npm:@*/*.json",
-    "npm:*.json"
-  ],
-  map: {
-    "@angular/animations": "npm:@angular/animations@4.0.2",
-    "@angular/common": "npm:@angular/common@4.0.2",
-    "@angular/compiler": "npm:@angular/compiler@4.0.2",
-    "@angular/core": "npm:@angular/core@4.0.2",
-    "@angular/forms": "npm:@angular/forms@4.0.2",
-    "@angular/http": "npm:@angular/http@4.0.2",
-    "@angular/material": "npm:@angular/material@2.0.0-beta.3",
-    "@angular/platform-browser": "npm:@angular/platform-browser@4.0.2",
-    "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@4.0.2",
-    "@angular/router": "npm:@angular/router@4.0.2",
-    "@covalent/core": "npm:@covalent/core@1.0.0-beta.3-1",
-    "@covalent/dynamic-forms": "npm:@covalent/dynamic-forms@1.0.0-beta.3-1",
-    "@covalent/http": "npm:@covalent/http@1.0.0-beta.3-1",
-    "angular-in-memory-web-api": "npm:angular-in-memory-web-api@0.3.1",
-    "angular-safeguard": "npm:angular-safeguard@1.0.1",
-    "assert": "npm:jspm-nodelibs-assert@0.2.1",
-    "buffer": "npm:jspm-nodelibs-buffer@0.2.2",
-    "constants": "npm:jspm-nodelibs-constants@0.2.1",
-    "core-js": "npm:core-js@2.4.1",
-    "crypto": "npm:jspm-nodelibs-crypto@0.2.1",
-    "events": "npm:jspm-nodelibs-events@0.2.2",
-    "file-saver": "npm:file-saver@1.3.3",
-    "fs": "npm:jspm-nodelibs-fs@0.2.1",
-    "hammerjs": "npm:hammerjs@2.0.8",
-    "ng2-toastr": "npm:ng2-toastr@4.0.1",
-    "os": "npm:jspm-nodelibs-os@0.2.1",
-    "path": "npm:jspm-nodelibs-path@0.2.3",
-    "process": "npm:jspm-nodelibs-process@0.2.1",
-    "rxjs": "npm:rxjs@5.3.0",
-    "stream": "npm:jspm-nodelibs-stream@0.2.1",
-    "string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.1",
-    "timers": "npm:jspm-nodelibs-timers@0.2.1",
-    "util": "npm:jspm-nodelibs-util@0.2.2",
-    "vm": "npm:jspm-nodelibs-vm@0.2.1",
-    "web-animations-js": "npm:web-animations-js@2.2.2",
-    "zone.js": "npm:zone.js@0.8.5"
-  },
-  packages: {
-    "npm:jspm-nodelibs-buffer@0.2.2": {
-      "map": {
-        "buffer": "npm:buffer@4.9.1"
-      }
-    },
-    "npm:buffer@4.9.1": {
-      "map": {
-        "isarray": "npm:isarray@1.0.0",
-        "ieee754": "npm:ieee754@1.1.8",
-        "base64-js": "npm:base64-js@1.2.0"
-      }
-    },
-    "npm:jspm-nodelibs-os@0.2.1": {
-      "map": {
-        "os-browserify": "npm:os-browserify@0.2.1"
-      }
-    },
-    "npm:jspm-nodelibs-crypto@0.2.1": {
-      "map": {
-        "crypto-browserify": "npm:crypto-browserify@3.11.0"
-      }
-    },
-    "npm:crypto-browserify@3.11.0": {
-      "map": {
-        "browserify-cipher": "npm:browserify-cipher@1.0.0",
-        "create-hash": "npm:create-hash@1.1.2",
-        "create-ecdh": "npm:create-ecdh@4.0.0",
-        "diffie-hellman": "npm:diffie-hellman@5.0.2",
-        "browserify-sign": "npm:browserify-sign@4.0.4",
-        "randombytes": "npm:randombytes@2.0.3",
-        "inherits": "npm:inherits@2.0.3",
-        "create-hmac": "npm:create-hmac@1.1.4",
-        "pbkdf2": "npm:pbkdf2@3.0.9",
-        "public-encrypt": "npm:public-encrypt@4.0.0"
-      }
-    },
-    "npm:browserify-sign@4.0.4": {
-      "map": {
-        "create-hash": "npm:create-hash@1.1.2",
-        "inherits": "npm:inherits@2.0.3",
-        "create-hmac": "npm:create-hmac@1.1.4",
-        "bn.js": "npm:bn.js@4.11.6",
-        "elliptic": "npm:elliptic@6.4.0",
-        "parse-asn1": "npm:parse-asn1@5.1.0",
-        "browserify-rsa": "npm:browserify-rsa@4.0.1"
-      }
-    },
-    "npm:create-hash@1.1.2": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3",
-        "sha.js": "npm:sha.js@2.4.8",
-        "cipher-base": "npm:cipher-base@1.0.3",
-        "ripemd160": "npm:ripemd160@1.0.1"
-      }
-    },
-    "npm:diffie-hellman@5.0.2": {
-      "map": {
-        "randombytes": "npm:randombytes@2.0.3",
-        "bn.js": "npm:bn.js@4.11.6",
-        "miller-rabin": "npm:miller-rabin@4.0.0"
-      }
-    },
-    "npm:browserify-cipher@1.0.0": {
-      "map": {
-        "browserify-des": "npm:browserify-des@1.0.0",
-        "browserify-aes": "npm:browserify-aes@1.0.6",
-        "evp_bytestokey": "npm:evp_bytestokey@1.0.0"
-      }
-    },
-    "npm:browserify-des@1.0.0": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3",
-        "des.js": "npm:des.js@1.0.0",
-        "cipher-base": "npm:cipher-base@1.0.3"
-      }
-    },
-    "npm:create-hmac@1.1.4": {
-      "map": {
-        "create-hash": "npm:create-hash@1.1.2",
-        "inherits": "npm:inherits@2.0.3"
-      }
-    },
-    "npm:browserify-aes@1.0.6": {
-      "map": {
-        "create-hash": "npm:create-hash@1.1.2",
-        "inherits": "npm:inherits@2.0.3",
-        "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
-        "cipher-base": "npm:cipher-base@1.0.3",
-        "buffer-xor": "npm:buffer-xor@1.0.3"
-      }
-    },
-    "npm:pbkdf2@3.0.9": {
-      "map": {
-        "create-hmac": "npm:create-hmac@1.1.4"
-      }
-    },
-    "npm:evp_bytestokey@1.0.0": {
-      "map": {
-        "create-hash": "npm:create-hash@1.1.2"
-      }
-    },
-    "npm:create-ecdh@4.0.0": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "elliptic": "npm:elliptic@6.4.0"
-      }
-    },
-    "npm:des.js@1.0.0": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3",
-        "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
-      }
-    },
-    "npm:sha.js@2.4.8": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3"
-      }
-    },
-    "npm:cipher-base@1.0.3": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3"
-      }
-    },
-    "npm:parse-asn1@5.1.0": {
-      "map": {
-        "browserify-aes": "npm:browserify-aes@1.0.6",
-        "create-hash": "npm:create-hash@1.1.2",
-        "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
-        "pbkdf2": "npm:pbkdf2@3.0.9",
-        "asn1.js": "npm:asn1.js@4.9.1"
-      }
-    },
-    "npm:elliptic@6.4.0": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "inherits": "npm:inherits@2.0.3",
-        "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
-        "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1",
-        "brorand": "npm:brorand@1.1.0",
-        "hash.js": "npm:hash.js@1.0.3",
-        "hmac-drbg": "npm:hmac-drbg@1.0.1"
-      }
-    },
-    "npm:jspm-nodelibs-stream@0.2.1": {
-      "map": {
-        "stream-browserify": "npm:stream-browserify@2.0.1"
-      }
-    },
-    "npm:asn1.js@4.9.1": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "inherits": "npm:inherits@2.0.3",
-        "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
-      }
-    },
-    "npm:browserify-rsa@4.0.1": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "randombytes": "npm:randombytes@2.0.3"
-      }
-    },
-    "npm:stream-browserify@2.0.1": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3",
-        "readable-stream": "npm:readable-stream@2.2.9"
-      }
-    },
-    "npm:hash.js@1.0.3": {
-      "map": {
-        "inherits": "npm:inherits@2.0.3"
-      }
-    },
-    "npm:jspm-nodelibs-string_decoder@0.2.1": {
-      "map": {
-        "string_decoder": "npm:string_decoder@0.10.31"
-      }
-    },
-    "npm:readable-stream@2.2.9": {
-      "map": {
-        "string_decoder": "npm:string_decoder@1.0.0",
-        "isarray": "npm:isarray@1.0.0",
-        "inherits": "npm:inherits@2.0.3",
-        "buffer-shims": "npm:buffer-shims@1.0.0",
-        "process-nextick-args": "npm:process-nextick-args@1.0.7",
-        "util-deprecate": "npm:util-deprecate@1.0.2",
-        "core-util-is": "npm:core-util-is@1.0.2"
-      }
-    },
-    "npm:hmac-drbg@1.0.1": {
-      "map": {
-        "hash.js": "npm:hash.js@1.0.3",
-        "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
-        "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1"
-      }
-    },
-    "npm:string_decoder@1.0.0": {
-      "map": {
-        "buffer-shims": "npm:buffer-shims@1.0.0"
-      }
-    },
-    "npm:miller-rabin@4.0.0": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "brorand": "npm:brorand@1.1.0"
-      }
-    },
-    "npm:public-encrypt@4.0.0": {
-      "map": {
-        "bn.js": "npm:bn.js@4.11.6",
-        "browserify-rsa": "npm:browserify-rsa@4.0.1",
-        "create-hash": "npm:create-hash@1.1.2",
-        "parse-asn1": "npm:parse-asn1@5.1.0",
-        "randombytes": "npm:randombytes@2.0.3"
-      }
-    },
-    "npm:rxjs@5.3.0": {
-      "map": {
-        "symbol-observable": "npm:symbol-observable@1.0.4"
-      }
-    },
-    "npm:jspm-nodelibs-timers@0.2.1": {
-      "map": {
-        "timers-browserify": "npm:timers-browserify@1.4.2"
-      }
-    },
-    "npm:timers-browserify@1.4.2": {
-      "map": {
-        "process": "npm:process@0.11.9"
-      }
-    },
-    "npm:@covalent/core@1.0.0-beta.3-1": {
-      "map": {
-        "@angular/flex-layout": "npm:@angular/flex-layout@2.0.0-beta.7",
-        "@angular/material": "npm:@angular/material@2.0.0-beta.3"
-      }
-    },
-    "npm:@covalent/dynamic-forms@1.0.0-beta.3-1": {
-      "map": {
-        "@covalent/core": "npm:@covalent/core@1.0.0-beta.3-1"
-      }
-    }
-  }
-});
diff --git a/securis/src/main/webapp/src/app/common/utils.ts b/securis/src/main/webapp/src/app/common/utils.ts
index 25ce5d9..b60a4e4 100644
--- a/securis/src/main/webapp/src/app/common/utils.ts
+++ b/securis/src/main/webapp/src/app/common/utils.ts
@@ -1,6 +1,6 @@
 
 import { Component, Injectable, Input } from '@angular/core';
-import {LocaleService} from './i18n';
+import { LocaleService } from './i18n';
 import { Observable } from 'rxjs/Observable';
 
 
@@ -40,26 +40,23 @@
 @Injectable()
 export class BasicService {
 
-	constructor(protected $L: LocaleService) {}
+	constructor(protected $L: LocaleService) { }
 
-	public processErrorResponse(errorResponse: Response | any) {
-      // In a real world app, we might use a remote logging infrastructure
-      var error: IError = <IError>{};
-      if (errorResponse instanceof Response) {
+	public processErrorResponse(errorResponse: Response) {
+		// In a real world app, we might use a remote logging infrastructure
+		var error: IError = <IError>{};
 		error.httpCode = errorResponse.status;
-      }
+		error.code = errorResponse.headers.get(ERROR_CODE_MESSAGE_HEADER) || error.httpCode;
 
-	  error.code = errorResponse.headers.get(ERROR_CODE_MESSAGE_HEADER) || error.httpCode;
+		if (errorResponse.status === 403 /* forbidden */ || errorResponse.status === 401 /* unauthorized */) {
+			error.message = this.$L.get('Invalid credentials');
+			error.code = ErrorCodes.INVALID_CREDENTIALS;
+		} else if (errorResponse.status === 418 /* Teapot */) {
+			error.message = errorResponse.headers.get(ERROR_MESSAGE_HEADER) || errorResponse.statusText || this.$L.get('Unknown');
+		} else {
+			error.message = this.$L.get(`Unexpected error HTTP (${error.httpCode}) accessing to server. Contact with the administrator.`);
+		}
 
-      if (errorResponse.status === 403 /* forbidden */ || errorResponse.status === 401 /* unauthorized */) {
-        error.message = this.$L.get('Invalid credentials');
-		error.code = ErrorCodes.INVALID_CREDENTIALS;
-      } else if (errorResponse.status === 418 /* Teapot */) {
-        error.message = errorResponse.headers.get(ERROR_MESSAGE_HEADER) || errorResponse.statusText || this.$L.get('Unknown');
-      } else {
-        error.message = this.$L.get(`Unexpected error HTTP (${error.httpCode}) accessing to server. Contact with the administrator.`);
-      }
-
-      return Observable.throw(error);
-    }
+		return Observable.throw(error);
+	}
 }
\ No newline at end of file
diff --git a/securis/src/main/webapp/src/app/forms/license.form.component.ts b/securis/src/main/webapp/src/app/forms/license.form.component.ts
index 2f3c71b..ee052b9 100644
--- a/securis/src/main/webapp/src/app/forms/license.form.component.ts
+++ b/securis/src/main/webapp/src/app/forms/license.form.component.ts
@@ -53,15 +53,36 @@
 
 
   licenseAction(action: string) {
-    return this.licenses[action](this.data.id).subscribe(
-      (actionResponse : any) => {
-        this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
-        this.init();
-      },
-      (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
-    );
+    if (action === 'cancel') {      
+      this.dialogs.openPrompt({
+        message: this.$L.get('Please, specify the reason to cancel the current license'),
+        title: this.$L.get('License cancelation'), //OPTIONAL, hides if not provided
+        value: '', 
+        cancelButton: this.$L.get('Close'), 
+        acceptButton: this.$L.get('Cancel license'), //OPTIONAL, defaults to 'ACCEPT'
+      }).afterClosed().subscribe((reason: string) => {
+        if (reason) {
+          this.licenses.cancel(this.data.id, reason).subscribe(
+            (actionResponse : any) => {
+              this.toaster.success(this.$L.get('License cancelled sucessfully'));
+              this.init();
+            },
+            (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
+          );
+        }
+      });
+    } else {
+      return this.licenses[action](this.data.id).subscribe(
+        (actionResponse : any) => {
+          this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
+          this.init();
+        },
+        (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
+      );
+    }
   }
 
+
   
   canBeDeleted() : boolean {
     return !this.isNew && this.licenses.isActionAvailable('delete', this.data);
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 de8295c..866e81f 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
@@ -71,7 +71,7 @@
         this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
         this.init();
       },
-      (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
+      (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
     );
   }
 
diff --git a/securis/src/main/webapp/src/app/listing/license.list.component.ts b/securis/src/main/webapp/src/app/listing/license.list.component.ts
index 14a6050..c184d64 100644
--- a/securis/src/main/webapp/src/app/listing/license.list.component.ts
+++ b/securis/src/main/webapp/src/app/listing/license.list.component.ts
@@ -1,6 +1,6 @@
 import { ActivatedRoute, Router } from '@angular/router';
 import { MdDialog, MdDialogConfig } from '@angular/material';
-import { TdDataTableService, TdPagingBarComponent, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
+import { TdDialogService, TdDataTableService, TdPagingBarComponent, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
 import { IPageChangeEvent } from '@covalent/core';
 import { Component, AfterViewInit, ViewChild } from '@angular/core';
 import { TdMediaService } from '@covalent/core';
@@ -48,13 +48,33 @@
   license_menu_options = LICENSE_ACTIONS;
   
   licenseAction(action: string, license: any) {
-    return this.licenses[action](license.id).subscribe(
-      (actionResponse : any) => {
-        this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
-        this.reload(this.pack.id);
-      },
-      (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
-    );
+    if (action === 'cancel') {      
+      this.dialogs.openPrompt({
+        message: this.$L.get('Please, specify the reason to cancel the current license'),
+        title: this.$L.get('License cancelation'), //OPTIONAL, hides if not provided
+        value: '', 
+        cancelButton: this.$L.get('Close'), 
+        acceptButton: this.$L.get('Cancel license'), //OPTIONAL, defaults to 'ACCEPT'
+      }).afterClosed().subscribe((reason: string) => {
+        if (reason) {
+          this.licenses.cancel(license.id, reason).subscribe(
+            (actionResponse : any) => {
+              this.toaster.success(this.$L.get('License cancelled sucessfully'));
+              this.reload(this.pack.id);
+            },
+            (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
+          );
+        }
+      });
+    } else {
+      return this.licenses[action](license.id).subscribe(
+        (actionResponse : any) => {
+          this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
+          this.reload(this.pack.id);
+        },
+        (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
+      );
+    }
   }
 
   reload(packId: number) : void  {
@@ -73,6 +93,7 @@
 
   constructor( _dataTableService: TdDataTableService,
     private media: TdMediaService,
+    private dialogs: TdDialogService,
     private $L: LocaleService,
     private router: Router,
     private location: Location,
diff --git a/securis/src/main/webapp/src/app/listing/pack.list.component.ts b/securis/src/main/webapp/src/app/listing/pack.list.component.ts
index 42927b1..9fcef79 100644
--- a/securis/src/main/webapp/src/app/listing/pack.list.component.ts
+++ b/securis/src/main/webapp/src/app/listing/pack.list.component.ts
@@ -92,7 +92,7 @@
         this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
         this.reload();
       },
-      (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
+      (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
     );
   }
 
diff --git a/securis/src/main/webapp/src/app/resources/base.ts b/securis/src/main/webapp/src/app/resources/base.ts
index c03ed59..352b641 100644
--- a/securis/src/main/webapp/src/app/resources/base.ts
+++ b/securis/src/main/webapp/src/app/resources/base.ts
@@ -37,11 +37,9 @@
       return this.http.delete(url).map(response => response.json()).catch(err => super.processErrorResponse(err));
     }
     
-    public action(id: any, action: string, method = 'POST') : Observable<any> {
+    public action(id: any, action: string, method = 'POST', params : any = {}) : Observable<any> {
       let url = `${this.resource}/${id}/${action}`;
-      var params = {
-        action: action
-      }
+      params.action = action;
       var options:RequestOptionsArgs = {
         url: url,
         method: method,
diff --git a/securis/src/main/webapp/src/app/resources/licenses.ts b/securis/src/main/webapp/src/app/resources/licenses.ts
index c15580d..bb51ddd 100644
--- a/securis/src/main/webapp/src/app/resources/licenses.ts
+++ b/securis/src/main/webapp/src/app/resources/licenses.ts
@@ -3,9 +3,7 @@
 import { Injectable } from '@angular/core';
 import { Http, RequestOptions, ResponseContentType, Response } from '@angular/http';
 import { SeCurisResourceServices } from './base';
-import "file-saver";
-
-declare var saveAs: FileSaver;
+import { saveAs } from "file-saver";
 
 export const LIC_STATUS = {
 	CREATED: 'CR',
@@ -71,6 +69,10 @@
     command: 'cancel',
     icon: 'cancel',
     name: 'Cancel'
+  },{
+    command: 'delete',
+    icon: 'delete',
+    name: 'Delete'
   }]
 
 
@@ -102,8 +104,12 @@
 		return super.action(id, "send");
 	}
 
-	public cancel(id: number) {
-		return super.action(id, "cancel");
+	public cancel(id: number, reason: string) {
+		return super.action(id, "cancel", 'POST', {reason: reason});
+	}
+
+	public delete(id: number) {
+		return super.remove(id);
 	}
 
 	public download(id: number) {

--
Gitblit v1.3.2