mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-31 08:25:35 +00:00
Console connect to all nodes added
This commit is contained in:
parent
03b88da9f6
commit
5832d3f36e
@ -1,3 +1,11 @@
|
|||||||
|
<button
|
||||||
|
matTooltip="Console connect to all nodes"
|
||||||
|
mat-icon-button
|
||||||
|
(click)="startConsoleForAllNodes()"
|
||||||
|
class="menu-button"
|
||||||
|
>
|
||||||
|
<mat-icon>web_asset</mat-icon>
|
||||||
|
</button>
|
||||||
<button
|
<button
|
||||||
matTooltip="Start/Resume all nodes"
|
matTooltip="Start/Resume all nodes"
|
||||||
mat-icon-button
|
mat-icon-button
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
import { NodesMenuComponent } from './nodes-menu.component';
|
import { NodesMenuComponent } from './nodes-menu.component';
|
||||||
import { MockedToasterService } from '../../../services/toaster.service.spec';
|
import { MockedToasterService } from '../../../services/toaster.service.spec';
|
||||||
import { MockedNodeService } from '../project-map.component.spec';
|
import { MockedNodeService, MockedNodesDataSource } from '../project-map.component.spec';
|
||||||
import { MatButtonModule, MatIconModule } from '@angular/material';
|
import { MatButtonModule, MatIconModule } from '@angular/material';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
|
||||||
@ -9,19 +9,28 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
|
|||||||
import { NodeService } from '../../../services/node.service';
|
import { NodeService } from '../../../services/node.service';
|
||||||
import { ToasterService } from '../../../services/toaster.service';
|
import { ToasterService } from '../../../services/toaster.service';
|
||||||
import { of } from 'rxjs';
|
import { of } from 'rxjs';
|
||||||
|
import { NodesDataSource } from '../../../cartography/datasources/nodes-datasource';
|
||||||
|
import { ServerService } from '../../../services/server.service';
|
||||||
|
import { SettingsService } from '../../../services/settings.service';
|
||||||
|
import { ElectronService } from 'ngx-electron';
|
||||||
|
|
||||||
describe('NodesMenuComponent', () => {
|
describe('NodesMenuComponent', () => {
|
||||||
let component: NodesMenuComponent;
|
let component: NodesMenuComponent;
|
||||||
let fixture: ComponentFixture<NodesMenuComponent>;
|
let fixture: ComponentFixture<NodesMenuComponent>;
|
||||||
let mockedToasterService: MockedToasterService = new MockedToasterService();
|
let mockedToasterService: MockedToasterService = new MockedToasterService();
|
||||||
let mockedNodeService: MockedNodeService = new MockedNodeService();
|
let mockedNodeService: MockedNodeService = new MockedNodeService();
|
||||||
|
let mockedNodesDataSource: MockedNodesDataSource = new MockedNodesDataSource();
|
||||||
|
|
||||||
beforeEach(async(() => {
|
beforeEach(async(() => {
|
||||||
TestBed.configureTestingModule({
|
TestBed.configureTestingModule({
|
||||||
imports: [MatButtonModule, MatIconModule, CommonModule, NoopAnimationsModule],
|
imports: [MatButtonModule, MatIconModule, CommonModule, NoopAnimationsModule],
|
||||||
providers: [
|
providers: [
|
||||||
{ provide: NodeService, useValue: mockedNodeService },
|
{ provide: NodeService, useValue: mockedNodeService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService }
|
{ provide: ToasterService, useValue: mockedToasterService },
|
||||||
|
{ provide: NodesDataSource, useValue: mockedNodesDataSource },
|
||||||
|
{ provide: ServerService },
|
||||||
|
{ provide: SettingsService },
|
||||||
|
{ provide: ElectronService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
NodesMenuComponent,
|
NodesMenuComponent,
|
||||||
|
@ -3,6 +3,10 @@ import { Project } from '../../../models/project';
|
|||||||
import { Server } from '../../../models/server';
|
import { Server } from '../../../models/server';
|
||||||
import { NodeService } from '../../../services/node.service';
|
import { NodeService } from '../../../services/node.service';
|
||||||
import { ToasterService } from '../../../services/toaster.service';
|
import { ToasterService } from '../../../services/toaster.service';
|
||||||
|
import { NodesDataSource } from '../../../cartography/datasources/nodes-datasource';
|
||||||
|
import { ElectronService } from 'ngx-electron';
|
||||||
|
import { SettingsService } from '../../../services/settings.service';
|
||||||
|
import { ServerService } from '../../../services/server.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-nodes-menu',
|
selector: 'app-nodes-menu',
|
||||||
@ -15,9 +19,39 @@ export class NodesMenuComponent {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private nodeService: NodeService,
|
private nodeService: NodeService,
|
||||||
private toasterService: ToasterService
|
private nodesDataSource: NodesDataSource,
|
||||||
|
private toasterService: ToasterService,
|
||||||
|
private serverService: ServerService,
|
||||||
|
private settingsService: SettingsService,
|
||||||
|
private electronService: ElectronService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
async startConsoleForAllNodes() {
|
||||||
|
if (this.electronService.isElectronApp) {
|
||||||
|
let consoleCommand = this.settingsService.get<string>('console_command');
|
||||||
|
if(consoleCommand === undefined) {
|
||||||
|
consoleCommand = `putty.exe -telnet \%h \%p -wt \"\%d\" -gns3 5 -skin 4`;
|
||||||
|
}
|
||||||
|
|
||||||
|
let nodes = this.nodesDataSource.getItems();
|
||||||
|
for(var node of nodes) {
|
||||||
|
const request = {
|
||||||
|
command: consoleCommand,
|
||||||
|
type: node.console_type,
|
||||||
|
host: node.console_host,
|
||||||
|
port: node.console,
|
||||||
|
name: node.name,
|
||||||
|
project_id: node.project_id,
|
||||||
|
node_id: node.node_id,
|
||||||
|
server_url: this.serverService.getServerUrl(this.server)
|
||||||
|
};
|
||||||
|
await this.electronService.remote.require('./console-executor.js').openConsole(request);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.toasterService.error("Starting all nodes available only in Electron app.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
startNodes() {
|
startNodes() {
|
||||||
this.nodeService.startAll(this.server, this.project).subscribe(() => {
|
this.nodeService.startAll(this.server, this.project).subscribe(() => {
|
||||||
this.toasterService.success('All nodes successfully started');
|
this.toasterService.success('All nodes successfully started');
|
||||||
|
@ -80,7 +80,7 @@ g.node:hover {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.extended {
|
.extended {
|
||||||
width: 770px !important;
|
width: 830px !important;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user