Project

General

Profile

« Previous | Next » 

Revision 60875

[Trunk | Library]:
1. myOrcidLinks.component.ts:
a. Remove comments from file.
b. Update and move on top of the page, message about green icons and when the data will be synchronized with ORCID.
c. Align "Discover research results related to you" on the right side of title.
d. [Bug fix] Set "baseUrl" with properties.myOrcidLinksPage.
2. orcid-work.component.ts: Show last update date in ORCID, on hover of Update button.
3. searchResult.component.ts: Add a missing condition (|| properties.adminToolsPortalType "community") to get ORCID putCodes for community dashboards except for Explore portal.
4. env-properties.ts: Added property "myOrcidLinksPage?: string;".
5. result-preview.component.html:
a. Add a missing condition (|| properties.adminToolsPortalType "community") to get ORCID putCodes for community dashboards except for Explore portal.
b. Hidle "result.orcidUpdateDates" from results preview (this info is moved on hover of update button).

View differences:

myOrcidLinks.component.ts
10 10
import {OrcidService} from "../orcid.service";
11 11
import {Identifier, StringUtils} from "../../utils/string-utils.class";
12 12
import {SearchResearchResultsService} from "../../services/searchResearchResults.service";
13
import {Session} from "../../login/utils/helper.class";
14
import {LoginErrorCodes} from "../../login/utils/guardHelper.class";
15 13
import {SearchResult} from "../../utils/entities/searchResult";
16 14
import {ResultPreview} from "../../utils/result-preview/result-preview";
17
import {HttpClient} from "@angular/common/http";
18 15
import {Meta, Title} from "@angular/platform-browser";
19 16
import {UserManagementService} from "../../services/user-management.service";
20 17
import {PiwikService} from "../../utils/piwik/piwik.service";
......
24 21
@Component({
25 22
  selector: 'my-orcid-links',
26 23
  template: `
27

  
28
<!--    <div class="uk-section uk-padding-remove-bottom uk-padding-remove-top">-->
29
<!--      <div class="explorePanelBackground communityPanelBackground uk-padding-small">-->
30
<!--        <div class="uk-container uk-container-large uk-margin-small-top uk-margin-small-bottom">-->
31
<!--          <breadcrumbs  [light]="!!(this.communityId)" [breadcrumbs]="breadcrumbs"></breadcrumbs>-->
32
<!--        </div>-->
33
<!--      </div>-->
34
<!--    </div>-->
35
    <div class="">
36
      <div class="uk-container uk-container-large uk-margin-top">
37
        <div class="uk-article-title custom-article-title">
38
          My ORCID links
39
        </div>
24
    
25
    <div class="uk-container uk-container-large">
26
      <div class="uk-margin-medium-bottom">
40 27
        <div class="uk-margin-top">
41
          <span *ngIf="authorNameParam">
42
            <a class="uk-button-text" [queryParams]="authorNameParam" 
43
                [routerLink]="properties.searchLinkToAdvancedResults" routerLinkActive="router-link-active">
44
              Discover research results related to you
45
            </a>
46
          </span>
47
          <span class="uk-align-right@m uk-margin-remove">
48
            Need help?
49
            <a href="https://www.openaire.eu/openaire-explore-integration-with-the-orcid-search-and-link-wizard" target="_blank">
50
              Read more  <span class="custom-external custom-icon space"></span>
51
            </a>
52
          </span>
53
        </div>
54
        <div *ngIf="showErrorMessage" class="uk-animation-fade uk-alert uk-alert-warning uk-margin-large-top" role="alert">
55
          An Error Occurred
56
        </div>
57
        <div *ngIf="!showLoading && !orcidQuery && !requestGrant && !showErrorMessage" 
58
              class="uk-animation-fade uk-alert uk-alert-primary uk-margin-large-top" role="alert">
59
          No ORCID links found
60
        </div>
61
        <div *ngIf="requestGrant" class="uk-margin-large-top">
62
          <div class="uk-text-center uk-padding-small">
63
            <div>
64
              This is a private page, only for users that have connected their ORCID iD with OpenAIRE.
65
              Please grant OpenAIRE to access and update your ORCID works.
28
          <div class="uk-grid uk-flex uk-flex-middle">
29
            <div class="uk-article-title custom-article-title uk-width-auto">
30
              My ORCID links
66 31
            </div>
67

  
68
            <div class="uk-margin-medium-top uk-align-center">
69
              <button (click)="openGrantWindow()" type="submit"
70
                      class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">
71
                <span>Grant OpenAIRE</span>
72
              </button>
32
            <span *ngIf="authorNameParam" class="uk-width-1-1 uk-width-expand@m">
33
              <a class="uk-button-text uk-align-right@m" [queryParams]="authorNameParam" 
34
                  [routerLink]="properties.searchLinkToAdvancedResults" routerLinkActive="router-link-active">
35
                Discover research results related to you
36
              </a>
37
            </span>
38
          </div>
39
          
40
          <div class="uk-margin-top">
41
            <span>
42
              Did you link a result with your ORCID <img src="assets/common-assets/common/ORCIDiD_icon16x16.png" alt="">
43
              but the <span class="orcid-color">green icon</span> is missing?
44
              <br>
45
              No worries! It will appear, as soon as we synchronize again with ORCID data.
46
                  <a href="https://www.openaire.eu/openaire-explore-integration-with-the-orcid-search-and-link-wizard"
47
                     target="_blank" class="uk-display-inline-block">
48
                Read more  <span class="custom-external custom-icon space"></span>
49
              </a>
50
            </span>
51
          </div>
52
          
53
          <div *ngIf="showErrorMessage" class="uk-animation-fade uk-alert uk-alert-warning uk-margin-large-top" role="alert">
54
            An Error Occurred
55
          </div>
56
          <div *ngIf="!showLoading && !orcidQuery && !requestGrant && !showErrorMessage" 
57
                class="uk-animation-fade uk-alert uk-alert-primary uk-margin-large-top" role="alert">
58
            No ORCID links found
59
          </div>
60
          <div *ngIf="requestGrant" class="uk-margin-large-top">
61
            <div class="uk-text-center uk-padding-small">
62
              <div>
63
                This is a private page, only for users that have connected their ORCID iD with OpenAIRE.
64
                Please grant OpenAIRE to access and update your ORCID works.
65
              </div>
66
  
67
              <div class="uk-margin-medium-top uk-align-center">
68
                <button (click)="openGrantWindow()" type="submit"
69
                        class="uk-button uk-padding-small uk-padding-remove-vertical uk-margin-left uk-button-primary">
70
                  <span>Grant OpenAIRE</span>
71
                </button>
72
              </div>
73 73
            </div>
74 74
          </div>
75 75
        </div>
76
      </div>
77
      
78
<!--      <div *ngIf="orcidQuery" class="uk-container uk-container-large uk-margin-top">-->
79

  
80
<!--        <form -->
81
<!--              class="uk-margin-top uk-grid uk-margin-small-left ng-untouched ng-pristine ng-valid uk-form-width-large uk-float-right">-->
82
<!-- -->
83
<!--          <div class=" uk-padding-remove-left uk-margin-small-top uk-inline uk-width-expand">-->
84
<!--            <a *ngIf="keyword.length > 0" class="uk-form-icon uk-form-icon-flip"-->
85
<!--               (click)="keyword = ''"-->
86
<!--               uk-icon="icon: close"></a>-->
87
<!--            <input type="text" class="uk-input text-input-box uk-width-expand"-->
88
<!--                   placeholder="Search by name, description, subject..." aria-describedby="sizing-addon2"-->
89
<!--                   [(ngModel)]="keyword" name="keyword">-->
90
<!--          </div>-->
91
<!--          <div class="uk-padding-remove-left">    -->
92
<!--          <button (click)="keywordChanged()" type="submit"-->
93
<!--                  class="portal-button uk-margin-small-left uk-margin-small-top uk-button">Search-->
94
<!--          </button>-->
95
<!--          </div>-->
96
<!-- -->
97
<!--        </form>-->
98
<!--      </div>-->
99
      
100
      
101
<!--      <div id="tm-main" class="   tm-middle" [class.uk-margin-top]="stickyForm">-->
102
<!--        <div uk-grid>-->
103
<!--          <div class="tm-main uk-width-1-1@s uk-width-1-1@m  uk-width-1-1@l uk-row-first ">-->
104
<!--            <div class="uk-container uk-container-large">-->
105
<!--              <my-orcid-result [results]="results"-->
106
<!--                            [status]="searchUtils.status"-->
107
<!--                            [type]="resultType"-->
108
<!--                            [properties]=properties>-->
109
<!--              </my-orcid-result>-->
110
<!--            </div>      -->
111
<!--          </div>-->
112
<!--        </div>-->
113
<!--      </div>-->
114
    </div>
115

  
116
    <div *ngIf="orcidQuery" class="tm-middle" id="tm-main">
117
      <div uk-grid="" class="uk-grid uk-grid-stack">
118
        <div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
119
          <div class="uk-container uk-container-large">
120
            <my-orcid-result [previewResults]="currentResults" 
121
                             [status]="searchUtils.status" 
122
                             [type]="resultType" 
123
                             [properties]=properties
124
                             [currentPage]="currentPage" 
125
                             [totalResults]="totalOrcidResults" 
126
                             [resultsPerPage]="resultsPerPage"
127
                             (pageChange)="pageChanged($event)">
128
            </my-orcid-result>        
129
            
130
            <div class="uk-text-center uk-margin-medium-top uk-margin-medium-bottom uk-animation-fade uk-alert" role="alert">
131
              Your ORCID links will be visible in the OpenAIRE research results as soon as we synchronize our data with ORCID.
76
  
77
        <div *ngIf="orcidQuery" class="tm-middle" id="tm-main">
78
          <div uk-grid="" class="uk-grid uk-grid-stack">
79
            <div class="tm-main uk-width-1-1@s uk-width-1-1@m uk-width-1-1@l uk-row-first uk-first-column">
80
              <div class="uk-container uk-container-large">
81
                <my-orcid-result [previewResults]="currentResults" 
82
                                 [status]="searchUtils.status" 
83
                                 [type]="resultType" 
84
                                 [properties]=properties
85
                                 [currentPage]="currentPage" 
86
                                 [totalResults]="totalOrcidResults" 
87
                                 [resultsPerPage]="resultsPerPage"
88
                                 (pageChange)="pageChanged($event)">
89
                </my-orcid-result>
90
              </div>
132 91
            </div>
133 92
          </div>
134 93
        </div>
135 94
      </div>
136 95
    </div>
137
    `
96
    `,
97
  styles: ['.orcid-color { color: #a6ce39; }']
138 98
})
139 99
export class MyOrcidLinksComponent {
140 100
  public resultType: string = "result";
......
159 119

  
160 120
  @Input() public communityId: string = null;
161 121

  
162
  depositLearnHowPage: string = null;
163 122
  public routerHelper:RouterHelper = new RouterHelper();
164
  // breadcrumbs:Breadcrumb[] = [];
165 123
  parameters = {};
166 124
  keyword  = "";
167 125

  
......
192 150
               private _searchResearchResultsService: SearchResearchResultsService,
193 151
               private userManagementService: UserManagementService,
194 152
               private _meta: Meta, private _title: Title
195
               // ,private http: HttpClient/*ATHENA CODE*/
196 153
  ) {
197 154
    this.errorCodes = new ErrorCodes();
198 155
    this.errorMessages = new ErrorMessagesComponent();
......
211 168

  
212 169
  public ngOnInit() {
213 170
    this.properties = properties;
214
    this.depositLearnHowPage = this.properties.depositLearnHowPage;
215
    this.baseUrl = this.properties.depositSearchPage;
171
    this.baseUrl = this.properties.myOrcidLinksPage;
216 172
    this.pagingLimit = this.properties.pagingLimit;
217
    // this.breadcrumbs.push({name: 'home', route: '/'}, {
218
    //   name: "Deposit",
219
    //   route: this.depositLearnHowPage
220
    // }, {name: "Browse repositories", route: null});
221

  
222
    // this.subscriptions.push(this.route.queryParams.subscribe(
223
    //   params => {
224
        // this.searchUtils.page = params['page'] ? params['page']-1 : 1;
225
        // this.searchUtils.size = params['size'] ? params['size'] : 5;
226

  
227
        // let page = (params['page'] === undefined) ? 1 : +params['page'];
228
        // this.searchUtils.page = (page <= 0) ? 1 : page;
229
        // let size = (params['size'] === undefined) ? 5 : +params['size'];
230
        // this.searchUtils.size = (size <= 0) ? 1 : size;
231
        //
232
        // if (params["type"]) {
233
        //   let types = params["type"];
234
        //   types = Array.isArray(types) ? types.join(',').split(","):types.split(",");
235
        //   types.map( function (t) {
236
        //     return StringUtils.unquote(StringUtils.URIDecode(t));
237
        //   } );
238
        //
239
        //   if(types.indexOf("publications")!=-1 && types.indexOf("datasets")!=-1 && types.indexOf("software")!=-1 && types.indexOf("other")!=-1 ){
240
        //     this.typeQuery += "&type=results";
241
        //   }else{
242
        //     for (let type of types) {
243
        //       this.typeQuery += "&type=" + StringUtils.unquote(StringUtils.URIDecode(type));
244
        //     }
245
        //   }
246
        // }else{
247
        //   this.typeQuery += "&type=results";
248
        // }
249

  
250
        // this.typeQuery = "&type=results";
251
        // this.getLocalWorks(this.currentPage, this.resultsPerPage);
252
    // }));
253 173
    var description = "Openaire, ORCID linking, publication, research data, software, other research product";
254 174
    this.updateTitle("My ORCID Links");
255 175
    this.updateDescription(description);
......
363 283
      for(let pid of work['pids']) {
364 284
        let identifier: Identifier = Identifier.getIdentifierFromString(pid);
365 285
        this.orcidQuery += (this.orcidQuery ? " or " : "") + ('(pidclassid exact "'+identifier.class+'" and pid="'+StringUtils.URIEncode(identifier.id)+'")');
366
        //this.orcidQuery = '(pidclassid exact "doi" and pid="10.1007/978-3-030-55814-7_16")';
367
        // console.debug(this.orcidQuery);
368 286
      }
369 287
    }
370 288
    this.showLoading = false;
......
383 301
    //this.subs.push(this._searchResearchResultsService.advancedSearchResults(this.resultType, parameters, page, size, sortBy, this.properties, null, this.searchPage.getFields(), refineFieldsFilterQuery)
384 302
      .subscribe(
385 303
        data => {
386
          // this is for testing purposes only!
387
          // let newRes = JSON.parse(JSON.stringify(data[1][0]));
388
          // newRes.identifiers = new Map();
389
          // newRes.identifiers.set("doi", [data[1][0].identifiers.get("doi")[1]]);
390
          // data[1].push(newRes);
391
          // console.log(data[1][data[0]]);
392
          //
393
          // data[1][0].identifiers.set("doi", [data[1][0].identifiers.get("doi")[0]]);
394
          // console.log(data[1][0]);
395
          //
396
          // data[0] += 1;
397

  
398 304
          let totalResults = data[0];
399 305
          let results = data[1];
400 306

  
401 307
          this.resultsReturned(results, totalResults, works);
402 308
        },
403 309
        err => {
404
          // this.handleError("Error getting " + this.getEntityName(this.resultType, true, true), err);
405 310
          console.error("Error getting " + this.getEntityName(this.resultType, true, true));
406 311
          this.showLoading = false;
407 312
          this.searchUtils.status = this.errorMessages.getErrorCode(err.status);
......
444 349
      })
445 350
    }
446 351

  
447
    // /////////////////////// ATHENA CODE ///////////////////////
448
    // // console.log(data[1]);
449
    // let dois = encodeURIComponent(results.map((result) => result.DOIs).join(","));
450
    // console.log(dois);
451
    // console.log(this.properties.impactFactorsAPIURL);
452
    // if(dois.length > 0 &&  (this.properties.impactFactorsAPIURL &&  this.properties.impactFactorsAPIURL.length > 0) ) {
453
    //   let url = this.properties.impactFactorsAPIURL + dois;
454
    //   this.http.get((this.properties.useCache?(this.properties.cacheUrl+(encodeURIComponent(url))):url)).subscribe((data_received:any[]) => {
455
    //     let impact =[];
456
    //     data_received.forEach(function (result) {
457
    //       if(result.doi && result.doi.length > 0 && result.pop_class!=null && result.inf_class!=null)
458
    //         impact[result.doi]=result;
459
    //     });
460
    //     this.currentResults.forEach(function (result) {
461
    //       if(result.identifiers) {
462
    //         result.identifiers.get("doi").forEach(function (doi) {
463
    //           if (impact[doi]) {
464
    //             result.DOI = doi;
465
    //           }
466
    //
467
    //         })
468
    //       }
469
    //     });
470
    //     for (let i = 0; i < this.currentResults.length; i++) {
471
    //       if (this.currentResults[i].DOI) {
472
    //         this.currentResults[i].pop_inf = new Array<string>();
473
    //         this.currentResults[i].pop_inf.push(impact[this.currentResults[i].DOI].pop_class, impact[this.currentResults[i].DOI].inf_class);
474
    //         if(this.currentResults[i].pop_inf[0]=="A"){
475
    //           // this.previewResults[i].pop_inf.push("High");
476
    //           this.currentResults[i].pop_inf.push("Exceptional");
477
    //         }else if(this.currentResults[i].pop_inf[0]=="B"){
478
    //           // this.previewResults[i].pop_inf.push("Average");
479
    //           this.currentResults[i].pop_inf.push("Substantial");
480
    //         }else{
481
    //           // this.previewResults[i].pop_inf.push("low");
482
    //           this.currentResults[i].pop_inf.push("Average");
483
    //         }
484
    //         if(this.currentResults[i].pop_inf[1]=="A"){
485
    //           // this.previewResults[i].pop_inf.push("Strong");
486
    //           this.currentResults[i].pop_inf.push("Exceptional");
487
    //         }else if(this.currentResults[i].pop_inf[1]=="B"){
488
    //           // this.previewResults[i].pop_inf.push("Average");
489
    //           this.currentResults[i].pop_inf.push("Substantial");
490
    //         }else{
491
    //           // this.previewResults[i].pop_inf.push("Weak");
492
    //           this.currentResults[i].pop_inf.push("Average");
493
    //         }
494
    //       }
495
    //     }
496
    //
497
    //   }, error1 => {
498
    //     console.error("Failed to get Impact factors for elixir-gr")
499
    //   });
500
    //   // console.log(researchResults[1]);
501
    //
502
    // }
503
    // /////////////////////// ATHENA CODE ///////////////////////
504

  
505

  
506 352
    this.results[this.currentPage-1] = this.currentResults;
507 353

  
508 354
    this.searchUtils.status = this.errorCodes.DONE;
......
539 385
        if(work['updateDate']) {
540 386
          this.currentResults[this.currentResults.length - 1].orcidUpdateDates.push(work['updateDate']);
541 387
        }
542

  
543
        // this.currentResults[this.currentResults.length - 1].orcidPutCodes.push(work['putCode']);
544
        // this.currentResults[this.currentResults.length - 1].orcidCreationDates.push(work['creationDate']);
545
        // this.currentResults[this.currentResults.length - 1].orcidUpdateDates.push(work['creationDate']);
546 388
      });
547 389
    }
548 390

  
549 391
    this.results[this.currentPage-1] = this.currentResults;
550
    // if(!refine) {
551
      // this.searchPage.buildPageURLParameters(this.filters, this.rangeFilters, false);
552
    // }
553

  
554 392
    this.searchUtils.status = this.errorCodes.DONE;
555 393
    if (this.searchUtils.totalResults == 0) {
556 394
      this.searchUtils.status = this.errorCodes.NONE;
......
563 401
    return ResultPreview.searchResultConvert(result, (result.entityType)?result.entityType:this.resultType);
564 402
  }
565 403

  
566
  // private handleError(message: string, error) {
567
  //   if(error && error.status == "401") {
568
  //     this.requestGrant = true;
569
  //     this.requestGrantMessage = "Please grant OpenAIRE to access and update your ORCID record and works. ";
570
  //     // + "If you have already granted OpenAIRE, you just need to login again to ORCID!";
571
  //   } else if(error && error.status == "403") {
572
  //     this.requestGrant = true;
573
  //     this.requestGrantMessage = "Please login again to ORCID."
574
  //   }
575
  //   console.error("My ORCID links Page: "+message, error);
576
  // }
577

  
578 404
  public getEntityName(entityType: string, plural: boolean, full: boolean): string {
579 405
    if (entityType == "publication") {
580 406
      return "publication" + (plural ? "s" : "");
......
592 418
  public pageChanged($event) {
593 419
    this.currentPage = $event.value;
594 420
    this.prepareOrcidQuery();
595
    // this.getLocalWorks(this.currentPage, this.resultsPerPage);
596 421
  }
597 422

  
598 423
  handleError(error, errorMsg: string) {
......
600 425
      this.requestGrant = true;
601 426
    } else {
602 427
      this.showErrorMessage = true;
603

  
604
      // UIkit.notification({
605
      //   message: errorMsg,
606
      //   status: 'warning',
607
      //   timeout: 6000,
608
      //   pos: 'bottom-right'
609
      // });
610 428
    }
611 429
    this.showLoading = false;
612 430
  }
613 431

  
614 432
  private updateTitle(title: string) {
615
    var _prefix = "";
616
    // if(!this.communityId) {
617
    //   _prefix = "OpenAIRE | ";
618
    // }
619
    // var _title = _prefix + ((title.length > 50) ? title.substring(0, 50) : title);
620 433
    this._title.setTitle(title);
621 434
    this._meta.updateTag({content: title}, "property='og:title'");
622 435
  }

Also available in: Unified diff