mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-02 19:16:44 +00:00
Isolate action added
This commit is contained in:
parent
f721bd0d26
commit
6353207d40
@ -129,6 +129,7 @@ import { StartCaptureOnStartedLinkActionComponent } from './components/project-m
|
||||
import { StartCaptureActionComponent } from './components/project-map/context-menu/actions/start-capture/start-capture-action.component';
|
||||
import { StartNodeActionComponent } from './components/project-map/context-menu/actions/start-node-action/start-node-action.component';
|
||||
import { StopCaptureActionComponent } from './components/project-map/context-menu/actions/stop-capture/stop-capture-action.component';
|
||||
import { IsolateNodeActionComponent } from './components/project-map/context-menu/actions/isolate-node-action/isolate-node-action.component';
|
||||
import { StopNodeActionComponent } from './components/project-map/context-menu/actions/stop-node-action/stop-node-action.component';
|
||||
import { SuspendLinkActionComponent } from './components/project-map/context-menu/actions/suspend-link/suspend-link-action.component';
|
||||
import { SuspendNodeActionComponent } from './components/project-map/context-menu/actions/suspend-node-action/suspend-node-action.component';
|
||||
@ -290,6 +291,7 @@ import { LoggedUserComponent } from './components/users/logged-user/logged-user.
|
||||
ContextMenuComponent,
|
||||
ContextConsoleMenuComponent,
|
||||
StartNodeActionComponent,
|
||||
IsolateNodeActionComponent,
|
||||
StopNodeActionComponent,
|
||||
TemplateComponent,
|
||||
TemplateListDialogComponent,
|
||||
|
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item (click)="isolate()">
|
||||
<mat-icon>link_off</mat-icon>
|
||||
<span>Isolate</span>
|
||||
</button>
|
@ -0,0 +1,28 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { ToasterService } from '../../../../../services/toaster.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-isolate-node-action',
|
||||
templateUrl: './isolate-node-action.component.html',
|
||||
})
|
||||
export class IsolateNodeActionComponent implements OnInit {
|
||||
@Input() server: Server;
|
||||
@Input() node: Node;
|
||||
isNodeWithStoppedStatus: boolean;
|
||||
|
||||
constructor(private nodeService: NodeService, private toasterService: ToasterService) {}
|
||||
|
||||
ngOnInit() {}
|
||||
|
||||
isolate() {
|
||||
this.nodeService.isolate(this.server, this.node).subscribe(
|
||||
(n: Node) => {},
|
||||
(error) => {
|
||||
this.toasterService.error(error.error.message);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
@ -32,6 +32,9 @@
|
||||
[server]="server"
|
||||
[node]="nodes[0]"
|
||||
></app-open-file-explorer-action>
|
||||
|
||||
<app-isolate-node-action *ngIf="nodes.length === 1" [server]="server" [node]="nodes[0]"></app-isolate-node-action>
|
||||
|
||||
<app-change-hostname-action
|
||||
*ngIf="!projectService.isReadOnly(project) && nodes.length === 1"
|
||||
[server]="server"
|
||||
|
@ -16,6 +16,14 @@ export class NodeService {
|
||||
return this.httpServer.get(server, `/projects/${projectId}/nodes/${nodeId}`);
|
||||
}
|
||||
|
||||
isolate(server: Server, node: Node) {
|
||||
return this.httpServer.post<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}/isolate`, {});
|
||||
}
|
||||
|
||||
unisolate(server: Server, node: Node) {
|
||||
return this.httpServer.post<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}/unisolate`, {});
|
||||
}
|
||||
|
||||
start(server: Server, node: Node) {
|
||||
return this.httpServer.post<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}/start`, {});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user