1
|
import { Component, OnInit } from '@angular/core';
|
2
|
import { Repository } from '../../../domain/typeScriptClasses';
|
3
|
import { RepositoryService } from '../../../services/repository.service';
|
4
|
import { AuthenticationService } from '../../../services/authentication.service';
|
5
|
import { ActivatedRoute, Router } from '@angular/router';
|
6
|
import { SharedService } from "../../../services/shared.service";
|
7
|
|
8
|
@Component({
|
9
|
selector: 'metrics-usagestats',
|
10
|
templateUrl: 'metrics-usagestats.component.html'
|
11
|
})
|
12
|
|
13
|
export class MetricsUsagestatsComponent implements OnInit {
|
14
|
|
15
|
errorMessage: string;
|
16
|
title = 'Get usage counts report';
|
17
|
|
18
|
repo: Repository;
|
19
|
|
20
|
constructor(private repoService: RepositoryService,
|
21
|
private sharedService: SharedService,
|
22
|
private authService: AuthenticationService,
|
23
|
private route: ActivatedRoute,
|
24
|
private router: Router) {}
|
25
|
|
26
|
ngOnInit() {
|
27
|
|
28
|
if(this.sharedService.getRepository()) {
|
29
|
this.repo = this.sharedService.getRepository();
|
30
|
this.title = this.title + ' for ' + this.repo.officialname;
|
31
|
}
|
32
|
|
33
|
this.sharedService.repository$.subscribe(
|
34
|
r => {
|
35
|
this.repo = r;
|
36
|
this.title = this.title + ' for ' + this.repo.officialname;
|
37
|
}
|
38
|
);
|
39
|
|
40
|
// this.getRepo();
|
41
|
let body = document.getElementsByTagName('body')[0];
|
42
|
body.classList.remove("top_bar_active"); //remove the class
|
43
|
body.classList.remove("page_heading_active");
|
44
|
body.classList.remove("landing");
|
45
|
body.classList.add("dashboard");
|
46
|
}
|
47
|
|
48
|
// getRepo() {
|
49
|
//
|
50
|
// if (this.repoId) {
|
51
|
// this.repoService.getRepositoryById(this.repoId).subscribe(
|
52
|
// repo => this.repo = repo,
|
53
|
// error => {
|
54
|
// console.log(error);
|
55
|
// this.errorMessage = 'The repository could not be retrieved';
|
56
|
// },
|
57
|
// () => {
|
58
|
// this.title = this.title + ' for ' + this.repo.officialName;
|
59
|
// console.log(this.authService.getUserEmail(), this.repo.registeredBy);
|
60
|
// }
|
61
|
// );
|
62
|
// }
|
63
|
// }
|
64
|
|
65
|
}
|