Project

General

Profile

« Previous | Next » 

Revision 60883

[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

View differences:

modules/uoa-services-library/trunk/ng-openaire-library/src/app/connect/community/CustomizationOptions.ts
83 83
    };
84 84
  }
85 85
  public static checkForObsoleteVersion(current:CustomizationOptions, communityId:string){
86
    let updated = new CustomizationOptions(current.identity.mainColor,current.identity.secondaryColor);
87 86
    let defaultCO = new CustomizationOptions(CustomizationOptions.getIdentity(communityId).mainColor,CustomizationOptions.getIdentity(communityId).secondaryColor);
87
    let updated = Object.assign({}, defaultCO);
88
    if(current.identity && current.identity.mainColor && current.identity.secondaryColor ) {
89
       updated = new CustomizationOptions(current.identity.mainColor, current.identity.secondaryColor);
90
    }
88 91
    if(!current.backgrounds){
89 92
      current.backgrounds = Object.assign({}, updated.backgrounds);
90 93
    }
modules/uoa-services-library/trunk/ng-openaire-library/src/app/landingPages/result/resultLanding.component.ts
39 39
  @ViewChild('relationModal') relationModal;
40 40
  @ViewChild('organizationModal') organizationModal;
41 41
  public deleteByInferenceOpened: boolean = false;
42
  
43
  public resultLandingInfo: ResultLandingInfo;
42
  @Input() public resultFromInput: boolean = false;
43
  @Input() public resultLandingInfo: ResultLandingInfo;
44 44
  public supplementaryResults: RelationResult[];
45 45
  public relation: string = 'trust';
46 46
  public id: string;
......
138 138
    this.getPageContents();
139 139
    this.updateUrl(this.properties.domain +this.properties.baseLink +  this._router.url);
140 140
    this.subscriptions.push(this.route.queryParams.subscribe(data => {
141
      this.resultLandingInfo = null;
142 141
      if (data['articleId']) {
143 142
        this.id = data['articleId'];
144 143
        this.initMetaAndLinks("publication");
......
165 164
      this.updateDescription("");
166 165

  
167 166
      this.metricsClicked = false;
168

  
167
      if(this.resultFromInput){
168
        this.id = this.resultLandingInfo.objIdentifier;
169
        this.type="publication";
170
      }
169 171
      if ((this.id && StringUtils.isOpenAIREID(this.id)) || (this.identifier)) {
170 172
        this.getProvenanceVocabularyAndResultLandingInfo();
171 173
      } else {
......
287 289
    this.warningMessage = '';
288 290
    this.errorMessage = '';
289 291
    this.showLoading = true;
290
    
291
    this.resultLandingInfo = null;
292
    
292

  
293 293
    if (typeof document !== 'undefined') {
294 294
      this.subscriptions.push(this._vocabulariesService.getProvenanceActionVocabulary(this.properties).subscribe(
295 295
        provenanceActionVocabulary => {
......
344 344
  // }
345 345
  
346 346
  private getResultLandingInfo(provenanceActionVocabulary: any) {
347
    if(this.resultFromInput && this.resultLandingInfo){
348
      this.showLoading = false;
349
      return;
350
    }
351
    this.resultLandingInfo = null;
347 352
    this.subscriptions.push(this._resultLandingService.getResultLandingInfo(this.id, this.identifier, this.type, provenanceActionVocabulary, this.properties).subscribe(
348 353
      data => {
349 354
        this.resultLandingInfo = data;
modules/uoa-services-library/trunk/ng-openaire-library/src/app/utils/fetchEntitiesClasses/fetchResearchResults.class.ts
47 47

  
48 48
  public getResultsForCommunity(resultType:string, communityId: string, page: number, size: number, properties:EnvProperties, contextId = null) {
49 49
    this.searchUtils.status = this.errorCodes.LOADING;
50

  
51
    this.subscriptions.push(this._searchResearchResultsService.search(resultType, "", "&fq=communityid=" + communityId + (contextId?'&fq=categoryid=' + encodeURIComponent(contextId):''), page, size, "resultdateofacceptance,descending", [], properties).subscribe(
50
    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(
52 51
      data => {
53 52
        this.searchUtils.totalResults = data[0];
54 53
        this.results = data[1];

Also available in: Unified diff