From 2762277c60db7df5ad3214b10a0dd93d4f2f1128 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Fri, 10 Mar 2017 08:53:44 +0000
Subject: [PATCH] #3527 feature - Added more features to angular2 version
---
securis/src/main/webapp/src/app/pack.list.component.html | 134 ---
securis/src/main/webapp/src/app/app.component.ts | 52
securis/src/main/webapp/src/app/resources/organizations.ts | 20
securis/src/main/webapp/src/app/resources/applications.ts | 26
securis/src/main/webapp/assets/images/securis_40.png | 0
securis/src/main/webapp/index.jsp | 44 +
securis/src/main/webapp/assets/securis_logo_bw.svg | 68 ++
securis/src/main/webapp/src/app/common/i18n.ts | 4
securis/src/main/webapp/src/app/catalogs.json | 210 ++++++
securis/src/main/webapp/src/favicon.ico | 0
securis/src/main/webapp/src/app/login.form.html | 76 +
securis/src/main/webapp/assets/securis_logo_white.svg | 48 +
securis/src/main/webapp/WEB-INF/web.xml | 16
securis/src/main/webapp/src/app/common/default.requests.options.ts | 21
securis/src/main/webapp/src/app/forms/pack.form.component.ts | 31 +
securis/src/main/webapp/src/app/resources/license_types.ts | 24
securis/src/main/webapp/assets/favicon.png | 0
securis/src/main/webapp/src/app/pack.list.component.ts | 166 +++--
securis/src/main/webapp/src/app/resources/licenses.ts | 98 +++
securis/src/main/webapp/src/app/resources/base.ts | 49 +
securis/src/main/webapp/bs-config.json | 3
securis/src/main/webapp/src/app/resources/users.ts | 26
securis/src/main/webapp/src/app/favicon.ico | 0
securis/src/main/webapp/src/app/app.home.html | 46 +
securis/src/main/webapp/assets/securis_logo.svg | 28
securis/src/main/java/net/curisit/securis/services/BasicServices.java | 167 ++--
securis/src/main/java/net/curisit/securis/DevFilter.java | 50 +
securis/src/main/webapp/src/app/app.routes.ts | 2
securis/src/main/webapp/assets/securis_logo_black.svg | 68 ++
securis/src/main/webapp/package.json | 16
securis/src/main/webapp/src/app/login.form.component.ts | 6
securis/src/main/webapp/assets/images/securis_100.png | 0
securis/pom.xml | 2
securis/src/main/webapp/src/app/resources/packs.ts | 92 ++
securis/src/main/webapp/.vscode/settings.json | 1
securis/src/main/webapp/index.html | 22
securis/src/main/webapp/src/app/app.module.ts | 23
securis/src/main/webapp/src/app/user.service.ts | 23
securis/src/main/webapp/src/app/forms/pack.form.html | 172 +++++
securis/src/main/webapp/assets/securis.css | 26
40 files changed, 1,515 insertions(+), 345 deletions(-)
diff --git a/securis/pom.xml b/securis/pom.xml
index fb1c231..bba52d0 100644
--- a/securis/pom.xml
+++ b/securis/pom.xml
@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.curisit</groupId>
<artifactId>securis-server</artifactId>
- <version>1.1.8</version>
+ <version>2.0.0</version>
<name>SeCuris</name>
<description>CurisTEC Server Licenses</description>
<dependencies>
diff --git a/securis/src/main/java/net/curisit/securis/DevFilter.java b/securis/src/main/java/net/curisit/securis/DevFilter.java
new file mode 100644
index 0000000..2a3c6c0
--- /dev/null
+++ b/securis/src/main/java/net/curisit/securis/DevFilter.java
@@ -0,0 +1,50 @@
+package net.curisit.securis;
+
+import java.io.IOException;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+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;
+import org.apache.logging.log4j.Logger;
+
+@ApplicationScoped
+@WebFilter(urlPatterns = "/*")
+public class DevFilter implements Filter {
+
+ private static final Logger LOG = LogManager.getLogger(DevFilter.class);
+
+ @Override
+ public void init(FilterConfig fc) throws ServletException {
+ }
+
+ @Override
+ public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain fc) throws IOException, ServletException {
+ HttpServletRequest req = (HttpServletRequest) sreq;
+ HttpServletResponse res = (HttpServletResponse) sres;
+ // For dev. using JS in different server
+ res.addHeader("Access-Control-Allow-Origin", "*");
+ //res.addHeader("Access-Control-Request-Headers", "*");
+ res.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS");
+ res.addHeader("Access-Control-Allow-Headers", "X-SECURIS-TOKEN, Content-Type");
+ res.addHeader("Access-Control-Expose-Headers", "X-SECURIS-ERROR-MSG, X-SECURIS-ERROR-CODE, Content-Type");
+
+ LOG.info("Added header to: " + res.getHeaderNames());
+ if (!req.getMethod().equals("OPTIONS")) {
+ fc.doFilter(sreq, sres);
+ }
+ }
+
+ @Override
+ public void destroy() {
+ }
+
+}
diff --git a/securis/src/main/java/net/curisit/securis/services/BasicServices.java b/securis/src/main/java/net/curisit/securis/services/BasicServices.java
index d1bba29..43289df 100644
--- a/securis/src/main/java/net/curisit/securis/services/BasicServices.java
+++ b/securis/src/main/java/net/curisit/securis/services/BasicServices.java
@@ -2,6 +2,8 @@
import java.net.URI;
import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
@@ -20,13 +22,13 @@
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
import net.curisit.integrity.commons.Utils;
import net.curisit.securis.ioc.EnsureTransaction;
import net.curisit.securis.security.Securable;
import net.curisit.securis.utils.TokenHelper;
-
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
/**
* Basic services for login and basic app wrkflow
@@ -37,93 +39,94 @@
@ApplicationScoped
public class BasicServices {
- private static final Logger LOG = LogManager.getLogger(BasicServices.class);
+ private static final Logger LOG = LogManager.getLogger(BasicServices.class);
- @Inject
- TokenHelper tokenHelper;
+ @Inject
+ TokenHelper tokenHelper;
- @Inject
- public BasicServices() {
- }
+ @Inject
+ public BasicServices() {
+ }
- @GET
- @Path("/info")
- @Produces({
- MediaType.TEXT_PLAIN
- })
- public Response info(@Context HttpServletRequest request) {
- return Response.ok().entity("License server running OK. Date: " + new Date()).build();
- }
+ @GET
+ @Path("/info")
+ @Produces({ MediaType.TEXT_PLAIN })
+ public Response info(@Context HttpServletRequest request) {
+ return Response.ok().entity("License server running OK. Date: " + new Date()).build();
+ }
- @GET
- @Path("/{module:(admin)|(login)|(licenses)}")
- @Produces({
- MediaType.TEXT_HTML
- })
- public Response init(@PathParam("module") String module, @Context HttpServletRequest request) {
- LOG.info("App index main.html");
- String page = "/index.jsp";
- URI uri = UriBuilder.fromUri(page).build();
- return Response.seeOther(uri).build();
- }
+ @GET
+ @Path("/version")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public Map<String, String> version(@Context HttpServletRequest request) {
+ Map<String, String> resp = new HashMap<>();
+ // TODO: Get the real version
+ String version = "2.0.0";
+ resp.put("version", version);
+ return resp;
+ }
- @POST
- @Path("/login")
- @Produces({
- MediaType.APPLICATION_JSON
- })
- public Response login(@FormParam("username") String user, @FormParam("password") String password, @Context HttpServletRequest request) {
- LOG.info("is user in role: {} == {} ? ", "advance", request.isUserInRole("advance"));
+ @GET
+ @Path("/{module:(admin)|(login)|(licenses)}")
+ @Produces({ MediaType.TEXT_HTML })
+ public Response init(@PathParam("module") String module, @Context HttpServletRequest request) {
+ LOG.info("App index main.html");
+ String page = "/index.jsp";
+ URI uri = UriBuilder.fromUri(page).build();
+ return Response.seeOther(uri).build();
+ }
- String tokenAuth = tokenHelper.generateToken(user);
- return Response.ok(Utils.createMap("success", true, "token", tokenAuth)).build();
- }
+ @POST
+ @Path("/login")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public Response login(@FormParam("username") String user, @FormParam("password") String password, @Context HttpServletRequest request) {
+ LOG.info("is user in role: {} == {} ? ", "advance", request.isUserInRole("advance"));
- /**
- * Check if current token is valid
- *
- * @param user
- * @param password
- * @param request
- * @return
- */
- @GET
- @Securable()
- @Path("/check")
- @Produces({
- MediaType.APPLICATION_JSON
- })
- @EnsureTransaction
- public Response check(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token, @QueryParam("token") String token2) {
- if (token == null) {
- token = token2;
- }
- if (token == null) {
- return Response.status(Status.FORBIDDEN).build();
- }
- boolean valid = tokenHelper.isTokenValid(token);
- if (!valid) {
- return Response.status(Status.UNAUTHORIZED).build();
- }
+ String tokenAuth = tokenHelper.generateToken(user);
+ return Response.ok(Utils.createMap("success", true, "token", tokenAuth)).build();
+ }
- String user = tokenHelper.extractUserFromToken(token);
- Date date = tokenHelper.extractDateCreationFromToken(token);
+ /**
+ * Check if current token is valid
+ *
+ * @param user
+ * @param password
+ * @param request
+ * @return
+ */
+ @GET
+ @Securable()
+ @Path("/check")
+ @Produces({ MediaType.APPLICATION_JSON })
+ @EnsureTransaction
+ public Response check(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token, @QueryParam("token") String token2) {
+ if (token == null) {
+ token = token2;
+ }
+ if (token == null) {
+ return Response.status(Status.FORBIDDEN).build();
+ }
+ boolean valid = tokenHelper.isTokenValid(token);
+ if (!valid) {
+ return Response.status(Status.UNAUTHORIZED).build();
+ }
- return Response.ok(Utils.createMap("valid", true, "user", user, "date", date)).build();
- }
+ String user = tokenHelper.extractUserFromToken(token);
+ Date date = tokenHelper.extractDateCreationFromToken(token);
- @GET
- @POST
- @Path("/logout")
- @Produces({
- MediaType.APPLICATION_JSON
- })
- public Response logout(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
- if (token == null) {
- Response.status(Status.BAD_REQUEST).build();
- }
- String user = tokenHelper.extractUserFromToken(token);
- LOG.info("User {} has logged out", user);
- return Response.ok().build();
- }
+ return Response.ok(Utils.createMap("valid", true, "user", user, "date", date)).build();
+ }
+
+ @GET
+ @POST
+ @Path("/logout")
+ @Produces({ MediaType.APPLICATION_JSON })
+ public Response logout(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
+ if (token == null) {
+ Response.status(Status.BAD_REQUEST).build();
+ }
+ String user = tokenHelper.extractUserFromToken(token);
+ LOG.info("User {} has logged out", user);
+ return Response.ok().build();
+ }
}
diff --git a/securis/src/main/webapp/.vscode/settings.json b/securis/src/main/webapp/.vscode/settings.json
index 0c807a4..18a36e8 100644
--- a/securis/src/main/webapp/.vscode/settings.json
+++ b/securis/src/main/webapp/.vscode/settings.json
@@ -1,4 +1,5 @@
// Place your settings in this file to overwrite default and user settings.
{
"typescript.tsdk": "./node_modules/typescript/lib"
+
}
\ No newline at end of file
diff --git a/securis/src/main/webapp/WEB-INF/web.xml b/securis/src/main/webapp/WEB-INF/web.xml
index 97d8d7e..0d4339d 100644
--- a/securis/src/main/webapp/WEB-INF/web.xml
+++ b/securis/src/main/webapp/WEB-INF/web.xml
@@ -40,7 +40,18 @@
<param-name>resteasy.injector.factory</param-name>
<param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
</context-param>
-
+
+ <filter>
+ <filter-name>DevFilter</filter-name>
+ <filter-class>
+ net.curisit.securis.DevFilter
+ </filter-class>
+ </filter>
+ <filter-mapping>
+ <filter-name>DevFilter</filter-name>
+ <url-pattern>/*</url-pattern>
+ </filter-mapping>
+
<filter>
<filter-name>Resteasy</filter-name>
<filter-class>
@@ -56,9 +67,6 @@
<filter-name>Resteasy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-
-
-
<welcome-file-list>
<welcome-file>/index.jsp</welcome-file>
diff --git a/securis/src/main/webapp/assets/favicon.png b/securis/src/main/webapp/assets/favicon.png
new file mode 100644
index 0000000..9ec9350
--- /dev/null
+++ b/securis/src/main/webapp/assets/favicon.png
Binary files differ
diff --git a/securis/src/main/webapp/assets/images/securis_100.png b/securis/src/main/webapp/assets/images/securis_100.png
new file mode 100644
index 0000000..4a68558
--- /dev/null
+++ b/securis/src/main/webapp/assets/images/securis_100.png
Binary files differ
diff --git a/securis/src/main/webapp/assets/images/securis_40.png b/securis/src/main/webapp/assets/images/securis_40.png
new file mode 100644
index 0000000..b735a65
--- /dev/null
+++ b/securis/src/main/webapp/assets/images/securis_40.png
Binary files differ
diff --git a/securis/src/main/webapp/assets/securis.css b/securis/src/main/webapp/assets/securis.css
new file mode 100644
index 0000000..3f5485c
--- /dev/null
+++ b/securis/src/main/webapp/assets/securis.css
@@ -0,0 +1,26 @@
+.mat-toolbar-row .mat-icon.md-icon-logo {
+ height: 40px;
+ width: 40px;
+}
+
+.login-logo.mat-icon {
+ height: 100px;
+ width: 100px;
+}
+
+.form-icon.mat-icon {
+ height: 28px;
+ width: auto;
+ max-width: 36px;
+ color: #999999;
+ margin-right: 5px;
+}
+
+td-layout-footer a,
+td-layout-footer a:visited {
+ color:rgba(0, 0, 0, 0.87);
+}
+
+td-layout-footer {
+ font-size: 0.8em;
+}
\ No newline at end of file
diff --git a/securis/src/main/webapp/assets/securis_logo.svg b/securis/src/main/webapp/assets/securis_logo.svg
new file mode 100644
index 0000000..cc7e585
--- /dev/null
+++ b/securis/src/main/webapp/assets/securis_logo.svg
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ style="clip-rule:evenodd;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
+ version="1.1"
+ id="svg4136"
+ viewBox="0 0 994.3679 890.63637"
+ height="89.063637"
+ width="99.43679"
+ xml:space="preserve">
+ <defs id="defs11" />
+ <g id="securis-logo">
+ <path
+ style="clip-rule:evenodd;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
+ id="curve1"
+ d="m 611.42012,9.9999999 c 171.6141,0 310.7898,139.1755401 310.7898,310.7898201 l 0,92.0714 -124.316,0 0,-92.0714 c 0,-102.94909 -83.52472,-186.47391 -186.4738,-186.47391 -102.94909,0 -186.47396,83.52482 -186.47396,186.47391 l 0,92.0714 -124.31587,0 0,-92.0714 c 0,-171.61428 139.17553,-310.7898201 310.78983,-310.7898201 z" /><path
+ style="fill:#cfcfcf;fill-opacity:1"
+ d="m 358.42774,225.55425 c -125.45278,0 -227.23633,109.93044 -227.23633,245.55274 C 59.707,503.34928 9.9999999,579.60509 9.9999999,667.73393 c 0,117.6076 88.1486301,212.9024 196.9375001,212.9024 l 112.50782,0 c -34.25186,0 -62.09961,-27.8658 -62.09961,-62.1387 l 0,-310.68947 c 0,-34.27296 27.84775,-62.13867 62.09961,-62.13867 l 429.13476,0 C 717.016,373.63099 649.16423,323.81597 570.51368,323.81597 c -9.65752,0 -19.22132,0.71661 -28.68946,2.25196 C 499.69102,263.93756 431.99513,225.55425 358.42774,225.55425 Z"
+ id="path5469" /><path
+ style="clip-rule:evenodd;fill:#0077ff;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
+ id="curve0"
+ d="m 300.63029,443.94025 621.57963,0 c 34.284,0 62.158,27.87394 62.158,62.15794 l 0,310.78994 c 0,34.2839 -27.874,62.1579 -62.158,62.1579 l -621.57963,0 c -34.28401,0 -62.15795,-27.874 -62.15795,-62.1579 l 0,-310.78994 c 0,-34.284 27.87394,-62.15794 62.15795,-62.15794 z m 310.78983,93.23698 c -34.28401,0 -62.15795,27.87389 -62.15795,62.1579 0,19.5214 8.93524,36.9063 23.01789,48.2696 l -23.01789,138.2043 124.31589,0 -23.01788,-138.2043 c 14.08264,-11.3633 23.01788,-28.7482 23.01788,-48.2696 0,-34.28401 -27.87394,-62.1579 -62.15794,-62.1579 z" />
+ </g>
+ </svg>
\ No newline at end of file
diff --git a/securis/src/main/webapp/assets/securis_logo_black.svg b/securis/src/main/webapp/assets/securis_logo_black.svg
new file mode 100644
index 0000000..806a057
--- /dev/null
+++ b/securis/src/main/webapp/assets/securis_logo_black.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xml:space="preserve"
+ width="1024px"
+ height="1024px"
+ shape-rendering="geometricPrecision"
+ text-rendering="geometricPrecision"
+ image-rendering="optimizeQuality"
+ fill-rule="nonzero"
+ clip-rule="evenodd"
+ viewBox="0 0 10240 10240"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="securis_logo_black.svg"><metadata
+ id="metadata13"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>cloud_dark icon</dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs11"><clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath5463"><path
+ id="path5465"
+ d="m 1374.633,5493.8708 c 0,-1356.223 1017.8243,-2455.5315 2272.3521,-2455.5315 735.6739,0 1412.6455,383.8367 1833.9775,1005.1404 94.6814,-15.3535 190.3094,-22.5184 286.8846,-22.5184 1087.8885,0 1969.3717,952.9387 1969.3717,2129.0143 0,11.2594 0,21.4949 0,32.7542 541.5773,298.881 908.9409,908.9256 908.9409,1604.9488 0,994.9056 -746.0889,1801.474 -1666.3915,1801.474 -1616.2105,0 -3231.4741,0 -4847.6845,0 -1087.8887,0 -1969.37199,-952.9389 -1969.37199,-2129.0146 0,-881.2885 497.07708,-1643.8443 1211.92119,-1966.2672 z"
+ style="fill:#333333;fill-opacity:1"
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1492"
+ inkscape:window-height="986"
+ id="namedview9"
+ showgrid="false"
+ showguides="false"
+ inkscape:zoom="0.80078125"
+ inkscape:cx="314.06829"
+ inkscape:cy="512"
+ inkscape:window-x="302"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" /><title
+ id="title4">cloud_dark icon</title><desc
+ id="desc6">cloud_dark icon from the IconExperience.com O-Collection. Copyright by INCORS GmbH (www.incors.com).</desc><path
+ style="fill:#333333;fill-opacity:1"
+ d="m 364.69922,303.83398 c -125.45278,0 -227.23633,109.93044 -227.23633,245.55274 -71.484411,32.24229 -121.191406,108.4981 -121.191406,196.62695 0,117.60757 88.148626,212.90235 196.937496,212.90235 l 112.50782,0 c -34.25186,0 -62.09961,-27.86572 -62.09961,-62.13868 l 0,-310.68945 c 0,-34.27296 27.84775,-62.13867 62.09961,-62.13867 l 429.13476,0 C 723.28748,451.91072 655.43571,402.0957 576.78516,402.0957 c -9.65752,0 -19.22132,0.71661 -28.68946,2.25196 C 505.9625,342.21729 438.26661,303.83398 364.69922,303.83398 Z"
+ transform="scale(9.9999999,9.9999999)"
+ id="path5469"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scsscssscscs" /><path
+ style="clip-rule:evenodd;fill:#333333;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
+ inkscape:connector-curvature="0"
+ id="curve1"
+ d="m 6108.4569,890.93001 c 1716.1666,0 3107.9418,1391.77509 3107.9418,3107.94169 l 0,920.7278 -1243.1767,0 0,-920.7278 c 0,-1029.5057 -835.2594,-1864.765 -1864.7651,-1864.765 -1029.5058,0 -1864.765,835.2593 -1864.765,1864.765 l 0,920.7278 -1243.1767,0 0,-920.7278 c 0,-1716.1666 1391.7751,-3107.94169 3107.9417,-3107.94169 z" /><path
+ style="clip-rule:evenodd;fill:#333333;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
+ inkscape:connector-curvature="0"
+ id="curve0"
+ d="m 2928.7103,5192.9303 6247.103,0 c 344.5668,0 624.7103,281.9434 624.7103,628.7242 l 0,3143.6211 c 0,346.7809 -280.1435,628.7244 -624.7103,628.7244 l -6247.103,0 C 2584.1435,9594 2304,9312.0565 2304,8965.2756 l 0,-3143.6211 c 0,-346.7808 280.1435,-628.7242 624.7103,-628.7242 z m 3123.5515,943.0862 c -344.5668,0 -624.7104,281.9436 -624.7104,628.7243 0,197.4587 89.8022,373.305 231.3381,488.2437 l -231.3381,1397.9291 1249.4206,0 -231.338,-1397.9291 c 141.536,-114.9387 231.338,-290.785 231.338,-488.2437 0,-346.7807 -280.1434,-628.7243 -624.7102,-628.7243 z" /></svg>
\ No newline at end of file
diff --git a/securis/src/main/webapp/assets/securis_logo_bw.svg b/securis/src/main/webapp/assets/securis_logo_bw.svg
new file mode 100644
index 0000000..e21d298
--- /dev/null
+++ b/securis/src/main/webapp/assets/securis_logo_bw.svg
@@ -0,0 +1,68 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ xml:space="preserve"
+ width="1024px"
+ height="1024px"
+ shape-rendering="geometricPrecision"
+ text-rendering="geometricPrecision"
+ image-rendering="optimizeQuality"
+ fill-rule="nonzero"
+ clip-rule="evenodd"
+ viewBox="0 0 10240 10240"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="securis_logo_wb.svg"><metadata
+ id="metadata13"><rdf:RDF><cc:Work
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>cloud_dark icon</dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs11"><clipPath
+ clipPathUnits="userSpaceOnUse"
+ id="clipPath5463"><path
+ id="path5465"
+ d="m 1374.633,5493.8708 c 0,-1356.223 1017.8243,-2455.5315 2272.3521,-2455.5315 735.6739,0 1412.6455,383.8367 1833.9775,1005.1404 94.6814,-15.3535 190.3094,-22.5184 286.8846,-22.5184 1087.8885,0 1969.3717,952.9387 1969.3717,2129.0143 0,11.2594 0,21.4949 0,32.7542 541.5773,298.881 908.9409,908.9256 908.9409,1604.9488 0,994.9056 -746.0889,1801.474 -1666.3915,1801.474 -1616.2105,0 -3231.4741,0 -4847.6845,0 -1087.8887,0 -1969.37199,-952.9389 -1969.37199,-2129.0146 0,-881.2885 497.07708,-1643.8443 1211.92119,-1966.2672 z"
+ style="fill:#333333;fill-opacity:1"
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1492"
+ inkscape:window-height="986"
+ id="namedview9"
+ showgrid="false"
+ showguides="false"
+ inkscape:zoom="0.80078125"
+ inkscape:cx="512"
+ inkscape:cy="512"
+ inkscape:window-x="302"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" /><title
+ id="title4">cloud_dark icon</title><desc
+ id="desc6">cloud_dark icon from the IconExperience.com O-Collection. Copyright by INCORS GmbH (www.incors.com).</desc><path
+ style="clip-rule:evenodd;fill:#b3b3b3;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
+ inkscape:connector-curvature="0"
+ id="curve1"
+ d="m 6108.4569,890.93001 c 1716.1666,0 3107.9418,1391.77509 3107.9418,3107.94169 l 0,920.7278 -1243.1767,0 0,-920.7278 c 0,-1029.5057 -835.2594,-1864.765 -1864.7651,-1864.765 -1029.5058,0 -1864.765,835.2593 -1864.765,1864.765 l 0,920.7278 -1243.1767,0 0,-920.7278 c 0,-1716.1666 1391.7751,-3107.94169 3107.9417,-3107.94169 z" /><path
+ style="fill:#cfcfcf;fill-opacity:1"
+ d="m 364.69922,303.83398 c -125.45278,0 -227.23633,109.93044 -227.23633,245.55274 -71.484411,32.24229 -121.191406,108.4981 -121.191406,196.62695 0,117.60757 88.148626,212.90235 196.937496,212.90235 l 112.50782,0 c -34.25186,0 -62.09961,-27.86572 -62.09961,-62.13868 l 0,-310.68945 c 0,-34.27296 27.84775,-62.13867 62.09961,-62.13867 l 429.13476,0 C 723.28748,451.91072 655.43571,402.0957 576.78516,402.0957 c -9.65752,0 -19.22132,0.71661 -28.68946,2.25196 C 505.9625,342.21729 438.26661,303.83398 364.69922,303.83398 Z"
+ transform="scale(9.9999999,9.9999999)"
+ id="path5469"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="scsscssscscs" /><path
+ style="clip-rule:evenodd;fill:#808080;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
+ inkscape:connector-curvature="0"
+ id="curve0"
+ d="m 3000.5152,5230.3937 6215.8835,0 c 342.8448,0 621.5883,278.7434 621.5883,621.5883 l 0,3107.9417 c 0,342.845 -278.7435,621.5885 -621.5883,621.5885 l -6215.8835,0 c -342.8449,0 -621.5884,-278.7435 -621.5884,-621.5885 l 0,-3107.9417 c 0,-342.8449 278.7435,-621.5883 621.5884,-621.5883 z m 3107.9417,932.3824 c -342.8448,0 -621.5884,278.7436 -621.5884,621.5884 0,195.2176 89.3534,369.0681 230.182,482.7022 l -230.182,1382.0629 1243.1767,0 -230.1819,-1382.0629 c 140.8286,-113.6341 230.1819,-287.4846 230.1819,-482.7022 0,-342.8448 -278.7434,-621.5884 -621.5883,-621.5884 z" /></svg>
\ No newline at end of file
diff --git a/securis/src/main/webapp/assets/securis_logo_white.svg b/securis/src/main/webapp/assets/securis_logo_white.svg
new file mode 100644
index 0000000..1a2beff
--- /dev/null
+++ b/securis/src/main/webapp/assets/securis_logo_white.svg
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ style="clip-rule:evenodd;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
+ version="1.1"
+ id="logo-securis.white"
+ viewBox="0 0 163.25001 149.35546"
+ height="14.935546"
+ width="16.325001"
+ xml:space="preserve"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="securis_logo_white.svg"><sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1876"
+ inkscape:window-height="1036"
+ id="namedview13"
+ showgrid="false"
+ inkscape:zoom="4.9933333"
+ inkscape:cx="75.725"
+ inkscape:cy="-59.97754"
+ inkscape:window-x="44"
+ inkscape:window-y="0"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="logo-securis.white"
+ fit-margin-top="1"
+ fit-margin-bottom="1"
+ fit-margin-left="1"
+ fit-margin-right="1" /><metadata
+ id="metadata13"><rdf:RDF><cc:Work
+ rdf:about=""><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
+ id="defs11" /><path
+ style="fill:#f2f2f2;fill-opacity:1"
+ d="M 98.373047,9.9999999 C 77.498558,9.9999999 59.860465,23.856515 54.138672,42.86914 39.17572,46.616392 28.011719,61.101313 28.011719,78.414062 17.38674,83.206346 9.9999999,94.54172 9.9999999,107.64063 c 0,17.48042 13.1018121,31.64453 29.2714841,31.64453 l 10.740235,0 c 0.361582,0.0432 0.726631,0.0703 1.099609,0.0703 l 92.853512,0 c 5.12142,0 9.28516,-4.18942 9.28516,-9.34375 l 0,-46.724611 c 0,-5.154325 -4.16374,-9.345703 -9.28516,-9.345703 l -24.51757,0 c -4.81836,-10.32836 -14.70334,-17.419912 -26.136723,-17.419912 -1.435431,0 -2.856389,0.107733 -4.263672,0.335937 C 85.099417,51.03643 79.639982,46.621687 73.40625,44.15039 77.889795,34.877265 87.386626,28.476562 98.373047,28.476562 c 15.301903,0 27.716793,12.414892 27.716793,27.716797 l 0,13.685547 18.47852,0 0,-13.685547 c 0,-25.507987 -20.68733,-46.1933591 -46.195313,-46.1933591 z M 97.537109,87.958984 c 5.121421,0 9.285161,4.19138 9.285161,9.345703 0,2.934903 -1.33381,5.547493 -3.4375,7.255863 l 3.4375,20.77734 -18.570317,0 3.439453,-20.77734 c -2.103698,-1.70837 -3.439453,-4.32096 -3.439453,-7.255863 0,-5.154323 4.163739,-9.345703 9.285156,-9.345703 z"
+ id="path5469"
+ inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
diff --git a/securis/src/main/webapp/bs-config.json b/securis/src/main/webapp/bs-config.json
index da69f66..f04b023 100644
--- a/securis/src/main/webapp/bs-config.json
+++ b/securis/src/main/webapp/bs-config.json
@@ -2,7 +2,8 @@
"server": {
"baseDir": "",
"routes": {
- "/node_modules": "node_modules"
+ "/node_modules": "node_modules",
+ "/assets": "assets"
}
}
}
diff --git a/securis/src/main/webapp/index.html b/securis/src/main/webapp/index.html
index f14ce28..32d0ecf 100644
--- a/securis/src/main/webapp/index.html
+++ b/securis/src/main/webapp/index.html
@@ -1,12 +1,12 @@
<!DOCTYPE html>
<html>
<head>
- <title>Angular QuickStart</title>
+ <title>SeCuris server</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<base href="/">
- <link rel="stylesheet" href="styles.css">
-
+ <link rel="icon" href="assets/favicon.png" sizes="32x29" type="image/png">
+
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script> -->
<!-- Polyfill(s) for older browsers -->
@@ -15,6 +15,7 @@
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
+
<script src="systemjs.config.js"></script>
<script>
@@ -22,14 +23,21 @@
</script>
<!-- Load the Covalent platform stylesheet -->
- <link href="https://unpkg.com/@covalent/core@1.0.0-beta.2/common/platform.css" rel="stylesheet">
+ <link href="assets/securis.css" rel="stylesheet">
+ <link href="node_modules/@covalent/core/common/platform.css" rel="stylesheet">
<!-- Load the Covalent/Material prebuilt theme -->
- <link href="https://unpkg.com/@covalent/core@1.0.0-beta.2/theming/prebuilt/blue-orange.css" rel="stylesheet">
-
+ <link href="node_modules/@covalent/core/theming/prebuilt/blue-orange.css" rel="stylesheet">
+ <link href="node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet" />
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
</head>
<body>
- <my-app>Loading AppComponent content here ...</my-app>
+ <app-home>
+ <div style="padding: 20%;text-align:center;">
+ <img src="assets/securis_logo.svg" width="100">
+ <div style="font-size: 0.8em;color: darkgrey;">SeCuris Loading...</div>
+ </div>
+ </app-home>
</body>
</html>
diff --git a/securis/src/main/webapp/index.jsp b/securis/src/main/webapp/index.jsp
new file mode 100644
index 0000000..a6d7f70
--- /dev/null
+++ b/securis/src/main/webapp/index.jsp
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>SeCuris server</title>
+ <base href="<%= pageContext.getServletContext().getContextPath() %>/">
+ <meta charset="utf-8">
+ <meta charset="UTF-8">
+ <meta name="viewport" content="width=device-width, initial-scale=1">
+ <link rel="icon" href="assets/favicon.png" sizes="32x29" type="image/png">
+ <base href="/">
+
+<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script> -->
+
+ <!-- Polyfill(s) for older browsers -->
+ <script src="node_modules/core-js/client/shim.min.js"></script>
+ <script src="node_modules/hammerjs/hammer.min.js"></script>
+
+ <script src="node_modules/zone.js/dist/zone.js"></script>
+ <script src="node_modules/systemjs/dist/system.src.js"></script>
+
+ <script src="systemjs.config.js"></script>
+ <script>
+ System.import('main').catch(function(err){ console.error(err); });
+ </script>
+
+ <!-- Load the Covalent platform stylesheet -->
+ <link href="assets/securis.css" rel="stylesheet">
+ <link href="node_modules/@covalent/core/common/platform.css" rel="stylesheet">
+
+ <!-- Load the Covalent/Material prebuilt theme -->
+ <link href="node_modules/@covalent/core/theming/prebuilt/blue-orange.css" rel="stylesheet">
+ <link href="node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet" />
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
+ </head>
+
+ <body>
+ <app-home>
+ <div style="padding: 20%;text-align:center;">
+ <img src="assets/securis_logo.svg" width="100">
+ <div style="font-size: 0.8em;color: darkgrey;">SeCuris Loading...</div>
+ </div>
+ </app-home>
+ </body>
+</html>
diff --git a/securis/src/main/webapp/package.json b/securis/src/main/webapp/package.json
index 509fc75..f953d0d 100644
--- a/securis/src/main/webapp/package.json
+++ b/securis/src/main/webapp/package.json
@@ -24,15 +24,15 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@angular/common": "^2.4.8",
- "@angular/compiler": "~2.4.0",
- "@angular/core": "~2.4.0",
- "@angular/forms": "~2.4.0",
- "@angular/http": "~2.4.0",
+ "@angular/common": "^2.4.9",
+ "@angular/compiler": "~2.4.9",
+ "@angular/core": "~2.4.9",
+ "@angular/forms": "~2.4.9",
+ "@angular/http": "~2.4.9",
"@angular/material": "^2.0.0-beta.2",
- "@angular/platform-browser": "~2.4.0",
- "@angular/platform-browser-dynamic": "~2.4.0",
- "@angular/router": "^3.4.8",
+ "@angular/platform-browser": "~2.4.9",
+ "@angular/platform-browser-dynamic": "~2.4.9",
+ "@angular/router": "^3.4.9",
"@covalent/core": "^1.0.0-beta.2",
"@covalent/dynamic-forms": "^1.0.0-beta.2",
"@covalent/http": "^1.0.0-beta.2",
diff --git a/securis/src/main/webapp/src/app/app.component.ts b/securis/src/main/webapp/src/app/app.component.ts
index 786b8d0..c791107 100644
--- a/securis/src/main/webapp/src/app/app.component.ts
+++ b/securis/src/main/webapp/src/app/app.component.ts
@@ -1,4 +1,7 @@
-import { Component, AfterViewInit } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
+import { BaseRequestOptions, Http } from '@angular/http';
+import { ToastsManager } from 'ng2-toastr/ng2-toastr';
+import { AfterViewInit, Component, ViewContainerRef } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { MdIconRegistry } from '@angular/material';
import { UserService } from './user.service';
@@ -10,41 +13,40 @@
// https://teradata.github.io/covalent-quickstart/#/
@Component({
- selector: 'my-app',
- template: `<router-outlet></router-outlet>`
+ selector: 'app-home',
+ templateUrl: 'src/app/app.home.html'
})
-
-
-export class AppComponent implements AfterViewInit {
-
+export class AppHomeComponent implements AfterViewInit {
+ securisVersion : string;
constructor(private userService: UserService,
+ toaster: ToastsManager,
+ vRef: ViewContainerRef,
private router: Router,
+ http: Http,
private media: TdMediaService,
private _iconRegistry: MdIconRegistry,
private _domSanitizer: DomSanitizer,
private store: LocalStorageService) {
this.registerIcons();
+ toaster.setRootViewContainerRef(vRef);
+ http.get("version", /* workaround to avoid OPTIONS method request*/ new BaseRequestOptions())
+ .map((res) => <string>res.json().version)
+ .subscribe(
+ version => this.securisVersion = version,
+ err => this.securisVersion = '0.0.0'
+ );
+
}
private registerIcons() : void {
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent',
- this._domSanitizer.bypassSecurityTrustResourceUrl('https://raw.githubusercontent.com/Teradata/covalent-quickstart/develop/src/assets/icons/covalent.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'teradata',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'github',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/github.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent-mark',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent-mark.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'teradata-ux',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata-ux.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'appcenter',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/appcenter.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'listener',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/listener.svg'));
- this._iconRegistry.addSvgIconInNamespace('assets', 'querygrid',
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/querygrid.svg'));
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo',
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo.svg'));
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-bw',
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_bw.svg'));
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-white',
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_white.svg'));
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-black',
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_black.svg'));
}
ngAfterViewInit(): void {
diff --git a/securis/src/main/webapp/src/app/app.home.html b/securis/src/main/webapp/src/app/app.home.html
new file mode 100644
index 0000000..a611be9
--- /dev/null
+++ b/securis/src/main/webapp/src/app/app.home.html
@@ -0,0 +1,46 @@
+<td-layout-nav toolbarTitle="SeCuris" logo="assets:logo-white" >
+ <div td-toolbar-content layout="row" layout-align="start center" flex>
+ <!-- <button>Hola</button> -->
+ <md-menu #notificationsMenu="mdMenu">
+ <td-menu>
+ <div td-menu-header class="md-subhead">Templates</div>
+ <md-nav-list dense>
+ <a md-list-item [routerLink]="['/login']">
+ <md-icon md-list-avatar>system_update_alt</md-icon>
+ <h4 md-line><span class="text-wrap">Landing Page</span></h4>
+ <p md-line>a landing page template</p>
+ </a>
+ <md-divider></md-divider>
+ <a md-list-item [routerLink]="['/login']">
+ <md-icon md-list-avatar>dashboard</md-icon>
+ <h4 md-line><span class="text-wrap">Dashboard</span></h4>
+ <p md-line>an ngx-charts dashboard template</p>
+ </a>
+ <md-divider></md-divider>
+ <a md-list-item [routerLink]="['/login']">
+ <md-icon md-list-avatar>email</md-icon>
+ <h4 md-line><span class="text-wrap">Email App</span></h4>
+ <p md-line>an email app template</p>
+ </a>
+ <md-divider></md-divider>
+ <a md-list-item [routerLink]="['/login']">
+ <md-icon md-list-avatar>view_array</md-icon>
+ <h4 md-line><span class="text-wrap">IDE Editor</span></h4>
+ <p md-line>an IDE text editor app template</p>
+ </a>
+ </md-nav-list>
+ <a md-button color="accent" td-menu-footer href="https://github.com/Teradata/covalent-quickstart/tree/develop/src/app/templates" target="_blank">
+ View Code
+ </a>
+ </td-menu>
+ </md-menu>
+ </div>
+ <router-outlet></router-outlet>
+ <td-layout-footer>
+ <div layout="row" layout-align="start center" flex>
+ <div flex layout="row" layout-align="start center">v. {{securisVersion}}</div>
+ <div flex layout="row" layout-align="center center"><a href="http://www.curistec.com/" target="_blank">CurisTec</a> ©2017</div>
+ <div flex></div>
+ </div>
+ </td-layout-footer>
+</td-layout-nav>
diff --git a/securis/src/main/webapp/src/app/app.module.ts b/securis/src/main/webapp/src/app/app.module.ts
index 9dc09d5..7ac7a54 100644
--- a/securis/src/main/webapp/src/app/app.module.ts
+++ b/securis/src/main/webapp/src/app/app.module.ts
@@ -10,14 +10,20 @@
import { LocalStorageModule } from 'angular-2-local-storage';
import { ToastModule } from 'ng2-toastr/ng2-toastr';
-import { AppComponent } from './app.component';
+import { AppHomeComponent } from './app.component';
import { UserService } from './user.service';
+import { PacksService } from './resources/packs';
+import { LicenseTypesService } from './resources/license_types';
+import { OrganizationsService } from './resources/organizations';
+import { ApplicationsService } from './resources/applications';
+import { UsersService } from './resources/users';
+import { LicensesService } from './resources/licenses';
import { PackListComponent } from './pack.list.component';
import { HeroDetailComponent } from './detail.component';
import { LoginFormComponent } from './login.form.component';
import { appRoutes, appRoutingProviders } from './app.routes';
-import { requestOptionsProvider } from './common/default.requests.options';
+import { requestOptionsProvider, requestBackendProvider } from './common/default.requests.options';
import { LocaleServiceModule } from './common/i18n';
@NgModule({
@@ -33,20 +39,27 @@
CovalentHttpModule.forRoot(),
CovalentDynamicFormsModule.forRoot(),
ToastModule.forRoot(),
- LocaleServiceModule,
+ LocaleServiceModule.withConfig('en'),
appRoutes,
],
declarations: [
HeroDetailComponent,
PackListComponent,
LoginFormComponent,
- AppComponent
+ AppHomeComponent
],
- bootstrap: [ AppComponent ],
+ bootstrap: [ AppHomeComponent ],
providers: [
UserService,
+ PacksService,
+ LicensesService,
+ ApplicationsService,
+ OrganizationsService,
+ LicenseTypesService,
+ UsersService,
appRoutingProviders,
requestOptionsProvider,
+ requestBackendProvider
]
})
diff --git a/securis/src/main/webapp/src/app/app.routes.ts b/securis/src/main/webapp/src/app/app.routes.ts
index a8c5fac..953f644 100644
--- a/securis/src/main/webapp/src/app/app.routes.ts
+++ b/securis/src/main/webapp/src/app/app.routes.ts
@@ -1,6 +1,6 @@
import { Routes, RouterModule } from '@angular/router';
-import { AppComponent } from './app.component';
+import { AppHomeComponent } from './app.component';
import { PackListComponent } from './pack.list.component';
import { LoginFormComponent } from './login.form.component';
diff --git a/securis/src/main/webapp/src/app/catalogs.json b/securis/src/main/webapp/src/app/catalogs.json
new file mode 100644
index 0000000..77bf78a
--- /dev/null
+++ b/securis/src/main/webapp/src/app/catalogs.json
@@ -0,0 +1,210 @@
+[ {
+ "name" : "Applications",
+ "resource" : "application",
+ "list_fields" : [ "name", "description", "creationTimestamp" ],
+ "fields" : [ {
+ "name" : "id",
+ "display" : "ID",
+ "type" : "number",
+ "pk" : true,
+ "autogenerate" : true,
+ "readOnly" : true
+ }, {
+ "name" : "code",
+ "display" : "Code",
+ "type" : "string",
+ "maxlength" : 4,
+ "mandatory" : true
+ }, {
+ "name" : "name",
+ "display" : "Name",
+ "type" : "string",
+ "maxlength" : 45,
+ "mandatory" : true
+ }, {
+ "name" : "description",
+ "display" : "Description",
+ "type" : "string",
+ "maxlength" : 500,
+ "multiline" : 2
+ }, {
+ "name" : "license_filename",
+ "display" : "License filename",
+ "type" : "string",
+ "maxlength" : 100,
+ "mandatory" : true
+ }, {
+ "name" : "creation_timestamp",
+ "display" : "Creation date",
+ "autogenerate" : true,
+ "type" : "date",
+ "readOnly" : true
+ }, {
+ "name" : "metadata",
+ "display" : "Metadata",
+ "type" : "metadata",
+ "allow_creation": true
+ } ]
+}, {
+ "name" : "License types",
+ "list_fields" : [ "code", "name", "application_name", "creationTimestamp" ],
+ "resource" : "licensetype",
+ "fields" : [ {
+ "name" : "id",
+ "display" : "ID",
+ "type" : "number",
+ "pk" : true,
+ "autogenerate" : true,
+ "readOnly" : true
+ }, {
+ "name" : "code",
+ "display" : "Code",
+ "type" : "string",
+ "maxlength" : 10,
+ "mandatory" : true
+ }, {
+ "name" : "name",
+ "display" : "Name",
+ "type" : "string",
+ "maxlength" : 45,
+ "mandatory" : true
+ }, {
+ "name" : "description",
+ "display" : "Description",
+ "type" : "string",
+ "maxlength" : 500,
+ "multiline" : 2
+ }, {
+ "name" : "application_id",
+ "display" : "Application",
+ "resource" : "application",
+ "mandatory" : true,
+ "type" : "select",
+ "onchange": "updateMetadata"
+ }, {
+ "name" : "creation_timestamp",
+ "display" : "Creation date",
+ "autogenerate" : true,
+ "type" : "date",
+ "readOnly" : true
+ }, {
+ "name" : "application_name",
+ "display" : "Application",
+ "listingOnly" : true
+ }, {
+ "name" : "metadata",
+ "display" : "Metadata",
+ "type" : "metadata",
+ "allow_creation": false
+ } ]
+}, {
+ "name" : "Organizations",
+ "list_fields" : [ "code", "name", "org_parent_name", "creationTimestamp" ],
+ "resource" : "organization",
+ "fields" : [ {
+ "name" : "id",
+ "display" : "ID",
+ "type" : "number",
+ "pk" : true,
+ "autogenerate" : true,
+ "readOnly" : true
+ }, {
+ "name" : "code",
+ "display" : "Code",
+ "type" : "string",
+ "maxlength" : 10,
+ "mandatory" : true
+ }, {
+ "name" : "name",
+ "display" : "Name",
+ "type" : "string",
+ "maxlength" : 45,
+ "mandatory" : true
+ }, {
+ "name" : "description",
+ "display" : "Description",
+ "type" : "string",
+ "maxlength" : 500,
+ "multiline" : 2
+ }, {
+ "name" : "org_parent_id",
+ "display" : "Parent organization",
+ "resource" : "organization",
+ "type" : "select"
+ }, {
+ "name" : "users_ids",
+ "display" : "Users",
+ "resource" : "user",
+ "type" : "multiselect"
+ }, {
+ "name" : "creation_timestamp",
+ "display" : "Creation date",
+ "autogenerate" : true,
+ "type" : "date",
+ "readOnly" : true
+ }, {
+ "name" : "org_parent_name",
+ "display" : "Parent org",
+ "listingOnly" : true
+ } ]
+}, {
+ "name" : "Users",
+ "list_fields" : [ "username", "first_name", "last_name", "lastLogin" ],
+ "resource" : "user",
+ "fields" : [ {
+ "name" : "username",
+ "display" : "Username",
+ "type" : "string",
+ "maxlength" : 45,
+ "pk" : true,
+ "readOnly" : true,
+ "mandatory" : true
+ }, {
+ "name" : "email",
+ "display" : "Email",
+ "type" : "email",
+ "maxlength" : 150,
+ "mandatory" : true
+ }, {
+ "name" : "first_name",
+ "display" : "First name",
+ "type" : "string",
+ "maxlength" : 100,
+ "mandatory" : true
+ }, {
+ "name" : "password",
+ "display" : "Password",
+ "type" : "password",
+ "maxlength" : 100,
+ "mandatory" : false
+ }, {
+ "name" : "last_name",
+ "display" : "Last name",
+ "type" : "string",
+ "maxlength" : 100
+ }, {
+ "name" : "organizations_ids",
+ "display" : "Organizations",
+ "resource" : "organization",
+ "type" : "multiselect"
+ }, {
+ "name" : "roles",
+ "display" : "Roles",
+ "values" : [{"id":1, "label":"Advance"}, {"id":2, "label":"Admin"}],
+ "type" : "multiselect"
+ }, {
+ "name" : "lastLogin",
+ "display" : "Last login",
+ "autogenerate" : true,
+ "type" : "date",
+ "readOnly" : true
+ }, {
+ "name" : "creation_timestamp",
+ "display" : "Creation date",
+ "autogenerate" : true,
+ "type" : "date",
+ "readOnly" : true
+ }]
+ }
+
+]
\ No newline at end of file
diff --git a/securis/src/main/webapp/src/app/common/default.requests.options.ts b/securis/src/main/webapp/src/app/common/default.requests.options.ts
index 62dbe13..d02c654 100644
--- a/securis/src/main/webapp/src/app/common/default.requests.options.ts
+++ b/securis/src/main/webapp/src/app/common/default.requests.options.ts
@@ -1,6 +1,15 @@
import { LocalStorageService } from 'angular-2-local-storage';
import { Injectable } from '@angular/core';
-import { BaseRequestOptions, RequestOptions, Request, XHRBackend, XHRConnection} from '@angular/http';
+import {
+ BaseRequestOptions,
+ BrowserXhr,
+ Request,
+ RequestOptions,
+ ResponseOptions,
+ XHRBackend,
+ XHRConnection,
+ XSRFStrategy
+} from '@angular/http';
// TODO: Chnage this to use Covalent Http helper service
@@ -17,6 +26,7 @@
let token = this.store.get<string>('token');
if (token) {
this.headers.set('X-SECURIS-TOKEN', token);
+
}
}
@@ -24,9 +34,14 @@
@Injectable()
export class ApiXHRBackend extends XHRBackend {
+
+ constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy) {
+ super(_browserXHR, _baseResponseOptions, _xsrfStrategy);
+ }
+
createConnection(request: Request): XHRConnection {
- if (request.url.startsWith('/')){
- // request.url = '/securis' + request.url; // prefix base url
+ if (!request.url.endsWith('.js') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
+ request.url = 'http://localhost:8080/securis/' + request.url; // prefix base url
}
return super.createConnection(request);
}
diff --git a/securis/src/main/webapp/src/app/common/i18n.ts b/securis/src/main/webapp/src/app/common/i18n.ts
index f7ca62c..b8132e1 100644
--- a/securis/src/main/webapp/src/app/common/i18n.ts
+++ b/securis/src/main/webapp/src/app/common/i18n.ts
@@ -79,6 +79,9 @@
* $L.get('Hello {0}!!', 'John'); // This returns: "Hola John!!" if language is spanish
*/
get(msg: string) : string {
+ if (msg == null) {
+ return '';
+ }
msg = msg.trim();
var trans_msg = msg;
@@ -121,6 +124,7 @@
})
export class LocaleServiceModule {
static withConfig(initLang?: string): ModuleWithProviders {
+ console.log('Init lang with ' + initLang);
return {
ngModule: LocaleServiceModule,
providers: [
diff --git a/securis/src/main/webapp/src/app/favicon.ico b/securis/src/main/webapp/src/app/favicon.ico
new file mode 100644
index 0000000..c1d9026
--- /dev/null
+++ b/securis/src/main/webapp/src/app/favicon.ico
Binary files differ
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
new file mode 100644
index 0000000..a10a8c6
--- /dev/null
+++ b/securis/src/main/webapp/src/app/forms/pack.form.component.ts
@@ -0,0 +1,31 @@
+import { PacksService } from '../resources/packs';
+import { LocaleService } from '../common/i18n';
+import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
+import { IPageChangeEvent } from '@covalent/core';
+import { Component, AfterViewInit } from '@angular/core';
+import { TdMediaService } from '@covalent/core';
+
+@Component({
+ selector: 'pack-form',
+ templateUrl: 'src/app/forms/pack.form.html'
+})
+export class PackFormComponent implements AfterViewInit {
+
+ form_title: string = '';
+ form_subtitle: string = '';
+
+ constructor(private packs: PacksService,
+ private $L: LocaleService) {
+ this.form_title = $L.get('Pack data');
+ this.form_subtitle = $L.get('Fullfill the pack data and save the changes');
+ }
+
+ ngOnInit(): void {
+ }
+
+
+ ngAfterViewInit(): void {
+
+ }
+}
+
diff --git a/securis/src/main/webapp/src/app/forms/pack.form.html b/securis/src/main/webapp/src/app/forms/pack.form.html
new file mode 100644
index 0000000..f9fae7f
--- /dev/null
+++ b/securis/src/main/webapp/src/app/forms/pack.form.html
@@ -0,0 +1,172 @@
+<h3 md-dialog-title>{{form_title}}</h3>
+<form #packForm="ngForm" class="inset" (keyup.enter)="save()">
+<md-dialog-content>
+ <div layout="column" layout-align="start center">
+ <div layout="row" layout-align="start center">
+ <md-icon class="form-icon">face</md-icon>
+ <md-input-container class="md-icon-float">
+ <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
+ </md-input-container>
+ <div id="invalid-auth-msg" *ngIf="invalidError" class="tc-red-600 text-center" flex i18n>The username or password is incorrect. Please try again.</div>
+ </div>
+ <div layout="row" layout-align="start center">
+ <md-icon class="form-icon">vpn_key</md-icon>
+ <md-input-container class="md-icon-float">
+ <input mdInput (keyup.enter)="loginForm.form.valid && false" flex placeholder="Password" type="password" [(ngModel)]="data.password"
+ name="password" required/>
+ </md-input-container>
+ </div>
+ </div>
+</md-dialog-content>
+<md-dialog-actions layout="row" layout-align="end center">
+ <button flex [disabled]="!packForm.form.valid" md-raised-button color="primary" (click)="save()">Save</button>
+ <button flex md-button (click)="close()">Cancel</button>
+</md-dialog-actions>
+</form>
+
+
+<form role="form" class="form-horizontal ng-pristine ng-invalid ng-invalid-required ng-valid-maxlength ng-valid-min" name="packForm" id="packForm" ng-submit="save()">
+<!-- ngIf: !isNew -->
+<div class="form-group">
+<label class="col-md-3 control-label" for="code" i18n="">Code</label>
+<div class="col-md-8">
+ <input type="string" id="code" name="code" placeholder="" class="form-control ng-pristine ng-invalid ng-invalid-required ng-valid-maxlength ng-touched" ng-model="pack.code" ng-required="mandatory.code" ng-maxlength="50" required="required">
+ <div class="alert inline-alert alert-warning" ng-show="packForm.code.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span> <span ng-show="packForm.code.$error.maxlength" ng-bind="maxLengthErrorMsg('Code', maxlength.code)" class="ng-binding ng-hide">Code length is too long (max: 50).</span> <span ng-show="packForm.code.$error.required" ng-bind="mandatoryFieldErrorMsg('Code')" class="ng-binding">'Code' is required.</span>
+ </div>
+</div>
+</div>
+
+<div class="form-group">
+<label class="col-md-3 control-label" for="init_valid_date" i18n="">Validity (from - to)</label>
+<div class="col-md-4">
+ <input type="date" id="init_valid_date" name="init_valid_date" placeholder="" class="form-control ng-pristine ng-untouched ng-valid ng-valid-required" ng-model="pack.init_valid_date" ng-required="mandatory.init_valid_date" required="required">
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.initValidDate.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span>
+ <span ng-show="packForm.init_valid_date.$error.required" ng-bind="mandatoryFieldErrorMsg('Init valid date')" class="ng-binding ng-hide">'Init valid date' is required.</span>
+ </div>
+</div>
+<div class="col-md-4">
+ <input type="date" id="end_valid_date" name="end_valid_date" placeholder="" class="form-control ng-pristine ng-untouched ng-valid-min ng-invalid ng-invalid-required" ng-model="pack.end_valid_date" min="2017-03-09" ng-required="mandatory.end_valid_date" required="required">
+ <div class="alert inline-alert alert-warning" ng-show="packForm.end_valid_date.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span>
+ <span ng-show="packForm.end_valid_date.$error.required" ng-bind="mandatoryFieldErrorMsg('End valid date')" class="ng-binding">'End valid date' is required.</span>
+ <span ng-show="packForm.end_valid_date.$error.min" ng-bind="field1ShouldBeGreaterThanField2('End date', 'Init date')" class="ng-binding ng-hide">End date should be greater than Init date</span>
+ </div>
+</div>
+</div>
+
+<div class="form-group">
+<label class="col-md-3 control-label" for="num_licenses" i18n="">Num.
+ Licenses</label>
+<div class="col-md-8">
+ <input type="number" id="num_licenses" name="num_licenses" placeholder="" class="form-control ng-pristine ng-untouched ng-valid ng-valid-required" ng-model="pack.num_licenses" ng-required="mandatory.num_licenses" required="required">
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.num_licenses.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span> <span ng-show="packForm.num_licenses.$error.maxlength" ng-bind="maxLengthErrorMsg('Num. Licenses', maxlength.num_licenses)" class="ng-binding ng-hide">Num. Licenses length is too long (max: undefined).</span>
+ <span ng-show="packForm.num_licenses.$error.required" ng-bind="mandatoryFieldErrorMsg('Num. Licenses')" class="ng-binding ng-hide">'Num. Licenses' is required.</span>
+ </div>
+</div>
+</div>
+
+<!-- ngIf: !isNew -->
+
+<div class="form-group">
+<label class="col-md-3 control-label" for="license_type_id" i18n="">License
+ type</label>
+<div class="col-md-8">
+ <!-- ngIf: isNew --><select ng-if="isNew" class="form-control ng-pristine ng-untouched ng-scope ng-invalid ng-invalid-required" id="license_type_id" ng-change="updateMetadata()" ng-required="mandatory.license_type_id" ng-model="pack.license_type_id" ng-options="o.id as o.label for o in refs.license_type_id" required="required"><option value="" selected="selected" label=""></option><option value="0" label="CI ConfigServer ext">CI ConfigServer ext</option><option value="1" label="Analytic2">Analytic2</option><option value="2" label="Doxr L2">Doxr L2</option><option value="3" label="Doxr L3">Doxr L3</option><option value="4" label="CurisIntegrity - Desktop">CurisIntegrity - Desktop</option><option value="5" label="CurisIntegrity SA">CurisIntegrity SA</option><option value="6" label="Analytic1">Analytic1</option><option value="7" label="CurisIntegrity - List of modes">CurisIntegrity - List of modes</option><option value="8" label="CurisIntegrity for Curistec">CurisIntegrity for Curistec</option><option value="9" label="CurisIntegrity for BP">CurisIntegrity for BP</option><option value="10" label="CD_AllMod_AllCemtest_Custom_0U">CD_AllMod_AllCemtest_Custom_0U</option><option value="11" label="CurisIntegrity StandAlone - A1CPC">CurisIntegrity StandAlone - A1CPC</option><option value="12" label="CD_AllMod_AllCemtest_MIDtest_Custom_0U">CD_AllMod_AllCemtest_MIDtest_Custom_0U</option><option value="13" label="CI SA Complete">CI SA Complete</option><option value="14" label="CI for Dev Complete">CI for Dev Complete</option><option value="15" label="CD_RockMod_MIDtest_MIDSynth_Express_50U">CD_RockMod_MIDtest_MIDSynth_Express_50U</option><option value="16" label="CurisData for Sonatrach">CurisData for Sonatrach</option><option value="17" label="CD_AllMod_Alltest_Full_100_L_0S_0U">CD_AllMod_Alltest_Full_100_L_0S_0U</option><option value="18" label="CD_CementAdvMod_AllCemtest_Custom_100L_0S_0U">CD_CementAdvMod_AllCemtest_Custom_100L_0S_0U</option><option value="19" label="CD_CementAdvMod_AllCemtest_Custom_30U">CD_CementAdvMod_AllCemtest_Custom_30U</option><option value="20" label="CD_CementAdvMod_30U_10L_Express">CD_CementAdvMod_30U_10L_Express</option><option value="21" label="CD_CementAdv_Monolab">CD_CementAdv_Monolab</option><option value="22" label="Stand alone - MultiComputation">Stand alone - MultiComputation</option><option value="23" label="MultiCement">MultiCement</option><option value="24" label="CD_CementAdvMod_AllCemtest_Custom_100U">CD_CementAdvMod_AllCemtest_Custom_100U</option><option value="25" label="CI StandAlone A1">CI StandAlone A1</option><option value="26" label="CI StandAlone A1 A2 QL CementProperties">CI StandAlone A1 A2 QL CementProperties</option><option value="27" label="CI Corporate A1">CI Corporate A1</option><option value="28" label="CI Demo version">CI Demo version</option><option value="29" label="CD Complete">CD Complete</option></select><!-- end ngIf: isNew -->
+ <!-- ngIf: !isNew -->
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.license_type_id.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span> <span ng-show="packForm.license_type_id.$error.required" ng-bind="mandatoryFieldErrorMsg('License type')" class="ng-binding ng-hide">'License type' is required.</span>
+ </div>
+</div>
+</div>
+
+<div class="form-group">
+<label class="col-md-3 control-label" for="organization_id" i18n="">Organization</label>
+<div class="col-md-8">
+ <!-- ngIf: isNew --><select ng-if="isNew" class="form-control ng-pristine ng-untouched ng-scope ng-invalid ng-invalid-required" ng-model="pack.organization_id" ng-required="mandatory.organization_id" ng-options="o.id as o.label for o in refs.organization_id" required="required"><option value="" selected="selected" label=""></option><option value="0" label="British Petroleum">British Petroleum</option><option value="1" label="CurisTec">CurisTec</option><option value="2" label="KindSoft">KindSoft</option><option value="3" label="CurisIT">CurisIT</option><option value="4" label="Trican">Trican</option><option value="5" label="Schlumberger">Schlumberger</option><option value="6" label="Sonatrach">Sonatrach</option><option value="7" label="Sanjel-Taqa">Sanjel-Taqa</option><option value="8" label="National Petroleum Services Saudi Arabia Int.">National Petroleum Services Saudi Arabia Int.</option></select><!-- end ngIf: isNew -->
+ <!-- ngIf: !isNew -->
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.organization_id.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span> <span ng-show="packForm.organization_id.$error.required" ng-bind="mandatoryFieldErrorMsg('Organization')" class="ng-binding ng-hide">'Organization' is required.</span>
+ </div>
+</div>
+</div>
+<div class="form-group">
+<label class="col-md-3 control-label" for="license_preactivation" i18n="">License preactivation</label>
+<div class="col-md-8">
+ <input type="checkbox" class="form-control ng-pristine ng-untouched ng-valid" ng-model="pack.license_preactivation">
+</div>
+</div>
+<div class="form-group">
+<label class="col-md-3 control-label" for="preactivation_valid_period" i18n="">Preactivation valid period (days)</label>
+<div class="col-md-8">
+ <input type="number" id="preactivation_valid_period" name="preactivation_valid_period" min="1" class="form-control ng-pristine ng-untouched ng-valid ng-valid-min ng-valid-required" ng-model="pack.preactivation_valid_period" ng-required="pack.license_preactivation" required="required">
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.preactivation_valid_period.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span>
+ <span ng-show="packForm.preactivation_valid_period.$error.required" ng-bind="mandatoryFieldErrorMsg('Preactivation valid period')" class="ng-binding ng-hide">'Preactivation valid period' is required.</span>
+ <span ng-show="packForm.preactivation_valid_period.$error.min" ng-bind="field1ShouldBeGreaterThanField2('The preactivation valid period', '0')" class="ng-binding ng-hide">The preactivation valid period should be greater than 0</span>
+ </div>
+</div>
+</div>
+<div class="form-group">
+<label class="col-md-3 control-label" for="renew_valid_period" i18n="">Period for renew (days)</label>
+<div class="col-md-8">
+ <input type="number" id="renew_valid_period" name="renew_valid_period" min="0" class="form-control ng-pristine ng-untouched ng-valid-min ng-valid ng-valid-required" ng-model="pack.renew_valid_period" ng-required="true" required="required">
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.renew_valid_period.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span>
+ <span ng-show="packForm.renew_valid_period.$error.required" ng-bind="mandatoryFieldErrorMsg('Period for renew')" class="ng-binding ng-hide">'Period for renew' is required.</span>
+ <span ng-show="packForm.renew_valid_period.$error.min" ng-bind="field1ShouldBeGreaterThanField2('The period for renew valid period', '0')" class="ng-binding ng-hide">The period for renew valid period should be greater than 0</span>
+ </div>
+</div>
+</div>
+
+
+<div class="form-group">
+<label class="col-md-3 control-label" for="comments" i18n="">Comments</label>
+<div class="col-md-8">
+ <textarea type="string" id="comments" name="comments" placeholder="" class="form-control ng-pristine ng-untouched ng-valid ng-valid-maxlength ng-valid-required" ng-model="pack.comments" rows="2" ng-required="mandatory.comments" ng-maxlength="1024"></textarea>
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.comments.$invalid">
+ <span class="glyphicon glyphicon-warning-sign"></span> <span ng-show="packForm.comments.$error.maxlength" ng-bind="maxLengthErrorMsg('Comments', maxlength.comments)" class="ng-binding ng-hide">Comments length is too long (max: 1024).</span>
+ <span ng-show="packForm.comments.$error.required" ng-bind="mandatoryFieldErrorMsg('comments')" class="ng-binding ng-hide">'comments' is required.</span>
+ </div>
+</div>
+</div>
+
+<!-- ngIf: !isNew -->
+
+<!-- ngIf: !isNew -->
+
+<div class="form-group">
+<label class="col-md-3 control-label" i18n="">Metadata</label>
+<div class="col-md-8">
+ <table class="table table-hover table-condensed">
+ <thead>
+ <tr>
+ <th i18n="">Key</th>
+ <th i18n="">Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ <!-- ngRepeat: row_md in pack.metadata -->
+ </tbody>
+ </table>
+</div>
+</div>
+
+<div class="form-group">
+<div class="col-md-offset-3 col-md-10">
+ <button id="save" type="submit" class="btn btn-primary">
+ <span i18n="" class="glyphicon glyphicon-floppy-disk"></span> Save
+ </button>
+ <!-- ngIf: !isNew -->
+ <ul class="dropdown-menu" role="menu">
+ <li><!-- ngIf: Packs.isActionAvailable('activate', pack) --><a ng-click="execute('activate')" ng-if="Packs.isActionAvailable('activate', pack)" href="#" class="ng-scope">Activate</a><!-- end ngIf: Packs.isActionAvailable('activate', pack) --></li>
+ <li><!-- ngIf: Packs.isActionAvailable('putonhold', pack) --></li>
+ <li class="divider"></li>
+ <li><!-- ngIf: Packs.isActionAvailable('cancel', pack) --></li>
+ <li><!-- ngIf: Packs.isActionAvailable('delete', pack) --><a ng-click="execute('delete')" ng-if="Packs.isActionAvailable('delete', pack)" href="#" class="ng-scope">Delete</a><!-- end ngIf: Packs.isActionAvailable('delete', pack) --></li>
+ </ul>
+</div>
+</div>
+</form>
\ No newline at end of file
diff --git a/securis/src/main/webapp/src/app/login.form.component.ts b/securis/src/main/webapp/src/app/login.form.component.ts
index 7de13b0..0994685 100644
--- a/securis/src/main/webapp/src/app/login.form.component.ts
+++ b/securis/src/main/webapp/src/app/login.form.component.ts
@@ -19,12 +19,14 @@
public constructor(private toaster: ToastsManager,
private router: Router,
private userService: UserService) {
+ this.data.username = 'admin';
+ this.data.password = 'securis';
}
public login() {
this.userService.login(this.data.username, this.data.password).subscribe(
- token => this.toaster.info('Hola'),
- err => this.toaster.error('Hubo un error: ' + err));
+ token => this.router.navigateByUrl("packs"),
+ errMsg => this.toaster.error(errMsg, 'Login error'));
}
public clear() {
diff --git a/securis/src/main/webapp/src/app/login.form.html b/securis/src/main/webapp/src/app/login.form.html
index 3d9d09e..a7db464 100644
--- a/securis/src/main/webapp/src/app/login.form.html
+++ b/securis/src/main/webapp/src/app/login.form.html
@@ -1,25 +1,51 @@
-<md-card>
- <md-card-title layout="row" layout-align="start end"><md-icon class="md-icon-logo" svgSrc="assets/icons/logo.svg"></md-icon> <span class="md-app-title" i18n>
- SeCuris Login</span></md-card-title>
- <md-card-subtitle>Sign in via your current SeCuris account</md-card-subtitle>
- <md-divider></md-divider>
- <md-card-content>
- <form #loginForm="ngForm" class="inset">
- <div layout="row">
- <md-input-container>
- <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
- </md-input-container>
- </div>
- <div layout="row">
- <md-input-container>
- <input mdInput (keyup.enter)="loginForm.form.valid && login()" flex placeholder="Password" type="password" [(ngModel)]="data.password" name="password" required/>
- </md-input-container>
- </div>
- </form>
- <div id="invalid-auth-msg" *ngIf="invalidError" class="tc-red-600 text-center" flex i18n>The username or password is incorrect. Please try again.</div>
- </md-card-content>
- <md-divider></md-divider>
- <md-card-actions>
- <button flex [disabled]="!loginForm.form.valid" md-raised-button color="primary" (click)="login()">Sign In</button>
- </md-card-actions>
-</md-card>
\ No newline at end of file
+<td-layout-card-over>
+ <md-toolbar role="toolbar" class="mat-secondary">
+ <div class="mat-toolbar-layout">
+ <md-toolbar-row class="mat-toolbar-row">SeCuris Sign in</md-toolbar-row>
+ </div>
+ </md-toolbar>
+ <div class="margin" layout-align-gt-xs="center start" layout-fill="" layout-gt-xs="row">
+ <div flex-gt-xs="70">
+
+ <md-card>
+ <md-card-title>
+ <div layout="row" layout-align="center center">
+ <md-icon class="login-logo" svgIcon="assets:logo"></md-icon>
+ </div>
+ </md-card-title>
+ <md-card-subtitle>
+ <div layout="row" layout-align="center center" i18n>
+ Sign in via your current SeCuris account
+ </div>
+ </md-card-subtitle>
+ <md-divider></md-divider>
+ <md-card-content>
+ <form #loginForm="ngForm" class="inset" (keyup.enter)="login()">
+ <div layout="column" layout-align="start center">
+ <div layout="row" layout-align="start center">
+ <md-icon class="form-icon">face</md-icon>
+ <md-input-container class="md-icon-float">
+ <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
+ </md-input-container>
+ </div>
+ <div layout="row" layout-align="start center">
+ <md-icon class="form-icon">vpn_key</md-icon>
+ <md-input-container class="md-icon-float">
+ <input mdInput (keyup.enter)="loginForm.form.valid && false" flex placeholder="Password" type="password" [(ngModel)]="data.password"
+ name="password" required/>
+ </md-input-container>
+ </div>
+ </div>
+ </form>
+ <div id="invalid-auth-msg" *ngIf="invalidError" class="tc-red-600 text-center" flex i18n>The username or password is incorrect. Please try again.</div>
+ </md-card-content>
+ <md-divider></md-divider>
+ <md-card-actions>
+ <div layout="row" layout-align="center center" class="margin">
+ <button flex="50" [disabled]="!loginForm.form.valid" md-raised-button color="primary" (click)="login()">Sign In</button>
+ </div>
+ </md-card-actions>
+ </md-card>
+ </div>
+ </div>
+</td-layout-card-over>
\ No newline at end of file
diff --git a/securis/src/main/webapp/src/app/pack.list.component.html b/securis/src/main/webapp/src/app/pack.list.component.html
index a2d59b6..7637a3f 100644
--- a/securis/src/main/webapp/src/app/pack.list.component.html
+++ b/securis/src/main/webapp/src/app/pack.list.component.html
@@ -1,112 +1,26 @@
-<td-layout-nav-list #navList
- logo="assets:covalent"
- toolbarTitle="Email App"
- class="light-blue-red"
- [opened]="media.registerQuery('gt-sm') | async"
- [mode] = "side"
- [sidenavWidth]="(media.registerQuery('gt-xs') | async) ? '350px' : '100%'">
- <div td-toolbar-content layout="row" layout-align="start center" flex>
- <span flex *ngIf="!searchBox.searchVisible"></span>
- <td-search-box #searchBox backIcon="arrow_back" class="pull-top-sm pull-bottom-sm" placeholder="Search here" flex>
+<md-toolbar role="toolbar" class="mat-secondary">
+ <span class="push-left-sm">
+ <span class="md-title" i18n>License Packs</span>
+ </span>
+ <span class="push-left-sm" *ngIf="filteredItems < data.length">
+ <span class="md-body-1">{{filteredItems}} of {{data.length}} packs filtered</span>
+ </span>
+ <td-search-box #searchBox class="push-right-sm" placeholder="Search here" (searchDebounce)="search($event)" flex>
</td-search-box>
- <button md-icon-button [mdMenuTriggerFor]="notificationsMenu">
- <td-notification-count color="accent" [notifications]="4">
- <md-icon>apps</md-icon>
- </td-notification-count>
+ <button md-mini-fab color="accent" (click)="createPack()">
+ <md-icon>add</md-icon>
</button>
- <md-menu #notificationsMenu="mdMenu">
- <td-menu>
- <div td-menu-header class="md-subhead">Templates</div>
- <md-nav-list dense>
- <a md-list-item [routerLink]="['/templates']">
- <md-icon md-list-avatar>system_update_alt</md-icon>
- <h4 md-line><span class="text-wrap">Landing Page</span></h4>
- <p md-line>a landing page template</p>
- </a>
- <md-divider></md-divider>
- <a md-list-item [routerLink]="['/templates/dashboard']">
- <md-icon md-list-avatar>dashboard</md-icon>
- <h4 md-line><span class="text-wrap">Dashboard</span></h4>
- <p md-line>an ngx-charts dashboard template</p>
- </a>
- <md-divider></md-divider>
- <a md-list-item [routerLink]="['/templates/email']">
- <md-icon md-list-avatar>email</md-icon>
- <h4 md-line><span class="text-wrap">Email App</span></h4>
- <p md-line>an email app template</p>
- </a>
- <md-divider></md-divider>
- <a md-list-item [routerLink]="['/templates/editor']">
- <md-icon md-list-avatar>view_array</md-icon>
- <h4 md-line><span class="text-wrap">IDE Editor</span></h4>
- <p md-line>an IDE text editor app template</p>
- </a>
- </md-nav-list>
- <a md-button color="accent" td-menu-footer href="https://github.com/Teradata/covalent-quickstart/tree/develop/src/app/templates" target="_blank">
- View Code
- </a>
- </td-menu>
- </md-menu>
- <a md-icon-button mdTooltip="View this code" href="https://github.com/Teradata/covalent-quickstart/tree/develop/src/app/templates" target="_blank"><md-icon svgIcon="assets:github"></md-icon></a>
- </div>
- <a md-fab td-sidenav-content color="accent" class="md-fab-position-bottom-right" style="bottom:20px; position: fixed;">
- <md-icon>add</md-icon>
- </a>
- <md-nav-list td-sidenav-content >
- <template let-i="index" let-last="last" let-hero ngFor [ngForOf]="heroes" [ngForTrackBy]="trackById">
- <a md-list-item>
- <img md-list-avatar src="http://lorempixel.com/40/40/people/{{i+1}}" />
- <h3 md-line> {{hero.name}} </h3>
- <p md-line> Hero ID is: {{hero.id}} </p>
- <md-icon class="tc-amber-800">fiber_new</md-icon>
- </a>
- <md-divider *ngIf="!last" md-inset></md-divider>
- </template>
- </md-nav-list>
- <md-card tdMediaToggle="gt-xs" [mediaClasses]="['side']">
- <md-card-header>
- <img md-card-avatar src="http://lorempixel.com/40/40/people/9" />
- <md-card-title>Firstname Lastname</md-card-title>
- <md-card-subtitle>Tuesday, January 3 2017 at 8:39 PM</md-card-subtitle>
- <span flex></span>
- <div class="pad-top pad-right">
- <button md-icon-button><md-icon>reply</md-icon></button>
- <button md-icon-button><md-icon>forward</md-icon></button>
- <button md-icon-button><md-icon>more_vert</md-icon></button>
- </div>
- </md-card-header>
- <md-divider></md-divider>
- <div class="md-padding">
- <p>
- Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment.
- </p>
- <p>
- Bring to the table win-win survival strategies to ensure proactive domination. At the end of the day, going forward, a new normal that has evolved from generation X is on the runway heading towards a streamlined cloud solution. User generated content in real-time will have multiple touchpoints for offshoring.
- </p>
- <p>
- Capitalize on low hanging fruit to identify a ballpark value added activity to beta test. Override the digital divide with additional clickthroughs from DevOps. Nanotechnology immersion along the information highway will close the loop on focusing solely on the bottom line.
- </p>
- <p>
- Podcasting operational change management inside of workflows to establish a framework. Taking seamless key performance indicators offline to maximise the long tail. Keeping your eye on the ball while performing a deep dive on the start-up mentality to derive convergence on cross-platform integration.
- </p>
- <p>
- Sincerly<br>-Kimmie
- </p>
- </div>
- <md-divider></md-divider>
- <div layout="row" layout-align="space-around center" class="pad">
- <button md-button class="tc-grey-600">
- <md-icon class="pull-bottom">reply</md-icon>
- <div class="md-caption">Reply</div>
- </button>
- <button md-button class="tc-grey-600">
- <md-icon class="pull-bottom">reply_all</md-icon>
- <div class="md-caption">Reply All</div>
- </button>
- <button md-button class="tc-grey-600">
- <md-icon class="pull-bottom">forward</md-icon>
- <div class="md-caption">Forward</div>
- </button>
- </div>
- </md-card>
-</td-layout-nav-list>
\ No newline at end of file
+</md-toolbar>
+<md-divider></md-divider>
+<td-data-table
+ [data]="filteredData"
+ [columns]="columns"
+ [sortable]="true"
+ [sortBy]="sortBy"
+ [sortOrder]="sortOrder"
+ (sortChange)="sort($event)">
+</td-data-table>
+<td-paging-bar #pagingBar [pageSizes]="[10, 20, 40]" [total]="filteredTotal" (change)="page($event)">
+ <span td-paging-bar-label hide-xs>Rows per page:</span>
+ {{pagingBar.range}} <span hide-xs>of {{pagingBar.total}}</span>
+</td-paging-bar>
diff --git a/securis/src/main/webapp/src/app/pack.list.component.ts b/securis/src/main/webapp/src/app/pack.list.component.ts
index 2355901..8b883a0 100644
--- a/securis/src/main/webapp/src/app/pack.list.component.ts
+++ b/securis/src/main/webapp/src/app/pack.list.component.ts
@@ -1,83 +1,119 @@
-import { Hero } from './hero';
+import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
+import { IPageChangeEvent } from '@covalent/core';
import { Component, AfterViewInit } from '@angular/core';
import { TdMediaService } from '@covalent/core';
+import { PacksService } from './resources/packs';
-
-const HEROES: Hero[] = [
- { id: 11, name: 'Mr. Nice' },
- { id: 12, name: 'Narco' },
- { id: 13, name: 'Bombasto' },
- { id: 14, name: 'Celeritas' },
- { id: 15, name: 'Magneta' },
- { id: 16, name: 'RubberMan' },
- { id: 17, name: 'Dynama' },
- { id: 18, name: 'Dr IQ' },
- { id: 19, name: 'Magma' },
- { id: 20, name: 'Tornado' }
-];
+var pack_example = {
+ id: 7,
+ code: 'DX250000',
+ status: 'AC',
+ application_name: 'Doxr',
+ created_by_id: 'admin',
+ created_by_name: 'Administrator (admin)',
+ creation_timestamp: 1440597540000,
+ end_valid_date: 2051222400000,
+ init_valid_date: 1440547200000,
+ license_preactivation: true,
+ license_type_id: 5,
+ licensetype_code: 'DXL3',
+ metadata:
+ [ { key: 'max_docs',
+ value: '250000',
+ readonly: true,
+ mandatory: true,
+ pack_id: 7 } ],
+ num_activations: 7,
+ num_available: -2,
+ num_creations: 7,
+ num_licenses: 5,
+ organization_id: 2,
+ organization_name: 'CurisTec',
+ preactivation_valid_period: 70,
+ renew_valid_period: 0,
+}
@Component({
selector: 'pack-list',
templateUrl: 'src/app/pack.list.component.html'
})
-
- /*`
- <h2>My Heroes</h2>
- <ul class="heroes">
- <li *ngFor="let hero of heroes"
- [class.selected]="hero === selectedHero"
- (click)="onSelect(hero)">
- <span class="badge">{{hero.id}}</span> {{hero.name}}
- </li>
- </ul>
-<div *ngIf="selectedHero">
- <my-hero-detail [hero]="selectedHero"></my-hero-detail>
-</div>
-
- `*/
-
export class PackListComponent implements AfterViewInit {
- routes: Object[] = [
- {
- title: 'Dashboard',
- route: '/',
- icon: 'dashboard',
- }, {
- title: 'Product Dashboard',
- route: '/',
- icon: 'view_quilt',
- }, {
- title: 'Product Logs',
- route: '/',
- icon: 'receipt',
- }, {
- title: 'Manage Users',
- route: '/',
- icon: 'people',
- }, {
- title: 'Covalent Templates',
- route: '/',
- icon: 'view_module',
- },
- ];
+ data: any[] = [];
+ columns: ITdDataTableColumn[] = [
+ { name: 'code', label: 'Code', tooltip: 'License pack code' },
+ { name: 'application_name', label: 'App name' },
+ { name: 'licensetype_code', label: 'License type' },
+ { name: 'organization_name', label: 'Organization' },
+ { name: 'num_licenses', label: 'Lic', numeric: true, tooltip: 'Initial pack licenses' },
+ { name: 'num_available', label: 'Ava', numeric: true, tooltip: 'Available licenses' },
+ ];
- title = 'Tour of Heroes';
- heroes = HEROES;
- selectedHero: Hero;
- hero: Hero = {
- id: 1,
- name: 'Windstorm'
- };
+ filteredData: any[] = this.data;
+ filteredTotal: number = this.data.length;
- constructor(public media: TdMediaService) {
-
+ searchTerm: string = '';
+ fromRow: number = 1;
+ currentPage: number = 1;
+ pageSize: number = 10;
+ sortBy: string = 'application_name';
+ sortOrder: TdDataTableSortingOrder = TdDataTableSortingOrder.Descending;
+ filteredItems = this.data.length;
+
+ constructor(private _dataTableService: TdDataTableService,
+ private media: TdMediaService,
+ private packs: PacksService) {
+ this.packs.get().subscribe(
+ list => {
+ this.data = list;
+ this.filter();
+ },
+ err => console.error(err)
+ );
}
- onSelect(hero: Hero): void {
- this.selectedHero = hero;
+ ngOnInit(): void {
+ this.filter();
+ }
+
+ createPack() : void {
+
+ }
+
+ sort(sortEvent: ITdDataTableSortChangeEvent): void {
+ this.sortBy = sortEvent.name;
+ this.sortOrder = sortEvent.order;
+ this.filter();
+ }
+
+ search(searchTerm: string): void {
+ this.searchTerm = searchTerm;
+ this.filter();
+ }
+
+ page(pagingEvent: IPageChangeEvent): void {
+ this.fromRow = pagingEvent.fromRow;
+ this.currentPage = pagingEvent.page;
+ this.pageSize = pagingEvent.pageSize;
+ this.filter();
+ }
+
+ loadData() {
+
+ }
+
+ filter(): void {
+ let newData: any[] = this.data;
+ newData = this._dataTableService.filterData(newData, this.searchTerm, true);
+ this.filteredTotal = newData.length;
+ this.filteredItems = newData.length;
+ newData = this._dataTableService.sortData(newData, this.sortBy, this.sortOrder);
+ newData = this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize);
+ this.filteredData = newData;
}
ngAfterViewInit(): void {
- this.media.broadcast();
+ this.media.broadcast();
+
}
}
+
diff --git a/securis/src/main/webapp/src/app/resources/applications.ts b/securis/src/main/webapp/src/app/resources/applications.ts
new file mode 100644
index 0000000..d214bed
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/applications.ts
@@ -0,0 +1,26 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var app_example = { code: 'CICS',
+ creation_timestamp: 1418384439000,
+ description: 'Wellbore integrity analysis software',
+ id: 1,
+ license_filename: 'config_server.lic',
+ metadata:
+ [ { key: 'simulationModes',
+ value: 'A1,A2,A3,QL,N1,QLPRO',
+ creation_timestamp: 1418384439000,
+ mandatory: true } ],
+ name: 'CurisIntegrity' }
+
+@Injectable()
+export class ApplicationsService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'application');
+ }
+
+
+}
+
diff --git a/securis/src/main/webapp/src/app/resources/base.ts b/securis/src/main/webapp/src/app/resources/base.ts
new file mode 100644
index 0000000..4f79cc2
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/base.ts
@@ -0,0 +1,49 @@
+import { Observable } from 'rxjs/Observable';
+import { Http, RequestOptionsArgs, URLSearchParams } from '@angular/http';
+
+class MySearchParams extends URLSearchParams {
+ constructor(obj : any) {
+ var searchQuery = Object.keys(obj).map(key => `${key}=${encodeURIComponent(obj[key])}`).join('&');
+ super(searchQuery);
+ }
+}
+
+export class SeCurisResourceServices {
+ constructor(protected http: Http,
+ protected resource: string) {
+ }
+
+ public get(id?: any) : Observable<any> {
+ let url = `${this.resource}/${id || ''}`;
+ return this.http.get(url).map(response => response.json());
+ }
+
+ public create(data: any) : Observable<any> {
+ let url = `${this.resource}`;
+ return this.http.post(url, JSON.stringify(data)).map(response => response.json());
+ }
+
+ public modify(id: any, data: any) : Observable<any> {
+ let url = `${this.resource}/${id}`;
+ return this.http.post(url, JSON.stringify(data)).map(response => response.json());
+ }
+
+ public remove(id: any) : Observable<any> {
+ let url = `${this.resource}/${id}`;
+ return this.http.delete(url).map(response => response.json());
+ }
+
+ public action(id: any, action: string, method = 'POST') : Observable<any> {
+ let url = `${this.resource}/${id}/${action}`;
+ var params = {
+ action: action
+ }
+ var options:RequestOptionsArgs = {
+ url: url,
+ method: method,
+ search: (method == 'GET') && new MySearchParams(params) || undefined,
+ body: (method == 'POST') && JSON.stringify(params) || undefined
+ };
+ return this.http.request(url, options).map(response => response.json());
+ }
+}
\ No newline at end of file
diff --git a/securis/src/main/webapp/src/app/resources/license_types.ts b/securis/src/main/webapp/src/app/resources/license_types.ts
new file mode 100644
index 0000000..cc6b700
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/license_types.ts
@@ -0,0 +1,24 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var lictype_example = { application_name: 'CurisIntegrity',
+ code: 'CIA2',
+ creation_timestamp: 1437145151000,
+ description: 'Modified after bug',
+ id: 2,
+ metadata: [ { key: 'datasetPrefix', value: '', mandatory: true } ],
+ name: 'Analytic2' }
+
+
+@Injectable()
+export class LicenseTypesService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'licensetype');
+ }
+
+
+
+}
+
diff --git a/securis/src/main/webapp/src/app/resources/licenses.ts b/securis/src/main/webapp/src/app/resources/licenses.ts
new file mode 100644
index 0000000..2cab46d
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/licenses.ts
@@ -0,0 +1,98 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var lic_example = {
+ id: 101,
+ activation_code: 'f3e2d27e-7f81-4ac7-87ba-b9e38b4fdbb8',
+ code: 'CITR01-436-1',
+ code_suffix: 1,
+ created_by_id: '_client',
+ creation_timestamp: 1445898088000,
+ email: 'GQuercia@trican.ca',
+ expiration_date: 1487523828000,
+ full_name: 'George Quercia',
+ licenseData: '{"appCode":"CICS","appName":"CurisIntegrity","licenseCode":"CITR01-436-1","activationCode":"f3e2d27e-7f81-4ac7-87ba-b9e38b4fdbb8","expirationDate":1487523828416,"arch":"amd64","osName":"Windows 7","macAddresses":["C4-D9-87-5D-53-72","C4-D9-87-5D-53-76","FC-15-B4-EB-70-F9"],"crcLogo":"10f6379e0e1c00ebc403160307e3c5d0aba0727c9cae0bf1ac7cd19d84fdc80f","metadata":{"a2Mode":"false","datasetPrefix":"TR","extendedMode":"false","maxConcurrentInstances":"-1","maxInstances":"3","maxUsers":"0","maxWellLifeLines":"50","timeThreshold":"0"},"signature":"cjyLYFyhXpWWsMNnG6ER9mtCREgw02aQDnXPSQQWZtiLWbu/GyHZzK+1msLhwuKMGYG6I90s5wp82HVIqhIheHOsov3JfnHgNtYzf3BdkqUinwPFuDqPqkXz5Sjb6bouWkmvTI1TN/s4U2DJOXVnYN4FnYl0/dBTcU9RP4NZlQxMu6oFuRrZSMfdMCxEJYZAU62SWgTSurkdmHhFgwRjIwsOXRWHYsr6vGT//yILI7UvMGbMc6dRCGwyJLPNi4nXwF9PRMLinB7fYK8HxKylTJx2O7bvWCZd6EOdwi6gRI/0HhOqZ7E4DzBDrqEnsHeuH4L47DfRdIMGDnA492F+mg=="}',
+ modification_timestamp: 1484931828000,
+ pack_code: 'CITR01',
+ pack_id: 12,
+ request_data: '{"appCode":"CICS","activationCode":"f3e2d27e-7f81-4ac7-87ba-b9e38b4fdbb8","arch":"amd64","osName":"Windows 7","macAddresses":["C4-D9-87-5D-53-72","C4-D9-87-5D-53-76","FC-15-B4-EB-70-F9"],"crcLogo":"10f6379e0e1c00ebc403160307e3c5d0aba0727c9cae0bf1ac7cd19d84fdc80f"}',
+ status: 'AC'
+}
+
+export const PACK_STATUS = {
+ CREATED: 'CR',
+ ACTIVE: 'AC',
+ ONHOLD: 'OH',
+ EXPIRED: 'EX',
+ CANCELLED: 'CA'
+}
+
+export const LIC_STATUS = {
+ CREATED: 'CR',
+ ACTIVE: 'AC',
+ REQUESTED: 'RE',
+ PREACTIVE: 'PA',
+ EXPIRED: 'EX',
+ BLOCKED: 'BL',
+ CANCELLED: 'CA'
+}
+
+export const LIC_STATUSES = {
+ 'CR': 'Created',
+ 'AC': 'Active',
+ 'PA': 'Pre-active',
+ 'RE': 'Requested',
+ 'EX': 'Expired',
+ 'BL': 'Blocked',
+ 'CA': 'Cancelled'
+};
+
+/**
+ * These transitions could be get from server, class License.Status, but
+ * we copy them for simplicity, this info won't change easily
+ */
+export const LIC_ACTIONS_BY_STATUS = {
+ edit: [LIC_STATUS.REQUESTED, LIC_STATUS.CREATED, LIC_STATUS.EXPIRED, LIC_STATUS.PREACTIVE, LIC_STATUS.ACTIVE, LIC_STATUS.CANCELLED, LIC_STATUS.BLOCKED],
+ add_request: [LIC_STATUS.CREATED],
+ activate: [LIC_STATUS.CREATED, LIC_STATUS.REQUESTED, LIC_STATUS.PREACTIVE],
+ send: [LIC_STATUS.ACTIVE, LIC_STATUS.PREACTIVE],
+ download: [LIC_STATUS.ACTIVE, LIC_STATUS.PREACTIVE],
+ block: [LIC_STATUS.CANCELLED],
+ unblock: [LIC_STATUS.BLOCKED],
+ cancel: [LIC_STATUS.REQUESTED, LIC_STATUS.EXPIRED, LIC_STATUS.PREACTIVE, LIC_STATUS.ACTIVE],
+ 'delete': [LIC_STATUS.CREATED, LIC_STATUS.CANCELLED, LIC_STATUS.BLOCKED]
+}
+
+
+
+@Injectable()
+export class LicensesService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'license');
+ }
+
+ public getByPack(packId: number) {
+ let url = `${this.resource}?packId=${packId}`;
+ return this.http.get(url).map(response => response.json());
+ }
+
+ public activate(id: number) {
+ return super.action(id, "activate");
+ }
+
+ public cancel(id: number) {
+ return super.action(id, "cancel");
+ }
+
+ public putonhold(id: number) {
+ return super.action(id, "putonhold");
+ }
+
+ public isActionAvailable(action:string, lic:any) {
+ var validStatuses = LIC_ACTIONS_BY_STATUS[action];
+ return lic && validStatuses && validStatuses.indexOf(lic.status) !== -1;
+ }
+}
+
diff --git a/securis/src/main/webapp/src/app/resources/organizations.ts b/securis/src/main/webapp/src/app/resources/organizations.ts
new file mode 100644
index 0000000..20b902a
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/organizations.ts
@@ -0,0 +1,20 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var org_example = { code: 'NPS',
+ creation_timestamp: 1488269722000,
+ id: 9,
+ name: 'National Petroleum Services Saudi Arabia Int.',
+ users_ids: [ 'admin' ] }
+
+@Injectable()
+export class OrganizationsService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'organization');
+ }
+
+
+}
+
diff --git a/securis/src/main/webapp/src/app/resources/packs.ts b/securis/src/main/webapp/src/app/resources/packs.ts
new file mode 100644
index 0000000..5caa552
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/packs.ts
@@ -0,0 +1,92 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var pack_example = {
+ id: 7,
+ code: 'DX250000',
+ status: 'AC',
+ application_name: 'Doxr',
+ created_by_id: 'admin',
+ created_by_name: 'Administrator (admin)',
+ creation_timestamp: 1440597540000,
+ end_valid_date: 2051222400000,
+ init_valid_date: 1440547200000,
+ license_preactivation: true,
+ license_type_id: 5,
+ licensetype_code: 'DXL3',
+ metadata:
+ [ { key: 'max_docs',
+ value: '250000',
+ readonly: true,
+ mandatory: true,
+ pack_id: 7 } ],
+ num_activations: 7,
+ num_available: -2,
+ num_creations: 7,
+ num_licenses: 5,
+ organization_id: 2,
+ organization_name: 'CurisTec',
+ preactivation_valid_period: 70,
+ renew_valid_period: 0,
+}
+
+export const PACK_STATUS = {
+ CREATED: 'CR',
+ ACTIVE: 'AC',
+ ONHOLD: 'OH',
+ EXPIRED: 'EX',
+ CANCELLED: 'CA'
+ }
+
+export const PACK_STATUSES = {
+ 'CR': 'Created',
+ 'AC': 'Active',
+ 'OH': 'On Hold',
+ 'EX': 'Expired',
+ 'CA': 'Cancelled'
+ };
+
+export const COLORS_BY_STATUS = {
+ 'CR': '#808080',
+ 'AC': '#329e5a',
+ 'OH': '#9047c7',
+ 'EX': '#ea7824',
+ 'CA': '#a21717'
+ };
+
+export const PACK_ACTIONS_BY_STATUS = {
+ edit: [PACK_STATUS.CREATED, PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD, PACK_STATUS.ACTIVE],
+ activate: [PACK_STATUS.CREATED, PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD],
+ putonhold: [PACK_STATUS.ACTIVE],
+ cancel: [PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD, PACK_STATUS.ACTIVE],
+ 'delete': [PACK_STATUS.CREATED, PACK_STATUS.CANCELLED]
+ }
+
+
+@Injectable()
+export class PacksService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'pack');
+ }
+
+ public activate(id: number) {
+ return super.action(id, "activate");
+ }
+
+ public cancel(id: number) {
+ return super.action(id, "cancel");
+ }
+
+ public putonhold(id: number) {
+ return super.action(id, "putonhold");
+ }
+
+ public isActionAvailable(action:string, pack:any) {
+ var validStatuses = PACK_ACTIONS_BY_STATUS[action];
+ return pack && validStatuses && validStatuses.indexOf(pack.status) !== -1;
+ }
+
+}
+
diff --git a/securis/src/main/webapp/src/app/resources/users.ts b/securis/src/main/webapp/src/app/resources/users.ts
new file mode 100644
index 0000000..b0f57ac
--- /dev/null
+++ b/securis/src/main/webapp/src/app/resources/users.ts
@@ -0,0 +1,26 @@
+import { Observable } from 'rxjs/Rx';
+import { Injectable } from '@angular/core';
+import { Http, RequestOptions } from '@angular/http';
+import { SeCurisResourceServices } from './base';
+
+var user_example = {
+ creation_timestamp: 1479898458000,
+ email: 'rbouchair@curistec.com',
+ first_name: 'Rym',
+ lastLogin: 1488885433000,
+ last_name: 'Bouchair',
+ modificationTimestamp: 1479898458000,
+ organizations_ids: [ 1, 2, 5, 6, 7, 8 ],
+ roles: [ 1 ],
+ username: 'rym' }
+
+
+@Injectable()
+export class UsersService extends SeCurisResourceServices {
+ constructor(http: Http) {
+ super(http, 'user');
+ }
+
+
+}
+
diff --git a/securis/src/main/webapp/src/app/user.service.ts b/securis/src/main/webapp/src/app/user.service.ts
index 38d842d..13466d2 100644
--- a/securis/src/main/webapp/src/app/user.service.ts
+++ b/securis/src/main/webapp/src/app/user.service.ts
@@ -1,3 +1,4 @@
+import { LocaleService } from './common/i18n';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Location } from '@angular/common';
@@ -11,7 +12,8 @@
@Injectable()
export class UserService {
- constructor(private router: Router,
+ constructor(private $L: LocaleService,
+ private router: Router,
private store: LocalStorageService,
private http: Http) {
@@ -22,14 +24,14 @@
params.append('username', username);
params.append('password', password);
let options = new RequestOptions({ headers: new Headers({ "Content-Type": "application/x-www-form-urlencoded" })});
- return this.http.post('user/login', params, options)
+ return this.http.post('user/login', params.toString(), options)
.map((res: Response) => {
let data = res.json();
this.store.set('username', username);
this.store.set('token', data.token);
return <string>data.token;
})
- .catch(this.handleError);
+ .catch((r) => this.handleError(r));
}
isLoggedIn() : Observable<Boolean> {
@@ -45,7 +47,7 @@
}
return body.valid;
})
- .catch(this.handleError)
+ .catch((r) => this.handleError(r))
.catch(() => Observable.of(false));
}
@@ -62,12 +64,21 @@
// In a real world app, we might use a remote logging infrastructure
let errMsg: string;
if (error instanceof Response) {
- const body = error.json() || '';
- const err = body.error || JSON.stringify(body);
+ const err = JSON.stringify(error);
errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
} else {
errMsg = error.message ? error.message : error.toString();
}
+
+ if (error.status === 403 /* forbidden */ || error.status === 401 /* unauthorized */) {
+ errMsg = this.$L.get('Invalid credentials');
+ } else if (error.status === 418 /* Teapot */) {
+ errMsg = this.$L.get(error.headers.get('X-SECURIS-ERROR-MSG'));
+ } else {
+ console.error(error);
+ errMsg = this.$L.get(`Unexpected error HTTP (${error.status}) accessing to server. Contact with the administrator.`);
+ }
+
console.error(errMsg);
return Observable.throw(errMsg);
}
diff --git a/securis/src/main/webapp/src/favicon.ico b/securis/src/main/webapp/src/favicon.ico
index 8081c7c..c1d9026 100644
--- a/securis/src/main/webapp/src/favicon.ico
+++ b/securis/src/main/webapp/src/favicon.ico
Binary files differ
--
Gitblit v1.3.2