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
Add ancestors filter to show only relevant subprojects in "only subprojects" and "including subprojects" filter
Henriette Dargeaf7226b97098
diff --git a/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.html b/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.htmlindex c883aacb135..7d8c09072f6 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.html+++ b/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.html@@ -9,5 +9,6 @@[id]="'values-' + filter.id"class="advanced-filters--ng-select -multi-select"(valueChange)="onChange($event)"+ [apiFilters]="additionalProjectApiFilters"></op-project-autocompleter></div>diff --git a/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.ts b/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.tsindex 0bf621171b9..ea3b88e7bec 100644--- a/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.ts+++ b/frontend/src/app/features/work-packages/components/filters/filter-project/filter-project.component.ts@@ -30,6 +30,7 @@ import {ChangeDetectionStrategy,Component,Input,+ OnInit,Output,} from '@angular/core';import { I18nService } from 'core-app/core/i18n/i18n.service';@@ -40,26 +41,38 @@ import { componentDestroyed } from '@w11k/ngx-componentdestroyed';import { QueryFilterInstanceResource } from 'core-app/features/hal/resources/query-filter-instance-resource';import { IProjectAutocompleteItem } from 'core-app/shared/components/autocompleter/project-autocompleter/project-autocomplete-item';import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';+import { ApiV3ListFilter } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';+import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';@Component({selector: 'op-filter-project',templateUrl: './filter-project.component.html',changeDetection: ChangeDetectionStrategy.OnPush,})-export class FilterProjectComponent extends UntilDestroyedMixin {+export class FilterProjectComponent extends UntilDestroyedMixin implements OnInit {@Input() public shouldFocus = false;@Input() public filter:QueryFilterInstanceResource;@Output() public filterChanged = new DebouncedEventEmitter<QueryFilterInstanceResource>(componentDestroyed(this));+ additionalProjectApiFilters:ApiV3ListFilter[] = [];+constructor(readonly I18n:I18nService,readonly apiV3Service:ApiV3Service,+ readonly currentProjectService:CurrentProjectService,) {super();}+ ngOnInit():void {+ const projectID = this.currentProjectService.id;+ if (projectID && (this.filter.id === 'subprojectId' || this.filter.id === 'onlySubproject')) {+ this.additionalProjectApiFilters.push(['ancestor', '=', [projectID]]);+ }+ }+async onChange(val:HalResource[]|IProjectAutocompleteItem[]):Promise<void> {if (val === this.filter.values || val === undefined) {return;