Skip to content

Commit

Permalink
#318 Implemented changes for code solve
Browse files Browse the repository at this point in the history
Implemented new code that doesn't allow items to be published while the cache is running
  • Loading branch information
unaibrrgn committed Nov 28, 2023
1 parent 9d6fa72 commit a08f451
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 15 deletions.
48 changes: 43 additions & 5 deletions sources/Re3gistry2/src/main/webapp/jsp/registerManager.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<%@page import="eu.europa.ec.re3gistry2.base.utility.BaseConstants"%>
<%@page import="javax.persistence.EntityManager"%>
<%@page import="eu.europa.ec.re3gistry2.base.utility.PersistenceFactory"%>
<%@page import="eu.europa.ec.re3gistry2.javaapi.cache.CacheHelper"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="includes/common.inc.jsp" %>
<jsp:useBean id="constants" class="eu.europa.ec.re3gistry2.base.utility.BaseConstants" scope="session"/>
Expand Down Expand Up @@ -103,10 +104,29 @@
</div>
<%
} else {
%><h3>${localization.getString("label.actionslist")}</h3><%
}
%><h3 style="display:inline-block">${localization.getString("label.actionslist")}</h3><%
}
if (regActions.size() > 0) {
for (RegAction pubAction : regActions) {
// Checking the status of the action
boolean showActionPublish = false;
if (regActions.size() > 0) {
if (pubAction.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_ACCEPTED)
|| (pubAction.getRegItemRegistry() != null && pubAction.getRegItemRegister() == null && !pubAction.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_PUBLISHED))) {
showActionPublish = true;
}
if(CacheHelper.checkCacheCompleteRunning() && showActionPublish){
%>

<p style="display: inline-block; margin-left: 35rem; font-style: italic;"><svg style="display: inline-block;" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.032 17.025c-.774 0-1.407-.674-1.407-1.499V11.03c0-.825.633-1.5 1.407-1.5s1.406.675 1.406 1.5v4.496c0 .825-.632 1.5-1.406 1.5zm0 4.497c-.774 0-1.407-.674-1.407-1.499 0-.825.633-1.499 1.407-1.499s1.406.674 1.406 1.499c0 .825-.632 1.499-1.406 1.499zm0-21.517L0 24h23.995L12.032.005z"/></svg> The publication will remain disabled until the caching process is completed.</p>

<%
}
}
%>
<table id="list-table" class="table table-striped table-bordered mt-3" cellspacing="0" width="100%">
Expand Down Expand Up @@ -168,7 +188,25 @@
}
%>
<%-- Action buttons --%>
<%if (showActionPublish) {%>
<%if (showActionPublish) {
if (CacheHelper.checkCacheCompleteRunning()) {
%>

<a
href="?<%=BaseConstants.KEY_FORM_FIELD_NAME_ACTIONUUID%>=<%=tmp.getUuid()%>&<%=BaseConstants.KEY_FORM_FIELD_NAME_SUBMITACTION%>=true"
data-toggle="confirmation"
data-title="${localization.getString("registermanager.label.publish.confirm")}"
data-placement="left"
title=" Publishing is currently unavailable, wait for the current caching process to end."
data-singleton="true"
class="btn btn-sm btn-success btn-approve-action btn-reg-action disabled"
data-<%=WebConstants.DATA_PARAMETER_ACTIONUUID%>="<%=tmp.getUuid()%>"
>
<i class="fas fa-upload"></i> ${localization.getString("registermanager.label.publish")}</a><br/>
<%
}else{
%>
<a
href="?<%=BaseConstants.KEY_FORM_FIELD_NAME_ACTIONUUID%>=<%=tmp.getUuid()%>&<%=BaseConstants.KEY_FORM_FIELD_NAME_SUBMITACTION%>=true"
data-toggle="confirmation"
Expand All @@ -179,7 +217,7 @@
data-<%=WebConstants.DATA_PARAMETER_ACTIONUUID%>="<%=tmp.getUuid()%>"
>
<i class="fas fa-upload"></i> ${localization.getString("registermanager.label.publish")}</a><br/>
<%}%>
<%}}%>

