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%2FPendingRequestsShow.java;h=b528b24ba3303568ea8835f9f94fc5925f0eed41;hb=1296352d8eafee57f982a4342ad79ada4aa56d28;hp=ae5fe3750b98c759d551c5f7218e5875f508c1fd;hpb=078325f8ef05a6216292f5331ef0805a5bdd9ef1;p=aaf%2Fauthz.git diff --git a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java index ae5fe375..b528b24b 100644 --- a/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.java +++ b/auth/auth-gui/src/main/java/org/onap/aaf/auth/gui/pages/PendingRequestsShow.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. @@ -62,71 +62,71 @@ public class PendingRequestsShow extends Page { public static final String NAME = "MyRequests"; private static final String[] FIELDS = new String[] {"as_user"}; // as_user Checked in Display private static final String AS_USER=NAME+".as_user"; - + public PendingRequestsShow(final AAF_GUI gui, final Page ... breadcrumbs) throws APIException, IOException { super(gui.env, NAME,HREF, FIELDS, - new BreadCrumbs(breadcrumbs), + new BreadCrumbs(breadcrumbs), new TopOfPage(gui.env,true, "expedite"), new Table("Pending Requests",gui.env.newTransNoAvg(),new Model(gui.env), "class=std") ); } private static final class TopOfPage extends NamedCode { - private Slot sAsUser; - - private TopOfPage(AuthzEnv env, boolean no_cache, String name) { - super(no_cache, name); - sAsUser = env.slot(AS_USER); - } - - @Override - public void code(final Cache cache, final HTMLGen hgen) throws APIException, IOException { - cache.dynamic(hgen, new DynamicCode() { - @Override - public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) throws APIException, IOException { - String user = trans.get(sAsUser,null); - if(user==null) { - user=trans.user(); - } else { - hgen.incr(HTMLGen.H3,"class=center").text("Displaying for " + user).end(); - } - - hgen - .leaf(HTMLGen.P, "class=expedite_request").text("These are your submitted Requests that are awaiting Approval. ") - .br() - .text("To Expedite a Request: ") - .leaf("a","href=#expedite_directions","onclick=divVisibility('expedite_directions');") - .text("Click Here").end() - .divID("expedite_directions", "style=display:none"); - - hgen - .incr(HTMLGen.OL) - .incr(HTMLGen.LI) - .leaf("a","href="+ApprovalForm.HREF+"?user="+user, "id=userApprove") - .text("Copy This Link") - .end() - .end() - .incr(HTMLGen.LI) - .text("Send it to the Approver Listed") - .end() - .end() - .text("NOTE: Using this link, the Approver will only see your requests. You only need to send this link once!") - .end() - .end(); - } - }); + private Slot sAsUser; + + private TopOfPage(AuthzEnv env, boolean no_cache, String name) { + super(no_cache, name); + sAsUser = env.slot(AS_USER); + } + + @Override + public void code(final Cache cache, final HTMLGen hgen) throws APIException, IOException { + cache.dynamic(hgen, new DynamicCode() { + @Override + public void code(final AAF_GUI gui, final AuthzTrans trans, final Cache cache, final HTMLGen hgen) throws APIException, IOException { + String user = trans.get(sAsUser,null); + if(user==null) { + user=trans.user(); + } else { + hgen.incr(HTMLGen.H3,"class=center").text("Displaying for " + user).end(); + } + + hgen + .leaf(HTMLGen.P, "class=expedite_request").text("These are your submitted Requests that are awaiting Approval. ") + .br() + .text("To Expedite a Request: ") + .leaf("a","href=#expedite_directions","onclick=divVisibility('expedite_directions');") + .text("Click Here").end() + .divID("expedite_directions", "style=display:none"); + + hgen + .incr(HTMLGen.OL) + .incr(HTMLGen.LI) + .leaf("a","href="+ApprovalForm.HREF+"?user="+user, "id=userApprove") + .text("Copy This Link") + .end() + .end() + .incr(HTMLGen.LI) + .text("Send it to the Approver Listed") + .end() + .end() + .text("NOTE: Using this link, the Approver will only see your requests. You only need to send this link once!") + .end() + .end(); + } + }); } - } + } - /** + /** * Implement the Table Content for Requests by User - * + * * @author Jeremiah * */ private static class Model extends TableData { final long NUM_100NS_INTERVALS_SINCE_UUID_EPOCH = 0x01b21dd213814000L; - private final Slot sAsUser; + private final Slot sAsUser; private static final String[] headers = new String[] {"Request Date","Status","Memo","Approver"}; public Model(AuthzEnv env) { @@ -137,7 +137,7 @@ public class PendingRequestsShow extends Page { public String[] headers() { return headers; } - + @Override public Cells get(final AuthzTrans trans, final AAF_GUI gui) { final ArrayList rv = new ArrayList<>(); @@ -145,7 +145,7 @@ public class PendingRequestsShow extends Page { gui.clientAsUser(trans.getUserPrincipal(), new Retryable() { @Override public Void code(Rcli client)throws CadiException, ConnectException, APIException { - final String user = trans.get(sAsUser,trans.user()); + final String user = trans.get(sAsUser,trans.user()); TimeTaken tt = trans.start("AAF Get Approvals by User",Env.REMOTE); try { @@ -163,12 +163,12 @@ public class PendingRequestsShow extends Page { return id1.timestamp()<=id2.timestamp()?1:-1; } }); - + String prevTicket = null; for (Approval a : approvals) { String approver = a.getApprover(); // String approverShort = approver.substring(0,approver.indexOf('@')); - + AbsCell tsCell = null; String ticket = a.getTicket(); if (ticket==null || ticket.equals(prevTicket)) { @@ -180,7 +180,7 @@ public class PendingRequestsShow extends Page { RequestDetail.HREF + "?ticket=" + ticket,false); prevTicket = ticket; } - + AbsCell approverCell = new TextCell(approver); AbsCell[] sa = new AbsCell[] { tsCell,