Merge remote-tracking branch 'origin/master' into new-theme

This commit is contained in:
Konstantinos Triantafyllou 2022-02-16 18:27:35 +02:00
commit 7cbefb4118
3 changed files with 27 additions and 29 deletions

View File

@ -165,6 +165,8 @@ export class AppComponent {
if (communityId) {
this.properties.adminToolsPortalType = "community";
this.initLayout(communityId);
}else{
this.properties.adminToolsPortalType = "connect";
}
this.configurationService.initCommunityInformation(this.properties, (communityId) ? communityId : this.properties.adminToolsPortalType);
}

View File

@ -35,7 +35,8 @@ export class DemoComponent implements OnInit{
this.result.resultType = "Publication";
this.resultLanding.types = this.result.types = ["Article"];
this.resultLanding.accessMode = this.result.accessMode = "Open Access";
this.resultLanding.description = this.result.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
this.result.description = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."
this.resultLanding.description = [this.result.description];
this.resultLanding.authors = this.result.authors = [{fullName: "Lorem ipsum", orcid: "0000-1111-2222-3333", orcid_pending: null}, {fullName: "Lorem ipsum", orcid: null, orcid_pending: "0000-1111-2222-3333"},{fullName: "Lorem ipsum", orcid: null, orcid_pending: null}];
this.resultLanding.title = this.result.title = "Lorem ipsum dolor sit amet, consectetur adipiscing elit";
this.resultLanding.fundedByProjects = this.result.projects = [{id: "XYZ", acronym: "Project acronym", title: "Project name", funderShortname: "Funder acronym", funderName: "Funder name", code:" project code"}]

View File

@ -97,13 +97,11 @@ export class OpenaireSearchProjectsComponent {
this.keyword = decodeURIComponent(params['fv0']?params['fv0']:(params['keyword']?params['keyword']:''));
this.selectedFields = [];
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, this.customFilter, params, "project");
this.filters = [];
this.searchPage.prepareFiltersToShow(this.filters, 0);
if(this.initialLoad) {
this.initialLoad = false;
this._getResults();
}else{
this.filterResults();
this._getResults();
}
}));
}
@ -118,25 +116,31 @@ export class OpenaireSearchProjectsComponent {
});
}
private _getResults(){
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.enableSearchView = false;
this.results = [];
this.searchUtils.totalResults = 0;
this.subscriptions.push(this._searchProjectsService.searchProjects(this.properties, this.communityId).subscribe(
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.disableRefineForms = true;
this.enableSearchView = false;
if(this.allResults) {
this.subscriptions.push(this._searchProjectsService.searchProjects(this.properties, this.communityId).subscribe(
data => {
this.originalFilters = this.createFilters(data);
this.originalFilters = this.createFilters(data).slice(); //copy array
this.allResults = this.parseResults(data);
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
this.filterResults();
},
err => {
this.handleError("Error getting projects for community with id: "+this.communityId, err);
this.handleError("Error getting projects for community with id: " + this.communityId, err);
this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
this.enableSearchView = true;
}
));
));
}else{
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
this.filterResults();
}
}
@ -204,11 +208,6 @@ export class OpenaireSearchProjectsComponent {
return results;
}
filterResults(){
this.searchUtils.refineStatus = this.errorCodes.LOADING;
this.searchUtils.status = this.errorCodes.LOADING;
this.disableForms = true;
this.disableRefineForms = true;
this.enableSearchView = false;
let results = this.allResults.filter(value => { return value.title.name && value.title.name.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1 || value.acronym && value.acronym.toLowerCase().indexOf(this.keyword.toLowerCase()) !=-1});
let funderFilterValues = [];
for(let filter of this.filters){
@ -226,17 +225,13 @@ export class OpenaireSearchProjectsComponent {
});
}
this.oldTotalResults = results.length;
this.searchUtils.totalResults = results.length;
this.subscriptions.push(setTimeout(() => {
this.filters = this.searchPage.prepareFiltersToShow(this.originalFilters, this.allResults.length);
this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size );
this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
this.disableForms = false;
this.disableRefineForms = false;
this.enableSearchView = true;
this.searchUtils.refineStatus = this.errorCodes.DONE;
}, 300));
this.searchUtils.totalResults = results.length;
this.results = results.slice((this.searchUtils.page - 1) * this.searchUtils.size, this.searchUtils.page *this.searchUtils.size );
this.searchUtils.status = this.results.length == 0 ? this.errorCodes.NONE: this.errorCodes.DONE;
this.disableForms = false;
this.disableRefineForms = false;
this.enableSearchView = true;
this.searchUtils.refineStatus = this.errorCodes.DONE;
}
private handleError(message: string, error) {
console.error("Projects simple Search Page: "+message, error);