</td>
</tr>
Expand Down
42 changes: 32 additions & 10 deletions sources/Re3gistry2/src/main/webapp/jsp/registryManager.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,29 @@
</div>
<%
} else {
%><h3>${localization.getString("label.actionslist")}</h3><%
%><h3 style="display: inline-block">${localization.getString("label.actionslist")}</h3><%
}
if (regActions.size() > 0) {
for (RegAction pubAction : regActions) {
// Checking the status of the action
boolean showActionPublish = false;
if (pubAction.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_ACCEPTED)
|| (pubAction.getRegItemRegistry() != null && pubAction.getRegItemRegister() == null && !pubAction.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_PUBLISHED))) {
showActionPublish = true;
}
if(CacheHelper.checkCacheCompleteRunning() && showActionPublish){
%>

<p style="display: inline-block; margin-left: 35rem; font-style: italic;"><svg style="display: inline-block;" width="24" height="24" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.032 17.025c-.774 0-1.407-.674-1.407-1.499V11.03c0-.825.633-1.5 1.407-1.5s1.406.675 1.406 1.5v4.496c0 .825-.632 1.5-1.406 1.5zm0 4.497c-.774 0-1.407-.674-1.407-1.499 0-.825.633-1.499 1.407-1.499s1.406.674 1.406 1.499c0 .825-.632 1.499-1.406 1.499zm0-21.517L0 24h23.995L12.032.005z"/></svg> The publication will remain disabled until the caching process is completed.</p>

<%
}
}
%>
<table id="list-table" class="table table-striped table-bordered mt-3" cellspacing="0" width="100%">
Expand All @@ -158,7 +177,8 @@
</tr>
</thead>
<tbody>
<% for (RegAction tmp : regActions) {
<%
for (RegAction tmp : regActions) {
%>
<tr>
<td>
Expand Down Expand Up @@ -196,13 +216,7 @@
<td><%=tmp.getRegUser().getName() + " (" + tmp.getRegUser().getSsoreference() + ")"%></td>
<td>
<%
// Checking the status of the action
boolean showActionPublish = false;
if (tmp.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_ACCEPTED)
|| (tmp.getRegItemRegistry() != null && tmp.getRegItemRegister() == null && !tmp.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_PUBLISHED))) {
showActionPublish = true;
}
%>

<%
Expand All @@ -223,6 +237,14 @@
}
}
// Checking the status of the action
boolean showActionPublish = false;
if (tmp.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_ACCEPTED)
|| (tmp.getRegItemRegistry() != null && tmp.getRegItemRegister() == null && !tmp.getRegStatus().getLocalid().equals(BaseConstants.KEY_STATUS_LOCALID_PUBLISHED))) {
showActionPublish = true;
}
%>
<%if (showActionPublish==false) {%>
<%if (showSubmit && !(regAction == null && showChangesRequest)) {%>
Expand All @@ -240,7 +262,7 @@
<% if (!CacheHelper.checkCacheCompleteRunning()) {%>
<a href="?<%=BaseConstants.KEY_FORM_FIELD_NAME_ACTIONUUID%>=<%=tmp.getUuid()%>&<%=BaseConstants.KEY_FORM_FIELD_NAME_SUBMITACTION%>=true" data-toggle="confirmation" data-title="${localization.getString("registrymanager.label.publish.confirm")}" data-placement="left" data-singleton="true" class="btn btn-sm btn-success btn-approve-action btn-reg-action" data-<%=WebConstants.DATA_PARAMETER_ACTIONUUID%>="<%=tmp.getUuid()%>"><i class="fas fa-upload"></i> ${localization.getString("registrymanager.label.publish")}</a><br/>
<%} else {%>
<a href="?<%=BaseConstants.KEY_FORM_FIELD_NAME_ACTIONUUID%>=<%=tmp.getUuid()%>&<%=BaseConstants.KEY_FORM_FIELD_NAME_SUBMITACTION%>=true" data-toggle="confirmation" data-title="${localization.getString("registrymanager.label.publish.confirm")}" data-placement="left" data-singleton="true" class="btn btn-sm btn-success btn-approve-action btn-reg-action disabled" data-<%=WebConstants.DATA_PARAMETER_ACTIONUUID%>="<%=tmp.getUuid()%>"><i class="fas fa-upload"></i> ${localization.getString("registrymanager.label.publish")}</a><br/>
<a href="?<%=BaseConstants.KEY_FORM_FIELD_NAME_ACTIONUUID%>=<%=tmp.getUuid()%>&<%=BaseConstants.KEY_FORM_FIELD_NAME_SUBMITACTION%>=true" title=" Publishing is currently unavailable, wait for the current caching process to end." data-toggle="confirmation" data-title="${localization.getString("registrymanager.label.publish.confirm")}" data-placement="left" data-singleton="true" class="btn btn-sm btn-success btn-approve-action btn-reg-action disabled" data-<%=WebConstants.DATA_PARAMETER_ACTIONUUID%>="<%=tmp.getUuid()%>"><i class="fas fa-upload"></i> ${localization.getString("registrymanager.label.publish")}</a><br/>
<%}%>
<%}%>
<script>
Expand Down

0 comments on commit a08f451

Please sign in to comment.