Extending error information

This commit is contained in:
piotrpekala7
2020-03-17 17:45:01 +01:00
parent ae540777a4
commit 2b45f7a643
2 changed files with 13 additions and 4 deletions

View File

@ -20,8 +20,8 @@ export class ProgressService {
constructor() {} constructor() {}
public setError(error: Error) { public setError(error) {
this.state.next(new State(false, error)); this.state.next(new State(false, error.error));
} }
public clear() { public clear() {

View File

@ -2,6 +2,7 @@ import { Component, Input, OnInit, OnChanges } from '@angular/core';
import { Server } from '../../../../../models/server'; import { Server } from '../../../../../models/server';
import { NodeService } from '../../../../../services/node.service'; import { NodeService } from '../../../../../services/node.service';
import { Node } from '../../../../../cartography/models/node'; import { Node } from '../../../../../cartography/models/node';
import { ToasterService } from '../../../../../services/toaster.service';
@Component({ @Component({
selector: 'app-start-node-action', selector: 'app-start-node-action',
@ -12,7 +13,10 @@ export class StartNodeActionComponent implements OnInit, OnChanges {
@Input() nodes: Node[]; @Input() nodes: Node[];
isNodeWithStoppedStatus: boolean; isNodeWithStoppedStatus: boolean;
constructor(private nodeService: NodeService) {} constructor(
private nodeService: NodeService,
private toasterService: ToasterService
) {}
ngOnInit() { ngOnInit() {
} }
@ -30,7 +34,12 @@ export class StartNodeActionComponent implements OnInit, OnChanges {
startNodes() { startNodes() {
this.nodes.forEach((node) => { this.nodes.forEach((node) => {
this.nodeService.start(this.server, node).subscribe((n: Node) => {}); this.nodeService.start(this.server, node).subscribe(
(n: Node) => {},
error => {
this.toasterService.error(error.error.message)
}
);
}); });
} }
} }