rsanchez
2017-04-17 f11e78dacb3bbf45988a5002bed3bf8e7f97d043
#3529 fix - Fixed cancel an delete commands on licenses
1 files deleted
8 files modified
changed files
securis/src/main/java/net/curisit/securis/GzipFilter.java patch | view | blame | history
securis/src/main/webapp/jspm.config.OK.js patch | view | blame | history
securis/src/main/webapp/src/app/common/utils.ts patch | view | blame | history
securis/src/main/webapp/src/app/forms/license.form.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/forms/pack.form.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/listing/license.list.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/listing/pack.list.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/base.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/licenses.ts patch | view | blame | history
securis/src/main/java/net/curisit/securis/GzipFilter.java
....@@ -10,7 +10,6 @@
1010 import javax.servlet.ServletRequest;
1111 import javax.servlet.ServletResponse;
1212 import javax.servlet.annotation.WebFilter;
13
-import javax.servlet.http.HttpServletRequest;
1413 import javax.servlet.http.HttpServletResponse;
1514
1615 import org.apache.logging.log4j.LogManager;
....@@ -20,6 +19,7 @@
2019 @WebFilter(urlPatterns = "*.gz")
2120 public class GzipFilter implements Filter {
2221
22
+ @SuppressWarnings("unused")
2323 private static final Logger LOG = LogManager.getLogger(GzipFilter.class);
2424
2525 @Override
....@@ -28,10 +28,10 @@
2828
2929 @Override
3030 public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain fc) throws IOException, ServletException {
31
- HttpServletRequest req = (HttpServletRequest) sreq;
31
+ //HttpServletRequest req = (HttpServletRequest) sreq;
3232 HttpServletResponse res = (HttpServletResponse) sres;
3333 res.addHeader("Content-Encoding", "gzip");
34
- LOG.info("Content served as gzip: {}", req.getRequestURI());
34
+ // LOG.info("Content served as gzip: {}", req.getRequestURI());
3535 fc.doFilter(sreq, sres);
3636 }
3737
securis/src/main/webapp/jspm.config.OK.js
deleted file mode 100644
....@@ -1,337 +0,0 @@
1
-SystemJS.config({
2
- nodeConfig: {
3
- "paths": {
4
- "github:": "jspm_packages/github/",
5
- "npm:": "jspm_packages/npm/",
6
- "app/": "src/app/"
7
- }
8
- },
9
- devConfig: {
10
- "map": {
11
- "plugin-typescript": "github:frankwallis/plugin-typescript@7.0.6",
12
- "typescript": "npm:typescript@2.2.2",
13
- "child_process": "npm:jspm-nodelibs-child_process@0.2.1",
14
- "module": "npm:jspm-nodelibs-module@0.2.1",
15
- "net": "npm:jspm-nodelibs-net@0.2.1"
16
- },
17
- "packages": {
18
- "npm:source-map-support@0.4.14": {
19
- "map": {
20
- "source-map": "npm:source-map@0.5.6"
21
- }
22
- },
23
- "npm:typescript@2.2.2": {
24
- "map": {
25
- "source-map-support": "npm:source-map-support@0.4.14"
26
- }
27
- }
28
- }
29
- },
30
- packages: {
31
- 'environments': {
32
- defaultExtension: 'js'
33
- },
34
- 'app': {
35
- defaultExtension: 'js'
36
- },
37
- 'main': {
38
- main: 'main.js',
39
- defaultExtension: 'js'
40
- }
41
- },
42
- map: {
43
- "@angular/animations/browser": "npm:@angular/animations@4.0.2/bundles/animations-browser.umd.min.js",
44
- "@angular/platform-browser/animations": "npm:@angular/platform-browser@4.0.2/bundles/platform-browser-animations.umd.min.js",
45
- 'main': 'src',
46
- 'app': 'src/app'
47
- }
48
-});
49
-
50
-SystemJS.config({
51
- packageConfigPaths: [
52
- "github:*/*.json",
53
- "npm:@*/*.json",
54
- "npm:*.json"
55
- ],
56
- map: {
57
- "@angular/animations": "npm:@angular/animations@4.0.2",
58
- "@angular/common": "npm:@angular/common@4.0.2",
59
- "@angular/compiler": "npm:@angular/compiler@4.0.2",
60
- "@angular/core": "npm:@angular/core@4.0.2",
61
- "@angular/forms": "npm:@angular/forms@4.0.2",
62
- "@angular/http": "npm:@angular/http@4.0.2",
63
- "@angular/material": "npm:@angular/material@2.0.0-beta.3",
64
- "@angular/platform-browser": "npm:@angular/platform-browser@4.0.2",
65
- "@angular/platform-browser-dynamic": "npm:@angular/platform-browser-dynamic@4.0.2",
66
- "@angular/router": "npm:@angular/router@4.0.2",
67
- "@covalent/core": "npm:@covalent/core@1.0.0-beta.3-1",
68
- "@covalent/dynamic-forms": "npm:@covalent/dynamic-forms@1.0.0-beta.3-1",
69
- "@covalent/http": "npm:@covalent/http@1.0.0-beta.3-1",
70
- "angular-in-memory-web-api": "npm:angular-in-memory-web-api@0.3.1",
71
- "angular-safeguard": "npm:angular-safeguard@1.0.1",
72
- "assert": "npm:jspm-nodelibs-assert@0.2.1",
73
- "buffer": "npm:jspm-nodelibs-buffer@0.2.2",
74
- "constants": "npm:jspm-nodelibs-constants@0.2.1",
75
- "core-js": "npm:core-js@2.4.1",
76
- "crypto": "npm:jspm-nodelibs-crypto@0.2.1",
77
- "events": "npm:jspm-nodelibs-events@0.2.2",
78
- "file-saver": "npm:file-saver@1.3.3",
79
- "fs": "npm:jspm-nodelibs-fs@0.2.1",
80
- "hammerjs": "npm:hammerjs@2.0.8",
81
- "ng2-toastr": "npm:ng2-toastr@4.0.1",
82
- "os": "npm:jspm-nodelibs-os@0.2.1",
83
- "path": "npm:jspm-nodelibs-path@0.2.3",
84
- "process": "npm:jspm-nodelibs-process@0.2.1",
85
- "rxjs": "npm:rxjs@5.3.0",
86
- "stream": "npm:jspm-nodelibs-stream@0.2.1",
87
- "string_decoder": "npm:jspm-nodelibs-string_decoder@0.2.1",
88
- "timers": "npm:jspm-nodelibs-timers@0.2.1",
89
- "util": "npm:jspm-nodelibs-util@0.2.2",
90
- "vm": "npm:jspm-nodelibs-vm@0.2.1",
91
- "web-animations-js": "npm:web-animations-js@2.2.2",
92
- "zone.js": "npm:zone.js@0.8.5"
93
- },
94
- packages: {
95
- "npm:jspm-nodelibs-buffer@0.2.2": {
96
- "map": {
97
- "buffer": "npm:buffer@4.9.1"
98
- }
99
- },
100
- "npm:buffer@4.9.1": {
101
- "map": {
102
- "isarray": "npm:isarray@1.0.0",
103
- "ieee754": "npm:ieee754@1.1.8",
104
- "base64-js": "npm:base64-js@1.2.0"
105
- }
106
- },
107
- "npm:jspm-nodelibs-os@0.2.1": {
108
- "map": {
109
- "os-browserify": "npm:os-browserify@0.2.1"
110
- }
111
- },
112
- "npm:jspm-nodelibs-crypto@0.2.1": {
113
- "map": {
114
- "crypto-browserify": "npm:crypto-browserify@3.11.0"
115
- }
116
- },
117
- "npm:crypto-browserify@3.11.0": {
118
- "map": {
119
- "browserify-cipher": "npm:browserify-cipher@1.0.0",
120
- "create-hash": "npm:create-hash@1.1.2",
121
- "create-ecdh": "npm:create-ecdh@4.0.0",
122
- "diffie-hellman": "npm:diffie-hellman@5.0.2",
123
- "browserify-sign": "npm:browserify-sign@4.0.4",
124
- "randombytes": "npm:randombytes@2.0.3",
125
- "inherits": "npm:inherits@2.0.3",
126
- "create-hmac": "npm:create-hmac@1.1.4",
127
- "pbkdf2": "npm:pbkdf2@3.0.9",
128
- "public-encrypt": "npm:public-encrypt@4.0.0"
129
- }
130
- },
131
- "npm:browserify-sign@4.0.4": {
132
- "map": {
133
- "create-hash": "npm:create-hash@1.1.2",
134
- "inherits": "npm:inherits@2.0.3",
135
- "create-hmac": "npm:create-hmac@1.1.4",
136
- "bn.js": "npm:bn.js@4.11.6",
137
- "elliptic": "npm:elliptic@6.4.0",
138
- "parse-asn1": "npm:parse-asn1@5.1.0",
139
- "browserify-rsa": "npm:browserify-rsa@4.0.1"
140
- }
141
- },
142
- "npm:create-hash@1.1.2": {
143
- "map": {
144
- "inherits": "npm:inherits@2.0.3",
145
- "sha.js": "npm:sha.js@2.4.8",
146
- "cipher-base": "npm:cipher-base@1.0.3",
147
- "ripemd160": "npm:ripemd160@1.0.1"
148
- }
149
- },
150
- "npm:diffie-hellman@5.0.2": {
151
- "map": {
152
- "randombytes": "npm:randombytes@2.0.3",
153
- "bn.js": "npm:bn.js@4.11.6",
154
- "miller-rabin": "npm:miller-rabin@4.0.0"
155
- }
156
- },
157
- "npm:browserify-cipher@1.0.0": {
158
- "map": {
159
- "browserify-des": "npm:browserify-des@1.0.0",
160
- "browserify-aes": "npm:browserify-aes@1.0.6",
161
- "evp_bytestokey": "npm:evp_bytestokey@1.0.0"
162
- }
163
- },
164
- "npm:browserify-des@1.0.0": {
165
- "map": {
166
- "inherits": "npm:inherits@2.0.3",
167
- "des.js": "npm:des.js@1.0.0",
168
- "cipher-base": "npm:cipher-base@1.0.3"
169
- }
170
- },
171
- "npm:create-hmac@1.1.4": {
172
- "map": {
173
- "create-hash": "npm:create-hash@1.1.2",
174
- "inherits": "npm:inherits@2.0.3"
175
- }
176
- },
177
- "npm:browserify-aes@1.0.6": {
178
- "map": {
179
- "create-hash": "npm:create-hash@1.1.2",
180
- "inherits": "npm:inherits@2.0.3",
181
- "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
182
- "cipher-base": "npm:cipher-base@1.0.3",
183
- "buffer-xor": "npm:buffer-xor@1.0.3"
184
- }
185
- },
186
- "npm:pbkdf2@3.0.9": {
187
- "map": {
188
- "create-hmac": "npm:create-hmac@1.1.4"
189
- }
190
- },
191
- "npm:evp_bytestokey@1.0.0": {
192
- "map": {
193
- "create-hash": "npm:create-hash@1.1.2"
194
- }
195
- },
196
- "npm:create-ecdh@4.0.0": {
197
- "map": {
198
- "bn.js": "npm:bn.js@4.11.6",
199
- "elliptic": "npm:elliptic@6.4.0"
200
- }
201
- },
202
- "npm:des.js@1.0.0": {
203
- "map": {
204
- "inherits": "npm:inherits@2.0.3",
205
- "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
206
- }
207
- },
208
- "npm:sha.js@2.4.8": {
209
- "map": {
210
- "inherits": "npm:inherits@2.0.3"
211
- }
212
- },
213
- "npm:cipher-base@1.0.3": {
214
- "map": {
215
- "inherits": "npm:inherits@2.0.3"
216
- }
217
- },
218
- "npm:parse-asn1@5.1.0": {
219
- "map": {
220
- "browserify-aes": "npm:browserify-aes@1.0.6",
221
- "create-hash": "npm:create-hash@1.1.2",
222
- "evp_bytestokey": "npm:evp_bytestokey@1.0.0",
223
- "pbkdf2": "npm:pbkdf2@3.0.9",
224
- "asn1.js": "npm:asn1.js@4.9.1"
225
- }
226
- },
227
- "npm:elliptic@6.4.0": {
228
- "map": {
229
- "bn.js": "npm:bn.js@4.11.6",
230
- "inherits": "npm:inherits@2.0.3",
231
- "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
232
- "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1",
233
- "brorand": "npm:brorand@1.1.0",
234
- "hash.js": "npm:hash.js@1.0.3",
235
- "hmac-drbg": "npm:hmac-drbg@1.0.1"
236
- }
237
- },
238
- "npm:jspm-nodelibs-stream@0.2.1": {
239
- "map": {
240
- "stream-browserify": "npm:stream-browserify@2.0.1"
241
- }
242
- },
243
- "npm:asn1.js@4.9.1": {
244
- "map": {
245
- "bn.js": "npm:bn.js@4.11.6",
246
- "inherits": "npm:inherits@2.0.3",
247
- "minimalistic-assert": "npm:minimalistic-assert@1.0.0"
248
- }
249
- },
250
- "npm:browserify-rsa@4.0.1": {
251
- "map": {
252
- "bn.js": "npm:bn.js@4.11.6",
253
- "randombytes": "npm:randombytes@2.0.3"
254
- }
255
- },
256
- "npm:stream-browserify@2.0.1": {
257
- "map": {
258
- "inherits": "npm:inherits@2.0.3",
259
- "readable-stream": "npm:readable-stream@2.2.9"
260
- }
261
- },
262
- "npm:hash.js@1.0.3": {
263
- "map": {
264
- "inherits": "npm:inherits@2.0.3"
265
- }
266
- },
267
- "npm:jspm-nodelibs-string_decoder@0.2.1": {
268
- "map": {
269
- "string_decoder": "npm:string_decoder@0.10.31"
270
- }
271
- },
272
- "npm:readable-stream@2.2.9": {
273
- "map": {
274
- "string_decoder": "npm:string_decoder@1.0.0",
275
- "isarray": "npm:isarray@1.0.0",
276
- "inherits": "npm:inherits@2.0.3",
277
- "buffer-shims": "npm:buffer-shims@1.0.0",
278
- "process-nextick-args": "npm:process-nextick-args@1.0.7",
279
- "util-deprecate": "npm:util-deprecate@1.0.2",
280
- "core-util-is": "npm:core-util-is@1.0.2"
281
- }
282
- },
283
- "npm:hmac-drbg@1.0.1": {
284
- "map": {
285
- "hash.js": "npm:hash.js@1.0.3",
286
- "minimalistic-assert": "npm:minimalistic-assert@1.0.0",
287
- "minimalistic-crypto-utils": "npm:minimalistic-crypto-utils@1.0.1"
288
- }
289
- },
290
- "npm:string_decoder@1.0.0": {
291
- "map": {
292
- "buffer-shims": "npm:buffer-shims@1.0.0"
293
- }
294
- },
295
- "npm:miller-rabin@4.0.0": {
296
- "map": {
297
- "bn.js": "npm:bn.js@4.11.6",
298
- "brorand": "npm:brorand@1.1.0"
299
- }
300
- },
301
- "npm:public-encrypt@4.0.0": {
302
- "map": {
303
- "bn.js": "npm:bn.js@4.11.6",
304
- "browserify-rsa": "npm:browserify-rsa@4.0.1",
305
- "create-hash": "npm:create-hash@1.1.2",
306
- "parse-asn1": "npm:parse-asn1@5.1.0",
307
- "randombytes": "npm:randombytes@2.0.3"
308
- }
309
- },
310
- "npm:rxjs@5.3.0": {
311
- "map": {
312
- "symbol-observable": "npm:symbol-observable@1.0.4"
313
- }
314
- },
315
- "npm:jspm-nodelibs-timers@0.2.1": {
316
- "map": {
317
- "timers-browserify": "npm:timers-browserify@1.4.2"
318
- }
319
- },
320
- "npm:timers-browserify@1.4.2": {
321
- "map": {
322
- "process": "npm:process@0.11.9"
323
- }
324
- },
325
- "npm:@covalent/core@1.0.0-beta.3-1": {
326
- "map": {
327
- "@angular/flex-layout": "npm:@angular/flex-layout@2.0.0-beta.7",
328
- "@angular/material": "npm:@angular/material@2.0.0-beta.3"
329
- }
330
- },
331
- "npm:@covalent/dynamic-forms@1.0.0-beta.3-1": {
332
- "map": {
333
- "@covalent/core": "npm:@covalent/core@1.0.0-beta.3-1"
334
- }
335
- }
336
- }
337
-});
securis/src/main/webapp/src/app/common/utils.ts
....@@ -1,6 +1,6 @@
11
22 import { Component, Injectable, Input } from '@angular/core';
3
-import {LocaleService} from './i18n';
3
+import { LocaleService } from './i18n';
44 import { Observable } from 'rxjs/Observable';
55
66
....@@ -40,26 +40,23 @@
4040 @Injectable()
4141 export class BasicService {
4242
43
- constructor(protected $L: LocaleService) {}
43
+ constructor(protected $L: LocaleService) { }
4444
45
- public processErrorResponse(errorResponse: Response | any) {
46
- // In a real world app, we might use a remote logging infrastructure
47
- var error: IError = <IError>{};
48
- if (errorResponse instanceof Response) {
45
+ public processErrorResponse(errorResponse: Response) {
46
+ // In a real world app, we might use a remote logging infrastructure
47
+ var error: IError = <IError>{};
4948 error.httpCode = errorResponse.status;
50
- }
49
+ error.code = errorResponse.headers.get(ERROR_CODE_MESSAGE_HEADER) || error.httpCode;
5150
52
- error.code = errorResponse.headers.get(ERROR_CODE_MESSAGE_HEADER) || error.httpCode;
51
+ if (errorResponse.status === 403 /* forbidden */ || errorResponse.status === 401 /* unauthorized */) {
52
+ error.message = this.$L.get('Invalid credentials');
53
+ error.code = ErrorCodes.INVALID_CREDENTIALS;
54
+ } else if (errorResponse.status === 418 /* Teapot */) {
55
+ error.message = errorResponse.headers.get(ERROR_MESSAGE_HEADER) || errorResponse.statusText || this.$L.get('Unknown');
56
+ } else {
57
+ error.message = this.$L.get(`Unexpected error HTTP (${error.httpCode}) accessing to server. Contact with the administrator.`);
58
+ }
5359
54
- if (errorResponse.status === 403 /* forbidden */ || errorResponse.status === 401 /* unauthorized */) {
55
- error.message = this.$L.get('Invalid credentials');
56
- error.code = ErrorCodes.INVALID_CREDENTIALS;
57
- } else if (errorResponse.status === 418 /* Teapot */) {
58
- error.message = errorResponse.headers.get(ERROR_MESSAGE_HEADER) || errorResponse.statusText || this.$L.get('Unknown');
59
- } else {
60
- error.message = this.$L.get(`Unexpected error HTTP (${error.httpCode}) accessing to server. Contact with the administrator.`);
61
- }
62
-
63
- return Observable.throw(error);
64
- }
60
+ return Observable.throw(error);
61
+ }
6562 }
securis/src/main/webapp/src/app/forms/license.form.component.ts
....@@ -53,15 +53,36 @@
5353
5454
5555 licenseAction(action: string) {
56
- return this.licenses[action](this.data.id).subscribe(
57
- (actionResponse : any) => {
58
- this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
59
- this.init();
60
- },
61
- (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
62
- );
56
+ if (action === 'cancel') {
57
+ this.dialogs.openPrompt({
58
+ message: this.$L.get('Please, specify the reason to cancel the current license'),
59
+ title: this.$L.get('License cancelation'), //OPTIONAL, hides if not provided
60
+ value: '',
61
+ cancelButton: this.$L.get('Close'),
62
+ acceptButton: this.$L.get('Cancel license'), //OPTIONAL, defaults to 'ACCEPT'
63
+ }).afterClosed().subscribe((reason: string) => {
64
+ if (reason) {
65
+ this.licenses.cancel(this.data.id, reason).subscribe(
66
+ (actionResponse : any) => {
67
+ this.toaster.success(this.$L.get('License cancelled sucessfully'));
68
+ this.init();
69
+ },
70
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
71
+ );
72
+ }
73
+ });
74
+ } else {
75
+ return this.licenses[action](this.data.id).subscribe(
76
+ (actionResponse : any) => {
77
+ this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
78
+ this.init();
79
+ },
80
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
81
+ );
82
+ }
6383 }
6484
85
+
6586
6687 canBeDeleted() : boolean {
6788 return !this.isNew && this.licenses.isActionAvailable('delete', this.data);
securis/src/main/webapp/src/app/forms/pack.form.component.ts
....@@ -71,7 +71,7 @@
7171 this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
7272 this.init();
7373 },
74
- (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
74
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
7575 );
7676 }
7777
securis/src/main/webapp/src/app/listing/license.list.component.ts
....@@ -1,6 +1,6 @@
11 import { ActivatedRoute, Router } from '@angular/router';
22 import { MdDialog, MdDialogConfig } from '@angular/material';
3
-import { TdDataTableService, TdPagingBarComponent, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
3
+import { TdDialogService, TdDataTableService, TdPagingBarComponent, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
44 import { IPageChangeEvent } from '@covalent/core';
55 import { Component, AfterViewInit, ViewChild } from '@angular/core';
66 import { TdMediaService } from '@covalent/core';
....@@ -48,13 +48,33 @@
4848 license_menu_options = LICENSE_ACTIONS;
4949
5050 licenseAction(action: string, license: any) {
51
- return this.licenses[action](license.id).subscribe(
52
- (actionResponse : any) => {
53
- this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
54
- this.reload(this.pack.id);
55
- },
56
- (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
57
- );
51
+ if (action === 'cancel') {
52
+ this.dialogs.openPrompt({
53
+ message: this.$L.get('Please, specify the reason to cancel the current license'),
54
+ title: this.$L.get('License cancelation'), //OPTIONAL, hides if not provided
55
+ value: '',
56
+ cancelButton: this.$L.get('Close'),
57
+ acceptButton: this.$L.get('Cancel license'), //OPTIONAL, defaults to 'ACCEPT'
58
+ }).afterClosed().subscribe((reason: string) => {
59
+ if (reason) {
60
+ this.licenses.cancel(license.id, reason).subscribe(
61
+ (actionResponse : any) => {
62
+ this.toaster.success(this.$L.get('License cancelled sucessfully'));
63
+ this.reload(this.pack.id);
64
+ },
65
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action) )
66
+ );
67
+ }
68
+ });
69
+ } else {
70
+ return this.licenses[action](license.id).subscribe(
71
+ (actionResponse : any) => {
72
+ this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
73
+ this.reload(this.pack.id);
74
+ },
75
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
76
+ );
77
+ }
5878 }
5979
6080 reload(packId: number) : void {
....@@ -73,6 +93,7 @@
7393
7494 constructor( _dataTableService: TdDataTableService,
7595 private media: TdMediaService,
96
+ private dialogs: TdDialogService,
7697 private $L: LocaleService,
7798 private router: Router,
7899 private location: Location,
securis/src/main/webapp/src/app/listing/pack.list.component.ts
....@@ -92,7 +92,7 @@
9292 this.toaster.success(this.$L.get('Action "{}" executed successfully', action));
9393 this.reload();
9494 },
95
- (err : any) => this.toaster.error(this.$L.get('Action "{}" failed', action))
95
+ (err : any) => this.toaster.error(err.message, this.$L.get('Action "{}" failed', action))
9696 );
9797 }
9898
securis/src/main/webapp/src/app/resources/base.ts
....@@ -37,11 +37,9 @@
3737 return this.http.delete(url).map(response => response.json()).catch(err => super.processErrorResponse(err));
3838 }
3939
40
- public action(id: any, action: string, method = 'POST') : Observable<any> {
40
+ public action(id: any, action: string, method = 'POST', params : any = {}) : Observable<any> {
4141 let url = `${this.resource}/${id}/${action}`;
42
- var params = {
43
- action: action
44
- }
42
+ params.action = action;
4543 var options:RequestOptionsArgs = {
4644 url: url,
4745 method: method,
securis/src/main/webapp/src/app/resources/licenses.ts
....@@ -3,9 +3,7 @@
33 import { Injectable } from '@angular/core';
44 import { Http, RequestOptions, ResponseContentType, Response } from '@angular/http';
55 import { SeCurisResourceServices } from './base';
6
-import "file-saver";
7
-
8
-declare var saveAs: FileSaver;
6
+import { saveAs } from "file-saver";
97
108 export const LIC_STATUS = {
119 CREATED: 'CR',
....@@ -71,6 +69,10 @@
7169 command: 'cancel',
7270 icon: 'cancel',
7371 name: 'Cancel'
72
+ },{
73
+ command: 'delete',
74
+ icon: 'delete',
75
+ name: 'Delete'
7476 }]
7577
7678
....@@ -102,8 +104,12 @@
102104 return super.action(id, "send");
103105 }
104106
105
- public cancel(id: number) {
106
- return super.action(id, "cancel");
107
+ public cancel(id: number, reason: string) {
108
+ return super.action(id, "cancel", 'POST', {reason: reason});
109
+ }
110
+
111
+ public delete(id: number) {
112
+ return super.remove(id);
107113 }
108114
109115 public download(id: number) {