Skip to content

Commit

Permalink
bug/IVYPORTAL-18051-Portal-Dashboard-shows-no-permission-screen-when-…
Browse files Browse the repository at this point in the history
…dashboards-is-empty
  • Loading branch information
nhthinh-axonivy committed Dec 9, 2024
1 parent 04b3205 commit 35de562
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,17 @@ private MenuElement buildDashboardItem() {
String mainMenuDisplayName = mainMenuEntryService.getNameInCurrentLocale();
String mainMenuIcon = mainMenuEntryService.getMenuIcon();

var subItemDashboards = getSubItemDashboards();
List<Dashboard> subItemDashboards = getSubItemDashboards();
if (subItemDashboards.size() > 1) {
return buildDashboardGroupMenu(subItemDashboards, dashboardTitle, mainMenuDisplayName, mainMenuIcon,
currentLanguage, dashboardLink);
} else if (subItemDashboards.size() == 1) {
Dashboard dashboard = subItemDashboards.getFirst();
String localizedTitle = getLocalizedTitle(dashboard, currentLanguage, dashboardTitle);
return buildSingleDashboardMenu(localizedTitle, dashboardId, dashboardLink, dashboard.getIcon());
}

return buildSingleDashboardMenu(dashboardTitle, dashboardId, dashboardLink);
return buildSingleDashboardMenu(dashboardTitle, "", dashboardLink, "");
}

private String determineDashboardLink() {
Expand Down Expand Up @@ -238,9 +242,11 @@ private void setMenuExpansion(DefaultSubMenu dashboardGroupMenu) {
}
}

private MenuElement buildSingleDashboardMenu(String dashboardTitle, String dashboardId, String dashboardLink) {
private MenuElement buildSingleDashboardMenu(String dashboardTitle, String dashboardId, String dashboardLink,
String dashboardIcon) {
var dashboardMenu = new PortalMenuBuilder(dashboardTitle, MenuKind.DASHBOARD, this.isWorkingOnATask)
.icon(PortalMenuItem.DEFAULT_DASHBOARD_ICON).url(dashboardLink).workingTaskId(this.workingTaskId).build();
.icon(StringUtils.isNoneEmpty(dashboardIcon) ? dashboardIcon : PortalMenuItem.DEFAULT_DASHBOARD_ICON)
.url(dashboardLink).workingTaskId(this.workingTaskId).build();

if (StringUtils.isBlank(dashboardId)) {
dashboardId = dashboardMenu.getId();
Expand Down

0 comments on commit 35de562

Please sign in to comment.