From 87dbbc4df31df84bf6c03edee1c458fb0de9dda6 Mon Sep 17 00:00:00 2001 From: Tung Le <76459536+lttung-axonivy@users.noreply.github.com> Date: Mon, 25 Nov 2024 10:17:37 +0700 Subject: [PATCH] IVYPORTAL-17422 Remove Full Case List and Replace it with the Case Widget (#1256) - Added loadCaseListFirstTime to jmeter - Not write isTopMenu to JSON if default value --- .../jmeter/portal_walkthrough_testplan.jmx | 84 +++++++++++++++++++ .../portalkit/dto/dashboard/Dashboard.java | 11 ++- .../converter/BusinessEntityConverter.java | 12 +++ .../addon/portalkit/util/DashboardUtils.java | 15 ++++ 4 files changed, 118 insertions(+), 4 deletions(-) diff --git a/AxonIvyPortal/portal-selenium-test/jmeter/portal_walkthrough_testplan.jmx b/AxonIvyPortal/portal-selenium-test/jmeter/portal_walkthrough_testplan.jmx index 2cca9533399..b8279fee7d0 100644 --- a/AxonIvyPortal/portal-selenium-test/jmeter/portal_walkthrough_testplan.jmx +++ b/AxonIvyPortal/portal-selenium-test/jmeter/portal_walkthrough_testplan.jmx @@ -1421,6 +1421,90 @@ + + + + + true + true + = + true + javax.faces.partial.ajax + + + true + case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime + = + true + javax.faces.source + + + true + case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime + = + true + javax.faces.partial.execute + + + true + case-default_case_list_dashboard_case_1:case-component:dashboard-cases-container + = + true + javax.faces.partial.render + + + true + case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime + = + true + case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime + + + true + 1 + = + true + portal-breadcrumb:breadcrumb-form_SUBMIT + + + true + ${viewState} + = + true + javax.faces.ViewState + + + + + + + + ${url} + POST + true + false + true + false + + + + + + + + 200 + + + Assertion.response_code + false + 8 + + + + ${__P(portal.duration.normal)} + + + diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/Dashboard.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/Dashboard.java index 7d4a76151e1..0896ec2dc67 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/Dashboard.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/Dashboard.java @@ -33,9 +33,12 @@ public class Dashboard extends AbstractConfiguration implements Serializable { private List permissionDTOs; @JsonIgnore private String displayedPermission; - private boolean isTopMenu; + private Boolean isTopMenu; - public Dashboard() {} + public Dashboard() { + // Set default values + isTopMenu = false; + } public Dashboard(Dashboard dashboard) { setId(dashboard.getId()); @@ -135,11 +138,11 @@ public void setTemplateId(String templateId) { this.templateId = templateId; } - public boolean getIsTopMenu() { + public Boolean getIsTopMenu() { return isTopMenu; } - public void setIsTopMenu(boolean isTopMenu) { + public void setIsTopMenu(Boolean isTopMenu) { this.isTopMenu = isTopMenu; } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java index 2c1917cb585..12107271cd1 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/persistence/converter/BusinessEntityConverter.java @@ -20,7 +20,9 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.json.JsonMapper; +import ch.ivy.addon.portalkit.dto.dashboard.Dashboard; import ch.ivy.addon.portalkit.service.exception.PortalException; +import ch.ivy.addon.portalkit.util.DashboardUtils; /** * This class provides method to convert Business entity object into JSON value and reverse @@ -126,4 +128,14 @@ public static List convertJsonToListString(String value) return new ArrayList<>(); } + + public static String entityToJsonValue(List dashboards) { + DashboardUtils.updatePropertiesToNullIfCurrentValueIsDefaultValue(dashboards); + try { + return getObjectMapper().writeValueAsString(dashboards); + } catch (JsonProcessingException e) { + throw new PortalException(e); + } + } + } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java index fc65b3943a7..ede15c3e5e6 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/util/DashboardUtils.java @@ -311,4 +311,19 @@ public static boolean isMainDashboard(String dashboardId, boolean defaultValue) return isMainDashboard; } + + /** + * Uses this method before saving a dashboard to simplify generated json from the dashboard + */ + public static void updatePropertiesToNullIfCurrentValueIsDefaultValue(List dashboards) { + if (CollectionUtils.isEmpty(dashboards)) { + return; + } + for (Dashboard dashboard : dashboards) { + if (!dashboard.getIsTopMenu()) { + dashboard.setIsTopMenu(null); + } + } + } + }