rsanchez
2017-03-10 2762277c60db7df5ad3214b10a0dd93d4f2f1128
#3527 feature - Added more features to angular2 version
22 files added
18 files modified
changed files
securis/pom.xml patch | view | blame | history
securis/src/main/java/net/curisit/securis/DevFilter.java patch | view | blame | history
securis/src/main/java/net/curisit/securis/services/BasicServices.java patch | view | blame | history
securis/src/main/webapp/.vscode/settings.json patch | view | blame | history
securis/src/main/webapp/WEB-INF/web.xml patch | view | blame | history
securis/src/main/webapp/assets/favicon.png patch | view | blame | history
securis/src/main/webapp/assets/images/securis_100.png patch | view | blame | history
securis/src/main/webapp/assets/images/securis_40.png patch | view | blame | history
securis/src/main/webapp/assets/securis.css patch | view | blame | history
securis/src/main/webapp/assets/securis_logo.svg patch | view | blame | history
securis/src/main/webapp/assets/securis_logo_black.svg patch | view | blame | history
securis/src/main/webapp/assets/securis_logo_bw.svg patch | view | blame | history
securis/src/main/webapp/assets/securis_logo_white.svg patch | view | blame | history
securis/src/main/webapp/bs-config.json patch | view | blame | history
securis/src/main/webapp/index.html patch | view | blame | history
securis/src/main/webapp/index.jsp patch | view | blame | history
securis/src/main/webapp/package.json patch | view | blame | history
securis/src/main/webapp/src/app/app.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/app.home.html patch | view | blame | history
securis/src/main/webapp/src/app/app.module.ts patch | view | blame | history
securis/src/main/webapp/src/app/app.routes.ts patch | view | blame | history
securis/src/main/webapp/src/app/catalogs.json patch | view | blame | history
securis/src/main/webapp/src/app/common/default.requests.options.ts patch | view | blame | history
securis/src/main/webapp/src/app/common/i18n.ts patch | view | blame | history
securis/src/main/webapp/src/app/favicon.ico patch | view | blame | history
securis/src/main/webapp/src/app/forms/pack.form.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/forms/pack.form.html patch | view | blame | history
securis/src/main/webapp/src/app/login.form.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/login.form.html patch | view | blame | history
securis/src/main/webapp/src/app/pack.list.component.html patch | view | blame | history
securis/src/main/webapp/src/app/pack.list.component.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/applications.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/base.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/license_types.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/licenses.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/organizations.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/packs.ts patch | view | blame | history
securis/src/main/webapp/src/app/resources/users.ts patch | view | blame | history
securis/src/main/webapp/src/app/user.service.ts patch | view | blame | history
securis/src/main/webapp/src/favicon.ico patch | view | blame | history
securis/pom.xml
....@@ -3,7 +3,7 @@
33 <modelVersion>4.0.0</modelVersion>
44 <groupId>net.curisit</groupId>
55 <artifactId>securis-server</artifactId>
6
- <version>1.1.8</version>
6
+ <version>2.0.0</version>
77 <name>SeCuris</name>
88 <description>CurisTEC Server Licenses</description>
99 <dependencies>
securis/src/main/java/net/curisit/securis/DevFilter.java
....@@ -0,0 +1,50 @@
1
+package net.curisit.securis;
2
+
3
+import java.io.IOException;
4
+
5
+import javax.enterprise.context.ApplicationScoped;
6
+import javax.servlet.Filter;
7
+import javax.servlet.FilterChain;
8
+import javax.servlet.FilterConfig;
9
+import javax.servlet.ServletException;
10
+import javax.servlet.ServletRequest;
11
+import javax.servlet.ServletResponse;
12
+import javax.servlet.annotation.WebFilter;
13
+import javax.servlet.http.HttpServletRequest;
14
+import javax.servlet.http.HttpServletResponse;
15
+
16
+import org.apache.logging.log4j.LogManager;
17
+import org.apache.logging.log4j.Logger;
18
+
19
+@ApplicationScoped
20
+@WebFilter(urlPatterns = "/*")
21
+public class DevFilter implements Filter {
22
+
23
+ private static final Logger LOG = LogManager.getLogger(DevFilter.class);
24
+
25
+ @Override
26
+ public void init(FilterConfig fc) throws ServletException {
27
+ }
28
+
29
+ @Override
30
+ public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain fc) throws IOException, ServletException {
31
+ HttpServletRequest req = (HttpServletRequest) sreq;
32
+ HttpServletResponse res = (HttpServletResponse) sres;
33
+ // For dev. using JS in different server
34
+ res.addHeader("Access-Control-Allow-Origin", "*");
35
+ //res.addHeader("Access-Control-Request-Headers", "*");
36
+ res.addHeader("Access-Control-Allow-Methods", "GET, POST, PUT, OPTIONS");
37
+ res.addHeader("Access-Control-Allow-Headers", "X-SECURIS-TOKEN, Content-Type");
38
+ res.addHeader("Access-Control-Expose-Headers", "X-SECURIS-ERROR-MSG, X-SECURIS-ERROR-CODE, Content-Type");
39
+
40
+ LOG.info("Added header to: " + res.getHeaderNames());
41
+ if (!req.getMethod().equals("OPTIONS")) {
42
+ fc.doFilter(sreq, sres);
43
+ }
44
+ }
45
+
46
+ @Override
47
+ public void destroy() {
48
+ }
49
+
50
+}
securis/src/main/java/net/curisit/securis/services/BasicServices.java
....@@ -2,6 +2,8 @@
22
33 import java.net.URI;
44 import java.util.Date;
5
+import java.util.HashMap;
6
+import java.util.Map;
57
68 import javax.enterprise.context.ApplicationScoped;
79 import javax.inject.Inject;
....@@ -20,13 +22,13 @@
2022 import javax.ws.rs.core.Response.Status;
2123 import javax.ws.rs.core.UriBuilder;
2224
25
+import org.apache.logging.log4j.LogManager;
26
+import org.apache.logging.log4j.Logger;
27
+
2328 import net.curisit.integrity.commons.Utils;
2429 import net.curisit.securis.ioc.EnsureTransaction;
2530 import net.curisit.securis.security.Securable;
2631 import net.curisit.securis.utils.TokenHelper;
27
-
28
-import org.apache.logging.log4j.LogManager;
29
-import org.apache.logging.log4j.Logger;
3032
3133 /**
3234 * Basic services for login and basic app wrkflow
....@@ -37,93 +39,94 @@
3739 @ApplicationScoped
3840 public class BasicServices {
3941
40
- private static final Logger LOG = LogManager.getLogger(BasicServices.class);
42
+ private static final Logger LOG = LogManager.getLogger(BasicServices.class);
4143
42
- @Inject
43
- TokenHelper tokenHelper;
44
+ @Inject
45
+ TokenHelper tokenHelper;
4446
45
- @Inject
46
- public BasicServices() {
47
- }
47
+ @Inject
48
+ public BasicServices() {
49
+ }
4850
49
- @GET
50
- @Path("/info")
51
- @Produces({
52
- MediaType.TEXT_PLAIN
53
- })
54
- public Response info(@Context HttpServletRequest request) {
55
- return Response.ok().entity("License server running OK. Date: " + new Date()).build();
56
- }
51
+ @GET
52
+ @Path("/info")
53
+ @Produces({ MediaType.TEXT_PLAIN })
54
+ public Response info(@Context HttpServletRequest request) {
55
+ return Response.ok().entity("License server running OK. Date: " + new Date()).build();
56
+ }
5757
58
- @GET
59
- @Path("/{module:(admin)|(login)|(licenses)}")
60
- @Produces({
61
- MediaType.TEXT_HTML
62
- })
63
- public Response init(@PathParam("module") String module, @Context HttpServletRequest request) {
64
- LOG.info("App index main.html");
65
- String page = "/index.jsp";
66
- URI uri = UriBuilder.fromUri(page).build();
67
- return Response.seeOther(uri).build();
68
- }
58
+ @GET
59
+ @Path("/version")
60
+ @Produces({ MediaType.APPLICATION_JSON })
61
+ public Map<String, String> version(@Context HttpServletRequest request) {
62
+ Map<String, String> resp = new HashMap<>();
63
+ // TODO: Get the real version
64
+ String version = "2.0.0";
65
+ resp.put("version", version);
66
+ return resp;
67
+ }
6968
70
- @POST
71
- @Path("/login")
72
- @Produces({
73
- MediaType.APPLICATION_JSON
74
- })
75
- public Response login(@FormParam("username") String user, @FormParam("password") String password, @Context HttpServletRequest request) {
76
- LOG.info("is user in role: {} == {} ? ", "advance", request.isUserInRole("advance"));
69
+ @GET
70
+ @Path("/{module:(admin)|(login)|(licenses)}")
71
+ @Produces({ MediaType.TEXT_HTML })
72
+ public Response init(@PathParam("module") String module, @Context HttpServletRequest request) {
73
+ LOG.info("App index main.html");
74
+ String page = "/index.jsp";
75
+ URI uri = UriBuilder.fromUri(page).build();
76
+ return Response.seeOther(uri).build();
77
+ }
7778
78
- String tokenAuth = tokenHelper.generateToken(user);
79
- return Response.ok(Utils.createMap("success", true, "token", tokenAuth)).build();
80
- }
79
+ @POST
80
+ @Path("/login")
81
+ @Produces({ MediaType.APPLICATION_JSON })
82
+ public Response login(@FormParam("username") String user, @FormParam("password") String password, @Context HttpServletRequest request) {
83
+ LOG.info("is user in role: {} == {} ? ", "advance", request.isUserInRole("advance"));
8184
82
- /**
83
- * Check if current token is valid
84
- *
85
- * @param user
86
- * @param password
87
- * @param request
88
- * @return
89
- */
90
- @GET
91
- @Securable()
92
- @Path("/check")
93
- @Produces({
94
- MediaType.APPLICATION_JSON
95
- })
96
- @EnsureTransaction
97
- public Response check(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token, @QueryParam("token") String token2) {
98
- if (token == null) {
99
- token = token2;
100
- }
101
- if (token == null) {
102
- return Response.status(Status.FORBIDDEN).build();
103
- }
104
- boolean valid = tokenHelper.isTokenValid(token);
105
- if (!valid) {
106
- return Response.status(Status.UNAUTHORIZED).build();
107
- }
85
+ String tokenAuth = tokenHelper.generateToken(user);
86
+ return Response.ok(Utils.createMap("success", true, "token", tokenAuth)).build();
87
+ }
10888
109
- String user = tokenHelper.extractUserFromToken(token);
110
- Date date = tokenHelper.extractDateCreationFromToken(token);
89
+ /**
90
+ * Check if current token is valid
91
+ *
92
+ * @param user
93
+ * @param password
94
+ * @param request
95
+ * @return
96
+ */
97
+ @GET
98
+ @Securable()
99
+ @Path("/check")
100
+ @Produces({ MediaType.APPLICATION_JSON })
101
+ @EnsureTransaction
102
+ public Response check(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token, @QueryParam("token") String token2) {
103
+ if (token == null) {
104
+ token = token2;
105
+ }
106
+ if (token == null) {
107
+ return Response.status(Status.FORBIDDEN).build();
108
+ }
109
+ boolean valid = tokenHelper.isTokenValid(token);
110
+ if (!valid) {
111
+ return Response.status(Status.UNAUTHORIZED).build();
112
+ }
111113
112
- return Response.ok(Utils.createMap("valid", true, "user", user, "date", date)).build();
113
- }
114
+ String user = tokenHelper.extractUserFromToken(token);
115
+ Date date = tokenHelper.extractDateCreationFromToken(token);
114116
115
- @GET
116
- @POST
117
- @Path("/logout")
118
- @Produces({
119
- MediaType.APPLICATION_JSON
120
- })
121
- public Response logout(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
122
- if (token == null) {
123
- Response.status(Status.BAD_REQUEST).build();
124
- }
125
- String user = tokenHelper.extractUserFromToken(token);
126
- LOG.info("User {} has logged out", user);
127
- return Response.ok().build();
128
- }
117
+ return Response.ok(Utils.createMap("valid", true, "user", user, "date", date)).build();
118
+ }
119
+
120
+ @GET
121
+ @POST
122
+ @Path("/logout")
123
+ @Produces({ MediaType.APPLICATION_JSON })
124
+ public Response logout(@HeaderParam(TokenHelper.TOKEN_HEADER_PÀRAM) String token) {
125
+ if (token == null) {
126
+ Response.status(Status.BAD_REQUEST).build();
127
+ }
128
+ String user = tokenHelper.extractUserFromToken(token);
129
+ LOG.info("User {} has logged out", user);
130
+ return Response.ok().build();
131
+ }
129132 }
securis/src/main/webapp/.vscode/settings.json
....@@ -1,4 +1,5 @@
11 // Place your settings in this file to overwrite default and user settings.
22 {
33 "typescript.tsdk": "./node_modules/typescript/lib"
4
+
45 }
securis/src/main/webapp/WEB-INF/web.xml
....@@ -40,7 +40,18 @@
4040 <param-name>resteasy.injector.factory</param-name>
4141 <param-value>org.jboss.resteasy.cdi.CdiInjectorFactory</param-value>
4242 </context-param>
43
-
43
+
44
+ <filter>
45
+ <filter-name>DevFilter</filter-name>
46
+ <filter-class>
47
+ net.curisit.securis.DevFilter
48
+ </filter-class>
49
+ </filter>
50
+ <filter-mapping>
51
+ <filter-name>DevFilter</filter-name>
52
+ <url-pattern>/*</url-pattern>
53
+ </filter-mapping>
54
+
4455 <filter>
4556 <filter-name>Resteasy</filter-name>
4657 <filter-class>
....@@ -56,9 +67,6 @@
5667 <filter-name>Resteasy</filter-name>
5768 <url-pattern>/*</url-pattern>
5869 </filter-mapping>
59
-
60
-
61
-
6270
6371 <welcome-file-list>
6472 <welcome-file>/index.jsp</welcome-file>
securis/src/main/webapp/assets/favicon.png
Binary files differ
securis/src/main/webapp/assets/images/securis_100.png
Binary files differ
securis/src/main/webapp/assets/images/securis_40.png
Binary files differ
securis/src/main/webapp/assets/securis.css
....@@ -0,0 +1,26 @@
1
+.mat-toolbar-row .mat-icon.md-icon-logo {
2
+ height: 40px;
3
+ width: 40px;
4
+}
5
+
6
+.login-logo.mat-icon {
7
+ height: 100px;
8
+ width: 100px;
9
+}
10
+
11
+.form-icon.mat-icon {
12
+ height: 28px;
13
+ width: auto;
14
+ max-width: 36px;
15
+ color: #999999;
16
+ margin-right: 5px;
17
+}
18
+
19
+td-layout-footer a,
20
+td-layout-footer a:visited {
21
+ color:rgba(0, 0, 0, 0.87);
22
+}
23
+
24
+td-layout-footer {
25
+ font-size: 0.8em;
26
+}
securis/src/main/webapp/assets/securis_logo.svg
....@@ -0,0 +1,28 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ style="clip-rule:evenodd;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
9
+ version="1.1"
10
+ id="svg4136"
11
+ viewBox="0 0 994.3679 890.63637"
12
+ height="89.063637"
13
+ width="99.43679"
14
+ xml:space="preserve">
15
+ <defs id="defs11" />
16
+ <g id="securis-logo">
17
+ <path
18
+ style="clip-rule:evenodd;fill:#ff6600;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
19
+ id="curve1"
20
+ 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
21
+ style="fill:#cfcfcf;fill-opacity:1"
22
+ 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"
23
+ id="path5469" /><path
24
+ style="clip-rule:evenodd;fill:#0077ff;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
25
+ id="curve0"
26
+ 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" />
27
+ </g>
28
+ </svg>
securis/src/main/webapp/assets/securis_logo_black.svg
....@@ -0,0 +1,68 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ xml:space="preserve"
11
+ width="1024px"
12
+ height="1024px"
13
+ shape-rendering="geometricPrecision"
14
+ text-rendering="geometricPrecision"
15
+ image-rendering="optimizeQuality"
16
+ fill-rule="nonzero"
17
+ clip-rule="evenodd"
18
+ viewBox="0 0 10240 10240"
19
+ id="svg2"
20
+ version="1.1"
21
+ inkscape:version="0.91 r13725"
22
+ sodipodi:docname="securis_logo_black.svg"><metadata
23
+ id="metadata13"><rdf:RDF><cc:Work
24
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
25
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>cloud_dark icon</dc:title></cc:Work></rdf:RDF></metadata><defs
26
+ id="defs11"><clipPath
27
+ clipPathUnits="userSpaceOnUse"
28
+ id="clipPath5463"><path
29
+ id="path5465"
30
+ 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"
31
+ style="fill:#333333;fill-opacity:1"
32
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
33
+ pagecolor="#ffffff"
34
+ bordercolor="#666666"
35
+ borderopacity="1"
36
+ objecttolerance="10"
37
+ gridtolerance="10"
38
+ guidetolerance="10"
39
+ inkscape:pageopacity="0"
40
+ inkscape:pageshadow="2"
41
+ inkscape:window-width="1492"
42
+ inkscape:window-height="986"
43
+ id="namedview9"
44
+ showgrid="false"
45
+ showguides="false"
46
+ inkscape:zoom="0.80078125"
47
+ inkscape:cx="314.06829"
48
+ inkscape:cy="512"
49
+ inkscape:window-x="302"
50
+ inkscape:window-y="0"
51
+ inkscape:window-maximized="0"
52
+ inkscape:current-layer="svg2" /><title
53
+ id="title4">cloud_dark icon</title><desc
54
+ id="desc6">cloud_dark icon from the IconExperience.com O-Collection. Copyright by INCORS GmbH (www.incors.com).</desc><path
55
+ style="fill:#333333;fill-opacity:1"
56
+ 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"
57
+ transform="scale(9.9999999,9.9999999)"
58
+ id="path5469"
59
+ inkscape:connector-curvature="0"
60
+ sodipodi:nodetypes="scsscssscscs" /><path
61
+ style="clip-rule:evenodd;fill:#333333;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
62
+ inkscape:connector-curvature="0"
63
+ id="curve1"
64
+ 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
65
+ style="clip-rule:evenodd;fill:#333333;fill-opacity:1;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
66
+ inkscape:connector-curvature="0"
67
+ id="curve0"
68
+ 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>
securis/src/main/webapp/assets/securis_logo_bw.svg
....@@ -0,0 +1,68 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ xml:space="preserve"
11
+ width="1024px"
12
+ height="1024px"
13
+ shape-rendering="geometricPrecision"
14
+ text-rendering="geometricPrecision"
15
+ image-rendering="optimizeQuality"
16
+ fill-rule="nonzero"
17
+ clip-rule="evenodd"
18
+ viewBox="0 0 10240 10240"
19
+ id="svg2"
20
+ version="1.1"
21
+ inkscape:version="0.91 r13725"
22
+ sodipodi:docname="securis_logo_wb.svg"><metadata
23
+ id="metadata13"><rdf:RDF><cc:Work
24
+ rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
25
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title>cloud_dark icon</dc:title></cc:Work></rdf:RDF></metadata><defs
26
+ id="defs11"><clipPath
27
+ clipPathUnits="userSpaceOnUse"
28
+ id="clipPath5463"><path
29
+ id="path5465"
30
+ 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"
31
+ style="fill:#333333;fill-opacity:1"
32
+ inkscape:connector-curvature="0" /></clipPath></defs><sodipodi:namedview
33
+ pagecolor="#ffffff"
34
+ bordercolor="#666666"
35
+ borderopacity="1"
36
+ objecttolerance="10"
37
+ gridtolerance="10"
38
+ guidetolerance="10"
39
+ inkscape:pageopacity="0"
40
+ inkscape:pageshadow="2"
41
+ inkscape:window-width="1492"
42
+ inkscape:window-height="986"
43
+ id="namedview9"
44
+ showgrid="false"
45
+ showguides="false"
46
+ inkscape:zoom="0.80078125"
47
+ inkscape:cx="512"
48
+ inkscape:cy="512"
49
+ inkscape:window-x="302"
50
+ inkscape:window-y="0"
51
+ inkscape:window-maximized="0"
52
+ inkscape:current-layer="svg2" /><title
53
+ id="title4">cloud_dark icon</title><desc
54
+ id="desc6">cloud_dark icon from the IconExperience.com O-Collection. Copyright by INCORS GmbH (www.incors.com).</desc><path
55
+ style="clip-rule:evenodd;fill:#b3b3b3;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
56
+ inkscape:connector-curvature="0"
57
+ id="curve1"
58
+ 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
59
+ style="fill:#cfcfcf;fill-opacity:1"
60
+ 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"
61
+ transform="scale(9.9999999,9.9999999)"
62
+ id="path5469"
63
+ inkscape:connector-curvature="0"
64
+ sodipodi:nodetypes="scsscssscscs" /><path
65
+ style="clip-rule:evenodd;fill:#808080;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision;fill-opacity:1"
66
+ inkscape:connector-curvature="0"
67
+ id="curve0"
68
+ 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>
securis/src/main/webapp/assets/securis_logo_white.svg
....@@ -0,0 +1,48 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<svg
3
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
4
+ xmlns:cc="http://creativecommons.org/ns#"
5
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
6
+ xmlns:svg="http://www.w3.org/2000/svg"
7
+ xmlns="http://www.w3.org/2000/svg"
8
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
9
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
10
+ style="clip-rule:evenodd;fill-rule:nonzero;image-rendering:optimizeQuality;shape-rendering:geometricPrecision;text-rendering:geometricPrecision"
11
+ version="1.1"
12
+ id="logo-securis.white"
13
+ viewBox="0 0 163.25001 149.35546"
14
+ height="14.935546"
15
+ width="16.325001"
16
+ xml:space="preserve"
17
+ inkscape:version="0.91 r13725"
18
+ sodipodi:docname="securis_logo_white.svg"><sodipodi:namedview
19
+ pagecolor="#ffffff"
20
+ bordercolor="#666666"
21
+ borderopacity="1"
22
+ objecttolerance="10"
23
+ gridtolerance="10"
24
+ guidetolerance="10"
25
+ inkscape:pageopacity="0"
26
+ inkscape:pageshadow="2"
27
+ inkscape:window-width="1876"
28
+ inkscape:window-height="1036"
29
+ id="namedview13"
30
+ showgrid="false"
31
+ inkscape:zoom="4.9933333"
32
+ inkscape:cx="75.725"
33
+ inkscape:cy="-59.97754"
34
+ inkscape:window-x="44"
35
+ inkscape:window-y="0"
36
+ inkscape:window-maximized="1"
37
+ inkscape:current-layer="logo-securis.white"
38
+ fit-margin-top="1"
39
+ fit-margin-bottom="1"
40
+ fit-margin-left="1"
41
+ fit-margin-right="1" /><metadata
42
+ id="metadata13"><rdf:RDF><cc:Work
43
+ rdf:about=""><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
44
+ id="defs11" /><path
45
+ style="fill:#f2f2f2;fill-opacity:1"
46
+ 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"
47
+ id="path5469"
48
+ inkscape:connector-curvature="0" /></svg>
securis/src/main/webapp/bs-config.json
....@@ -2,7 +2,8 @@
22 "server": {
33 "baseDir": "",
44 "routes": {
5
- "/node_modules": "node_modules"
5
+ "/node_modules": "node_modules",
6
+ "/assets": "assets"
67 }
78 }
89 }
securis/src/main/webapp/index.html
....@@ -1,12 +1,12 @@
11 <!DOCTYPE html>
22 <html>
33 <head>
4
- <title>Angular QuickStart</title>
4
+ <title>SeCuris server</title>
55 <meta charset="UTF-8">
66 <meta name="viewport" content="width=device-width, initial-scale=1">
77 <base href="/">
8
- <link rel="stylesheet" href="styles.css">
9
-
8
+ <link rel="icon" href="assets/favicon.png" sizes="32x29" type="image/png">
9
+
1010 <!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script> -->
1111
1212 <!-- Polyfill(s) for older browsers -->
....@@ -15,6 +15,7 @@
1515
1616 <script src="node_modules/zone.js/dist/zone.js"></script>
1717 <script src="node_modules/systemjs/dist/system.src.js"></script>
18
+
1819
1920 <script src="systemjs.config.js"></script>
2021 <script>
....@@ -22,14 +23,21 @@
2223 </script>
2324
2425 <!-- Load the Covalent platform stylesheet -->
25
- <link href="https://unpkg.com/@covalent/core@1.0.0-beta.2/common/platform.css" rel="stylesheet">
26
+ <link href="assets/securis.css" rel="stylesheet">
27
+ <link href="node_modules/@covalent/core/common/platform.css" rel="stylesheet">
2628
2729 <!-- Load the Covalent/Material prebuilt theme -->
28
- <link href="https://unpkg.com/@covalent/core@1.0.0-beta.2/theming/prebuilt/blue-orange.css" rel="stylesheet">
29
-
30
+ <link href="node_modules/@covalent/core/theming/prebuilt/blue-orange.css" rel="stylesheet">
31
+ <link href="node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet" />
32
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
3033 </head>
3134
3235 <body>
33
- <my-app>Loading AppComponent content here ...</my-app>
36
+ <app-home>
37
+ <div style="padding: 20%;text-align:center;">
38
+ <img src="assets/securis_logo.svg" width="100">
39
+ <div style="font-size: 0.8em;color: darkgrey;">SeCuris Loading...</div>
40
+ </div>
41
+ </app-home>
3442 </body>
3543 </html>
securis/src/main/webapp/index.jsp
....@@ -0,0 +1,44 @@
1
+<!DOCTYPE html>
2
+<html>
3
+ <head>
4
+ <title>SeCuris server</title>
5
+ <base href="<%= pageContext.getServletContext().getContextPath() %>/">
6
+ <meta charset="utf-8">
7
+ <meta charset="UTF-8">
8
+ <meta name="viewport" content="width=device-width, initial-scale=1">
9
+ <link rel="icon" href="assets/favicon.png" sizes="32x29" type="image/png">
10
+ <base href="/">
11
+
12
+<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.4.1/core.min.js"></script> -->
13
+
14
+ <!-- Polyfill(s) for older browsers -->
15
+ <script src="node_modules/core-js/client/shim.min.js"></script>
16
+ <script src="node_modules/hammerjs/hammer.min.js"></script>
17
+
18
+ <script src="node_modules/zone.js/dist/zone.js"></script>
19
+ <script src="node_modules/systemjs/dist/system.src.js"></script>
20
+
21
+ <script src="systemjs.config.js"></script>
22
+ <script>
23
+ System.import('main').catch(function(err){ console.error(err); });
24
+ </script>
25
+
26
+ <!-- Load the Covalent platform stylesheet -->
27
+ <link href="assets/securis.css" rel="stylesheet">
28
+ <link href="node_modules/@covalent/core/common/platform.css" rel="stylesheet">
29
+
30
+ <!-- Load the Covalent/Material prebuilt theme -->
31
+ <link href="node_modules/@covalent/core/theming/prebuilt/blue-orange.css" rel="stylesheet">
32
+ <link href="node_modules/ng2-toastr/bundles/ng2-toastr.min.css" rel="stylesheet" />
33
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
34
+ </head>
35
+
36
+ <body>
37
+ <app-home>
38
+ <div style="padding: 20%;text-align:center;">
39
+ <img src="assets/securis_logo.svg" width="100">
40
+ <div style="font-size: 0.8em;color: darkgrey;">SeCuris Loading...</div>
41
+ </div>
42
+ </app-home>
43
+ </body>
44
+</html>
securis/src/main/webapp/package.json
....@@ -24,15 +24,15 @@
2424 "author": "",
2525 "license": "MIT",
2626 "dependencies": {
27
- "@angular/common": "^2.4.8",
28
- "@angular/compiler": "~2.4.0",
29
- "@angular/core": "~2.4.0",
30
- "@angular/forms": "~2.4.0",
31
- "@angular/http": "~2.4.0",
27
+ "@angular/common": "^2.4.9",
28
+ "@angular/compiler": "~2.4.9",
29
+ "@angular/core": "~2.4.9",
30
+ "@angular/forms": "~2.4.9",
31
+ "@angular/http": "~2.4.9",
3232 "@angular/material": "^2.0.0-beta.2",
33
- "@angular/platform-browser": "~2.4.0",
34
- "@angular/platform-browser-dynamic": "~2.4.0",
35
- "@angular/router": "^3.4.8",
33
+ "@angular/platform-browser": "~2.4.9",
34
+ "@angular/platform-browser-dynamic": "~2.4.9",
35
+ "@angular/router": "^3.4.9",
3636 "@covalent/core": "^1.0.0-beta.2",
3737 "@covalent/dynamic-forms": "^1.0.0-beta.2",
3838 "@covalent/http": "^1.0.0-beta.2",
securis/src/main/webapp/src/app/app.component.ts
....@@ -1,4 +1,7 @@
1
-import { Component, AfterViewInit } from '@angular/core';
1
+import { Observable } from 'rxjs/Observable';
2
+import { BaseRequestOptions, Http } from '@angular/http';
3
+import { ToastsManager } from 'ng2-toastr/ng2-toastr';
4
+import { AfterViewInit, Component, ViewContainerRef } from '@angular/core';
25 import { DomSanitizer } from '@angular/platform-browser';
36 import { MdIconRegistry } from '@angular/material';
47 import { UserService } from './user.service';
....@@ -10,41 +13,40 @@
1013 // https://teradata.github.io/covalent-quickstart/#/
1114
1215 @Component({
13
- selector: 'my-app',
14
- template: `<router-outlet></router-outlet>`
16
+ selector: 'app-home',
17
+ templateUrl: 'src/app/app.home.html'
1518 })
16
-
17
-
18
-export class AppComponent implements AfterViewInit {
19
-
19
+export class AppHomeComponent implements AfterViewInit {
20
+ securisVersion : string;
2021 constructor(private userService: UserService,
22
+ toaster: ToastsManager,
23
+ vRef: ViewContainerRef,
2124 private router: Router,
25
+ http: Http,
2226 private media: TdMediaService,
2327 private _iconRegistry: MdIconRegistry,
2428 private _domSanitizer: DomSanitizer,
2529 private store: LocalStorageService) {
2630 this.registerIcons();
31
+ toaster.setRootViewContainerRef(vRef);
32
+ http.get("version", /* workaround to avoid OPTIONS method request*/ new BaseRequestOptions())
33
+ .map((res) => <string>res.json().version)
34
+ .subscribe(
35
+ version => this.securisVersion = version,
36
+ err => this.securisVersion = '0.0.0'
37
+ );
38
+
2739 }
2840
2941 private registerIcons() : void {
30
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent',
31
- this._domSanitizer.bypassSecurityTrustResourceUrl('https://raw.githubusercontent.com/Teradata/covalent-quickstart/develop/src/assets/icons/covalent.svg'));
32
- this._iconRegistry.addSvgIconInNamespace('assets', 'teradata',
33
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata.svg'));
34
- this._iconRegistry.addSvgIconInNamespace('assets', 'github',
35
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/github.svg'));
36
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent',
37
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent.svg'));
38
- this._iconRegistry.addSvgIconInNamespace('assets', 'covalent-mark',
39
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/covalent-mark.svg'));
40
- this._iconRegistry.addSvgIconInNamespace('assets', 'teradata-ux',
41
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/teradata-ux.svg'));
42
- this._iconRegistry.addSvgIconInNamespace('assets', 'appcenter',
43
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/appcenter.svg'));
44
- this._iconRegistry.addSvgIconInNamespace('assets', 'listener',
45
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/listener.svg'));
46
- this._iconRegistry.addSvgIconInNamespace('assets', 'querygrid',
47
- this._domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/querygrid.svg'));
42
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo',
43
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo.svg'));
44
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-bw',
45
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_bw.svg'));
46
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-white',
47
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_white.svg'));
48
+ this._iconRegistry.addSvgIconInNamespace('assets', 'logo-black',
49
+ this._domSanitizer.bypassSecurityTrustResourceUrl('assets/securis_logo_black.svg'));
4850 }
4951
5052 ngAfterViewInit(): void {
securis/src/main/webapp/src/app/app.home.html
....@@ -0,0 +1,46 @@
1
+<td-layout-nav toolbarTitle="SeCuris" logo="assets:logo-white" >
2
+ <div td-toolbar-content layout="row" layout-align="start center" flex>
3
+ <!-- <button>Hola</button> -->
4
+ <md-menu #notificationsMenu="mdMenu">
5
+ <td-menu>
6
+ <div td-menu-header class="md-subhead">Templates</div>
7
+ <md-nav-list dense>
8
+ <a md-list-item [routerLink]="['/login']">
9
+ <md-icon md-list-avatar>system_update_alt</md-icon>
10
+ <h4 md-line><span class="text-wrap">Landing Page</span></h4>
11
+ <p md-line>a landing page template</p>
12
+ </a>
13
+ <md-divider></md-divider>
14
+ <a md-list-item [routerLink]="['/login']">
15
+ <md-icon md-list-avatar>dashboard</md-icon>
16
+ <h4 md-line><span class="text-wrap">Dashboard</span></h4>
17
+ <p md-line>an ngx-charts dashboard template</p>
18
+ </a>
19
+ <md-divider></md-divider>
20
+ <a md-list-item [routerLink]="['/login']">
21
+ <md-icon md-list-avatar>email</md-icon>
22
+ <h4 md-line><span class="text-wrap">Email App</span></h4>
23
+ <p md-line>an email app template</p>
24
+ </a>
25
+ <md-divider></md-divider>
26
+ <a md-list-item [routerLink]="['/login']">
27
+ <md-icon md-list-avatar>view_array</md-icon>
28
+ <h4 md-line><span class="text-wrap">IDE Editor</span></h4>
29
+ <p md-line>an IDE text editor app template</p>
30
+ </a>
31
+ </md-nav-list>
32
+ <a md-button color="accent" td-menu-footer href="https://github.com/Teradata/covalent-quickstart/tree/develop/src/app/templates" target="_blank">
33
+ View Code
34
+ </a>
35
+ </td-menu>
36
+ </md-menu>
37
+ </div>
38
+ <router-outlet></router-outlet>
39
+ <td-layout-footer>
40
+ <div layout="row" layout-align="start center" flex>
41
+ <div flex layout="row" layout-align="start center">v. {{securisVersion}}</div>
42
+ <div flex layout="row" layout-align="center center"><a href="http://www.curistec.com/" target="_blank">CurisTec</a>&nbsp;©2017</div>
43
+ <div flex></div>
44
+ </div>
45
+ </td-layout-footer>
46
+</td-layout-nav>
securis/src/main/webapp/src/app/app.module.ts
....@@ -10,14 +10,20 @@
1010 import { LocalStorageModule } from 'angular-2-local-storage';
1111 import { ToastModule } from 'ng2-toastr/ng2-toastr';
1212
13
-import { AppComponent } from './app.component';
13
+import { AppHomeComponent } from './app.component';
1414 import { UserService } from './user.service';
15
+import { PacksService } from './resources/packs';
16
+import { LicenseTypesService } from './resources/license_types';
17
+import { OrganizationsService } from './resources/organizations';
18
+import { ApplicationsService } from './resources/applications';
19
+import { UsersService } from './resources/users';
20
+import { LicensesService } from './resources/licenses';
1521 import { PackListComponent } from './pack.list.component';
1622 import { HeroDetailComponent } from './detail.component';
1723 import { LoginFormComponent } from './login.form.component';
1824
1925 import { appRoutes, appRoutingProviders } from './app.routes';
20
-import { requestOptionsProvider } from './common/default.requests.options';
26
+import { requestOptionsProvider, requestBackendProvider } from './common/default.requests.options';
2127 import { LocaleServiceModule } from './common/i18n';
2228
2329 @NgModule({
....@@ -33,20 +39,27 @@
3339 CovalentHttpModule.forRoot(),
3440 CovalentDynamicFormsModule.forRoot(),
3541 ToastModule.forRoot(),
36
- LocaleServiceModule,
42
+ LocaleServiceModule.withConfig('en'),
3743 appRoutes,
3844 ],
3945 declarations: [
4046 HeroDetailComponent,
4147 PackListComponent,
4248 LoginFormComponent,
43
- AppComponent
49
+ AppHomeComponent
4450 ],
45
- bootstrap: [ AppComponent ],
51
+ bootstrap: [ AppHomeComponent ],
4652 providers: [
4753 UserService,
54
+ PacksService,
55
+ LicensesService,
56
+ ApplicationsService,
57
+ OrganizationsService,
58
+ LicenseTypesService,
59
+ UsersService,
4860 appRoutingProviders,
4961 requestOptionsProvider,
62
+ requestBackendProvider
5063 ]
5164 })
5265
securis/src/main/webapp/src/app/app.routes.ts
....@@ -1,6 +1,6 @@
11 import { Routes, RouterModule } from '@angular/router';
22
3
-import { AppComponent } from './app.component';
3
+import { AppHomeComponent } from './app.component';
44 import { PackListComponent } from './pack.list.component';
55 import { LoginFormComponent } from './login.form.component';
66
securis/src/main/webapp/src/app/catalogs.json
....@@ -0,0 +1,210 @@
1
+[ {
2
+ "name" : "Applications",
3
+ "resource" : "application",
4
+ "list_fields" : [ "name", "description", "creationTimestamp" ],
5
+ "fields" : [ {
6
+ "name" : "id",
7
+ "display" : "ID",
8
+ "type" : "number",
9
+ "pk" : true,
10
+ "autogenerate" : true,
11
+ "readOnly" : true
12
+ }, {
13
+ "name" : "code",
14
+ "display" : "Code",
15
+ "type" : "string",
16
+ "maxlength" : 4,
17
+ "mandatory" : true
18
+ }, {
19
+ "name" : "name",
20
+ "display" : "Name",
21
+ "type" : "string",
22
+ "maxlength" : 45,
23
+ "mandatory" : true
24
+ }, {
25
+ "name" : "description",
26
+ "display" : "Description",
27
+ "type" : "string",
28
+ "maxlength" : 500,
29
+ "multiline" : 2
30
+ }, {
31
+ "name" : "license_filename",
32
+ "display" : "License filename",
33
+ "type" : "string",
34
+ "maxlength" : 100,
35
+ "mandatory" : true
36
+ }, {
37
+ "name" : "creation_timestamp",
38
+ "display" : "Creation date",
39
+ "autogenerate" : true,
40
+ "type" : "date",
41
+ "readOnly" : true
42
+ }, {
43
+ "name" : "metadata",
44
+ "display" : "Metadata",
45
+ "type" : "metadata",
46
+ "allow_creation": true
47
+ } ]
48
+}, {
49
+ "name" : "License types",
50
+ "list_fields" : [ "code", "name", "application_name", "creationTimestamp" ],
51
+ "resource" : "licensetype",
52
+ "fields" : [ {
53
+ "name" : "id",
54
+ "display" : "ID",
55
+ "type" : "number",
56
+ "pk" : true,
57
+ "autogenerate" : true,
58
+ "readOnly" : true
59
+ }, {
60
+ "name" : "code",
61
+ "display" : "Code",
62
+ "type" : "string",
63
+ "maxlength" : 10,
64
+ "mandatory" : true
65
+ }, {
66
+ "name" : "name",
67
+ "display" : "Name",
68
+ "type" : "string",
69
+ "maxlength" : 45,
70
+ "mandatory" : true
71
+ }, {
72
+ "name" : "description",
73
+ "display" : "Description",
74
+ "type" : "string",
75
+ "maxlength" : 500,
76
+ "multiline" : 2
77
+ }, {
78
+ "name" : "application_id",
79
+ "display" : "Application",
80
+ "resource" : "application",
81
+ "mandatory" : true,
82
+ "type" : "select",
83
+ "onchange": "updateMetadata"
84
+ }, {
85
+ "name" : "creation_timestamp",
86
+ "display" : "Creation date",
87
+ "autogenerate" : true,
88
+ "type" : "date",
89
+ "readOnly" : true
90
+ }, {
91
+ "name" : "application_name",
92
+ "display" : "Application",
93
+ "listingOnly" : true
94
+ }, {
95
+ "name" : "metadata",
96
+ "display" : "Metadata",
97
+ "type" : "metadata",
98
+ "allow_creation": false
99
+ } ]
100
+}, {
101
+ "name" : "Organizations",
102
+ "list_fields" : [ "code", "name", "org_parent_name", "creationTimestamp" ],
103
+ "resource" : "organization",
104
+ "fields" : [ {
105
+ "name" : "id",
106
+ "display" : "ID",
107
+ "type" : "number",
108
+ "pk" : true,
109
+ "autogenerate" : true,
110
+ "readOnly" : true
111
+ }, {
112
+ "name" : "code",
113
+ "display" : "Code",
114
+ "type" : "string",
115
+ "maxlength" : 10,
116
+ "mandatory" : true
117
+ }, {
118
+ "name" : "name",
119
+ "display" : "Name",
120
+ "type" : "string",
121
+ "maxlength" : 45,
122
+ "mandatory" : true
123
+ }, {
124
+ "name" : "description",
125
+ "display" : "Description",
126
+ "type" : "string",
127
+ "maxlength" : 500,
128
+ "multiline" : 2
129
+ }, {
130
+ "name" : "org_parent_id",
131
+ "display" : "Parent organization",
132
+ "resource" : "organization",
133
+ "type" : "select"
134
+ }, {
135
+ "name" : "users_ids",
136
+ "display" : "Users",
137
+ "resource" : "user",
138
+ "type" : "multiselect"
139
+ }, {
140
+ "name" : "creation_timestamp",
141
+ "display" : "Creation date",
142
+ "autogenerate" : true,
143
+ "type" : "date",
144
+ "readOnly" : true
145
+ }, {
146
+ "name" : "org_parent_name",
147
+ "display" : "Parent org",
148
+ "listingOnly" : true
149
+ } ]
150
+}, {
151
+ "name" : "Users",
152
+ "list_fields" : [ "username", "first_name", "last_name", "lastLogin" ],
153
+ "resource" : "user",
154
+ "fields" : [ {
155
+ "name" : "username",
156
+ "display" : "Username",
157
+ "type" : "string",
158
+ "maxlength" : 45,
159
+ "pk" : true,
160
+ "readOnly" : true,
161
+ "mandatory" : true
162
+ }, {
163
+ "name" : "email",
164
+ "display" : "Email",
165
+ "type" : "email",
166
+ "maxlength" : 150,
167
+ "mandatory" : true
168
+ }, {
169
+ "name" : "first_name",
170
+ "display" : "First name",
171
+ "type" : "string",
172
+ "maxlength" : 100,
173
+ "mandatory" : true
174
+ }, {
175
+ "name" : "password",
176
+ "display" : "Password",
177
+ "type" : "password",
178
+ "maxlength" : 100,
179
+ "mandatory" : false
180
+ }, {
181
+ "name" : "last_name",
182
+ "display" : "Last name",
183
+ "type" : "string",
184
+ "maxlength" : 100
185
+ }, {
186
+ "name" : "organizations_ids",
187
+ "display" : "Organizations",
188
+ "resource" : "organization",
189
+ "type" : "multiselect"
190
+ }, {
191
+ "name" : "roles",
192
+ "display" : "Roles",
193
+ "values" : [{"id":1, "label":"Advance"}, {"id":2, "label":"Admin"}],
194
+ "type" : "multiselect"
195
+ }, {
196
+ "name" : "lastLogin",
197
+ "display" : "Last login",
198
+ "autogenerate" : true,
199
+ "type" : "date",
200
+ "readOnly" : true
201
+ }, {
202
+ "name" : "creation_timestamp",
203
+ "display" : "Creation date",
204
+ "autogenerate" : true,
205
+ "type" : "date",
206
+ "readOnly" : true
207
+ }]
208
+ }
209
+
210
+]
securis/src/main/webapp/src/app/common/default.requests.options.ts
....@@ -1,6 +1,15 @@
11 import { LocalStorageService } from 'angular-2-local-storage';
22 import { Injectable } from '@angular/core';
3
-import { BaseRequestOptions, RequestOptions, Request, XHRBackend, XHRConnection} from '@angular/http';
3
+import {
4
+ BaseRequestOptions,
5
+ BrowserXhr,
6
+ Request,
7
+ RequestOptions,
8
+ ResponseOptions,
9
+ XHRBackend,
10
+ XHRConnection,
11
+ XSRFStrategy
12
+} from '@angular/http';
413
514
615 // TODO: Chnage this to use Covalent Http helper service
....@@ -17,6 +26,7 @@
1726 let token = this.store.get<string>('token');
1827 if (token) {
1928 this.headers.set('X-SECURIS-TOKEN', token);
29
+
2030 }
2131
2232 }
....@@ -24,9 +34,14 @@
2434
2535 @Injectable()
2636 export class ApiXHRBackend extends XHRBackend {
37
+
38
+ constructor(_browserXHR: BrowserXhr, _baseResponseOptions: ResponseOptions, _xsrfStrategy: XSRFStrategy) {
39
+ super(_browserXHR, _baseResponseOptions, _xsrfStrategy);
40
+ }
41
+
2742 createConnection(request: Request): XHRConnection {
28
- if (request.url.startsWith('/')){
29
- // request.url = '/securis' + request.url; // prefix base url
43
+ if (!request.url.endsWith('.js') && !request.url.endsWith('.html') && !request.url.endsWith('.svg')){
44
+ request.url = 'http://localhost:8080/securis/' + request.url; // prefix base url
3045 }
3146 return super.createConnection(request);
3247 }
securis/src/main/webapp/src/app/common/i18n.ts
....@@ -79,6 +79,9 @@
7979 * $L.get('Hello {0}!!', 'John'); // This returns: "Hola John!!" if language is spanish
8080 */
8181 get(msg: string) : string {
82
+ if (msg == null) {
83
+ return '';
84
+ }
8285 msg = msg.trim();
8386 var trans_msg = msg;
8487
....@@ -121,6 +124,7 @@
121124 })
122125 export class LocaleServiceModule {
123126 static withConfig(initLang?: string): ModuleWithProviders {
127
+ console.log('Init lang with ' + initLang);
124128 return {
125129 ngModule: LocaleServiceModule,
126130 providers: [
securis/src/main/webapp/src/app/favicon.ico
Binary files differ
securis/src/main/webapp/src/app/forms/pack.form.component.ts
....@@ -0,0 +1,31 @@
1
+import { PacksService } from '../resources/packs';
2
+import { LocaleService } from '../common/i18n';
3
+import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
4
+import { IPageChangeEvent } from '@covalent/core';
5
+import { Component, AfterViewInit } from '@angular/core';
6
+import { TdMediaService } from '@covalent/core';
7
+
8
+@Component({
9
+ selector: 'pack-form',
10
+ templateUrl: 'src/app/forms/pack.form.html'
11
+})
12
+export class PackFormComponent implements AfterViewInit {
13
+
14
+ form_title: string = '';
15
+ form_subtitle: string = '';
16
+
17
+ constructor(private packs: PacksService,
18
+ private $L: LocaleService) {
19
+ this.form_title = $L.get('Pack data');
20
+ this.form_subtitle = $L.get('Fullfill the pack data and save the changes');
21
+ }
22
+
23
+ ngOnInit(): void {
24
+ }
25
+
26
+
27
+ ngAfterViewInit(): void {
28
+
29
+ }
30
+}
31
+
securis/src/main/webapp/src/app/forms/pack.form.html
....@@ -0,0 +1,172 @@
1
+<h3 md-dialog-title>{{form_title}}</h3>
2
+<form #packForm="ngForm" class="inset" (keyup.enter)="save()">
3
+<md-dialog-content>
4
+ <div layout="column" layout-align="start center">
5
+ <div layout="row" layout-align="start center">
6
+ <md-icon class="form-icon">face</md-icon>
7
+ <md-input-container class="md-icon-float">
8
+ <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
9
+ </md-input-container>
10
+ <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>
11
+ </div>
12
+ <div layout="row" layout-align="start center">
13
+ <md-icon class="form-icon">vpn_key</md-icon>
14
+ <md-input-container class="md-icon-float">
15
+ <input mdInput (keyup.enter)="loginForm.form.valid && false" flex placeholder="Password" type="password" [(ngModel)]="data.password"
16
+ name="password" required/>
17
+ </md-input-container>
18
+ </div>
19
+ </div>
20
+</md-dialog-content>
21
+<md-dialog-actions layout="row" layout-align="end center">
22
+ <button flex [disabled]="!packForm.form.valid" md-raised-button color="primary" (click)="save()">Save</button>
23
+ <button flex md-button (click)="close()">Cancel</button>
24
+</md-dialog-actions>
25
+</form>
26
+
27
+
28
+<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()">
29
+<!-- ngIf: !isNew -->
30
+<div class="form-group">
31
+<label class="col-md-3 control-label" for="code" i18n="">Code</label>
32
+<div class="col-md-8">
33
+ <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">
34
+ <div class="alert inline-alert alert-warning" ng-show="packForm.code.$invalid">
35
+ <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>
36
+ </div>
37
+</div>
38
+</div>
39
+
40
+<div class="form-group">
41
+<label class="col-md-3 control-label" for="init_valid_date" i18n="">Validity (from - to)</label>
42
+<div class="col-md-4">
43
+ <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">
44
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.initValidDate.$invalid">
45
+ <span class="glyphicon glyphicon-warning-sign"></span>
46
+ <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>
47
+ </div>
48
+</div>
49
+<div class="col-md-4">
50
+ <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">
51
+ <div class="alert inline-alert alert-warning" ng-show="packForm.end_valid_date.$invalid">
52
+ <span class="glyphicon glyphicon-warning-sign"></span>
53
+ <span ng-show="packForm.end_valid_date.$error.required" ng-bind="mandatoryFieldErrorMsg('End valid date')" class="ng-binding">'End valid date' is required.</span>
54
+ <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>
55
+ </div>
56
+</div>
57
+</div>
58
+
59
+<div class="form-group">
60
+<label class="col-md-3 control-label" for="num_licenses" i18n="">Num.
61
+ Licenses</label>
62
+<div class="col-md-8">
63
+ <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">
64
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.num_licenses.$invalid">
65
+ <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>
66
+ <span ng-show="packForm.num_licenses.$error.required" ng-bind="mandatoryFieldErrorMsg('Num. Licenses')" class="ng-binding ng-hide">'Num. Licenses' is required.</span>
67
+ </div>
68
+</div>
69
+</div>
70
+
71
+<!-- ngIf: !isNew -->
72
+
73
+<div class="form-group">
74
+<label class="col-md-3 control-label" for="license_type_id" i18n="">License
75
+ type</label>
76
+<div class="col-md-8">
77
+ <!-- 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 -->
78
+ <!-- ngIf: !isNew -->
79
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.license_type_id.$invalid">
80
+ <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>
81
+ </div>
82
+</div>
83
+</div>
84
+
85
+<div class="form-group">
86
+<label class="col-md-3 control-label" for="organization_id" i18n="">Organization</label>
87
+<div class="col-md-8">
88
+ <!-- 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 -->
89
+ <!-- ngIf: !isNew -->
90
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.organization_id.$invalid">
91
+ <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>
92
+ </div>
93
+</div>
94
+</div>
95
+<div class="form-group">
96
+<label class="col-md-3 control-label" for="license_preactivation" i18n="">License preactivation</label>
97
+<div class="col-md-8">
98
+ <input type="checkbox" class="form-control ng-pristine ng-untouched ng-valid" ng-model="pack.license_preactivation">
99
+</div>
100
+</div>
101
+<div class="form-group">
102
+<label class="col-md-3 control-label" for="preactivation_valid_period" i18n="">Preactivation valid period (days)</label>
103
+<div class="col-md-8">
104
+ <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">
105
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.preactivation_valid_period.$invalid">
106
+ <span class="glyphicon glyphicon-warning-sign"></span>
107
+ <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>
108
+ <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>
109
+ </div>
110
+</div>
111
+</div>
112
+<div class="form-group">
113
+<label class="col-md-3 control-label" for="renew_valid_period" i18n="">Period for renew (days)</label>
114
+<div class="col-md-8">
115
+ <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">
116
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.renew_valid_period.$invalid">
117
+ <span class="glyphicon glyphicon-warning-sign"></span>
118
+ <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>
119
+ <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>
120
+ </div>
121
+</div>
122
+</div>
123
+
124
+
125
+<div class="form-group">
126
+<label class="col-md-3 control-label" for="comments" i18n="">Comments</label>
127
+<div class="col-md-8">
128
+ <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>
129
+ <div class="alert inline-alert alert-warning ng-hide" ng-show="packForm.comments.$invalid">
130
+ <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>
131
+ <span ng-show="packForm.comments.$error.required" ng-bind="mandatoryFieldErrorMsg('comments')" class="ng-binding ng-hide">'comments' is required.</span>
132
+ </div>
133
+</div>
134
+</div>
135
+
136
+<!-- ngIf: !isNew -->
137
+
138
+<!-- ngIf: !isNew -->
139
+
140
+<div class="form-group">
141
+<label class="col-md-3 control-label" i18n="">Metadata</label>
142
+<div class="col-md-8">
143
+ <table class="table table-hover table-condensed">
144
+ <thead>
145
+ <tr>
146
+ <th i18n="">Key</th>
147
+ <th i18n="">Value</th>
148
+ </tr>
149
+ </thead>
150
+ <tbody>
151
+ <!-- ngRepeat: row_md in pack.metadata -->
152
+ </tbody>
153
+ </table>
154
+</div>
155
+</div>
156
+
157
+<div class="form-group">
158
+<div class="col-md-offset-3 col-md-10">
159
+ <button id="save" type="submit" class="btn btn-primary">
160
+ <span i18n="" class="glyphicon glyphicon-floppy-disk"></span> Save
161
+ </button>
162
+ <!-- ngIf: !isNew -->
163
+ <ul class="dropdown-menu" role="menu">
164
+ <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>
165
+ <li><!-- ngIf: Packs.isActionAvailable('putonhold', pack) --></li>
166
+ <li class="divider"></li>
167
+ <li><!-- ngIf: Packs.isActionAvailable('cancel', pack) --></li>
168
+ <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>
169
+ </ul>
170
+</div>
171
+</div>
172
+</form>
securis/src/main/webapp/src/app/login.form.component.ts
....@@ -19,12 +19,14 @@
1919 public constructor(private toaster: ToastsManager,
2020 private router: Router,
2121 private userService: UserService) {
22
+ this.data.username = 'admin';
23
+ this.data.password = 'securis';
2224 }
2325
2426 public login() {
2527 this.userService.login(this.data.username, this.data.password).subscribe(
26
- token => this.toaster.info('Hola'),
27
- err => this.toaster.error('Hubo un error: ' + err));
28
+ token => this.router.navigateByUrl("packs"),
29
+ errMsg => this.toaster.error(errMsg, 'Login error'));
2830 }
2931
3032 public clear() {
securis/src/main/webapp/src/app/login.form.html
....@@ -1,25 +1,51 @@
1
-<md-card>
2
- <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>
3
- SeCuris Login</span></md-card-title>
4
- <md-card-subtitle>Sign in via your current SeCuris account</md-card-subtitle>
5
- <md-divider></md-divider>
6
- <md-card-content>
7
- <form #loginForm="ngForm" class="inset">
8
- <div layout="row">
9
- <md-input-container>
10
- <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
11
- </md-input-container>
12
- </div>
13
- <div layout="row">
14
- <md-input-container>
15
- <input mdInput (keyup.enter)="loginForm.form.valid && login()" flex placeholder="Password" type="password" [(ngModel)]="data.password" name="password" required/>
16
- </md-input-container>
17
- </div>
18
- </form>
19
- <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>
20
- </md-card-content>
21
- <md-divider></md-divider>
22
- <md-card-actions>
23
- <button flex [disabled]="!loginForm.form.valid" md-raised-button color="primary" (click)="login()">Sign In</button>
24
- </md-card-actions>
25
-</md-card>
1
+<td-layout-card-over>
2
+ <md-toolbar role="toolbar" class="mat-secondary">
3
+ <div class="mat-toolbar-layout">
4
+ <md-toolbar-row class="mat-toolbar-row">SeCuris Sign in</md-toolbar-row>
5
+ </div>
6
+ </md-toolbar>
7
+ <div class="margin" layout-align-gt-xs="center start" layout-fill="" layout-gt-xs="row">
8
+ <div flex-gt-xs="70">
9
+
10
+ <md-card>
11
+ <md-card-title>
12
+ <div layout="row" layout-align="center center">
13
+ <md-icon class="login-logo" svgIcon="assets:logo"></md-icon>
14
+ </div>
15
+ </md-card-title>
16
+ <md-card-subtitle>
17
+ <div layout="row" layout-align="center center" i18n>
18
+ Sign in via your current SeCuris account
19
+ </div>
20
+ </md-card-subtitle>
21
+ <md-divider></md-divider>
22
+ <md-card-content>
23
+ <form #loginForm="ngForm" class="inset" (keyup.enter)="login()">
24
+ <div layout="column" layout-align="start center">
25
+ <div layout="row" layout-align="start center">
26
+ <md-icon class="form-icon">face</md-icon>
27
+ <md-input-container class="md-icon-float">
28
+ <input mdInput flex placeholder="Username" type="text" [(ngModel)]="data.username" name="username" required />
29
+ </md-input-container>
30
+ </div>
31
+ <div layout="row" layout-align="start center">
32
+ <md-icon class="form-icon">vpn_key</md-icon>
33
+ <md-input-container class="md-icon-float">
34
+ <input mdInput (keyup.enter)="loginForm.form.valid && false" flex placeholder="Password" type="password" [(ngModel)]="data.password"
35
+ name="password" required/>
36
+ </md-input-container>
37
+ </div>
38
+ </div>
39
+ </form>
40
+ <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>
41
+ </md-card-content>
42
+ <md-divider></md-divider>
43
+ <md-card-actions>
44
+ <div layout="row" layout-align="center center" class="margin">
45
+ <button flex="50" [disabled]="!loginForm.form.valid" md-raised-button color="primary" (click)="login()">Sign In</button>
46
+ </div>
47
+ </md-card-actions>
48
+ </md-card>
49
+ </div>
50
+ </div>
51
+</td-layout-card-over>
securis/src/main/webapp/src/app/pack.list.component.html
....@@ -1,112 +1,26 @@
1
-<td-layout-nav-list #navList
2
- logo="assets:covalent"
3
- toolbarTitle="Email App"
4
- class="light-blue-red"
5
- [opened]="media.registerQuery('gt-sm') | async"
6
- [mode] = "side"
7
- [sidenavWidth]="(media.registerQuery('gt-xs') | async) ? '350px' : '100%'">
8
- <div td-toolbar-content layout="row" layout-align="start center" flex>
9
- <span flex *ngIf="!searchBox.searchVisible"></span>
10
- <td-search-box #searchBox backIcon="arrow_back" class="pull-top-sm pull-bottom-sm" placeholder="Search here" flex>
1
+<md-toolbar role="toolbar" class="mat-secondary">
2
+ <span class="push-left-sm">
3
+ <span class="md-title" i18n>License Packs</span>
4
+ </span>
5
+ <span class="push-left-sm" *ngIf="filteredItems < data.length">
6
+ <span class="md-body-1">{{filteredItems}} of {{data.length}} packs filtered</span>
7
+ </span>
8
+ <td-search-box #searchBox class="push-right-sm" placeholder="Search here" (searchDebounce)="search($event)" flex>
119 </td-search-box>
12
- <button md-icon-button [mdMenuTriggerFor]="notificationsMenu">
13
- <td-notification-count color="accent" [notifications]="4">
14
- <md-icon>apps</md-icon>
15
- </td-notification-count>
10
+ <button md-mini-fab color="accent" (click)="createPack()">
11
+ <md-icon>add</md-icon>
1612 </button>
17
- <md-menu #notificationsMenu="mdMenu">
18
- <td-menu>
19
- <div td-menu-header class="md-subhead">Templates</div>
20
- <md-nav-list dense>
21
- <a md-list-item [routerLink]="['/templates']">
22
- <md-icon md-list-avatar>system_update_alt</md-icon>
23
- <h4 md-line><span class="text-wrap">Landing Page</span></h4>
24
- <p md-line>a landing page template</p>
25
- </a>
26
- <md-divider></md-divider>
27
- <a md-list-item [routerLink]="['/templates/dashboard']">
28
- <md-icon md-list-avatar>dashboard</md-icon>
29
- <h4 md-line><span class="text-wrap">Dashboard</span></h4>
30
- <p md-line>an ngx-charts dashboard template</p>
31
- </a>
32
- <md-divider></md-divider>
33
- <a md-list-item [routerLink]="['/templates/email']">
34
- <md-icon md-list-avatar>email</md-icon>
35
- <h4 md-line><span class="text-wrap">Email App</span></h4>
36
- <p md-line>an email app template</p>
37
- </a>
38
- <md-divider></md-divider>
39
- <a md-list-item [routerLink]="['/templates/editor']">
40
- <md-icon md-list-avatar>view_array</md-icon>
41
- <h4 md-line><span class="text-wrap">IDE Editor</span></h4>
42
- <p md-line>an IDE text editor app template</p>
43
- </a>
44
- </md-nav-list>
45
- <a md-button color="accent" td-menu-footer href="https://github.com/Teradata/covalent-quickstart/tree/develop/src/app/templates" target="_blank">
46
- View Code
47
- </a>
48
- </td-menu>
49
- </md-menu>
50
- <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>
51
- </div>
52
- <a md-fab td-sidenav-content color="accent" class="md-fab-position-bottom-right" style="bottom:20px; position: fixed;">
53
- <md-icon>add</md-icon>
54
- </a>
55
- <md-nav-list td-sidenav-content >
56
- <template let-i="index" let-last="last" let-hero ngFor [ngForOf]="heroes" [ngForTrackBy]="trackById">
57
- <a md-list-item>
58
- <img md-list-avatar src="http://lorempixel.com/40/40/people/{{i+1}}" />
59
- <h3 md-line> {{hero.name}} </h3>
60
- <p md-line> Hero ID is: {{hero.id}} </p>
61
- <md-icon class="tc-amber-800">fiber_new</md-icon>
62
- </a>
63
- <md-divider *ngIf="!last" md-inset></md-divider>
64
- </template>
65
- </md-nav-list>
66
- <md-card tdMediaToggle="gt-xs" [mediaClasses]="['side']">
67
- <md-card-header>
68
- <img md-card-avatar src="http://lorempixel.com/40/40/people/9" />
69
- <md-card-title>Firstname Lastname</md-card-title>
70
- <md-card-subtitle>Tuesday, January 3 2017 at 8:39 PM</md-card-subtitle>
71
- <span flex></span>
72
- <div class="pad-top pad-right">
73
- <button md-icon-button><md-icon>reply</md-icon></button>
74
- <button md-icon-button><md-icon>forward</md-icon></button>
75
- <button md-icon-button><md-icon>more_vert</md-icon></button>
76
- </div>
77
- </md-card-header>
78
- <md-divider></md-divider>
79
- <div class="md-padding">
80
- <p>
81
- 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.
82
- </p>
83
- <p>
84
- 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.
85
- </p>
86
- <p>
87
- 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.
88
- </p>
89
- <p>
90
- 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.
91
- </p>
92
- <p>
93
- Sincerly<br>-Kimmie
94
- </p>
95
- </div>
96
- <md-divider></md-divider>
97
- <div layout="row" layout-align="space-around center" class="pad">
98
- <button md-button class="tc-grey-600">
99
- <md-icon class="pull-bottom">reply</md-icon>
100
- <div class="md-caption">Reply</div>
101
- </button>
102
- <button md-button class="tc-grey-600">
103
- <md-icon class="pull-bottom">reply_all</md-icon>
104
- <div class="md-caption">Reply All</div>
105
- </button>
106
- <button md-button class="tc-grey-600">
107
- <md-icon class="pull-bottom">forward</md-icon>
108
- <div class="md-caption">Forward</div>
109
- </button>
110
- </div>
111
- </md-card>
112
-</td-layout-nav-list>
13
+</md-toolbar>
14
+<md-divider></md-divider>
15
+<td-data-table
16
+ [data]="filteredData"
17
+ [columns]="columns"
18
+ [sortable]="true"
19
+ [sortBy]="sortBy"
20
+ [sortOrder]="sortOrder"
21
+ (sortChange)="sort($event)">
22
+</td-data-table>
23
+<td-paging-bar #pagingBar [pageSizes]="[10, 20, 40]" [total]="filteredTotal" (change)="page($event)">
24
+ <span td-paging-bar-label hide-xs>Rows per page:</span>
25
+ {{pagingBar.range}} <span hide-xs>of {{pagingBar.total}}</span>
26
+</td-paging-bar>
securis/src/main/webapp/src/app/pack.list.component.ts
....@@ -1,83 +1,119 @@
1
-import { Hero } from './hero';
1
+import { TdDataTableService, TdDataTableSortingOrder, ITdDataTableSortChangeEvent, ITdDataTableColumn } from '@covalent/core';
2
+import { IPageChangeEvent } from '@covalent/core';
23 import { Component, AfterViewInit } from '@angular/core';
34 import { TdMediaService } from '@covalent/core';
5
+import { PacksService } from './resources/packs';
46
5
-
6
-const HEROES: Hero[] = [
7
- { id: 11, name: 'Mr. Nice' },
8
- { id: 12, name: 'Narco' },
9
- { id: 13, name: 'Bombasto' },
10
- { id: 14, name: 'Celeritas' },
11
- { id: 15, name: 'Magneta' },
12
- { id: 16, name: 'RubberMan' },
13
- { id: 17, name: 'Dynama' },
14
- { id: 18, name: 'Dr IQ' },
15
- { id: 19, name: 'Magma' },
16
- { id: 20, name: 'Tornado' }
17
-];
7
+var pack_example = {
8
+ id: 7,
9
+ code: 'DX250000',
10
+ status: 'AC',
11
+ application_name: 'Doxr',
12
+ created_by_id: 'admin',
13
+ created_by_name: 'Administrator (admin)',
14
+ creation_timestamp: 1440597540000,
15
+ end_valid_date: 2051222400000,
16
+ init_valid_date: 1440547200000,
17
+ license_preactivation: true,
18
+ license_type_id: 5,
19
+ licensetype_code: 'DXL3',
20
+ metadata:
21
+ [ { key: 'max_docs',
22
+ value: '250000',
23
+ readonly: true,
24
+ mandatory: true,
25
+ pack_id: 7 } ],
26
+ num_activations: 7,
27
+ num_available: -2,
28
+ num_creations: 7,
29
+ num_licenses: 5,
30
+ organization_id: 2,
31
+ organization_name: 'CurisTec',
32
+ preactivation_valid_period: 70,
33
+ renew_valid_period: 0,
34
+}
1835
1936 @Component({
2037 selector: 'pack-list',
2138 templateUrl: 'src/app/pack.list.component.html'
2239 })
23
-
24
- /*`
25
- <h2>My Heroes</h2>
26
- <ul class="heroes">
27
- <li *ngFor="let hero of heroes"
28
- [class.selected]="hero === selectedHero"
29
- (click)="onSelect(hero)">
30
- <span class="badge">{{hero.id}}</span> {{hero.name}}
31
- </li>
32
- </ul>
33
-<div *ngIf="selectedHero">
34
- <my-hero-detail [hero]="selectedHero"></my-hero-detail>
35
-</div>
36
-
37
- `*/
38
-
3940 export class PackListComponent implements AfterViewInit {
40
- routes: Object[] = [
41
- {
42
- title: 'Dashboard',
43
- route: '/',
44
- icon: 'dashboard',
45
- }, {
46
- title: 'Product Dashboard',
47
- route: '/',
48
- icon: 'view_quilt',
49
- }, {
50
- title: 'Product Logs',
51
- route: '/',
52
- icon: 'receipt',
53
- }, {
54
- title: 'Manage Users',
55
- route: '/',
56
- icon: 'people',
57
- }, {
58
- title: 'Covalent Templates',
59
- route: '/',
60
- icon: 'view_module',
61
- },
62
- ];
41
+ data: any[] = [];
42
+ columns: ITdDataTableColumn[] = [
43
+ { name: 'code', label: 'Code', tooltip: 'License pack code' },
44
+ { name: 'application_name', label: 'App name' },
45
+ { name: 'licensetype_code', label: 'License type' },
46
+ { name: 'organization_name', label: 'Organization' },
47
+ { name: 'num_licenses', label: 'Lic', numeric: true, tooltip: 'Initial pack licenses' },
48
+ { name: 'num_available', label: 'Ava', numeric: true, tooltip: 'Available licenses' },
49
+ ];
6350
64
- title = 'Tour of Heroes';
65
- heroes = HEROES;
66
- selectedHero: Hero;
67
- hero: Hero = {
68
- id: 1,
69
- name: 'Windstorm'
70
- };
51
+ filteredData: any[] = this.data;
52
+ filteredTotal: number = this.data.length;
7153
72
- constructor(public media: TdMediaService) {
73
-
54
+ searchTerm: string = '';
55
+ fromRow: number = 1;
56
+ currentPage: number = 1;
57
+ pageSize: number = 10;
58
+ sortBy: string = 'application_name';
59
+ sortOrder: TdDataTableSortingOrder = TdDataTableSortingOrder.Descending;
60
+ filteredItems = this.data.length;
61
+
62
+ constructor(private _dataTableService: TdDataTableService,
63
+ private media: TdMediaService,
64
+ private packs: PacksService) {
65
+ this.packs.get().subscribe(
66
+ list => {
67
+ this.data = list;
68
+ this.filter();
69
+ },
70
+ err => console.error(err)
71
+ );
7472 }
7573
76
- onSelect(hero: Hero): void {
77
- this.selectedHero = hero;
74
+ ngOnInit(): void {
75
+ this.filter();
76
+ }
77
+
78
+ createPack() : void {
79
+
80
+ }
81
+
82
+ sort(sortEvent: ITdDataTableSortChangeEvent): void {
83
+ this.sortBy = sortEvent.name;
84
+ this.sortOrder = sortEvent.order;
85
+ this.filter();
86
+ }
87
+
88
+ search(searchTerm: string): void {
89
+ this.searchTerm = searchTerm;
90
+ this.filter();
91
+ }
92
+
93
+ page(pagingEvent: IPageChangeEvent): void {
94
+ this.fromRow = pagingEvent.fromRow;
95
+ this.currentPage = pagingEvent.page;
96
+ this.pageSize = pagingEvent.pageSize;
97
+ this.filter();
98
+ }
99
+
100
+ loadData() {
101
+
102
+ }
103
+
104
+ filter(): void {
105
+ let newData: any[] = this.data;
106
+ newData = this._dataTableService.filterData(newData, this.searchTerm, true);
107
+ this.filteredTotal = newData.length;
108
+ this.filteredItems = newData.length;
109
+ newData = this._dataTableService.sortData(newData, this.sortBy, this.sortOrder);
110
+ newData = this._dataTableService.pageData(newData, this.fromRow, this.currentPage * this.pageSize);
111
+ this.filteredData = newData;
78112 }
79113
80114 ngAfterViewInit(): void {
81
- this.media.broadcast();
115
+ this.media.broadcast();
116
+
82117 }
83118 }
119
+
securis/src/main/webapp/src/app/resources/applications.ts
....@@ -0,0 +1,26 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var app_example = { code: 'CICS',
7
+ creation_timestamp: 1418384439000,
8
+ description: 'Wellbore integrity analysis software',
9
+ id: 1,
10
+ license_filename: 'config_server.lic',
11
+ metadata:
12
+ [ { key: 'simulationModes',
13
+ value: 'A1,A2,A3,QL,N1,QLPRO',
14
+ creation_timestamp: 1418384439000,
15
+ mandatory: true } ],
16
+ name: 'CurisIntegrity' }
17
+
18
+@Injectable()
19
+export class ApplicationsService extends SeCurisResourceServices {
20
+ constructor(http: Http) {
21
+ super(http, 'application');
22
+ }
23
+
24
+
25
+}
26
+
securis/src/main/webapp/src/app/resources/base.ts
....@@ -0,0 +1,49 @@
1
+import { Observable } from 'rxjs/Observable';
2
+import { Http, RequestOptionsArgs, URLSearchParams } from '@angular/http';
3
+
4
+class MySearchParams extends URLSearchParams {
5
+ constructor(obj : any) {
6
+ var searchQuery = Object.keys(obj).map(key => `${key}=${encodeURIComponent(obj[key])}`).join('&');
7
+ super(searchQuery);
8
+ }
9
+}
10
+
11
+export class SeCurisResourceServices {
12
+ constructor(protected http: Http,
13
+ protected resource: string) {
14
+ }
15
+
16
+ public get(id?: any) : Observable<any> {
17
+ let url = `${this.resource}/${id || ''}`;
18
+ return this.http.get(url).map(response => response.json());
19
+ }
20
+
21
+ public create(data: any) : Observable<any> {
22
+ let url = `${this.resource}`;
23
+ return this.http.post(url, JSON.stringify(data)).map(response => response.json());
24
+ }
25
+
26
+ public modify(id: any, data: any) : Observable<any> {
27
+ let url = `${this.resource}/${id}`;
28
+ return this.http.post(url, JSON.stringify(data)).map(response => response.json());
29
+ }
30
+
31
+ public remove(id: any) : Observable<any> {
32
+ let url = `${this.resource}/${id}`;
33
+ return this.http.delete(url).map(response => response.json());
34
+ }
35
+
36
+ public action(id: any, action: string, method = 'POST') : Observable<any> {
37
+ let url = `${this.resource}/${id}/${action}`;
38
+ var params = {
39
+ action: action
40
+ }
41
+ var options:RequestOptionsArgs = {
42
+ url: url,
43
+ method: method,
44
+ search: (method == 'GET') && new MySearchParams(params) || undefined,
45
+ body: (method == 'POST') && JSON.stringify(params) || undefined
46
+ };
47
+ return this.http.request(url, options).map(response => response.json());
48
+ }
49
+}
securis/src/main/webapp/src/app/resources/license_types.ts
....@@ -0,0 +1,24 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var lictype_example = { application_name: 'CurisIntegrity',
7
+ code: 'CIA2',
8
+ creation_timestamp: 1437145151000,
9
+ description: 'Modified after bug',
10
+ id: 2,
11
+ metadata: [ { key: 'datasetPrefix', value: '', mandatory: true } ],
12
+ name: 'Analytic2' }
13
+
14
+
15
+@Injectable()
16
+export class LicenseTypesService extends SeCurisResourceServices {
17
+ constructor(http: Http) {
18
+ super(http, 'licensetype');
19
+ }
20
+
21
+
22
+
23
+}
24
+
securis/src/main/webapp/src/app/resources/licenses.ts
....@@ -0,0 +1,98 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var lic_example = {
7
+ id: 101,
8
+ activation_code: 'f3e2d27e-7f81-4ac7-87ba-b9e38b4fdbb8',
9
+ code: 'CITR01-436-1',
10
+ code_suffix: 1,
11
+ created_by_id: '_client',
12
+ creation_timestamp: 1445898088000,
13
+ email: 'GQuercia@trican.ca',
14
+ expiration_date: 1487523828000,
15
+ full_name: 'George Quercia',
16
+ 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=="}',
17
+ modification_timestamp: 1484931828000,
18
+ pack_code: 'CITR01',
19
+ pack_id: 12,
20
+ 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"}',
21
+ status: 'AC'
22
+}
23
+
24
+export const PACK_STATUS = {
25
+ CREATED: 'CR',
26
+ ACTIVE: 'AC',
27
+ ONHOLD: 'OH',
28
+ EXPIRED: 'EX',
29
+ CANCELLED: 'CA'
30
+}
31
+
32
+export const LIC_STATUS = {
33
+ CREATED: 'CR',
34
+ ACTIVE: 'AC',
35
+ REQUESTED: 'RE',
36
+ PREACTIVE: 'PA',
37
+ EXPIRED: 'EX',
38
+ BLOCKED: 'BL',
39
+ CANCELLED: 'CA'
40
+}
41
+
42
+export const LIC_STATUSES = {
43
+ 'CR': 'Created',
44
+ 'AC': 'Active',
45
+ 'PA': 'Pre-active',
46
+ 'RE': 'Requested',
47
+ 'EX': 'Expired',
48
+ 'BL': 'Blocked',
49
+ 'CA': 'Cancelled'
50
+};
51
+
52
+/**
53
+ * These transitions could be get from server, class License.Status, but
54
+ * we copy them for simplicity, this info won't change easily
55
+ */
56
+export const LIC_ACTIONS_BY_STATUS = {
57
+ edit: [LIC_STATUS.REQUESTED, LIC_STATUS.CREATED, LIC_STATUS.EXPIRED, LIC_STATUS.PREACTIVE, LIC_STATUS.ACTIVE, LIC_STATUS.CANCELLED, LIC_STATUS.BLOCKED],
58
+ add_request: [LIC_STATUS.CREATED],
59
+ activate: [LIC_STATUS.CREATED, LIC_STATUS.REQUESTED, LIC_STATUS.PREACTIVE],
60
+ send: [LIC_STATUS.ACTIVE, LIC_STATUS.PREACTIVE],
61
+ download: [LIC_STATUS.ACTIVE, LIC_STATUS.PREACTIVE],
62
+ block: [LIC_STATUS.CANCELLED],
63
+ unblock: [LIC_STATUS.BLOCKED],
64
+ cancel: [LIC_STATUS.REQUESTED, LIC_STATUS.EXPIRED, LIC_STATUS.PREACTIVE, LIC_STATUS.ACTIVE],
65
+ 'delete': [LIC_STATUS.CREATED, LIC_STATUS.CANCELLED, LIC_STATUS.BLOCKED]
66
+}
67
+
68
+
69
+
70
+@Injectable()
71
+export class LicensesService extends SeCurisResourceServices {
72
+ constructor(http: Http) {
73
+ super(http, 'license');
74
+ }
75
+
76
+ public getByPack(packId: number) {
77
+ let url = `${this.resource}?packId=${packId}`;
78
+ return this.http.get(url).map(response => response.json());
79
+ }
80
+
81
+ public activate(id: number) {
82
+ return super.action(id, "activate");
83
+ }
84
+
85
+ public cancel(id: number) {
86
+ return super.action(id, "cancel");
87
+ }
88
+
89
+ public putonhold(id: number) {
90
+ return super.action(id, "putonhold");
91
+ }
92
+
93
+ public isActionAvailable(action:string, lic:any) {
94
+ var validStatuses = LIC_ACTIONS_BY_STATUS[action];
95
+ return lic && validStatuses && validStatuses.indexOf(lic.status) !== -1;
96
+ }
97
+}
98
+
securis/src/main/webapp/src/app/resources/organizations.ts
....@@ -0,0 +1,20 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var org_example = { code: 'NPS',
7
+ creation_timestamp: 1488269722000,
8
+ id: 9,
9
+ name: 'National Petroleum Services Saudi Arabia Int.',
10
+ users_ids: [ 'admin' ] }
11
+
12
+@Injectable()
13
+export class OrganizationsService extends SeCurisResourceServices {
14
+ constructor(http: Http) {
15
+ super(http, 'organization');
16
+ }
17
+
18
+
19
+}
20
+
securis/src/main/webapp/src/app/resources/packs.ts
....@@ -0,0 +1,92 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var pack_example = {
7
+ id: 7,
8
+ code: 'DX250000',
9
+ status: 'AC',
10
+ application_name: 'Doxr',
11
+ created_by_id: 'admin',
12
+ created_by_name: 'Administrator (admin)',
13
+ creation_timestamp: 1440597540000,
14
+ end_valid_date: 2051222400000,
15
+ init_valid_date: 1440547200000,
16
+ license_preactivation: true,
17
+ license_type_id: 5,
18
+ licensetype_code: 'DXL3',
19
+ metadata:
20
+ [ { key: 'max_docs',
21
+ value: '250000',
22
+ readonly: true,
23
+ mandatory: true,
24
+ pack_id: 7 } ],
25
+ num_activations: 7,
26
+ num_available: -2,
27
+ num_creations: 7,
28
+ num_licenses: 5,
29
+ organization_id: 2,
30
+ organization_name: 'CurisTec',
31
+ preactivation_valid_period: 70,
32
+ renew_valid_period: 0,
33
+}
34
+
35
+export const PACK_STATUS = {
36
+ CREATED: 'CR',
37
+ ACTIVE: 'AC',
38
+ ONHOLD: 'OH',
39
+ EXPIRED: 'EX',
40
+ CANCELLED: 'CA'
41
+ }
42
+
43
+export const PACK_STATUSES = {
44
+ 'CR': 'Created',
45
+ 'AC': 'Active',
46
+ 'OH': 'On Hold',
47
+ 'EX': 'Expired',
48
+ 'CA': 'Cancelled'
49
+ };
50
+
51
+export const COLORS_BY_STATUS = {
52
+ 'CR': '#808080',
53
+ 'AC': '#329e5a',
54
+ 'OH': '#9047c7',
55
+ 'EX': '#ea7824',
56
+ 'CA': '#a21717'
57
+ };
58
+
59
+export const PACK_ACTIONS_BY_STATUS = {
60
+ edit: [PACK_STATUS.CREATED, PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD, PACK_STATUS.ACTIVE],
61
+ activate: [PACK_STATUS.CREATED, PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD],
62
+ putonhold: [PACK_STATUS.ACTIVE],
63
+ cancel: [PACK_STATUS.EXPIRED, PACK_STATUS.ONHOLD, PACK_STATUS.ACTIVE],
64
+ 'delete': [PACK_STATUS.CREATED, PACK_STATUS.CANCELLED]
65
+ }
66
+
67
+
68
+@Injectable()
69
+export class PacksService extends SeCurisResourceServices {
70
+ constructor(http: Http) {
71
+ super(http, 'pack');
72
+ }
73
+
74
+ public activate(id: number) {
75
+ return super.action(id, "activate");
76
+ }
77
+
78
+ public cancel(id: number) {
79
+ return super.action(id, "cancel");
80
+ }
81
+
82
+ public putonhold(id: number) {
83
+ return super.action(id, "putonhold");
84
+ }
85
+
86
+ public isActionAvailable(action:string, pack:any) {
87
+ var validStatuses = PACK_ACTIONS_BY_STATUS[action];
88
+ return pack && validStatuses && validStatuses.indexOf(pack.status) !== -1;
89
+ }
90
+
91
+}
92
+
securis/src/main/webapp/src/app/resources/users.ts
....@@ -0,0 +1,26 @@
1
+import { Observable } from 'rxjs/Rx';
2
+import { Injectable } from '@angular/core';
3
+import { Http, RequestOptions } from '@angular/http';
4
+import { SeCurisResourceServices } from './base';
5
+
6
+var user_example = {
7
+ creation_timestamp: 1479898458000,
8
+ email: 'rbouchair@curistec.com',
9
+ first_name: 'Rym',
10
+ lastLogin: 1488885433000,
11
+ last_name: 'Bouchair',
12
+ modificationTimestamp: 1479898458000,
13
+ organizations_ids: [ 1, 2, 5, 6, 7, 8 ],
14
+ roles: [ 1 ],
15
+ username: 'rym' }
16
+
17
+
18
+@Injectable()
19
+export class UsersService extends SeCurisResourceServices {
20
+ constructor(http: Http) {
21
+ super(http, 'user');
22
+ }
23
+
24
+
25
+}
26
+
securis/src/main/webapp/src/app/user.service.ts
....@@ -1,3 +1,4 @@
1
+import { LocaleService } from './common/i18n';
12 import { Injectable } from '@angular/core';
23 import { Router } from '@angular/router';
34 import { Location } from '@angular/common';
....@@ -11,7 +12,8 @@
1112 @Injectable()
1213 export class UserService {
1314
14
- constructor(private router: Router,
15
+ constructor(private $L: LocaleService,
16
+ private router: Router,
1517 private store: LocalStorageService,
1618 private http: Http) {
1719
....@@ -22,14 +24,14 @@
2224 params.append('username', username);
2325 params.append('password', password);
2426 let options = new RequestOptions({ headers: new Headers({ "Content-Type": "application/x-www-form-urlencoded" })});
25
- return this.http.post('user/login', params, options)
27
+ return this.http.post('user/login', params.toString(), options)
2628 .map((res: Response) => {
2729 let data = res.json();
2830 this.store.set('username', username);
2931 this.store.set('token', data.token);
3032 return <string>data.token;
3133 })
32
- .catch(this.handleError);
34
+ .catch((r) => this.handleError(r));
3335 }
3436
3537 isLoggedIn() : Observable<Boolean> {
....@@ -45,7 +47,7 @@
4547 }
4648 return body.valid;
4749 })
48
- .catch(this.handleError)
50
+ .catch((r) => this.handleError(r))
4951 .catch(() => Observable.of(false));
5052 }
5153
....@@ -62,12 +64,21 @@
6264 // In a real world app, we might use a remote logging infrastructure
6365 let errMsg: string;
6466 if (error instanceof Response) {
65
- const body = error.json() || '';
66
- const err = body.error || JSON.stringify(body);
67
+ const err = JSON.stringify(error);
6768 errMsg = `${error.status} - ${error.statusText || ''} ${err}`;
6869 } else {
6970 errMsg = error.message ? error.message : error.toString();
7071 }
72
+
73
+ if (error.status === 403 /* forbidden */ || error.status === 401 /* unauthorized */) {
74
+ errMsg = this.$L.get('Invalid credentials');
75
+ } else if (error.status === 418 /* Teapot */) {
76
+ errMsg = this.$L.get(error.headers.get('X-SECURIS-ERROR-MSG'));
77
+ } else {
78
+ console.error(error);
79
+ errMsg = this.$L.get(`Unexpected error HTTP (${error.status}) accessing to server. Contact with the administrator.`);
80
+ }
81
+
7182 console.error(errMsg);
7283 return Observable.throw(errMsg);
7384 }
securis/src/main/webapp/src/favicon.ico
Binary files differ