Edit improvements

This commit is contained in:
Katerina Iatropoulou 2020-10-13 18:26:00 +00:00
parent 4b0a3a8c01
commit f106d42191
4 changed files with 14 additions and 7 deletions

View File

@ -22,7 +22,6 @@ public class RegisteredServicesUtils {
} }
public void addRegistedService(RegisteredService registeredService) throws SQLException { public void addRegistedService(RegisteredService registeredService) throws SQLException {
System.out.println("I AM HEEEEEEEEERE :P");
registeredServiceDao.insertRegisteredService(registeredService); registeredServiceDao.insertRegisteredService(registeredService);
} }

View File

@ -68,12 +68,13 @@ public class TokenUtils {
} }
public static ServiceResponse getRegisteredService(String serviceId, String accessToken) throws IOException { public static ServiceResponse getRegisteredService(String serviceId, String accessToken) throws IOException {
HttpGet httpGet = new HttpGet("https://openaire-dev.aai-dev.grnet.gr/oidc/api/clients/22"); HttpGet httpGet = new HttpGet("https://openaire-dev.aai-dev.grnet.gr/oidc/api/clients/"+serviceId);
httpGet.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken); httpGet.setHeader(HttpHeaders.AUTHORIZATION, "Bearer " + accessToken);
CloseableHttpClient httpclient = HttpClients.createDefault(); CloseableHttpClient httpclient = HttpClients.createDefault();
HttpResponse httpResponse = httpclient.execute(httpGet); HttpResponse httpResponse = httpclient.execute(httpGet);
String registeredService = IOUtils.toString(httpResponse.getEntity().getContent(), StandardCharsets.UTF_8.name()); String registeredService = IOUtils.toString(httpResponse.getEntity().getContent(), StandardCharsets.UTF_8.name());
System.out.println(registeredService);
return new Gson().fromJson(registeredService,ServiceResponse.class); return new Gson().fromJson(registeredService,ServiceResponse.class);
} }
@ -100,6 +101,8 @@ public class TokenUtils {
GsonBuilder builder = new GsonBuilder(); GsonBuilder builder = new GsonBuilder();
builder.serializeNulls(); builder.serializeNulls();
Gson gson = builder.create(); Gson gson = builder.create();
System.out.println("Created json " +serviceJSON);
return gson.toJson(serviceJSON); return gson.toJson(serviceJSON);
} }
} }

View File

@ -94,14 +94,15 @@
<div class="alert alert-danger" aria-hidden="true" style="display: none;"></div> <div class="alert alert-danger" aria-hidden="true" style="display: none;"></div>
<div class="form-group"> <div class="form-group">
<span class="msg_first_name_error uk-text-danger uk-text-small uk-float-left" style='${msg_first_name_error_display}'>Please enter a name for your service.</span> <span class="msg_first_name_error uk-text-danger uk-text-small uk-float-left" style='${msg_first_name_error_display}'>Please enter a name for your service.</span>
<input id="first_name" name="first_name" type="text" placeholder="Name (*)" class="form-control" value=${first_name}></div> <input id="first_name" name="first_name" type="text" placeholder="Name (*)" class="form-control" value="${first_name}"></div>
<c:remove var="msg_first_name_error_display" scope="session" /> <c:remove var="msg_first_name_error_display" scope="session" />
<c:remove var="first_name" scope="session" /> <c:remove var="first_name" scope="session" />
<div class="form-group"> <div class="form-group">
<textarea id="description" name="description" type="textarea" placeholder="Description:" class="form-control uk-textarea" rows="3" value=${description}></textarea> <textarea id="description" name="description" type="textarea" placeholder="Description:" class="form-control uk-textarea" rows="3" value="${description}">
<c:remove var="organization" scope="session" /> ${description}</textarea>
<c:remove var="description" scope="session" />
<div class="uk-width-1-1 uk-grid-margin uk-first-column"> <div class="uk-width-1-1 uk-grid-margin uk-first-column">
<button type="submit" class="uk-button uk-button-default" onclick="location.href='../registeredServices'">Cancel</button> <button type="button" class="uk-button uk-button-default" onclick="document.location.href='./registeredServices'">Cancel</button>
<button type="submit" class="uk-button uk-button-primary" onclick="return validate();">Update service</button> <button type="submit" class="uk-button uk-button-primary" onclick="return validate();">Update service</button>
</div> </div>
</div> </div>

View File

@ -89,8 +89,12 @@
<div class="uk-width-2-3@l uk-width-2-3@m"> <div class="uk-width-2-3@l uk-width-2-3@m">
<h2 class="uk-h2 uk-margin-small-bottom">Registered services</h2> <h2 class="uk-h2 uk-margin-small-bottom">Registered services</h2>
<span id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</span> <p class="uk-text-success uk-text-medium uk-float-left">${success}</p>
<c:remove var="success" scope="session" />
<p id="server_error" class="uk-text-danger uk-text-small uk-float-left">${message}</p>
<c:remove var="message" scope="session" /> <c:remove var="message" scope="session" />
<p><span class="uk-alert-primary uk-text-medium uk-float-left">You can register up to 5 services.</span></p> <p><span class="uk-alert-primary uk-text-medium uk-float-left">You can register up to 5 services.</span></p>
<c:if test="${reachedLimit}"> <c:if test="${reachedLimit}">