From 81145832db48ad7d352b1c5ccdad515a9c0e076f Mon Sep 17 00:00:00 2001 From: Luong Minh Luat <157108501+lmluat-axonivy@users.noreply.github.com> Date: Thu, 5 Sep 2024 10:28:19 +0700 Subject: [PATCH] =?UTF-8?q?feature/IVYPORTAL-17458-Quick-Search-function-k?= =?UTF-8?q?eeps-working-although-=E2=80=A6=20(#979)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feature/IVYPORTAL-17458-Quick-Search-function-keeps-working-although-it-is-deactivated-LE - fix bug related to quick search function in Task, Case, Process widget * feature/IVYPORTAL-17458-Quick-Search-function-keeps-working-although-it-is-deactivated-LE - Disable the input of quick search in edit mode --- .../portalkit/dto/dashboard/CaseDashboardWidget.java | 8 +++++++- .../dto/dashboard/CompactProcessDashboardWidget.java | 9 +++++++++ .../portalkit/dto/dashboard/TaskDashboardWidget.java | 9 +++++++-- .../layouts/restricted/decorator/TableWidget.xhtml | 2 +- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CaseDashboardWidget.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CaseDashboardWidget.java index 10a1919b3bb..e140b7980e3 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CaseDashboardWidget.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CaseDashboardWidget.java @@ -9,6 +9,7 @@ import java.util.stream.Collectors; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.primefaces.PrimeFaces; import org.primefaces.model.SortMeta; @@ -248,6 +249,11 @@ public void loadUserFilter() { @Override public void setQuickSearchKeyword() { - this.dataModel.getCriteria().setQuickSearchKeyword(this.getQuickSearchKeyword()); + if (BooleanUtils.isTrue(enableQuickSearch)) { + this.dataModel.getCriteria().setQuickSearchKeyword(this.getQuickSearchKeyword()); + } + else { + this.setQuickSearchKeyword(StringUtils.EMPTY); + } } } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CompactProcessDashboardWidget.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CompactProcessDashboardWidget.java index c75d4515fb9..babb320597e 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CompactProcessDashboardWidget.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/CompactProcessDashboardWidget.java @@ -6,6 +6,8 @@ import java.util.List; import java.util.Map; +import org.apache.commons.lang.BooleanUtils; + import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonInclude; @@ -176,4 +178,11 @@ public boolean isEnableQuickSearch() { public void setEnableQuickSearch(boolean enableQuickSearch) { this.enableQuickSearch = enableQuickSearch; } + + @Override + public void setQuickSearchKeyword(String quickSearchKeyword) { + if (BooleanUtils.isTrue(this.enableQuickSearch)) { + super.setQuickSearchKeyword(quickSearchKeyword); + } + } } diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/TaskDashboardWidget.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/TaskDashboardWidget.java index f31bbc40e42..1ffa9bfd5c1 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/TaskDashboardWidget.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/dto/dashboard/TaskDashboardWidget.java @@ -9,6 +9,7 @@ import java.util.stream.Collectors; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.primefaces.PrimeFaces; import org.primefaces.model.SortMeta; @@ -209,8 +210,12 @@ public void setRowsPerPage(int rowsPerPage) { @Override public void setQuickSearchKeyword() { - this.dataModel.getCriteria().setQuickSearchKeyword(this.getQuickSearchKeyword()); - } + if (BooleanUtils.isTrue(this.enableQuickSearch)) { + this.dataModel.getCriteria().setQuickSearchKeyword(this.getQuickSearchKeyword()); + } + else { + this.setQuickSearchKeyword(StringUtils.EMPTY); + }} public List getFilters() { return this.dataModel.getCriteria().getFilters(); diff --git a/AxonIvyPortal/portal/webContent/layouts/restricted/decorator/TableWidget.xhtml b/AxonIvyPortal/portal/webContent/layouts/restricted/decorator/TableWidget.xhtml index 2e8468f1f35..21dc94c141c 100644 --- a/AxonIvyPortal/portal/webContent/layouts/restricted/decorator/TableWidget.xhtml +++ b/AxonIvyPortal/portal/webContent/layouts/restricted/decorator/TableWidget.xhtml @@ -45,7 +45,7 @@ + onkeydown="handleKeyDown(event)" disabled="#{!isReadOnlyMode}">