Revision 58098
Added by Stefania Martziou about 4 years ago
metrics-instructions.component.ts | ||
---|---|---|
2 | 2 |
* Created by myrto on 11/24/17. |
3 | 3 |
*/ |
4 | 4 |
import { Component, OnInit } from '@angular/core'; |
5 |
import { PiwikInfo } from '../../domain/typeScriptClasses';
|
|
5 |
import { PiwikInfo, Repository } from '../../../domain/typeScriptClasses';
|
|
6 | 6 |
import { ActivatedRoute, Router } from '@angular/router'; |
7 |
import { PiwikService } from '../../services/piwik.service'; |
|
8 |
import { AuthenticationService } from '../../services/authentication.service'; |
|
7 |
import { PiwikService } from '../../../services/piwik.service'; |
|
8 |
import { AuthenticationService } from '../../../services/authentication.service'; |
|
9 |
import { SharedService } from "../../../services/shared.service"; |
|
9 | 10 |
|
10 | 11 |
@Component ({ |
11 | 12 |
selector: 'app-metrics-instructions', |
... | ... | |
13 | 14 |
}) |
14 | 15 |
|
15 | 16 |
export class MetricsInstructionsComponent implements OnInit { |
17 |
|
|
16 | 18 |
piwik: PiwikInfo; |
17 | 19 |
errorMessage: string; |
18 | 20 |
|
... | ... | |
20 | 22 |
private route: ActivatedRoute, |
21 | 23 |
private router: Router, |
22 | 24 |
private piwikService: PiwikService, |
23 |
private authService: AuthenticationService) {} |
|
25 |
private authService: AuthenticationService, |
|
26 |
private sharedService: SharedService) {} |
|
24 | 27 |
|
25 | 28 |
ngOnInit() { |
26 |
this.getPiwik(); |
|
29 |
|
|
30 |
if(this.sharedService.getRepository()) |
|
31 |
this.piwik = this.sharedService.getRepository().piwikInfo; |
|
32 |
|
|
33 |
this.sharedService.repository$.subscribe( |
|
34 |
r => { |
|
35 |
this.piwik = r.piwikInfo; |
|
36 |
} |
|
37 |
); |
|
38 |
|
|
27 | 39 |
let body = document.getElementsByTagName('body')[0]; |
28 | 40 |
body.classList.remove("top_bar_active"); //remove the class |
29 | 41 |
body.classList.remove("page_heading_active"); |
30 | 42 |
body.classList.remove("landing"); |
31 | 43 |
body.classList.add("dashboard"); |
32 | 44 |
} |
33 |
|
|
34 |
getPiwik(): void { |
|
35 |
const id = this.route.snapshot.paramMap.get('id'); |
|
36 |
this.piwikService.getPiwikInfo(id).subscribe( |
|
37 |
piwik => this.piwik = piwik, |
|
38 |
error => console.log(error), |
|
39 |
() => {} |
|
40 |
); |
|
41 |
} |
|
42 |
|
|
43 | 45 |
} |
Also available in: Unified diff
Second commit for the new layout provided by the UX team