X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=auth%2Fauth-gui%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fgui%2Fpages%2FCredHistory.java;fp=auth%2Fauth-gui%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Faaf%2Fauth%2Fgui%2Fpages%2FCredHistory.java;h=af26a43015fd6b52572d2db999f4c6d554b6f6ab;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=7e3962ecf882fd622be91e99ca050a1564391d81;hpb=bdce7667a6e272e2fa32e298d957a0d9090c5bc9;p=aaf%2Fauthz.git diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java index 7e3962ec..af26a430 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/CredHistory.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -61,7 +61,7 @@ public class CredHistory extends Page { static final String HREF = "/gui/credHistory"; static final String FIELDS[] = {"user","dates"}; - + public CredHistory(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { super(gui.env,NAME,HREF, FIELDS, new BreadCrumbs(breadcrumbs), @@ -74,24 +74,24 @@ public class CredHistory extends Page { @Override public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) throws APIException, IOException { String obUser = trans.get(user, null); - + // Use Javascript to make the table title more descriptive hgen.js() .text("var caption = document.querySelector(\".title\");") - .text("caption.innerHTML='History for User [ " + obUser + " ]';") + .text("caption.innerHTML='History for User [ " + obUser + " ]';") .done(); - + // Use Javascript to change Link Target to our last visited Detail page String lastPage = CredDetail.HREF + "?role=" + obUser; hgen.js() - .text("alterLink('roledetail', '"+lastPage + "');") + .text("alterLink('roledetail', '"+lastPage + "');") .done(); - + hgen.br(); hgen.leaf("a", "href=#advanced_search","onclick=divVisibility('advanced_search');","class=greenbutton").text("Advanced Search").end() .divID("advanced_search", "style=display:none"); hgen.incr("table"); - + addDateRow(hgen,"Start Date"); addDateRow(hgen,"End Date"); hgen.incr("tr").incr("td"); @@ -106,9 +106,9 @@ public class CredHistory extends Page { } ); - + } - + private static void addDateRow(HTMLGen hgen, String s) { hgen .incr("tr") @@ -129,16 +129,16 @@ public class CredHistory extends Page { .end() .incr("td") .tagOnly("input","type=number","id=year"+s.substring(0, s.indexOf(' ')),"required", - "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900", + "value="+Calendar.getInstance().get(Calendar.YEAR), "min=1900", "max="+Calendar.getInstance().get(Calendar.YEAR), "placeholder=Year").end() .end(); } - - + + /** * Implement the Table Content for History - * + * * @author Jonathan * */ @@ -146,25 +146,25 @@ public class CredHistory extends Page { private static final String[] headers = new String[] {"Date","User","Memo"}; private Slot user; private Slot dates; - + public Model(AuthzEnv env) { user = env.slot(NAME+".user"); dates = env.slot(NAME+".dates"); } - + @Override public String[] headers() { return headers; } - + @Override public Cells get(final AuthzTrans trans, final AAF_GUI gui) { final String oName = trans.get(user,null); final String oDates = trans.get(dates,null); - + Cells rv = Cells.EMPTY; if (oName!=null) { - + try { rv = gui.clientAsUser(trans.getUserPrincipal(), new Retryable() { @Override @@ -181,14 +181,14 @@ public class CredHistory extends Page { tt.done(); tt = trans.start("Load History Data", Env.SUB); List histItems = fh.value.getItem(); - + java.util.Collections.sort(histItems, new Comparator() { @Override public int compare(Item o1, Item o2) { return o2.getTimestamp().compare(o1.getTimestamp()); } }); - + for (Item i : histItems) { String user = i.getUser(); AbsCell userCell = new TextCell(user); @@ -209,7 +209,7 @@ public class CredHistory extends Page { } } finally { tt.done(); - } + } return new Cells(rv,msg); } });