Project

General

Profile

1
import {Component, OnInit} from "@angular/core";
2
import {Meta, Title} from "@angular/platform-browser";
3
import {SEOService} from "../openaireLibrary/sharedComponents/SEO/SEO.service";
4
import {properties} from "../../environments/environment";
5
import {Router} from "@angular/router";
6
import {AggregatorInfo, PortalAggregators} from "../utils/aggregators";
7
import {ConnectHelper} from "../openaireLibrary/connect/connectHelper";
8

    
9
@Component({
10
  selector: 'develop',
11
  template: `
12
    <div page-content>
13
      <div inner>
14
        <div *ngIf="aggregator" class="uk-container uk-container-large uk-section-small">
15
          <h2 class="uk-text-center">
16
            Develop
17
          </h2>
18
          <div class="uk-margin-medium-top uk-card uk-card-body uk-card-default">
19
            <h3 class="uk-text-center">Help developers with <span
20
              class="portal-color uk-text-bold">OpenAIRE APIs</span>
21
            </h3>
22
            <div class="uk-margin-large-top uk-margin-medium-bottom">
23
              Not sure where to start? Let us give you some guides and request examples.
24
            </div>
25
            <p>
26
              <span class="uk-text-bold">For research outcomes </span>
27
              (publications, datasets, software and other research data) you can use the
28
              <a href="http://api.openaire.eu/api.html" target="_blank">Selective Access APIs</a>
29
              by adding the <span class="uk-text-lowercase">country</span> parameter.
30
            </p>
31
            <div class="uk-grid   uk-child-width-1-2@m uk-child-width-1-1@s" uk-grid>
32
              <div>
33
                
34
                <p>
35
                  Request examples:
36
                </p>
37
                <ul class="portal-circle">
38
                  <li>
39
                    <span class="uk-text-bold">Access “Publications”</span><br>
40
                    <span class="uk-text-bold">GET</span>
41
                    <span
42
                      class="uk-text-break space">https://api.openaire.eu/search/publications?country={{aggregator.valueId}}</span>
43
                  </li>
44
                  <li>
45
                    <span class="uk-text-bold">Access “Open Access Publications”</span><br>
46
                    <span class="uk-text-bold">GET</span>
47
                    <span
48
                      class="uk-text-break space">http://api.openaire.eu/search/publications?country={{aggregator.valueId}}&OA=true</span>
49
                  </li>
50
                  <li>
51
                    <span class="uk-text-bold">Access “Datasets”</span><br>
52
                    <span class="uk-text-bold">GET</span>
53
                    <span
54
                      class="uk-text-break space">https://api.openaire.eu/search/datasets?country={{aggregator.valueId}}</span>
55
                  </li>
56
                  <li>
57
                    <span class="uk-text-bold">Access “Software”</span><br>
58
                    <span class="uk-text-bold">GET</span>
59
                    <span
60
                      class="uk-text-break space">https://api.openaire.eu/search/software?country={{aggregator.valueId}}</span>
61
                  </li>
62
                  <li>
63
                    <span class="uk-text-bold">Access “Other Research”</span><br>
64
                    <span class="uk-text-bold">GET</span>
65
                    <span
66
                      class="uk-text-break space">https://api.openaire.eu/search/other?country={{aggregator.valueId}}</span>
67
                  </li>
68
                </ul>
69
              </div>
70
              <div class="uk-flex uk-flex-middle">
71
                <div class="uk-flex uk-flex-center uk-width-1-1 uk-margin-medium-top">
72
                  <img width="350" src="assets/develop.png">
73
                </div>
74
              </div>
75
            </div>
76
            <div class="uk-margin-large-top uk-flex uk-flex-center uk-padding">
77
              <div class="documentation">
78
                For <span
79
                class="uk-text-bold">more information</span> on the full potential of the OpenAIRE APIs please check
80
                the <a href="http://develop.openaire.eu/" target="_blank">OpenAIRE API Documentation</a>.
81
              </div>
82
            </div>
83
          </div>
84
        </div>
85
      </div>
86
    </div>
87
  `,
88
  styleUrls: ['develop.component.css']
89
})
90
export class DevelopComponent implements OnInit {
91
  
92
  public aggregator: AggregatorInfo = null;
93

    
94
  constructor(private seoService: SEOService,
95
              private _meta: Meta,
96
              private _router: Router,
97
              private _title: Title) {
98
  }
99
  
100
  ngOnInit() {
101

    
102
      let id = ConnectHelper.getCommunityFromDomain(properties.domain);
103
      this.aggregator = PortalAggregators.getFilterInfoByMenuId(id);
104
      if (this.aggregator) {
105

    
106
        /* Metadata */
107
        const url = properties.domain + properties.baseLink + this._router.url;
108
        this.seoService.createLinkForCanonicalURL(url, false);
109
        this._meta.updateTag({content: url}, "property='og:url'");
110
        const description = "Develop | " + this.aggregator.valueName;
111
        const title = "Develop | " + this.aggregator.valueName;
112
        this._meta.updateTag({content: description}, "name='description'");
113
        this._meta.updateTag({content: description}, "property='og:description'");
114
        this._meta.updateTag({content: title}, "property='og:title'");
115
        this._title.setTitle(title);
116

    
117
      }else {
118
        this.navigateToError();
119
      }
120

    
121
  }
122

    
123
  private navigateToError() {
124
    this._router.navigate(['/error'], {queryParams: {'page': this._router.url}});
125
  }
126
  
127

    
128
}
(2-2/3)