Skip to content

Commit

Permalink
Merge pull request #6173 from effective-webwork/filter-menu
Browse files Browse the repository at this point in the history
Improve suggestions for properties in filter menu
  • Loading branch information
solth authored Sep 2, 2024
2 parents e1181b4 + cd24ac1 commit c7af10b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Kitodo/src/main/java/org/kitodo/production/filters/FilterMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ private List<Suggestion> createSuggestionsForProcessValue(FilterString category,
suggestions.addAll(createStringSuggestionsMatchingInput(input, filterService.initProjects(), FilterPart.VALUE));
break;
case PROPERTY:
suggestions.addAll(createStringSuggestionsMatchingInput(input,
filterService.initProcessPropertyTitles(), FilterPart.VALUE));
suggestions.addAll(createStringSuggestionsMatchingInput(input, initProcessPropertyTitles(), FilterPart.VALUE));
break;
default:
// Do nothing
Expand All @@ -230,6 +229,17 @@ private List<Suggestion> createSuggestionsForProcessValue(FilterString category,
return suggestions;
}

/**
* Get list of process properties and format them with a trailing colon.
*
* @return List of formatted process property keys
*/
private List<String> initProcessPropertyTitles() {
return ServiceManager.getFilterService().initProcessPropertyTitles().stream()
.map(propertyTitle -> propertyTitle + ":")
.collect(Collectors.toList());
}

private List<Suggestion> createSuggestionsForTaskValue(FilterString category, String input) {
List<Suggestion> suggestions = new ArrayList<>();
if (Objects.isNull(category)) {
Expand All @@ -246,8 +256,7 @@ private List<Suggestion> createSuggestionsForTaskValue(FilterString category, St
suggestions.addAll(createStringSuggestionsMatchingInput(input, filterService.initProjects(), FilterPart.VALUE));
break;
case PROPERTY:
suggestions.addAll(createStringSuggestionsMatchingInput(input,
filterService.initProcessPropertyTitles(), FilterPart.VALUE));
suggestions.addAll(createStringSuggestionsMatchingInput(input, initProcessPropertyTitles(), FilterPart.VALUE));
break;
default:
// Do nothing
Expand Down

0 comments on commit c7af10b

Please sign in to comment.