Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/axonivy-market/portal int…
Browse files Browse the repository at this point in the history
…o feature/IVYPORTAL-18050-Create-cache-mechanism-for-dashboard-converter-to-enhance-performance
  • Loading branch information
nhthinh-axonivy committed Dec 17, 2024
2 parents 80bc517 + f3e1757 commit f8ca4eb
Show file tree
Hide file tree
Showing 18 changed files with 105 additions and 80 deletions.
4 changes: 2 additions & 2 deletions AxonIvyPortal/PortalKitTestHelper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<version>9.1.0.0-SNAPSHOT</version>
<packaging>iar</packaging>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal-components/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
</snapshotRepository>
</distributionManagement>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal-migration/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<version>9.4.0</version>
<packaging>iar</packaging>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
</properties>
<build>
<plugins>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal-product/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
</releases>
<name>Axonivy Repo</name>
<id>release-repo</id>
<url>http://repo.axonivy.com/artifactory/libs-release/</url>
<url>https://repo.axonivy.com/artifactory/libs-release/</url>
<layout>default</layout>
</repository>
<repository>
Expand All @@ -35,7 +35,7 @@
</snapshots>
<name>Axonivy Repo</name>
<id>snapshots-repo</id>
<url>http://repo.axonivy.com/artifactory/libs-snapshot/</url>
<url>https://repo.axonivy.com/artifactory/libs-snapshot/</url>
<layout>default</layout>
</repository>
</repositories>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal-selenium-test/customized_pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<version>9.1.0.0-SNAPSHOT</version>
<packaging>iar</packaging>
<properties>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<version>9.1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<properties>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1650,7 +1650,7 @@
</elementProp>
<elementProp name="case-default_case_list_dashboard_case_1:quick-search-form:quick-search-input-0" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">true</boolProp>
<stringProp name="Argument.value">Create test data with category attach to one business case</stringProp>
<stringProp name="Argument.value">Business case has lots of tasks cases</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
<boolProp name="HTTPArgument.use_equals">true</boolProp>
<stringProp name="Argument.name">case-default_case_list_dashboard_case_1:quick-search-form:quick-search-input-0</stringProp>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal-selenium-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<version>9.1.0.0-SNAPSHOT</version>
<packaging>iar</packaging>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions AxonIvyPortal/portal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</snapshotRepository>
</distributionManagement>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ public void buildPortalLeftMenu(ITask workingTask, boolean isWorkingOnATask) {
mainMenuModel = new DefaultMenuModel();
mainMenuModel.getElements().add(buildDashboardItem()); // menuIndex = 0



List<SubMenuItem> subMenuItems = PortalMenuNavigator.callSubMenuItemsProcess();
int menuIndex = 1;
for (SubMenuItem subMenu : subMenuItems) {
Expand Down Expand Up @@ -156,9 +154,13 @@ private MenuElement buildDashboardItem() {
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 @@ -240,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
Original file line number Diff line number Diff line change
Expand Up @@ -94,27 +94,12 @@ public void init() {
menuView.updateDashboardCache(dashboards);
}

if (CollectionUtils.isNotEmpty(DashboardUtils.getDashboardsWithoutMenuItem())) {
if (CollectionUtils.isNotEmpty(DashboardUtils.getDashboardsWithoutMenuItem())
|| isRequestPathForMainOrDetailModification()) {
updateSelectedDashboardIdFromSessionAttribute();
currentDashboardIndex = findIndexOfDashboardById(selectedDashboardId);
selectedDashboard = dashboards.get(currentDashboardIndex);

String selectedDashboardName = selectedDashboard.getTitles().stream()
.filter(displayName -> displayName.getLocale().equals(Ivy.session().getContentLocale()))
.findFirst()
.orElseGet(() -> selectedDashboard.getTitles().get(0)).getValue();
setSelectedDashboardName(selectedDashboardName);
initShareDashboardLink(selectedDashboard);
// can not find dashboard by dashboard id session in view mode
if (StringUtils.isBlank(selectedDashboardId)
|| (!selectedDashboardId.equalsIgnoreCase(selectedDashboard.getId())
&& DashboardUtils.getDashboardsWithoutMenuItem().size() > 1)) {
DashboardUtils.storeDashboardInSession(selectedDashboard.getId());
}
if (isReadOnlyMode) {
DashboardUtils.highlightDashboardMenuItem(selectedDashboard.getId());
}
}
updateSelectedDashboard();
storeAndHighlightDashboardIfRequired();
}
buildWidgetModels(selectedDashboard);
isRunningTaskWhenClickingOnTaskInList = GlobalSettingService.getInstance()
.findGlobalSettingValue(GlobalVariable.DEFAULT_BEHAVIOUR_WHEN_CLICKING_ON_LINE_IN_TASK_LIST)
Expand All @@ -128,6 +113,33 @@ private void buildClientStatisticApiUri() {
.getExternalContext().getRequestContextPath() + "/api/statistics/data";
}

private boolean isRequestPathForMainOrDetailModification() {
String requestPath = Ivy.request().getRequestPath();
return requestPath.endsWith("/PortalMainDashboard.xhtml")
|| requestPath.endsWith("/PortalDashboardDetailModification.xhtml");
}

private void updateSelectedDashboard() {
currentDashboardIndex = findIndexOfDashboardById(selectedDashboardId);
selectedDashboard = dashboards.get(currentDashboardIndex);

String selectedDashboardName = selectedDashboard.getTitles().stream()
.filter(displayName -> displayName.getLocale().equals(Ivy.session().getContentLocale())).findFirst()
.orElseGet(() -> selectedDashboard.getTitles().get(0)).getValue();
setSelectedDashboardName(selectedDashboardName);
initShareDashboardLink(selectedDashboard);
}

private void storeAndHighlightDashboardIfRequired() {
if (StringUtils.isBlank(selectedDashboardId) || (!selectedDashboardId.equalsIgnoreCase(selectedDashboard.getId())
&& DashboardUtils.getDashboardsWithoutMenuItem().size() > 1)) {
DashboardUtils.storeDashboardInSession(selectedDashboard.getId());
}
if (isReadOnlyMode) {
DashboardUtils.highlightDashboardMenuItem(selectedDashboard.getId());
}
}

protected List<Dashboard> collectDashboards() {
return DashboardUtils.collectDashboards();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public class IFrameTaskTemplateBean extends AbstractTaskTemplateBean implements
public static final String PORTAL_GROWL_MESSGE_PARAM = "portalGrowlMessage";
private static final String DEFAULT_TASK_ICON = "si si-task-list-edit";
private static final String TASK_ICON = "taskIcon";
private static final String TASK_URL = "taskUrl";

private int currentProcessStep;
private List<String> processSteps;
Expand All @@ -74,6 +75,12 @@ public class IFrameTaskTemplateBean extends AbstractTaskTemplateBean implements

private Long caseId = null;

public String getTaskUrl() {
return Optional.ofNullable(FacesContext.getCurrentInstance()
.getExternalContext().getRequestParameterMap().get(TASK_URL))
.orElse(StringUtils.EMPTY);
}

public void useTaskInIFrame() {
keepOverridePortalGrowl();
Map<String, String> requestParamMap = getRequestParameterMap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,24 @@
**2. JavaScript-Based Configuration:**
Example:
<script>
window.taskName = "Approve Investment";
window.taskIcon = "si si-bulb";
window.isHideTaskName = false;
window.caseId = "123456";
window.isHideCaseInfo = false;
window.currentProcessStep = 0;
window.processSteps = ["Create Investment Request", "Approve Investment Request"];
// Convert Java List of steps to JSON format if needed:
window.processSteps = #{portalComponentUtilsBean.convertToJSON(data.steps)};
window.isShowAllSteps = true;
window.processChainDirection = "VERTICAL";
window.processChainShape = "LINE";
window.isHideTaskAction = false;
window.isWorkingOnATask = false;
window.announcementInvisible = false;
window.isCardFrame = true;
window.viewName = "TASK_DETAIL";
</script>
window.taskName = "Approve Investment";
window.taskIcon = "si si-bulb";
window.isHideTaskName = false;
window.caseId = "123456";
window.isHideCaseInfo = false;
window.currentProcessStep = 0;
window.processSteps = ["Create Investment Request", "Approve Investment Request"];
// Convert Java List of steps to JSON format if needed:
window.processSteps = #{portalComponentUtilsBean.convertToJSON(data.steps)};
window.isShowAllSteps = true;
window.processChainDirection = "VERTICAL";
window.processChainShape = "LINE";
window.isHideTaskAction = false;
window.isWorkingOnATask = false;
window.announcementInvisible = false;
window.isCardFrame = true;
window.viewName = "TASK_DETAIL";
</script>
-->


Expand All @@ -113,6 +113,19 @@
<ui:param name="taskIcon" value="#{iFrameTaskTemplateBean.taskIcon}" />

<ui:define name="content">
<script>
$(document).ready(function() {
var taskUrl = '#{iFrameTaskTemplateBean.taskUrl}';
if (taskUrl){
if(taskUrl.endsWith('blank')){
window.history.back(document.referrer);
}
getPortalIframe().src = taskUrl;
}

loadIframe(false);
});
</script>
<h:form>
<p:remoteCommand name="redirectToEndPageCommand" actionListener="#{iFrameTaskTemplateBean.navigateToEndPage()}" />
<p:remoteCommand name="displayPortalGrowlMessageCommand" actionListener="#{iFrameTaskTemplateBean.displayPortalGrowlMessage()}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
var invalidIFrameSrcPath = false;

let taskUrl = new URLSearchParams(window.location.search).get("taskUrl");
let updateIframeSrc = (newSrc) => {
getPortalIframe().src = newSrc;
}
if (taskUrl){
if(taskUrl.endsWith('blank')){
window.history.back(document.referrer);
}
updateIframeSrc(taskUrl)
}
loadIframe(false);
var recheckFrameTimer;
function loadIframe(recheckIndicator) {
var iframe = getPortalIframe();
Expand Down
4 changes: 2 additions & 2 deletions Showcase/InternalSupport/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<version>9.1.0.0-SNAPSHOT</version>
<packaging>iar</packaging>
<properties>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
Expand Down
4 changes: 2 additions & 2 deletions Showcase/portal-components-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</snapshotRepository>
</distributionManagement>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions Showcase/portal-developer-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</snapshotRepository>
</distributionManagement>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions Showcase/portal-user-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
</snapshotRepository>
</distributionManagement>
<properties>
<ivy.engine.version>12.0.1</ivy.engine.version>
<build.plugin.version>12.0.0-SNAPSHOT</build.plugin.version>
<ivy.engine.version>12.0.2</ivy.engine.version>
<build.plugin.version>12.0.0</build.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down

0 comments on commit f8ca4eb

Please sign in to comment.