diff --git a/galaxyui/src/app/search/search-routing.module.ts b/galaxyui/src/app/search/search-routing.module.ts index bddd81047..5e43f9bcc 100644 --- a/galaxyui/src/app/search/search-routing.module.ts +++ b/galaxyui/src/app/search/search-routing.module.ts @@ -21,6 +21,7 @@ const routes: Routes = [ { path: 'search', component: SearchComponent, + runGuardsAndResolvers: 'always', resolve: { cloudPlatforms: SearchCloudPlatformResolver, content: SearchContentResolver, diff --git a/galaxyui/src/app/search/search.component.ts b/galaxyui/src/app/search/search.component.ts index a3c70623e..8969f5bcd 100644 --- a/galaxyui/src/app/search/search.component.ts +++ b/galaxyui/src/app/search/search.component.ts @@ -188,6 +188,14 @@ export class SearchComponent implements OnInit, AfterViewInit { this.route.queryParams.subscribe(params => { this.route.data.subscribe( (data) => { + // This function is called each time the route updates, so + // the default values have to be reset + this.appliedFilters = []; + this.paginationConfig.pageNumber = 1; + this.pageNumber = 1; + this.sortParams = '&order_by=-relevance'; + this.setSortConfig(this.sortParams); + this.preparePlatforms(data.platforms); this.prepareContentTypes(data.contentTypes); this.prepareCloudPlatforms(data.cloudPlatforms); @@ -476,7 +484,11 @@ export class SearchComponent implements OnInit, AfterViewInit { private prepareContent(data: Content[], count: number) { data.forEach(item => { - item.imported = moment(item.imported).fromNow(); + if (item.imported === null) { + item.imported = 'NA'; + } else { + item.imported = moment(item.imported).fromNow(); + } item['repository_format'] = item.summary_fields['repository']['format']; item['avatar_url'] = item.summary_fields['namespace']['avatar_url'] || '/assets/avatar.png'; if (!item.summary_fields['namespace']['is_vendor']) {