mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-14 00:39:48 +00:00
Merge branch '2.2' into master-3.0
# Conflicts: # package.json # yarn.lock
This commit is contained in:
commit
26a4205164
@ -69,6 +69,7 @@
|
||||
"eev": "^0.1.5",
|
||||
"ini": "^3.0.0",
|
||||
"marked": "^4.0.14",
|
||||
"ipaddr.js": "^2.1.0",
|
||||
"material-design-icons": "^3.0.1",
|
||||
"mousetrap": "^1.6.5",
|
||||
"ng-circle-progress": "^1.6.0",
|
||||
|
@ -4,6 +4,7 @@ import { Node } from '../../../../../cartography/models/node';
|
||||
import { Controller } from '../../../../../models/controller';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { ToasterService } from '../../../../../services/toaster.service';
|
||||
import * as ipaddr from 'ipaddr.js';
|
||||
|
||||
@Component({
|
||||
selector: 'app-console-device-action-browser',
|
||||
@ -68,14 +69,18 @@ export class ConsoleDeviceActionBrowserComponent {
|
||||
|
||||
try {
|
||||
var uri;
|
||||
var host = this.node.console_host;
|
||||
if (ipaddr.IPv6.isValid(host)) {
|
||||
host = `[${host}]`;
|
||||
}
|
||||
if (this.node.console_type === 'telnet') {
|
||||
uri = `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}`;
|
||||
uri = `gns3+telnet://${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 === 'vnc') {
|
||||
uri = `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}`;
|
||||
uri = `gns3+vnc://${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')) {
|
||||
uri = `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}`
|
||||
uri = `gns3+spice://${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('http')) {
|
||||
uri = `${this.node.console_type}://[${this.node.console_host}]:${this.node.console}`
|
||||
uri = `${this.node.console_type}://${host}:${this.node.console}`
|
||||
return window.open(uri); // open an http console directly in a new window/tab
|
||||
} else {
|
||||
this.toasterService.error('Supported console types are: telnet, vnc, spice and spice+agent.');
|
||||
|
@ -26,6 +26,7 @@ import { NodeConsoleService } from '../../../services/nodeConsole.service';
|
||||
import { ThemeService } from '../../../services/theme.service';
|
||||
import { version } from '../../../version';
|
||||
import { LogEventsDataSource } from './log-events-datasource';
|
||||
import * as ipaddr from 'ipaddr.js';
|
||||
|
||||
@Component({
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
@ -224,20 +225,24 @@ export class LogConsoleComponent implements OnInit, AfterViewInit, OnDestroy {
|
||||
} else if (this.regexConsole.test(this.command)) {
|
||||
if (node.status === 'started') {
|
||||
this.showCommand(`Launching console for node ${splittedCommand[1]}...`);
|
||||
var host = node.console_host;
|
||||
if (ipaddr.IPv6.isValid(host)) {
|
||||
host = `[${host}]`;
|
||||
}
|
||||
if (node.console_type === 'telnet') {
|
||||
location.assign(
|
||||
`gns3+telnet://[${node.console_host}]:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}`
|
||||
`gns3+telnet://${host}:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}`
|
||||
);
|
||||
} else if (node.console_type === 'vnc') {
|
||||
location.assign(
|
||||
`gns3+vnc://[${node.console_host}]:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}`
|
||||
`gns3+vnc://${host}:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}`
|
||||
);
|
||||
} 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}`
|
||||
`gns3+spice://${host}:${node.console}?name=${node.name}&project_id=${node.project_id}&node_id=${node.node_id}`
|
||||
);
|
||||
} else if (node.console_type.startsWith('http')) {
|
||||
window.open(`${node.console_type}://[${node.console_host}]:${node.console}`);
|
||||
window.open(`${node.console_type}://${host}:${node.console}`);
|
||||
} else {
|
||||
this.showCommand('Supported console types are: telnet, vnc, spice and spice+agent');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user