mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-16 13:58:13 +00:00
Action to suspend added
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item *ngIf="isNodeWithStartedStatus" (click)="suspendNodes()">
|
||||
<mat-icon>pause</mat-icon>
|
||||
<span>Suspend</span>
|
||||
</button>
|
@ -0,0 +1,36 @@
|
||||
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';
|
||||
|
||||
@Component({
|
||||
selector: 'app-suspend-node-action',
|
||||
templateUrl: './suspend-node-action.component.html'
|
||||
})
|
||||
export class SuspendNodeActionComponent implements OnInit, OnChanges {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
isNodeWithStartedStatus: boolean;
|
||||
|
||||
constructor(private nodeService: NodeService) {}
|
||||
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStartedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'started') {
|
||||
this.isNodeWithStartedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
suspendNodes() {
|
||||
this.nodes.forEach((node) => {
|
||||
this.nodeService.suspend(this.server, node).subscribe((n: Node) => {});
|
||||
});
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@
|
||||
[node]="nodes[0]"
|
||||
></app-show-node-action>
|
||||
<app-start-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-start-node-action>
|
||||
<app-suspend-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-suspend-node-action>
|
||||
<app-stop-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-stop-node-action>
|
||||
<app-reload-node-action
|
||||
*ngIf="nodes.length" [server]="server" [nodes]="nodes"
|
||||
|
Reference in New Issue
Block a user