[Library|Trunk]
- Result landing: allow get result from input instead of the service. - FetchResearchResults class: getResultsForCommunity add check for current year when sorting on date - Customization checkForObsoleteVersion: add extra check git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@60883 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
f7fe97900f
commit
78f6d85d45
|
@ -83,8 +83,11 @@ export class CustomizationOptions {
|
|||
};
|
||||
}
|
||||
public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){
|
||||
let updated = new CustomizationOptions(current.identity.mainColor,current.identity.secondaryColor);
|
||||
let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor);
|
||||
let updated = Object.assign({}, defaultCO);
|
||||
if(current.identity && current.identity.mainColor && current.identity.secondaryColor ) {
|
||||
updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
|
||||
}
|
||||
if(!current.backgrounds){
|
||||
current.backgrounds = Object.assign({}, updated.backgrounds);
|
||||
}
|
||||
|
|
|
@ -39,8 +39,8 @@ export class ResultLandingComponent {
|
|||
@ViewChild('relationModal') relationModal;
|
||||
@ViewChild('organizationModal') organizationModal;
|
||||
public deleteByInferenceOpened: boolean = false;
|
||||
|
||||
public resultLandingInfo: ResultLandingInfo;
|
||||
@Input() public resultFromInput: boolean = false;
|
||||
@Input() public resultLandingInfo: ResultLandingInfo;
|
||||
public supplementaryResults: RelationResult[];
|
||||
public relation: string = 'trust';
|
||||
public id: string;
|
||||
|
@ -138,7 +138,6 @@ export class ResultLandingComponent {
|
|||
this.getPageContents();
|
||||
this.updateUrl(this.properties.domain +this.properties.baseLink + this._router.url);
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(data => {
|
||||
this.resultLandingInfo = null;
|
||||
if (data['articleId']) {
|
||||
this.id = data['articleId'];
|
||||
this.initMetaAndLinks("publication");
|
||||
|
@ -165,7 +164,10 @@ export class ResultLandingComponent {
|
|||
this.updateDescription("");
|
||||
|
||||
this.metricsClicked = false;
|
||||
|
||||
if(this.resultFromInput){
|
||||
this.id = this.resultLandingInfo.objIdentifier;
|
||||
this.type="publication";
|
||||
}
|
||||
if ((this.id && StringUtils.isOpenAIREID(this.id)) || (this.identifier)) {
|
||||
this.getProvenanceVocabularyAndResultLandingInfo();
|
||||
} else {
|
||||
|
@ -287,9 +289,7 @@ export class ResultLandingComponent {
|
|||
this.warningMessage = '';
|
||||
this.errorMessage = '';
|
||||
this.showLoading = true;
|
||||
|
||||
this.resultLandingInfo = null;
|
||||
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
|
||||
provenanceActionVocabulary => {
|
||||
|
@ -344,6 +344,11 @@ export class ResultLandingComponent {
|
|||
// }
|
||||
|
||||
private getResultLandingInfo(provenanceActionVocabulary: any) {
|
||||
if(this.resultFromInput && this.resultLandingInfo){
|
||||
this.showLoading = false;
|
||||
return;
|
||||
}
|
||||
this.resultLandingInfo = null;
|
||||
this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
|
||||
data => {
|
||||
this.resultLandingInfo = data;
|
||||
|
|
|
@ -47,8 +47,7 @@ export class FetchResearchResults {
|
|||
|
||||
public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
|
||||
this.searchUtils.status = this.errorCodes.LOADING;
|
||||
|
||||
this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId + (contextId?'&fq=categoryid=' + encodeURIComponent(contextId):''), page, size, "resultdateofacceptance,descending", [], properties).subscribe(
|
||||
this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=" + encodeURIComponent( "resultacceptanceyear <= " + (new Date()).getFullYear()) + "&fq=communityid=" + communityId + (contextId?'&fq=categoryid=' + encodeURIComponent(contextId):''), page, size, "resultdateofacceptance,descending", [], properties).subscribe(
|
||||
data => {
|
||||
this.searchUtils.totalResults = data[0];
|
||||
this.results = data[1];
|
||||
|
|
Loading…
Reference in New Issue