diff --git a/landingPages/dataProvider/dataProvider.component.ts b/landingPages/dataProvider/dataProvider.component.ts index 15d98cfe..4f8f755d 100644 --- a/landingPages/dataProvider/dataProvider.component.ts +++ b/landingPages/dataProvider/dataProvider.component.ts @@ -429,7 +429,9 @@ export class DataProviderComponent { private searchPublications(page: number, size: number) { if (this.reloadPublications && (this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || - this.fetchPublications.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0) + ) + ) { this.fetchPublications.getResultsForDataproviders("publication", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadPublications = false; @@ -442,7 +444,9 @@ export class DataProviderComponent { private searchDatasets(page: number, size: number) { if (this.reloadDatasets && (this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || - this.fetchDatasets.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0) + ) + ) { this.fetchDatasets.getResultsForDataproviders("dataset", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadDatasets = false; @@ -455,7 +459,9 @@ export class DataProviderComponent { private searchSoftware(page: number, size: number) { if (this.reloadSoftware && (this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || - this.fetchSoftware.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0) + ) + ) { this.fetchSoftware.getResultsForDataproviders("software", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadSoftware = false; @@ -468,7 +474,9 @@ export class DataProviderComponent { private searchOrps(page: number, size: number) { if (this.reloadOrps && (this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || - this.fetchOrps.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0) + ) + ) { this.fetchOrps.getResultsForDataproviders("other", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties); } this.reloadOrps = false; @@ -481,7 +489,9 @@ export class DataProviderComponent { private searchProjects(page: number, size: number) { if (this.reloadProjects && (this.fetchProjects.searchUtils.status == this.errorCodes.LOADING || - this.fetchProjects.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchProjects.searchUtils.status == this.errorCodes.DONE && this.fetchProjects.searchUtils.totalResults > 0) + ) + ) { this.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } this.reloadProjects = false; @@ -494,7 +504,9 @@ export class DataProviderComponent { private searchDatasources(page: number, size: number) { if (this.reloadDataproviders && (this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING || - this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE && this.fetchDataproviders.searchUtils.totalResults > 0) + ) + ) { this.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties); } this.reloadDataproviders = false; @@ -537,7 +549,8 @@ export class DataProviderComponent { // this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); if (this.reloadRelatedDatasources && (this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.LOADING || - this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.DONE) + (this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.DONE && this.fetchAggregatorsResults.searchUtils.totalResults > 0) + ) ) { this.relatedDatasourcesSub = this.fetchAggregatorsResults.requestComplete.subscribe( data => {}, diff --git a/landingPages/organization/organization.component.ts b/landingPages/organization/organization.component.ts index 5fb55ed6..05a1ba63 100644 --- a/landingPages/organization/organization.component.ts +++ b/landingPages/organization/organization.component.ts @@ -238,7 +238,9 @@ export class OrganizationComponent { private searchContentProviders(page: number, size: number) { if (this.reloadDataproviders && (this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING || - this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchDataproviders.searchUtils.status == this.errorCodes.DONE && this.fetchDataproviders.searchUtils.totalResults > 0) + ) + ) { this.fetchDataproviders.getResultsForEntity("organization", this.organizationId, page, size, this.properties); } this.reloadDataproviders = false; @@ -250,7 +252,9 @@ export class OrganizationComponent { private searchPublications(page: number, size: number) { if (this.reloadPublications && (this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || - this.fetchPublications.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0) + ) + ) { this.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, page, size, this.properties); } this.reloadPublications = false; @@ -262,7 +266,9 @@ export class OrganizationComponent { private searchDatasets(page: number, size: number) { if (this.reloadDatasets && (this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || - this.fetchDatasets.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0) + ) + ) { this.fetchDatasets.getResultsForEntity("dataset", "organization", this.organizationId, page, size, this.properties); } this.reloadDatasets = false; @@ -274,7 +280,9 @@ export class OrganizationComponent { private searchSoftware(page: number, size: number) { if (this.reloadSoftware && (this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || - this.fetchSoftware.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0) + ) + ) { this.fetchSoftware.getResultsForEntity("software", "organization", this.organizationId, page, size, this.properties); } this.reloadSoftware = false; @@ -286,7 +294,9 @@ export class OrganizationComponent { private searchOrps(page: number, size: number) { if (this.reloadOrps && (this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || - this.fetchOrps.searchUtils.status == this.errorCodes.DONE)) { + (this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0) + ) + ) { this.fetchOrps.getResultsForEntity("other", "organization", this.organizationId, page, size, this.properties); } this.reloadOrps = false; diff --git a/landingPages/project/project.component.ts b/landingPages/project/project.component.ts index aec33d04..194e75dd 100644 --- a/landingPages/project/project.component.ts +++ b/landingPages/project/project.component.ts @@ -286,57 +286,50 @@ export class ProjectComponent { } } - private searchPublications() { - this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, 1, this.searchNumber, this.properties); + public searchPublications(page: number, size: number) { + if (this.reloadPublications && + (this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || + (this.fetchPublications.searchUtils.status == this.errorCodes.DONE && this.fetchPublications.searchUtils.totalResults > 0) + ) + ) { + this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, page, size, this.properties); + } this.reloadPublications = false; } - private searchDatasets() { - this.fetchDatasets.getResultsForEntity("dataset", "project", this.projectId, 1, this.searchNumber, this.properties); + public searchDatasets(page: number, size: number) { + if (this.reloadDatasets && + (this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || + (this.fetchDatasets.searchUtils.status == this.errorCodes.DONE && this.fetchDatasets.searchUtils.totalResults > 0) + ) + ) { + this.fetchDatasets.getResultsForEntity("dataset", "project", this.projectId, page, size, this.properties); + } this.reloadDatasets = false; - //this.activeTab = "Research Data"; } - private searchSoftware() { - this.fetchSoftware.getResultsForEntity("software", "project", this.projectId, 1, this.searchNumber, this.properties); + private searchSoftware(page: number, size: number) { + if (this.reloadSoftware && + (this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || + (this.fetchSoftware.searchUtils.status == this.errorCodes.DONE && this.fetchSoftware.searchUtils.totalResults > 0) + ) + ) { + this.fetchSoftware.getResultsForEntity("software", "project", this.projectId, page, size, this.properties); + } this.reloadSoftware = false; } - private searchOrps() { - this.fetchOrps.getResultsForEntity("other", "project", this.projectId, 1, this.searchNumber, this.properties); + private searchOrps(page: number, size: number) { + if (this.reloadOrps && + (this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || + (this.fetchOrps.searchUtils.status == this.errorCodes.DONE && this.fetchOrps.searchUtils.totalResults > 0) + ) + ) { + this.fetchOrps.getResultsForEntity("other", "project", this.projectId, page, size, this.properties); + } this.reloadOrps = false; } - public searchPublicationsInit() { - if (this.reloadPublications && this.fetchPublications.searchUtils.totalResults > 0) { - this.searchPublications(); - } else if (this.fetchPublications.searchUtils.totalResults == 0) { - //this.statsClicked=true; - //this.activeTab = "Statistics"; - } - } - - public searchDatasetsInit() { - if (this.reloadDatasets && this.fetchDatasets.searchUtils.totalResults > 0) { - this.searchDatasets(); - } else if (this.fetchDatasets.searchUtils.totalResults == 0) { - //this.statsClicked=true; - //this.activeTab = "Statistics"; - } - } - - public searchSoftwareInit() { - if (this.reloadSoftware && this.fetchSoftware.searchUtils.totalResults > 0) { - this.searchSoftware(); - } - } - - public searchOrpsInit() { - if (this.reloadOrps && this.fetchOrps.searchUtils.totalResults > 0) { - this.searchOrps(); - } - } - private getProjectInfo(id: string) { this.warningMessage = ''; this.errorMessage = ""; @@ -678,16 +671,16 @@ export class ProjectComponent { this.activeTab = 'summary'; } else if (activeTabId == 'publications') { this.activeTab = 'publications'; - this.searchPublicationsInit(); + this.searchPublications(1, this.searchNumber); } else if (activeTabId == 'datasets') { this.activeTab = 'datasets'; - this.searchDatasetsInit(); + this.searchDatasets(1, this.searchNumber); } else if (activeTabId == 'software') { this.activeTab = 'software'; - this.searchSoftwareInit(); + this.searchSoftware(1, this.searchNumber); } else if (activeTabId == 'other') { this.activeTab = "other"; - this.searchOrpsInit(); + this.searchOrps(1, this.searchNumber); } else if (activeTabId == 'statistics') { this.activeTab = 'statistics'; this.statsClicked = true;