Skip to content

Commit

Permalink
set canConfigure to false for parametric search items
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Sep 26, 2022
1 parent d6ec49e commit 2494a6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,8 @@ public Search<C> load() {
search = storage.getSearch();
}

if (search == null || search.isTypeChanged()) {
// ||
// (!SearchBoxModeType.ADVANCED.equals(search.getSearchMode()) && !search.getItems().containsAll(newSearch.getItems()))
// || search.isTypeChanged()
// ) {
if (search == null || search.isTypeChanged() ||
(!SearchBoxModeType.BASIC.equals(search.getSearchMode()) && !search.allPropertyItemsPresent(newSearch.getItems()))) {
search = newSearch;
// search.searchWasReload();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public VariablesMap getFilterVariables(VariablesMap defaultVariables, PageBase p
VariablesMap variables = defaultVariables == null ? new VariablesMap() : defaultVariables;
List<AbstractSearchItemWrapper> items = getItems();
items.forEach(item -> {
if (StringUtils.isNotEmpty(item.getParameterName())) {
if (StringUtils.isNotEmpty(item.getParameterName()) && item.isApplyFilter(SearchBoxModeType.BASIC)) {
Object parameterValue = item.getValue() != null ? item.getValue().getValue() : null;
TypedValue value = new TypedValue(parameterValue, item.getParameterValueType());
variables.put(item.getParameterName(), value);
Expand All @@ -394,6 +394,16 @@ public void setFullText(String fullText) {
this.fullText = fullText;
}

public boolean allPropertyItemsPresent(List<AbstractSearchItemWrapper> items) {
for (AbstractSearchItemWrapper item : items) {
if (item instanceof PropertySearchItemWrapper && ((PropertySearchItemWrapper)item).getPath() != null &&
findPropertySearchItem(((PropertySearchItemWrapper<?>) item).getPath()) == null) {
return false;
}
}
return true;
}

public PropertySearchItemWrapper findPropertyItemByPath(ItemPath path) {
for (AbstractSearchItemWrapper searchItemWrapper : getItems()) {
if (!(searchItemWrapper instanceof PropertySearchItemWrapper)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ public static <C extends Containerable> PropertySearchItemWrapper createPropert
if (searchItemWrapper instanceof DateSearchItemWrapper) {
((DateSearchItemWrapper) searchItemWrapper).setInterval(false);
}
searchItemWrapper.setCanConfigure(false);
}

if (item.isVisibleByDefault() != null) {
Expand Down

0 comments on commit 2494a6a

Please sign in to comment.