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 icons (search and close) to the search bar in the quick add pane
Henriette Darge26ae6df58b57
diff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.html b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.htmlindex fc76181c5fd..1f4bbe49bbe 100644--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.html+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.html@@ -1,14 +1,32 @@-<input- class="op-quick-add-pane--search"- [placeholder]="text.placeholder"- (input)="searchWorkPackages($event.target.value)"-/>+<div class="op-quick-add-pane--search">+ <input+ [ngModel]="searchString"+ (ngModelChange)="searchWorkPackages($event)"+ class="op-quick-add-pane--search-input"+ [placeholder]="text.placeholder"+ />++ <op-icon+ class="op-quick-add-pane--search-icon"+ icon-classes="icon-context icon-search">+ </op-icon>++ <button+ *ngIf="isSearching"+ (click)="clearInput()"+ class="op-quick-add-pane--close-search"+ >+ <op-icon+ icon-classes="icon-small icon-close">+ </op-icon>+ </button>+</div><ng-container- *ngIf="(isLoading | async) === false; else loadingTemplate"+ *ngIf="(isLoading$ | async) === false; else loadingTemplate"><ng-container- *ngIf="(isEmpty | async) === false; else emptyTemplate"+ *ngIf="(isEmpty$ | async) === false; else emptyTemplate"><div class="op-quick-add-pane--results"><ng-container *ngFor="let wp of resultingWorkPackages">@@ -23,7 +41,6 @@class="op-quick-add-pane--empty-state"><img [src]="image.empty_state" class="op-quick-add-pane--empty-state-image"/>-<span[innerHTML]="text.empty_state"class="op-quick-add-pane--empty-state-text"diff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.sass b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.sassindex 2c7e999147d..ceb52e432bb 100644--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.sass+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.sass@@ -9,11 +9,30 @@.op-quick-add-pane&--search+ position: relative++ &--search-inputwidth: 100%line-height: 32pxheight: 32pxpadding: 0 12px 0 42px+ &--search-icon+ position: absolute+ top: 8px+ left: 16px++ &--close-search+ position: absolute+ top: 8px+ right: 8px+ padding: 0+ margin: 0+ background: transparent+ border: 0+ font: inherit+ text-align: inherit+&--resultsoverflow: auto@include styled-scroll-bardiff --git a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.tsindex c94745e2d0d..6a3c35f7843 100644--- a/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts+++ b/frontend/src/app/features/team-planner/team-planner/add-work-packages/quick-add-pane.component.ts@@ -21,6 +21,7 @@ import { WorkPackageNotificationService } from 'core-app/features/work-packages/import { CurrentProjectService } from 'core-app/core/current-project/current-project.service';import { UrlParamsHelperService } from 'core-app/features/work-packages/components/wp-query/url-params-helper';import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/query-space/isolated-query-space';+import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';@Component({selector: 'op-quick-add-pane',@@ -28,10 +29,12 @@ import { IsolatedQuerySpace } from 'core-app/features/work-packages/directives/qstyleUrls: ['./quick-add-pane.component.sass'],changeDetection: ChangeDetectionStrategy.OnPush,})-export class QuickAddPaneComponent implements OnInit {- isEmpty = new BehaviorSubject<boolean>(true);+export class QuickAddPaneComponent extends UntilDestroyedMixin implements OnInit {+ searchString = '';- isLoading = new BehaviorSubject<boolean>(false);+ isEmpty$ = new BehaviorSubject<boolean>(true);++ isLoading$ = new BehaviorSubject<boolean>(false);text = {empty_state: this.I18n.t('js.team_planner.quick_add.empty_state'),@@ -44,12 +47,29 @@ export class QuickAddPaneComponent implements OnInit {resultingWorkPackages:WorkPackageResource[] = [];- searchWorkPackages = (searchString:string):void => {- this.isLoading.next(true);+ constructor(+ private readonly querySpace:IsolatedQuerySpace,+ private I18n:I18nService,+ private readonly apiV3Service:ApiV3Service,+ private readonly notificationService:WorkPackageNotificationService,+ private readonly currentProject:CurrentProjectService,+ private readonly urlParamsHelper:UrlParamsHelperService,+ ) {+ super();+ }++ ngOnInit():void {+ }++ searchWorkPackages(searchString:string):void {+ this.searchString = searchString;+ this.isLoading$.next(true);// Return when the search string is emptyif (searchString.length === 0) {- this.isLoading.next(false);+ this.isLoading$.next(false);+ this.isEmpty$.next(true);+return;}@@ -89,29 +109,21 @@ export class QuickAddPaneComponent implements OnInit {this.notificationService.handleRawError(error);return of([]);}),+ this.untilDestroyed(),).subscribe((results) => {this.resultingWorkPackages = results;- this.isEmpty.next(results.length === 0);- this.isLoading.next(false);+ this.isEmpty$.next(results.length === 0);+ this.isLoading$.next(false);});- };-- public autocompleterOptions = {- resource: 'work_packages',- getOptionsFn: this.searchWorkPackages,- };+ }- constructor(- private readonly querySpace:IsolatedQuerySpace,- private I18n:I18nService,- private readonly apiV3Service:ApiV3Service,- private readonly notificationService:WorkPackageNotificationService,- private readonly currentProject:CurrentProjectService,- private readonly urlParamsHelper:UrlParamsHelperService,- ) { }+ clearInput():void {+ this.searchWorkPackages('');+ }- ngOnInit():void {+ get isSearching():boolean {+ return this.searchString !== '';}}