Reload action added

This commit is contained in:
Piotr Pekala
2019-09-06 08:51:13 -07:00
parent 00597accac
commit cd5edebd98
5 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,4 @@
<button mat-menu-item *ngIf="filteredNodes.length > 0" (click)="reloadNodes()">
<mat-icon>refresh</mat-icon>
<span>Reload</span>
</button>

View File

@ -0,0 +1,31 @@
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-reload-node-action',
templateUrl: './reload-node-action.component.html'
})
export class ReloadNodeActionComponent implements OnInit {
@Input() server: Server;
@Input() nodes: Node[];
filteredNodes: Node[] = [];
constructor(private nodeService: NodeService) {}
ngOnInit() {
this.nodes.forEach((node) => {
if (node.node_type === 'vpcs' || node.node_type === 'qemu' || node.node_type === 'virtualbox' || node.node_type === 'vmware') {
this.filteredNodes.push(node);
}
});
}
reloadNodes() {
this.filteredNodes.forEach((node) => {
this.nodeService.reload(this.server, node).subscribe((n: Node) => {});
});
}
}

View File

@ -7,6 +7,9 @@
></app-show-node-action>
<app-start-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-start-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"
></app-reload-node-action>
<app-console-device-action
*ngIf="!projectService.isReadOnly(project) && nodes.length && isElectronApp"
[server]="server"