mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-07 02:26:39 +00:00
Fix starting and stopping nodes
This commit is contained in:
parent
aac20a6830
commit
8442a9055c
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
@ -7,7 +7,7 @@ import { Node } from '../../../../../cartography/models/node';
|
||||
selector: 'app-start-node-action',
|
||||
templateUrl: './start-node-action.component.html'
|
||||
})
|
||||
export class StartNodeActionComponent implements OnInit {
|
||||
export class StartNodeActionComponent implements OnInit, OnChanges {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
isNodeWithStoppedStatus: boolean;
|
||||
@ -15,11 +15,17 @@ export class StartNodeActionComponent implements OnInit {
|
||||
constructor(private nodeService: NodeService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'stopped') {
|
||||
this.isNodeWithStoppedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStoppedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'stopped') {
|
||||
this.isNodeWithStoppedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
startNodes() {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
@ -7,7 +7,7 @@ import { Node } from '../../../../../cartography/models/node';
|
||||
selector: 'app-stop-node-action',
|
||||
templateUrl: './stop-node-action.component.html'
|
||||
})
|
||||
export class StopNodeActionComponent implements OnInit {
|
||||
export class StopNodeActionComponent implements OnInit, OnChanges {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
isNodeWithStartedStatus: boolean;
|
||||
@ -15,11 +15,17 @@ export class StopNodeActionComponent implements OnInit {
|
||||
constructor(private nodeService: NodeService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'started') {
|
||||
this.isNodeWithStartedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStartedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'started') {
|
||||
this.isNodeWithStartedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopNodes() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user