[Trunk | Library]: dataProvider.component & organization.component & project.component: Add better checks in search calls (fetch classes).

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@58812 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
konstantina.galouni 2020-05-31 13:09:26 +00:00
parent b454b318d0
commit cf7ed8a085
3 changed files with 71 additions and 55 deletions

View File

@ -429,7 +429,9 @@ export class DataProviderComponent {
private searchPublications(page: number, size: number) { private searchPublications(page: number, size: number) {
if (this.reloadPublications && if (this.reloadPublications &&
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || (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.fetchPublications.getResultsForDataproviders("publication", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
} }
this.reloadPublications = false; this.reloadPublications = false;
@ -442,7 +444,9 @@ export class DataProviderComponent {
private searchDatasets(page: number, size: number) { private searchDatasets(page: number, size: number) {
if (this.reloadDatasets && if (this.reloadDatasets &&
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || (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.fetchDatasets.getResultsForDataproviders("dataset", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
} }
this.reloadDatasets = false; this.reloadDatasets = false;
@ -455,7 +459,9 @@ export class DataProviderComponent {
private searchSoftware(page: number, size: number) { private searchSoftware(page: number, size: number) {
if (this.reloadSoftware && if (this.reloadSoftware &&
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || (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.fetchSoftware.getResultsForDataproviders("software", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
} }
this.reloadSoftware = false; this.reloadSoftware = false;
@ -468,7 +474,9 @@ export class DataProviderComponent {
private searchOrps(page: number, size: number) { private searchOrps(page: number, size: number) {
if (this.reloadOrps && if (this.reloadOrps &&
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || (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.fetchOrps.getResultsForDataproviders("other", this.datasourceId, this.dataProviderInfo.resultsBy, page, size, this.properties);
} }
this.reloadOrps = false; this.reloadOrps = false;
@ -481,7 +489,9 @@ export class DataProviderComponent {
private searchProjects(page: number, size: number) { private searchProjects(page: number, size: number) {
if (this.reloadProjects && if (this.reloadProjects &&
(this.fetchProjects.searchUtils.status == this.errorCodes.LOADING || (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.fetchProjects.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
} }
this.reloadProjects = false; this.reloadProjects = false;
@ -494,7 +504,9 @@ export class DataProviderComponent {
private searchDatasources(page: number, size: number) { private searchDatasources(page: number, size: number) {
if (this.reloadDataproviders && if (this.reloadDataproviders &&
(this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING || (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.fetchDataproviders.getResultsForDataproviders(this.datasourceId, page, size, this.properties);
} }
this.reloadDataproviders = false; this.reloadDataproviders = false;
@ -537,7 +549,8 @@ export class DataProviderComponent {
// this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties); // this.fetchAggregatorsOrps.getAggregatorResults("other", this.datasourceId, page, size, this.properties);
if (this.reloadRelatedDatasources && if (this.reloadRelatedDatasources &&
(this.fetchAggregatorsResults.searchUtils.status == this.errorCodes.LOADING || (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( this.relatedDatasourcesSub = this.fetchAggregatorsResults.requestComplete.subscribe(
data => {}, data => {},

View File

@ -238,7 +238,9 @@ export class OrganizationComponent {
private searchContentProviders(page: number, size: number) { private searchContentProviders(page: number, size: number) {
if (this.reloadDataproviders && if (this.reloadDataproviders &&
(this.fetchDataproviders.searchUtils.status == this.errorCodes.LOADING || (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.fetchDataproviders.getResultsForEntity("organization", this.organizationId, page, size, this.properties);
} }
this.reloadDataproviders = false; this.reloadDataproviders = false;
@ -250,7 +252,9 @@ export class OrganizationComponent {
private searchPublications(page: number, size: number) { private searchPublications(page: number, size: number) {
if (this.reloadPublications && if (this.reloadPublications &&
(this.fetchPublications.searchUtils.status == this.errorCodes.LOADING || (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.fetchPublications.getResultsForEntity("publication", "organization", this.organizationId, page, size, this.properties);
} }
this.reloadPublications = false; this.reloadPublications = false;
@ -262,7 +266,9 @@ export class OrganizationComponent {
private searchDatasets(page: number, size: number) { private searchDatasets(page: number, size: number) {
if (this.reloadDatasets && if (this.reloadDatasets &&
(this.fetchDatasets.searchUtils.status == this.errorCodes.LOADING || (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.fetchDatasets.getResultsForEntity("dataset", "organization", this.organizationId, page, size, this.properties);
} }
this.reloadDatasets = false; this.reloadDatasets = false;
@ -274,7 +280,9 @@ export class OrganizationComponent {
private searchSoftware(page: number, size: number) { private searchSoftware(page: number, size: number) {
if (this.reloadSoftware && if (this.reloadSoftware &&
(this.fetchSoftware.searchUtils.status == this.errorCodes.LOADING || (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.fetchSoftware.getResultsForEntity("software", "organization", this.organizationId, page, size, this.properties);
} }
this.reloadSoftware = false; this.reloadSoftware = false;
@ -286,7 +294,9 @@ export class OrganizationComponent {
private searchOrps(page: number, size: number) { private searchOrps(page: number, size: number) {
if (this.reloadOrps && if (this.reloadOrps &&
(this.fetchOrps.searchUtils.status == this.errorCodes.LOADING || (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.fetchOrps.getResultsForEntity("other", "organization", this.organizationId, page, size, this.properties);
} }
this.reloadOrps = false; this.reloadOrps = false;

View File

@ -286,57 +286,50 @@ export class ProjectComponent {
} }
} }
private searchPublications() { public searchPublications(page: number, size: number) {
this.fetchPublications.getResultsForEntity("publication", "project", this.projectId, 1, this.searchNumber, this.properties); 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; this.reloadPublications = false;
} }
private searchDatasets() { public searchDatasets(page: number, size: number) {
this.fetchDatasets.getResultsForEntity("dataset", "project", this.projectId, 1, this.searchNumber, this.properties); 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.reloadDatasets = false;
//this.activeTab = "Research Data";
} }
private searchSoftware() { private searchSoftware(page: number, size: number) {
this.fetchSoftware.getResultsForEntity("software", "project", this.projectId, 1, this.searchNumber, this.properties); 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; this.reloadSoftware = false;
} }
private searchOrps() { private searchOrps(page: number, size: number) {
this.fetchOrps.getResultsForEntity("other", "project", this.projectId, 1, this.searchNumber, this.properties); 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; 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) { private getProjectInfo(id: string) {
this.warningMessage = ''; this.warningMessage = '';
this.errorMessage = ""; this.errorMessage = "";
@ -678,16 +671,16 @@ export class ProjectComponent {
this.activeTab = 'summary'; this.activeTab = 'summary';
} else if (activeTabId == 'publications') { } else if (activeTabId == 'publications') {
this.activeTab = 'publications'; this.activeTab = 'publications';
this.searchPublicationsInit(); this.searchPublications(1, this.searchNumber);
} else if (activeTabId == 'datasets') { } else if (activeTabId == 'datasets') {
this.activeTab = 'datasets'; this.activeTab = 'datasets';
this.searchDatasetsInit(); this.searchDatasets(1, this.searchNumber);
} else if (activeTabId == 'software') { } else if (activeTabId == 'software') {
this.activeTab = 'software'; this.activeTab = 'software';
this.searchSoftwareInit(); this.searchSoftware(1, this.searchNumber);
} else if (activeTabId == 'other') { } else if (activeTabId == 'other') {
this.activeTab = "other"; this.activeTab = "other";
this.searchOrpsInit(); this.searchOrps(1, this.searchNumber);
} else if (activeTabId == 'statistics') { } else if (activeTabId == 'statistics') {
this.activeTab = 'statistics'; this.activeTab = 'statistics';
this.statsClicked = true; this.statsClicked = true;