mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-21 13:57:48 +00:00
Action to suspend added
This commit is contained in:
parent
cd5edebd98
commit
5e76feca5c
@ -210,6 +210,7 @@ import { EditProjectDialogComponent } from './components/projects/edit-project-d
|
|||||||
import { ProjectsFilter } from './filters/projectsFilter.pipe';
|
import { ProjectsFilter } from './filters/projectsFilter.pipe';
|
||||||
import { ComputeService } from './services/compute.service';
|
import { ComputeService } from './services/compute.service';
|
||||||
import { ReloadNodeActionComponent } from './components/project-map/context-menu/actions/reload-node-action/reload-node-action.component';
|
import { ReloadNodeActionComponent } from './components/project-map/context-menu/actions/reload-node-action/reload-node-action.component';
|
||||||
|
import { SuspendNodeActionComponent } from './components/project-map/context-menu/actions/suspend-node-action/suspend-node-action.component';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -347,7 +348,8 @@ if (environment.production) {
|
|||||||
ChangeSymbolDialogComponent,
|
ChangeSymbolDialogComponent,
|
||||||
ChangeSymbolActionComponent,
|
ChangeSymbolActionComponent,
|
||||||
EditProjectDialogComponent,
|
EditProjectDialogComponent,
|
||||||
ReloadNodeActionComponent
|
ReloadNodeActionComponent,
|
||||||
|
SuspendNodeActionComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
|
@ -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]"
|
[node]="nodes[0]"
|
||||||
></app-show-node-action>
|
></app-show-node-action>
|
||||||
<app-start-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-start-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-stop-node-action *ngIf="nodes.length && labels.length===0" [server]="server" [nodes]="nodes"></app-stop-node-action>
|
||||||
<app-reload-node-action
|
<app-reload-node-action
|
||||||
*ngIf="nodes.length" [server]="server" [nodes]="nodes"
|
*ngIf="nodes.length" [server]="server" [nodes]="nodes"
|
||||||
|
Loading…
Reference in New Issue
Block a user