OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Use special search function for WorkPackage filters
Aaron Contreras7f9524b1b60b
diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex a0a01559bde..d625d0d069e 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -1043,6 +1043,8 @@ en:createdAt: "Created on"description: "Description"date: "Date"+ done_ratio: "% Complete"+ done_ratio_alternative: "progress"dueDate: "Finish date"duration: "Duration"spentTime: "Spent time"@@ -1050,6 +1052,8 @@ en:percentageDone: "Percentage done"priority: "Priority"projectName: "Project"+ remaining_work: "Remaining work"+ remaining_work_alternative: "Remaining hours"responsible: "Responsible"startDate: "Start date"status: "Status"@@ -1060,6 +1064,8 @@ en:updatedAt: "Updated on"versionName: "Version"version: "Version"+ work: "Work"+ work_alternative: "Estimated time"remainingTime: "Remaining work"default_queries:latest_activity: "Latest activity"diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.htmlindex d26b16d0a1c..27eecbf8aaf 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.html@@ -61,6 +61,7 @@[closeOnSelect]="true"[virtualScroll]="true"[placeholder]="text.please_select"+ [searchFn]="searchFunction"(open)="onOpen()"(change)="onFilterAdded($event)"id="add_filter_select"diff --git a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.tsindex 3fdbd72cdcd..aac57a3d257 100644--- a/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/query-filters/query-filters.component.ts@@ -89,6 +89,15 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitbaseline_warning: this.I18n.t('js.work_packages.filters.baseline_warning'),};+ public specialSearchStrings = {+ done_ratio: this.I18n.t('js.work_packages.properties.done_ratio'),+ done_ratio_alternative: this.I18n.t('js.work_packages.properties.done_ratio_alternative'),+ work: this.I18n.t('js.work_packages.properties.work'),+ work_alternative: this.I18n.t('js.work_packages.properties.work_alternative'),+ remaining_work: this.I18n.t('js.work_packages.properties.remaining_work'),+ remaining_work_alternative: this.I18n.t('js.work_packages.properties.remaining_work_alternative'),+ };+constructor(readonly wpTableFilters:WorkPackageViewFiltersService,readonly wpTableBaseline:WorkPackageViewBaselineService,@@ -187,4 +196,27 @@ export class QueryFiltersComponent extends UntilDestroyedMixin implements OnInitpublic onOpen() {repositionDropdownBugfix(this.ngSelectComponent);}++ searchFunction = (term:string, currentItem:QueryFilterResource):boolean => {+ const alternativeNames:{ [index:string]:string } = {+ [this.specialSearchStrings.done_ratio_alternative]: this.specialSearchStrings.done_ratio,+ [this.specialSearchStrings.work_alternative]: this.specialSearchStrings.work,+ [this.specialSearchStrings.remaining_work_alternative]: this.specialSearchStrings.remaining_work,+ };++ const lowercaseSearchTerm = term.toLowerCase();+ const lowercaseCurrentItemName = currentItem.name.toLowerCase();++ const alternativeMatch = Object+ .keys(alternativeNames)+ .some((alternativeName) => {+ return alternativeName.toLowerCase().indexOf(lowercaseSearchTerm) > -1+ && currentItem.name === alternativeNames[alternativeName];+ });++ return (+ lowercaseCurrentItemName.indexOf(lowercaseSearchTerm) > -1+ || alternativeMatch+ );+ };}