Project

General

Profile

« Previous | Next » 

Revision 51590

corrected enableMetrics method

View differences:

modules/uoa-repository-dashboard-gui/trunk/app/pages/metrics/metrics-enable.component.ts
88 88
        openaireId: this.oaId,
89 89
        repositoryName: this.repo.officialName,
90 90
        country: this.repo.countryName,
91
        siteId: `${this.analyticsUrl}siteName=${encodeURIComponent(this.repo.officialName)}&url=${encodeURIComponent(this.repo.websiteUrl)}`,
91
        siteId: '',
92 92
        authenticationToken: this.authenticationToken,
93 93
        creationDate: null,
94 94
        requestorName: this.authService.getUserName(),
......
97 97
        validationDate: null,
98 98
        comment: ''
99 99
      };
100
      /*siteId: `${this.analyticsUrl}siteName=${encodeURIComponent(this.repo.officialName)}&url=${encodeURIComponent(this.repo.websiteUrl)}`,*/
101

  
100 102
      /*this.piwikService.savePiwikInfo(piwik).subscribe(*/
101
      this.piwikService.enableMetricsForRepository(piwik).subscribe(
103
      this.piwikService.enableMetricsForRepository(this.repo.officialName,this.repo.websiteUrl,piwik).subscribe(
102 104
        response => {
103 105
          console.log(`savePiwikInfo answered: ${response}`);
104 106
          this.successMessage = enabledMetricsSuccess;
modules/uoa-repository-dashboard-gui/trunk/app/services/piwik.service.ts
31 31
      .catch(this.handleError);
32 32
  }
33 33

  
34
  enableMetricsForRepository(piwik: PiwikInfo) {
35
    let url = `${this.apiUrl}enableMetricsForRepository`;
34
  enableMetricsForRepository(repoName: string, repoWebsite: string, piwik: PiwikInfo) {
35
    let url = `${this.apiUrl}enableMetricsForRepository?officialName=${encodeURIComponent(repoName)}&repoWebsite=${encodeURIComponent(repoWebsite)}`;
36 36
    console.log(`knocking on: ${url}`);
37 37
    console.log(`sending ${JSON.stringify(piwik)}`);
38 38
    httpOptions.withCredentials = true;
39
    return this.http.post(url,piwik,httpOptions)
39
    return this.http.post(url,JSON.stringify(piwik),httpOptions)
40 40
      .map( res => res.status.toString() )
41 41
      .catch(this.handleError);
42 42
  }
......
66 66
  }
67 67

  
68 68

  
69
  markPiwikSiteAsValidated(repositoryId: string) {
69
  markPiwikSiteAsValidated (repositoryId: string) {
70 70
    let url = `${this.apiUrl}markPiwikSiteAsValidated/${repositoryId}`;
71 71
    console.log(`knocking on: ${url}`);
72 72
    httpOptions.withCredentials = true;

Also available in: Unified diff