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