Project

General

Profile

« Previous | Next » 

Revision 50883

finished subscriptions and notifications

View differences:

metrics-enable.component.ts
3 3
import { ConfirmationDialogComponent } from '../../shared/reusablecomponents/confirmation-dialog.component';
4 4
import { PiwikService } from '../../services/piwik.service';
5 5
import { RepositoryService } from '../../services/repository.service';
6
import { Repository } from '../../domain/typeScriptClasses';
6
import { PiwikInfo, Repository } from '../../domain/typeScriptClasses';
7 7
import {
8 8
  enabledMetricsError, enabledMetricsSuccess, enablingMetrics, loadingRepoError,
9 9
  loadingRepoMessage
......
65 65

  
66 66
  getOAid () {
67 67
    this.piwikService.getOpenaireId(this.repo.id).subscribe(
68
      id => {this.oaId = id._body.toString(); console.log(this.oaId);},
68
      id => {
69
        this.oaId = id;
70
        console.log(this.oaId);},
69 71
      error => console.log(`ERROR is ${error}`)
70 72
    );
71 73
  }
......
79 81
  confirmedEnabling() {
80 82
    if (this.repo) {
81 83
      this.loadingMessage = enablingMetrics;
82
      this.piwikService.savePiwikInfo(this.repo.id,
83
        this.oaId,
84
        this.repo.officialName,
85
        this.repo.countryName,
86
        this.authService.userFullName,
87
        this.authService.userEmail).subscribe(
84
      let piwik: PiwikInfo = {
85
        repositoryId: this.repo.id,
86
        openaireId: this.oaId,
87
        repositoryName: this.repo.officialName,
88
        country: this.repo.countryName,
89
        siteId: '',
90
        authenticationToken: '',
91
        creationDate: null,
92
        requestorName: this.authService.userFullName,
93
        requestorEmail: this.authService.userEmail,
94
        validated: false,
95
        validationDate: null,
96
        comment: ''
97
      };
98
      this.piwikService.savePiwikInfo(piwik).subscribe(
88 99
        response => {
89 100
          console.log(`answered ${response}`);
90 101
          this.successMessage = enabledMetricsSuccess;
......
94 105
          console.log(error);
95 106
          this.errorMessage = enabledMetricsError;
96 107
          this.loadingMessage = '';
108
          this.getRepo();
97 109
        }
98 110
      );
99 111
    }

Also available in: Unified diff