1
|
import {Component, OnInit} from '@angular/core';
|
2
|
import {RepositoryService} from "../../services/repository.service";
|
3
|
import {PiwikInfo} from "../../domain/typeScriptClasses";
|
4
|
|
5
|
@Component ({
|
6
|
selector: 'app-metrics',
|
7
|
templateUrl: 'metrics.component.html'
|
8
|
})
|
9
|
|
10
|
export class MetricsComponent implements OnInit {
|
11
|
reposOfUser: PiwikInfo[];
|
12
|
|
13
|
constructor(private repoService: RepositoryService) {}
|
14
|
|
15
|
ngOnInit() {
|
16
|
this.getReposOfUser();
|
17
|
if(this.reposOfUser) {
|
18
|
console.log(`counted ${this.reposOfUser.length} repositories`);
|
19
|
} else {
|
20
|
console.log('no repos pulled');
|
21
|
}
|
22
|
}
|
23
|
|
24
|
getReposOfUser(): void {
|
25
|
this.repoService.getRepositoriesOfUser("ant.lebesis@gmail.com")
|
26
|
.subscribe(repos => this.reposOfUser = repos);
|
27
|
}
|
28
|
}
|