diff --git a/src/app/searchPages/simple/searchDataproviders.component.ts b/src/app/searchPages/simple/searchDataproviders.component.ts index f97c2e3..3c09685 100644 --- a/src/app/searchPages/simple/searchDataproviders.component.ts +++ b/src/app/searchPages/simple/searchDataproviders.component.ts @@ -23,6 +23,7 @@ import {PiwikHelper} from '../../utils/piwikHelper'; [columnNames]="columnNames" [showResultCount]=false [disableForms]="disableForms" + [enableSearchView]="enableSearchView" searchFormClass="datasourcesTableSearchForm" formPlaceholderText="Search for Content Providers"> @@ -43,12 +44,13 @@ export class OpenaireSearchDataprovidersComponent { properties:EnvProperties; public disableForms: boolean = false; + public enableSearchView: boolean = true; private communityId: string = ''; @ViewChild (SearchPageTableViewComponent) searchPage : SearchPageTableViewComponent ; piwikSiteId = null; - + constructor (private route: ActivatedRoute, private _searchDataprovidersService: SearchCommunityDataprovidersService) { this.errorCodes = new ErrorCodes(); this.searchUtils.status = this.errorCodes.LOADING; @@ -87,6 +89,7 @@ export class OpenaireSearchDataprovidersComponent { private _getResults(params){ this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.enableSearchView = false; this.results = []; this.searchUtils.totalResults = 0; @@ -106,10 +109,12 @@ export class OpenaireSearchDataprovidersComponent { this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = this.errorCodes.NONE; + } else { + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + this.disableForms = false; } - this.disableForms = false; - this.searchPage.triggerInitialLoad(); - this.searchPage.transform(this.results); + this.enableSearchView = true; }, err => { console.log(err); @@ -123,7 +128,7 @@ export class OpenaireSearchDataprovidersComponent { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - this.disableForms = false; + this.enableSearchView = true; } ); } diff --git a/src/app/searchPages/simple/searchProjects.component.ts b/src/app/searchPages/simple/searchProjects.component.ts index ffa114f..cfa8527 100644 --- a/src/app/searchPages/simple/searchProjects.component.ts +++ b/src/app/searchPages/simple/searchProjects.component.ts @@ -23,6 +23,7 @@ import {ConnectHelper} from '../../openaireLibrary/connect/connectHelper'; [columnNames]="columnNames" [showResultCount]=false [disableForms]="disableForms" + [enableSearchView]="enableSearchView" searchFormClass="projectsTableSearchForm" formPlaceholderText="Search for Projects"> @@ -43,6 +44,7 @@ export class OpenaireSearchProjectsComponent { properties:EnvProperties; public disableForms: boolean = false; + public enableSearchView: boolean = true; private communityId: string = ''; @@ -87,6 +89,7 @@ export class OpenaireSearchProjectsComponent { private _getResults(params){ this.searchUtils.status = this.errorCodes.LOADING; this.disableForms = true; + this.enableSearchView = false; this.results = []; this.searchUtils.totalResults = 0; @@ -107,10 +110,12 @@ export class OpenaireSearchProjectsComponent { this.searchUtils.status = this.errorCodes.DONE; if(this.searchUtils.totalResults == 0 ){ this.searchUtils.status = this.errorCodes.NONE; + } else { + this.searchPage.triggerInitialLoad(); + this.searchPage.transform(this.results); + this.disableForms = false; } - this.disableForms = false; - this.searchPage.triggerInitialLoad(); - this.searchPage.transform(this.results); + this.enableSearchView = true; }, err => { console.log(err); @@ -124,7 +129,7 @@ export class OpenaireSearchProjectsComponent { this.searchUtils.status = this.errorCodes.NOT_AVAILABLE; } - this.disableForms = false; + this.enableSearchView = true; } ); }