Skip videos count on client if we don't use it
[oweals/peertube.git] / client / src / app / shared / instance / instance-statistics.component.ts
1 import { map } from 'rxjs/operators'
2 import { HttpClient } from '@angular/common/http'
3 import { Component, OnInit } from '@angular/core'
4 import { I18n } from '@ngx-translate/i18n-polyfill'
5 import { ServerStats } from '@shared/models/server'
6 import { environment } from '../../../environments/environment'
7
8 @Component({
9   selector: 'my-instance-statistics',
10   templateUrl: './instance-statistics.component.html',
11   styleUrls: [ './instance-statistics.component.scss' ]
12 })
13 export class InstanceStatisticsComponent implements OnInit {
14   private static BASE_STATS_URL = environment.apiUrl + '/api/v1/server/stats'
15
16   serverStats: ServerStats = null
17
18   constructor (
19     private http: HttpClient,
20     private i18n: I18n
21   ) {
22   }
23
24   ngOnInit () {
25     this.getStats()
26       .subscribe(
27         res => {
28           this.serverStats = res
29         }
30       )
31   }
32
33   getStats () {
34     return this.http
35       .get<ServerStats>(InstanceStatisticsComponent.BASE_STATS_URL)
36   }
37 }