1
|
/**
|
2
|
* Created by myrto on 11/24/17.
|
3
|
*/
|
4
|
|
5
|
import {Component, OnInit} from '@angular/core';
|
6
|
import {PiwikInfo} from '../../domain/typeScriptClasses';
|
7
|
import {RepositoryService} from '../../services/repository.service';
|
8
|
import {ActivatedRoute} from '@angular/router';
|
9
|
|
10
|
@Component ({
|
11
|
selector: 'app-metrics-instructions',
|
12
|
templateUrl: 'metrics-instructions.component.html'
|
13
|
})
|
14
|
|
15
|
export class MetricsInstructionsComponent implements OnInit {
|
16
|
piwik: PiwikInfo;
|
17
|
errorMessage: string;
|
18
|
|
19
|
constructor(
|
20
|
private route: ActivatedRoute,
|
21
|
private repoService: RepositoryService
|
22
|
) {}
|
23
|
|
24
|
ngOnInit() {
|
25
|
this.getPiwik();
|
26
|
}
|
27
|
|
28
|
getPiwik(): void {
|
29
|
let id = this.route.snapshot.paramMap.get('id');
|
30
|
this.repoService.getPiwikInfo(id).subscribe(
|
31
|
piwik => this.piwik = piwik,
|
32
|
error => {
|
33
|
console.log(error);
|
34
|
this.errorMessage = 'An error occured! The information about the site could not be retrieved';
|
35
|
}
|
36
|
);
|
37
|
}
|
38
|
|
39
|
}
|