Update status-info.component.ts

This commit is contained in:
piotrpekala7 2020-01-20 17:23:00 +01:00
parent 61cca78609
commit 8175c47b6f

View File

@ -4,6 +4,7 @@ import { ComputeService } from '../../../services/compute.service';
import { ComputeStatistics } from '../../../models/computeStatistics';
import { ServerService } from '../../../services/server.service';
import { Server } from '../../../models/server';
import { ToasterService } from '../../../services/toaster.service';
@Component({
@ -18,15 +19,20 @@ export class StatusInfoComponent implements OnInit {
constructor(
private route: ActivatedRoute,
private computeService: ComputeService,
private serverService: ServerService
private serverService: ServerService,
private toasterService: ToasterService
) {}
ngOnInit() {
this.serverId = this.route.snapshot.paramMap.get("server_id");
this.serverService.get(Number(this.serverId)).then((server: Server) => {
this.computeService.getStatistics(server).subscribe((statistics: ComputeStatistics[]) => {
this.computeService.getStatistics(server).subscribe(
(statistics: ComputeStatistics[]) => {
this.computeStatistics = statistics;
});
}),
error => {
this.toasterService.error('Required server version is 2.3')
}
});
}
}