Skip to content

Commit

Permalink
Send user back to first page when they make searches. (#1550) (#1560)
Browse files Browse the repository at this point in the history
(cherry picked from commit ce6cf27)
  • Loading branch information
newswangerd authored Feb 13, 2019
1 parent 2405290 commit ff2f69f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions galaxyui/src/app/search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
<div class="search-bar">
<div class="search-field">
<div class="input-group">
<input type="text" [(ngModel)]="queryParams.keywords" (keyup.enter)="searchContent()" class="form-control" placeholder="Search for...">
<input type="text" [(ngModel)]="queryParams.keywords" (keyup.enter)="searchEntered()" class="form-control" placeholder="Search for...">
<span class="input-group-btn">
<button class="btn btn-default" type="button" (click)="searchContent()"><span class="fa fa-search"></span></button>
<button class="btn btn-default" type="button" (click)="searchEntered()"><span class="fa fa-search"></span></button>
</span>
</div>
</div>
Expand Down
13 changes: 10 additions & 3 deletions galaxyui/src/app/search/search.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export class SearchComponent implements OnInit, AfterViewInit {
}
sortParams += $event.field.id;
this.queryParams['order_by'] = sortParams;
this.searchContent();
this.searchEntered();
}

filterChanged($event: FilterEvent): void {
Expand Down Expand Up @@ -325,7 +325,7 @@ export class SearchComponent implements OnInit, AfterViewInit {
this.appliedFilters = [];
this.contentItems = [];
}
this.searchContent();
this.searchEntered();
}

getToolbarConfig(): ToolbarConfig {
Expand Down Expand Up @@ -372,10 +372,17 @@ export class SearchComponent implements OnInit, AfterViewInit {

if (update) {
this.setAppliedFilters(this.queryParams);
this.searchContent();
this.searchEntered();
}
}

searchEntered() {
this.queryParams['page'] = 1;
this.pageNumber = 1;
this.paginationConfig.pageNumber = 1;
this.searchContent();
}

searchContent() {
this.pageLoading = true;
this.setUrlParams(this.queryParams);
Expand Down

0 comments on commit ff2f69f

Please sign in to comment.