Project

General

Profile

« Previous | Next » 

Revision 58748

[Library | Trunk]: Finish result landing base on new mocks

View differences:

resultLanding.component.ts
15 15
import {MetricsService} from "../../services/metrics.service";
16 16
import {Organization, RelationResult, ResultPreview} from "../../utils/result-preview/result-preview";
17 17
import {IndexInfoService} from "../../utils/indexInfo.service";
18
import {FormArray, FormBuilder, FormControl, FormGroup} from "@angular/forms";
18 19

  
19 20

  
20 21
@Component({
......
36 37
  public deleteByInferenceOpened: boolean = false;
37 38
  
38 39
  public resultLandingInfo: ResultLandingInfo;
39
  public relationResults: RelationResult[];
40
  public relatedResults: RelationResult[];
41
  public supplementaryResults: RelationResult[];
40 42
  public relation: string = 'trust';
41 43
  public id: string;
42 44
  public title: string;
......
60 62
  // Custom tab paging variables
61 63
  public referencesPage: number = 1;
62 64
  public bioentitiesPage: number = 1;
63
  public relationPage: number = 1;
65
  public relatedPage: number = 1;
66
  public similarPage: number = 1;
67
  public supplementaryPage: number = 1;
68
  public supplementedByPage: number = 1;
64 69
  public organizationsPage: number = 1;
65
  public softwarePage: number = 1;
66 70
  public openCitationsPage: number = 1;
67 71
  public pageSize: number = 10;
68 72
  
73
  // relation filters
74
  public relatedFilter: FormGroup;
75
  public supplementaryFilter: FormGroup;
76
  
69 77
  // Map counting variables
70 78
  public bioentitiesNum: number = 0;
79
  public relatedResultsNum: number = 0;
80
  public supplementaryResultsNum: number = 0;
71 81
  
72 82
  // Message variables
73 83
  public warningMessage = "";
......
103 113
              private metricsService: MetricsService,
104 114
              private cdr: ChangeDetectorRef,
105 115
              private _location: Location,
106
              private indexInfoService: IndexInfoService) {
116
              private indexInfoService: IndexInfoService,
117
              private fb: FormBuilder) {
107 118
  }
108 119
  
109 120
  ngOnInit() {
......
302 313
          });
303 314
        }
304 315
        this.showLoading = false;
305
        if (this.resultLandingInfo.references) {
306
          this.activeTab = "References";
307
        } else if (this.resultLandingInfo.relatedResearchResults) {
308
          this.activeTab = "Related Research Results";
309
        } else if (this.resultLandingInfo.similarResearchResults) {
310
          this.activeTab = "Similar Research Results";
311
        } else if (this.resultLandingInfo.organizations) {
312
          this.activeTab = "Related Organizations";
313
        } else if (this.resultLandingInfo.bioentities) {
314
          this.activeTab = "Bioentities";
315
        } else {
316
          this.activeTab = "Metrics";
317
          //this.metricsClicked = true;
318
        }
316
        this.initFilters();
319 317
      },
320 318
      err => {
321 319
        this.handleError("Error getting " + this.type + " for id: " + this.id, err);
......
337 335
    );
338 336
  }
339 337
  
338
  public initFilters() {
339
    /*this.relatedFilter = this.fb.group({
340
      related: this.fb.control(true),
341
      similar:  this.fb.control(true),
342
    });
343
    this.supplementaryFilter = this.fb.group({
344
      supplementary: this.fb.control(true),
345
      supplementedBy:  this.fb.control(true),
346
    });*/
347
    this.filterRelatedResults();
348
    this.filterSupplementaryResults();
349
    /*this.relatedFilter.valueChanges.subscribe(value => {
350
      this.filterRelatedResults(value.related, value.similar);
351
    });
352
    this.supplementaryFilter.valueChanges.subscribe(value => {
353
      this.filterSupplementaryResults(value.supplementary, value.supplementedBy);
354
    });*/
355
  }
356
  
