From a6b5178c7295be4525ee0f607e42f72a12a2e3d6 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Wed, 15 Mar 2017 15:45:26 +0000
Subject: [PATCH] #3527 fix - Changes on licenses list and routes
---
securis/src/main/webapp/src/app/resources/licenses.ts | 32 +++++++++++++++++++++-----------
1 files changed, 21 insertions(+), 11 deletions(-)
diff --git a/securis/src/main/webapp/src/app/resources/licenses.ts b/securis/src/main/webapp/src/app/resources/licenses.ts
index 74404b8..459f2f5 100644
--- a/securis/src/main/webapp/src/app/resources/licenses.ts
+++ b/securis/src/main/webapp/src/app/resources/licenses.ts
@@ -1,3 +1,4 @@
+import { LocaleService } from '../common/i18n';
import { Observable } from 'rxjs/Rx';
import { Injectable } from '@angular/core';
import { Http, RequestOptions } from '@angular/http';
@@ -21,14 +22,6 @@
status: 'AC'
}
-export const PACK_STATUS = {
- CREATED: 'CR',
- ACTIVE: 'AC',
- ONHOLD: 'OH',
- EXPIRED: 'EX',
- CANCELLED: 'CA'
-}
-
export const LIC_STATUS = {
CREATED: 'CR',
ACTIVE: 'AC',
@@ -38,6 +31,15 @@
BLOCKED: 'BL',
CANCELLED: 'CA'
}
+
+export const COLORS_BY_STATUS = {
+ 'CR': '#808080',
+ 'AC': '#329e5a',
+ 'RE': '#2981d4',
+ 'EX': '#ea7824',
+ 'BL': '#ff0000',
+ 'CA': '#a21717'
+};
/**
* These transitions could be get from server, class License.Status, but
@@ -55,11 +57,10 @@
'delete': [LIC_STATUS.CREATED, LIC_STATUS.CANCELLED, LIC_STATUS.BLOCKED]
}
-
-
@Injectable()
export class LicensesService extends SeCurisResourceServices {
- constructor(http: Http) {
+ constructor(http: Http,
+ private $L: LocaleService) {
super(http, 'license');
}
@@ -84,5 +85,14 @@
var validStatuses = LIC_ACTIONS_BY_STATUS[action];
return lic && validStatuses && validStatuses.indexOf(lic.status) !== -1;
}
+
+
+ getStatusName(statusCode: string): string {
+ return this.$L.get(`pack.status.${statusCode}`, this.$L.get('Unknown'));
+ }
+
+ getStatusColor(statusCode: string): string {
+ return COLORS_BY_STATUS[statusCode] || '#cccccc';
+ }
}
--
Gitblit v1.3.2