Skip to content

Commit

Permalink
IVYPORTAL-17422 Remove Full Case List and Replace it with the Case Wi…
Browse files Browse the repository at this point in the history
…dget (#1256)

-  Added loadCaseListFirstTime to jmeter
- Not write isTopMenu to JSON if default value
  • Loading branch information
lttung-axonivy authored Nov 25, 2024
1 parent 2f8baea commit 87dbbc4
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1421,6 +1421,90 @@
</ResponseAssertion>
<hashTree/>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="LoadCaseListFirstTime" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
<elementProp name="javax.faces.partial.ajax" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">true</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">javax.faces.partial.ajax</stringProp>
</elementProp>
<elementProp name="javax.faces.source" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">javax.faces.source</stringProp>
</elementProp>
<elementProp name="javax.faces.partial.execute" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">javax.faces.partial.execute</stringProp>
</elementProp>
<elementProp name="javax.faces.partial.render" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">case-default_case_list_dashboard_case_1:case-component:dashboard-cases-container</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">javax.faces.partial.render</stringProp>
</elementProp>
<elementProp name="case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">case-default_case_list_dashboard_case_1:case-component:rcLoadCaseFirstTime</stringProp>
</elementProp>
<elementProp name="portal-breadcrumb:breadcrumb-form_SUBMIT" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">1</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">portal-breadcrumb:breadcrumb-form_SUBMIT</stringProp>
</elementProp>
<elementProp name="javax.faces.ViewState" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">${viewState}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">javax.faces.ViewState</stringProp>
</elementProp>
</collectionProp>
</elementProp>
<stringProp name="HTTPSampler.domain"></stringProp>
<stringProp name="HTTPSampler.port"></stringProp>
<stringProp name="HTTPSampler.protocol"></stringProp>
<stringProp name="HTTPSampler.contentEncoding"></stringProp>
<stringProp name="HTTPSampler.path">${url}</stringProp>
<stringProp name="HTTPSampler.method">POST</stringProp>
<boolProp name="HTTPSampler.follow_redirects">true</boolProp>
<boolProp name="HTTPSampler.auto_redirects">false</boolProp>
<boolProp name="HTTPSampler.use_keepalive">true</boolProp>
<boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
<stringProp name="HTTPSampler.embedded_url_re"></stringProp>
<stringProp name="HTTPSampler.connect_timeout"></stringProp>
<stringProp name="HTTPSampler.response_timeout"></stringProp>
</HTTPSamplerProxy>
<hashTree>
<ResponseAssertion guiclass="AssertionGui" testclass="ResponseAssertion" testname="Response Code Assertion" enabled="true">
<collectionProp name="Asserion.test_strings">
<stringProp name="49586">200</stringProp>
</collectionProp>
<stringProp name="Assertion.custom_message"></stringProp>
<stringProp name="Assertion.test_field">Assertion.response_code</stringProp>
<boolProp name="Assertion.assume_success">false</boolProp>
<intProp name="Assertion.test_type">8</intProp>
</ResponseAssertion>
<hashTree/>
<DurationAssertion guiclass="DurationAssertionGui" testclass="DurationAssertion" testname="Normal Duration Assertion" enabled="false">
<stringProp name="DurationAssertion.duration">${__P(portal.duration.normal)}</stringProp>
</DurationAssertion>
<hashTree/>
</hashTree>
<HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" testname="CaseListSearch" enabled="true">
<elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
<collectionProp name="Arguments.arguments">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ public class Dashboard extends AbstractConfiguration implements Serializable {
private List<SecurityMemberDTO> 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());
Expand Down Expand Up @@ -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;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -126,4 +128,14 @@ public static List<String> convertJsonToListString(String value)
return new ArrayList<>();

}

public static String entityToJsonValue(List<Dashboard> dashboards) {
DashboardUtils.updatePropertiesToNullIfCurrentValueIsDefaultValue(dashboards);
try {
return getObjectMapper().writeValueAsString(dashboards);
} catch (JsonProcessingException e) {
throw new PortalException(e);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<Dashboard> dashboards) {
if (CollectionUtils.isEmpty(dashboards)) {
return;
}
for (Dashboard dashboard : dashboards) {
if (!dashboard.getIsTopMenu()) {
dashboard.setIsTopMenu(null);
}
}
}

}

0 comments on commit 87dbbc4

Please sign in to comment.