Skip to content

Commit

Permalink
Send user back to first page when they make searches. (ansible#1550)
Browse files Browse the repository at this point in the history
(cherry picked from commit ce6cf27)
  • Loading branch information
newswangerd committed Feb 13, 2019
1 parent a337449 commit 9ef4ae1
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 @@ -327,7 +327,7 @@ export class SearchComponent implements OnInit, AfterViewInit {
this.appliedFilters = [];
this.contentItems = [];
}
this.searchContent();
this.searchEntered();
}

getToolbarConfig(): ToolbarConfig {
Expand Down Expand Up @@ -374,10 +374,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 9ef4ae1

Please sign in to comment.