Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IVYPORTAL-18026 Long loading time for accessing case details of case has thousands of tasks #1415

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.io.IOException;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

Expand Down Expand Up @@ -33,11 +34,13 @@
import ch.ivy.addon.portalkit.service.IvyCacheService;
import ch.ivy.addon.portalkit.util.DashboardUtils;
import ch.ivy.addon.portalkit.util.PermissionUtils;
import ch.ivy.addon.portalkit.util.PortalProcessViewerUtils;
import ch.ivy.addon.portalkit.util.RequestUtils;
import ch.ivy.addon.portalkit.util.TaskUtils;
import ch.ivyteam.ivy.environment.Ivy;
import ch.ivyteam.ivy.request.EngineUriResolver;
import ch.ivyteam.ivy.security.ISecurityContext;
import ch.ivyteam.ivy.workflow.ICase;
import ch.ivyteam.ivy.workflow.ITask;
import ch.ivyteam.ivy.workflow.TaskState;

Expand All @@ -58,6 +61,7 @@ public class UserMenuBean implements Serializable {
protected static final String MOBILE_LOGO_IMAGE_CMS_URI = "/images/MenuQRCode/MobileAppLogo/MobileAppLogo";
protected static final String APPLE_STORE_IMAGE_CMS_URL = "/images/MenuQRCode/AppleStore/AppleStore";
protected static final String GOOGLE_PLAY_IMAGE_CMS_URL = "/images/MenuQRCode/GooglePlay/GooglePlay";
private Map<Long, Boolean> caseIdToProcessViewerDisplayed;

public String getLoggedInUser() {
return loggedInUser;
Expand Down Expand Up @@ -396,4 +400,14 @@ public void navigateToChatBotOrDisplayWorkingTaskWarning(boolean isWorkingOnATas
navigateToAssistantDashboard();
}
}

public boolean isProcessViewerDisplayed(ICase caze) {
if (caseIdToProcessViewerDisplayed == null) {
caseIdToProcessViewerDisplayed = new HashMap<>();
}
if (!caseIdToProcessViewerDisplayed.containsKey(caze.getId())) {
caseIdToProcessViewerDisplayed.put(caze.getId(), PortalProcessViewerUtils.isShowProcessViewer(caze));
}
return caseIdToProcessViewerDisplayed.get(caze.getId());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@

import org.apache.commons.lang3.StringUtils;

import ch.ivy.addon.portal.generic.bean.UserMenuBean;
import ch.ivy.addon.portal.generic.navigation.PortalNavigator;
import ch.ivy.addon.portalkit.enums.GlobalVariable;
import ch.ivy.addon.portalkit.jsf.ManagedBeans;
import ch.ivy.addon.portalkit.service.GlobalSettingService;
import ch.ivy.addon.portalkit.service.exception.PortalException;
import ch.ivy.addon.portalkit.util.PermissionUtils;
Expand Down Expand Up @@ -227,7 +229,7 @@ public void setShowCaseDetails(boolean isShowCaseDetails) {
}

public boolean showProcessViewer(ICase caze) {
return PortalProcessViewerUtils.isShowProcessViewer(caze);
return ((UserMenuBean) ManagedBeans.get("userMenuBean")).isProcessViewerDisplayed(caze);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.axonivy.portal.components.publicapi.ProcessStartAPI;
import com.axonivy.portal.components.util.ProcessStartUtils;

import ch.ivy.addon.portal.generic.bean.UserMenuBean;
import ch.ivy.addon.portal.generic.navigation.PortalNavigator;
import ch.ivy.addon.portalkit.enums.PortalPermission;
import ch.ivy.addon.portalkit.jsf.ManagedBeans;
Expand Down Expand Up @@ -334,7 +335,7 @@ private String getElapsedTimeForRunningTaskOnTooltip(ITask task) {
}

public boolean showProcessViewer(ITask task) {
return PortalProcessViewerUtils.isShowProcessViewer(task.getCase().getBusinessCase());
return ((UserMenuBean) ManagedBeans.get("userMenuBean")).isProcessViewerDisplayed(task.getCase().getBusinessCase());
}

public boolean canExpiry(ITask task) {
Expand Down
Loading