changed vre name

This commit is contained in:
Alfredo Oliviero 2024-03-07 16:37:35 +01:00
parent 2ac68f0690
commit 7252491fd5
1 changed files with 46 additions and 35 deletions

View File

@ -9,6 +9,15 @@ pageContext.setAttribute("userGroups", userGroups);
List<String> userContexts = (List<String>) request.getAttribute("userContexts"); List<String> userContexts = (List<String>) request.getAttribute("userContexts");
pageContext.setAttribute("userContexts", userContexts); pageContext.setAttribute("userContexts", userContexts);
String sub = "-";
if (userContexts != null && userContexts.size()>0){
sub = userContexts.get(0).substring(userContexts.get(0).lastIndexOf("/") + 1);
}
pageContext.setAttribute("firstContextName", sub);
%> %>
<script type="text/javascript"> <script type="text/javascript">
var global_token_response = {}; var global_token_response = {};
@ -99,9 +108,9 @@ pageContext.setAttribute("userContexts", userContexts);
console.log("resultObject", resultObject) console.log("resultObject", resultObject)
closeInfo('intro_info', false); //closeInfo('intro_info', false);
openInfo('token_info', true); // closeInfo('token_info', true);
openInfo('refresh_token_info', true); // closeInfo('refresh_token_info', true);
} }
function setError(error_comment) { function setError(error_comment) {
@ -159,8 +168,8 @@ pageContext.setAttribute("userContexts", userContexts);
function toggleInfo(destination_id, do_switch) { function toggleInfo(destination_id, do_switch) {
$("#" + destination_id).toggle(do_switch); $("#" + destination_id).toggle(do_switch);
do_switch = $("#" + destination_id).css('display') != 'none'; do_switch = $("#" + destination_id).css('display') != 'none';
$("#" + destination_id + "_icon").toggleClass("icon-chevron-up", !do_switch); $("#" + destination_id + "_icon").toggleClass("icon-chevron-up", do_switch);
$("#" + destination_id + "_icon").toggleClass("icon-chevron-down", do_switch); $("#" + destination_id + "_icon").toggleClass("icon-chevron-down", !do_switch);
} }
function decodeFunction(text_id) { function decodeFunction(text_id) {
@ -266,7 +275,7 @@ pageContext.setAttribute("userContexts", userContexts);
<div> <div>
<c:if test="${userContexts.size() == 1}"> <c:if test="${userContexts.size() == 1}">
<p>Current context: ${userContexts[0]}</p> <p>Current context: ${firstContextName}</p>
<input type="hidden" name="contexts" id="myselect" value="${userContexts[0]}"> <input type="hidden" name="contexts" id="myselect" value="${userContexts[0]}">
</c:if> </c:if>
@ -295,32 +304,7 @@ pageContext.setAttribute("userContexts", userContexts);
</div> </div>
<br> <br>
<div class="well well-small" id="intro_container">
<div class="row" onclick="toggleInfo('intro_info')">
<span><b>Instructions</b></span>
<i id="intro_info_icon" class="icon-chevron-down pull-right"></i>
</div>
<div id="intro_info" class="well well-small bg_white">
<p>Obtain your personal OAuth2 Access and Refresh Tokens, to be used for
programmatic interaction with the D4Science Resources</p>
<p> Do not use this token to authenticate services but only for personal
access
</p>
<p>
ref:
<ul>
<li><a href="https://dev.d4science.org/how-to-access-resources">D4Science:
Accessing Resources - how to</a></li>
<li><a
href="https://www.oauth.com/oauth2-servers/making-authenticated-requests">OAuth2:
Making Authenticated Requests</a></li>
<li><a
href="https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/">OAuth2:
Refresh Tokens</a></li>
</ul>
</p>
</div>
</div>
<div id="response_group"> <div id="response_group">
@ -340,7 +324,7 @@ pageContext.setAttribute("userContexts", userContexts);
<div class="btn-group btn-group span2"> <div class="btn-group btn-group span2">
<button id="buttonDecode" data-toggle="tooltip" class="btn btn-small" <button id="buttonDecode" data-toggle="tooltip" class="btn btn-small"
onclick="decodeFunction('tokenResult')" title="Decode" alt="Decode"> onclick="decodeFunction('tokenResult')" title="Decode" alt="Decode">
<i class="icon-list"></i> <i class="icon-eye-open"></i>
</button> </button>
<button id="buttonCopy" data-toggle="tooltip" class="btn btn-small" <button id="buttonCopy" data-toggle="tooltip" class="btn btn-small"
onclick="copyFromTextField('tokenResult')" title="Copy" alt="Copy"> onclick="copyFromTextField('tokenResult')" title="Copy" alt="Copy">
@ -391,10 +375,10 @@ pageContext.setAttribute("userContexts", userContexts);
<div class="row"> <div class="row">
<span class="help-block span9" id='refreshTokenResultDetails'></span> <span class="help-block span9" id='refreshTokenResultDetails'></span>
<div class="btn-group btn-group span2"> <div class="btn-group btn-group span2">
<button id="buttonDecode" data-toggle="tooltip" class="btn btn-small" <button id="buttonDecodeRefresh" data-toggle="tooltip" class="btn btn-small"
onclick="decodeFunction('refreshTokenResult')" title="Decode" onclick="decodeFunction('refreshTokenResult')" title="Decode"
alt="Decode"> alt="Decode">
<i class="icon-list"></i> <i class="icon-eye-open"></i>
</button> </button>
<button id="buttonCopy" data-toggle="tooltip" class="btn btn-small" <button id="buttonCopy" data-toggle="tooltip" class="btn btn-small"
onclick="copyFromTextField('refreshTokenResult')" title="Copy" onclick="copyFromTextField('refreshTokenResult')" title="Copy"
@ -468,6 +452,33 @@ pageContext.setAttribute("userContexts", userContexts);
</div> </div>
<div class="well well-small" id="intro_container">
<div class="row" onclick="toggleInfo('intro_info')">
<span><b>Instructions</b></span>
<i id="intro_info_icon" class="icon-chevron-down pull-right"></i>
</div>
<div id="intro_info" class="well well-small bg_white">
<p>Obtain your personal OAuth2 Access and Refresh Tokens, to be used for
programmatic interaction with the Resources</p>
<p> Do not use this token to authenticate services but only for personal
access
</p>
<p>
ref:
<ul>
<li><a href="https://dev.d4science.org/how-to-access-resources">
Accessing Resources - how to</a></li>
<li><a
href="https://www.oauth.com/oauth2-servers/making-authenticated-requests">OAuth2:
Making Authenticated Requests</a></li>
<li><a
href="https://www.oauth.com/oauth2-servers/making-authenticated-requests/refreshing-an-access-token/">OAuth2:
Refresh Tokens</a></li>
</ul>
</p>
</div>
</div>
<div id="error_msg" class="alert alert-error"> <div id="error_msg" class="alert alert-error">
Configuration error, no context available Configuration error, no context available
</div> </div>