diff --git a/src/app/components/project-map/context-menu/actions/console-device-action-browser/console-device-action-browser.component.ts b/src/app/components/project-map/context-menu/actions/console-device-action-browser/console-device-action-browser.component.ts index f822d129..11e706b5 100644 --- a/src/app/components/project-map/context-menu/actions/console-device-action-browser/console-device-action-browser.component.ts +++ b/src/app/components/project-map/context-menu/actions/console-device-action-browser/console-device-action-browser.component.ts @@ -33,20 +33,24 @@ export class ConsoleDeviceActionBrowserComponent { this.node.console_host = this.server.host; } - if ( - this.node.console_type === 'telnet' || - this.node.console_type === 'vnc' || - this.node.console_type === 'spice' - ) { - try { + try { + if (this.node.console_type === 'telnet') { location.assign( - `gns3+${this.node.console_type}://${this.node.console_host}:${this.node.console}?name=${this.node.name}&project_id=${this.node.project_id}&node_id=${this.node.node_id}` + `gns3+telnet://${this.node.console_host}:${this.node.console}?name=${this.node.name}&project_id=${this.node.project_id}&node_id=${this.node.node_id}` ); - } catch (e) { - this.toasterService.error(e); + } else if (this.node.console_type === 'vnc') { + location.assign( + `gns3+vnc://${this.node.console_host}:${this.node.console}?name=${this.node.name}&project_id=${this.node.project_id}&node_id=${this.node.node_id}` + ); + } else if (this.node.console_type.startsWith('spice')) { + location.assign( + `gns3+spice://${this.node.console_host}:${this.node.console}?name=${this.node.name}&project_id=${this.node.project_id}&node_id=${this.node.node_id}` + ); + } else { + this.toasterService.error('Supported console types are: telnet, vnc, spice and spice+agent.'); } - } else { - this.toasterService.error('Supported console types: telnet, vnc, spice.'); + } catch (e) { + this.toasterService.error(e); } } } diff --git a/src/app/components/project-map/context-menu/actions/console-device-action/console-device-action.component.ts b/src/app/components/project-map/context-menu/actions/console-device-action/console-device-action.component.ts index f826a59a..f804893c 100644 --- a/src/app/components/project-map/context-menu/actions/console-device-action/console-device-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/console-device-action/console-device-action.component.ts @@ -29,7 +29,7 @@ export class ConsoleDeviceActionComponent implements OnInit { let consoleCommand = this.settingsService.getConsoleSettings() ? this.settingsService.getConsoleSettings() : this.nodeService.getDefaultCommand(); - const startedNodes = this.nodes.filter((node) => node.status === 'started'); + const startedNodes = this.nodes.filter((node) => node.status === 'started' && node.console_type !== 'none'); if (startedNodes.length === 0) { this.toasterService.error('Device needs to be started in order to console to it.'); @@ -37,7 +37,7 @@ export class ConsoleDeviceActionComponent implements OnInit { } for (var node of this.nodes) { - if (node.status !== 'started') { + if (node.status !== 'started' && node.console_type !== 'none') { continue; } diff --git a/src/app/components/project-map/log-console/log-console.component.ts b/src/app/components/project-map/log-console/log-console.component.ts index 1c5209d7..82d7a986 100644 --- a/src/app/components/project-map/log-console/log-console.component.ts +++ b/src/app/components/project-map/log-console/log-console.component.ts @@ -232,12 +232,12 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy { location.assign( `gns3+vnc://${node.console_host}:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}` ); - } else if (node.console_type === 'spice') { + } else if (node.console_type.startsWith('spice')) { location.assign( `gns3+spice://${node.console_host}:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}` ); } else { - this.showCommand('Supported console types: telnet, vnc, spice.'); + this.showCommand('Supported console types are: telnet, vnc, spice and spice+agent'); } } else { this.showCommand(`This node must be started before a console can be opened.`); @@ -297,28 +297,28 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy { printNode(node: Node): string { return ( - `command_line: ${node.command_line}, - compute_id: ${node.compute_id}, - console: ${node.console}, - console_host: ${node.console_host}, - console_type: ${node.console_type}, - first_port_name: ${node.first_port_name}, - height: ${node.height}, - label: ${node.label.text}, - name: ${node.name}, - node_directory: ${node.node_directory}, - node_id: ${node.node_id}, - node_type: ${node.node_type}, - port_name_format: ${node.port_name_format}, + `command_line: ${node.command_line}, + compute_id: ${node.compute_id}, + console: ${node.console}, + console_host: ${node.console_host}, + console_type: ${node.console_type}, + first_port_name: ${node.first_port_name}, + height: ${node.height}, + label: ${node.label.text}, + name: ${node.name}, + node_directory: ${node.node_directory}, + node_id: ${node.node_id}, + node_type: ${node.node_type}, + port_name_format: ${node.port_name_format}, port_segment_size: ${node.port_segment_size}, ` + this.printPorts(node.ports) + - `project_id: ${node.project_id}, - status: ${node.status}, - symbol: ${node.symbol}, - symbol_url: ${node.symbol_url}, - width: ${node.width}, - x: ${node.x}, - y: ${node.y}, + `project_id: ${node.project_id}, + status: ${node.status}, + symbol: ${node.symbol}, + symbol_url: ${node.symbol_url}, + width: ${node.width}, + x: ${node.x}, + y: ${node.y}, z: ${node.z}` ); } @@ -328,31 +328,31 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy { ports.forEach((port) => { response = response + - `adapter_number: ${port.adapter_number}, - link_type: ${port.link_type}, - name: ${port.name}, - port_number: ${port.port_number}, + `adapter_number: ${port.adapter_number}, + link_type: ${port.link_type}, + name: ${port.name}, + port_number: ${port.port_number}, short_name: ${port.short_name}, `; }); return response; } printLink(link: Link): string { - return `capture_file_name: ${link.capture_file_name}, - capture_file_path: ${link.capture_file_path}, - capturing: ${link.capturing}, - link_id: ${link.link_id}, - link_type: ${link.link_type}, - project_id: ${link.project_id}, + return `capture_file_name: ${link.capture_file_name}, + capture_file_path: ${link.capture_file_path}, + capturing: ${link.capturing}, + link_id: ${link.link_id}, + link_type: ${link.link_type}, + project_id: ${link.project_id}, suspend: ${link.suspend}, `; } printDrawing(drawing: Drawing): string { - return `drawing_id: ${drawing.drawing_id}, - project_id: ${drawing.project_id}, - rotation: ${drawing.rotation}, - x: ${drawing.x}, - y: ${drawing.y}, + return `drawing_id: ${drawing.drawing_id}, + project_id: ${drawing.project_id}, + rotation: ${drawing.rotation}, + x: ${drawing.x}, + y: ${drawing.y}, z: ${drawing.z}`; } } diff --git a/src/app/services/nodeConsole.service.ts b/src/app/services/nodeConsole.service.ts index 1b9f6708..9cdd1e63 100644 --- a/src/app/services/nodeConsole.service.ts +++ b/src/app/services/nodeConsole.service.ts @@ -78,13 +78,15 @@ export class NodeConsoleService { let nodesToStart = 'Please start the following nodes if you want to open consoles for them: '; let nodesToStartCounter = 0; nodes.forEach((n) => { - if (n.status === 'started') { - this.mapSettingsService.logConsoleSubject.next(true); - // this timeout is required due to xterm.js implementation - setTimeout(() => { this.openConsoleForNode(n); }, 500); - } else { - nodesToStartCounter++; - nodesToStart += n.name + ' ' + if (n.console_type !== "none") { + if (n.status === 'started') { + this.mapSettingsService.logConsoleSubject.next(true); + // this timeout is required due to xterm.js implementation + setTimeout(() => { this.openConsoleForNode(n); }, 500); + } else { + nodesToStartCounter++; + nodesToStart += n.name + ' ' + } } }); if (nodesToStartCounter > 0) { @@ -93,16 +95,19 @@ export class NodeConsoleService { } openConsolesForAllNodesInNewTabs(nodes: Node[]) { - let nodesToStart = 'Please start the following nodes if you want to open consoles for them: '; + let nodesToStart = 'Please start the following nodes if you want to open consoles in tabs for them: '; let nodesToStartCounter = 0; nodes.forEach((n) => { - if (n.status === 'started') { - let url = this.router.url.split('/'); - let urlString = `/static/web-ui/${url[1]}/${url[2]}/${url[3]}/${url[4]}/nodes/${n.node_id}`; - window.open(urlString); - } else { - nodesToStartCounter++; - nodesToStart += n.name + ' ' + // opening a console in tab is only supported for telnet type + if (n.console_type === "telnet") { + if (n.status === 'started') { + let url = this.router.url.split('/'); + let urlString = `/static/web-ui/${url[1]}/${url[2]}/${url[3]}/${url[4]}/nodes/${n.node_id}`; + window.open(urlString); + } else { + nodesToStartCounter++; + nodesToStart += n.name + ' ' + } } }); if (nodesToStartCounter > 0) {