Post Init Service Starter
[aaf/authz.git] / auth / auth-gui / src / main / java / org / onap / aaf / auth / gui / pages / Home.java
1 /**
2  * ============LICENSE_START====================================================
3  * org.onap.aaf
4  * ===========================================================================
5  * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6  * ===========================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END====================================================
19  *
20  */
21
22 package org.onap.aaf.auth.gui.pages;
23
24 import static org.onap.aaf.misc.xgen.html.HTMLGen.A;
25 import static org.onap.aaf.misc.xgen.html.HTMLGen.H3;
26
27 import java.io.IOException;
28
29 import org.onap.aaf.auth.gui.AAF_GUI;
30 import org.onap.aaf.auth.gui.NamedCode;
31 import org.onap.aaf.auth.gui.Page;
32 import org.onap.aaf.misc.env.APIException;
33 import org.onap.aaf.misc.xgen.Cache;
34 import org.onap.aaf.misc.xgen.Mark;
35 import org.onap.aaf.misc.xgen.html.HTMLGen;
36
37
38 public class Home extends Page {
39     public static final String HREF = "/gui/home";
40     /*
41      *      Relative path, Menu Name, Full Path
42      */
43     public static String[][] MENU_ITEMS = new String[][] {
44                 {"myperms","My Permissions","/gui/myperms"},
45                 {"myroles","My Roles","/gui/myroles"},
46                 {"ns","My Namespaces","/gui/ns"},
47                 {"approve","My Approvals","/gui/approve"},
48                 {"myrequests","My Pending Requests","/gui/myrequests"},
49                     // Enable later
50                 //  {"onboard","Onboarding"},
51                 {"passwd","Password Management","/gui/passwd"},
52                 {"cui","Command Prompt","/gui/cui"},
53                 {"api","AAF API","/gui/api"}
54     };
55     public Home(final AAF_GUI gui) throws APIException, IOException {
56         super(gui.env,"Home",HREF, NO_FIELDS, new NamedCode(false,"content") {
57             @Override
58             public void code(final Cache<HTMLGen> cache, final HTMLGen htmlGen) throws APIException, IOException {
59 //                // TEMP
60 //                JSGen jsg = xgen.js();
61 //                jsg.function("httpPost","sURL","sParam")
62 //                    .text("var oURL = new java.net.URL(sURL)")
63 //                    .text("var oConn = oURL.openConnection();")
64 //                    .text("oConn.setDoInput(true);")
65 //                    .text("oConn.setDoOutpu(true);")
66 //                    .text("oConn.setUseCaches(false);")
67 //                    .text("oConn.setRequestProperty(\"Content-Type\",\"application/x-www-form-urlencoded\");")
68 //                    .text(text)
69 //                jsg.done();
70                 // TEMP
71                 final Mark pages = htmlGen.divID("Pages");
72                 htmlGen.leaf(H3).text("Choose from the following:").end();
73                 for(String[] mi : MENU_ITEMS) {
74                         htmlGen.leaf(A,"href="+mi[0]).text(mi[1]).end();
75                 }
76                 htmlGen.end(pages);
77             }
78         });
79     }
80     
81 }