357
  public filterRelatedResults(related: boolean = true, similar: boolean = true) {
358
    this.relatedResults = [];
359
    this.relatedResultsNum = 0;
360
    if (this.resultLandingInfo.relatedResearchResults) {
361
      this.relatedResultsNum += this.resultLandingInfo.relatedResearchResults.length;
362
      /*if(related) {
363
        this.resultLandingInfo.relatedResearchResults.forEach(result => {
364
          this.relatedResults.push(result);
365
        });
366
      }*/
367
    }
368
    if (this.resultLandingInfo.similarResearchResults) {
369
      this.relatedResultsNum += this.resultLandingInfo.similarResearchResults.length;
370
      /*if(similar) {
371
        this.resultLandingInfo.similarResearchResults.forEach(result => {
372
          this.relatedResults.push(result);
373
        });
374
      }*/
375
    }
376
  }
377
  
378
  public filterSupplementaryResults(supplementary: boolean = true, supplementedBy: boolean = true) {
379
    this.supplementaryResults = [];
380
    this.supplementaryResultsNum = 0;
381
    if (this.resultLandingInfo.supplementaryResearchResults) {
382
      this.supplementaryResultsNum += this.resultLandingInfo.supplementaryResearchResults.length;
383
      /*if(supplementary) {
384
        this.resultLandingInfo.supplementaryResearchResults.forEach(result => {
385
          this.supplementaryResults.push(result);
386
        });
387
      }*/
388
    }
389
    if (this.resultLandingInfo.supplementedByResearchResults) {
390
      this.supplementaryResultsNum += this.resultLandingInfo.supplementedByResearchResults.length;
391
      /*if(supplementedBy) {
392
        this.resultLandingInfo.supplementedByResearchResults.forEach(result => {
393
          this.supplementaryResults.push(result);
394
        });
395
      }*/
396
    }
397
  }
398
  
340 399
  public metricsResults($event) {
341 400
    this.totalViews = $event.totalViews;
342 401
    this.totalDownloads = $event.totalDownloads;
......
357 416
    return !(this.totalViews && this.totalDownloads && this.pageViews) || this.totalViews > 0 || this.totalDownloads > 0 || this.pageViews > 0;
358 417
  }
359 418
  
360
  public buildCurationTooltip(): string {
361
    let tooltipContent: string = "<div class='uk-margin uk-padding-small'>";
362
    
363
    tooltipContent += "<h4>Record in preview</h4>";
364
    tooltipContent += "<p>Bibliographic record accepted by the system, but not yet processed by <br> OpenAIRE tools for information quality improvement and de-duplication</p>";
365
    
366
    tooltipContent += "</div>";
367
    return tooltipContent;
368
  }
369
  
370 419
  private updateDescription(description: string) {
371 420
    this._meta.updateTag({content: description.substring(0, 160)}, "name='description'");
372 421
    this._meta.updateTag({content: description.substring(0, 160)}, "property='og:description'");
......
402 451
    this.bioentitiesPage = $event.value;
403 452
  }
404 453
  
405
  public updateRelationPage($event) {
406
    this.relationPage = $event.value;
454
  public updateRelatedPage($event) {
455
    this.relatedPage = $event.value;
407 456
  }
408 457
  
458
  public updateSimilarPage($event) {
459
    this.similarPage = $event.value;
460
  }
461
  
462
  public updateSupplementaryPage($event) {
463
    this.supplementaryPage = $event.value;
464
  }
465
  
466
  public updateSupplementedByPage($event) {
467
    this.supplementedByPage = $event.value;
468
  }
469
  
409 470
  public updateOrganizationsPage($event) {
410 471
    this.organizationsPage = $event.value;
411 472
  }
412 473
  
413
  public updateSoftwarePage($event) {
414
    this.softwarePage = $event.value;
415
  }
416
  
417 474
  public updateOpenCitationsPage($event) {
418 475
    this.openCitationsPage = $event.value;
419 476
  }
......
475 532
    this.alertModalDeletedByInference.alertTitle = "Other versions of";
476 533
    this.alertModalDeletedByInference.open();
477 534
  }
478

  
479
  openRelationResults(title: string, relationResults: RelationResult[], relation: string = 'trust') {
480
    this.relationResults = relationResults;
481
    this.relation = relation;
482
    this.relationModal.cancelButton = false;
483
    this.relationModal.okButton = false;
484
    this.relationModal.alertTitle = title;
485
    this.relationPage = 1;
486
    this.relationModal.open();
487
  }
488 535
  
489 536
  openOrganizations() {
490 537
    this.relation = 'trust';

Also available in: Unified diff