mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-16 13:58:13 +00:00
Console connect to all nodes added
This commit is contained in:
@ -3,6 +3,10 @@ import { Project } from '../../../models/project';
|
||||
import { Server } from '../../../models/server';
|
||||
import { NodeService } from '../../../services/node.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({
|
||||
selector: 'app-nodes-menu',
|
||||
@ -15,9 +19,39 @@ export class NodesMenuComponent {
|
||||
|
||||
constructor(
|
||||
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() {
|
||||
this.nodeService.startAll(this.server, this.project).subscribe(() => {
|
||||
this.toasterService.success('All nodes successfully started');
|
||||
|
Reference in New Issue
Block a user