Skip to content

Commit

Permalink
feature/IVYPORTAL-18050-Create-cache-mechanism-for-dashboard-converte…
Browse files Browse the repository at this point in the history
…r-to-enhance-performance
  • Loading branch information
nhthinh-axonivy committed Dec 11, 2024
1 parent 429038d commit a857490
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,8 @@ public void savePublicArrangement() {
}
}
newDashboards.addAll(idToDashboard.values());
String dashboardsAsSJSON = BusinessEntityConverter.entityToJsonValue(newDashboards);
Ivy.var().set(PortalVariable.DASHBOARD.key, dashboardsAsSJSON);

saveDashboards(newDashboards);
}

public void savePrivateArrangement() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void setTemplateId(String templateId) {
}

public Boolean getIsTopMenu() {
return isTopMenu != null ? isTopMenu : false;
return isTopMenu;
}

public void setIsTopMenu(Boolean isTopMenu) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public static List<Dashboard> getPublicDashboards() {
try {
String dashboardJson = Ivy.var().get(PortalVariable.DASHBOARD.key);
dashboards = jsonToDashboards(dashboardJson);
ensureDefaultIsTopMenu(dashboards);
addDefaultTaskCaseListDashboardsIfMissing(dashboards);
setDashboardAsPublic(dashboards);
} catch (Exception e) {
Expand Down Expand Up @@ -167,6 +166,7 @@ private static List<Dashboard> jsonToDashboards(String dashboardJson) {
JsonDashboardMigrator migrator = new JsonDashboardMigrator(mapper.readTree(dashboardJson));
List<Dashboard> dashboards = BusinessEntityConverter.convertJsonNodeToList(migrator.migrate(), Dashboard.class);
dashboards.forEach(initDefaultPermission());

return dashboards;
} catch (JsonProcessingException e) {
Ivy.log().error("Failed to parse dashboards from JSON: {0}", e);
Expand Down Expand Up @@ -317,16 +317,6 @@ public static void updatePropertiesToNullIfCurrentValueIsDefaultValue(List<Dashb
}
}

private static void ensureDefaultIsTopMenu(List<Dashboard> dashboards) {
if (dashboards != null) {
dashboards.forEach(dashboard -> {
if (dashboard.getIsTopMenu() == null) {
dashboard.setIsTopMenu(false);
}
});
}
}

private record PortalPrivateDashboardWrapper(Locale loadedLocale, List<Dashboard> dashboards) {
}
private record PortalPublicDashboardWrapper(Locale loadedLocale, List<Dashboard> dashboards) {
Expand Down

0 comments on commit a857490

Please sign in to comment.