mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-16 13:58:13 +00:00
Dialog for ethernet hubs added
This commit is contained in:
@ -213,6 +213,7 @@ import { ReloadNodeActionComponent } from './components/project-map/context-menu
|
|||||||
import { SuspendNodeActionComponent } from './components/project-map/context-menu/actions/suspend-node-action/suspend-node-action.component';
|
import { SuspendNodeActionComponent } from './components/project-map/context-menu/actions/suspend-node-action/suspend-node-action.component';
|
||||||
import { ConfigActionComponent } from './components/project-map/context-menu/actions/config-action/config-action.component';
|
import { ConfigActionComponent } from './components/project-map/context-menu/actions/config-action/config-action.component';
|
||||||
import { ConfiguratorDialogVpcsComponent } from './components/project-map/node-editors/configurator/vpcs/configurator-vpcs.component';
|
import { ConfiguratorDialogVpcsComponent } from './components/project-map/node-editors/configurator/vpcs/configurator-vpcs.component';
|
||||||
|
import { ConfiguratorDialogEthernetHubComponent } from './components/project-map/node-editors/configurator/ethernet_hub/configurator-ethernet-hub.component';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -353,7 +354,8 @@ if (environment.production) {
|
|||||||
ReloadNodeActionComponent,
|
ReloadNodeActionComponent,
|
||||||
SuspendNodeActionComponent,
|
SuspendNodeActionComponent,
|
||||||
ConfigActionComponent,
|
ConfigActionComponent,
|
||||||
ConfiguratorDialogVpcsComponent
|
ConfiguratorDialogVpcsComponent,
|
||||||
|
ConfiguratorDialogEthernetHubComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
@ -454,7 +456,8 @@ if (environment.production) {
|
|||||||
InfoDialogComponent,
|
InfoDialogComponent,
|
||||||
ChangeSymbolDialogComponent,
|
ChangeSymbolDialogComponent,
|
||||||
EditProjectDialogComponent,
|
EditProjectDialogComponent,
|
||||||
ConfiguratorDialogVpcsComponent
|
ConfiguratorDialogVpcsComponent,
|
||||||
|
ConfiguratorDialogEthernetHubComponent
|
||||||
],
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
import { Label } from './label';
|
import { Label } from './label';
|
||||||
import { Port } from '../../models/port';
|
import { Port } from '../../models/port';
|
||||||
|
|
||||||
|
export class PortsMapping {
|
||||||
|
name: string;
|
||||||
|
port_number: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Properties {
|
||||||
|
ports_mapping: PortsMapping[];
|
||||||
|
}
|
||||||
|
|
||||||
export class Node {
|
export class Node {
|
||||||
command_line: string;
|
command_line: string;
|
||||||
compute_id: string;
|
compute_id: string;
|
||||||
@ -19,6 +28,7 @@ export class Node {
|
|||||||
port_segment_size: number;
|
port_segment_size: number;
|
||||||
ports: Port[];
|
ports: Port[];
|
||||||
project_id: string;
|
project_id: string;
|
||||||
|
properties: Properties;
|
||||||
status: string;
|
status: string;
|
||||||
symbol: string;
|
symbol: string;
|
||||||
symbol_url: string; // @TODO: full URL to symbol, move to MapNode once converters are moved to app module
|
symbol_url: string; // @TODO: full URL to symbol, move to MapNode once converters are moved to app module
|
||||||
|
@ -36,6 +36,7 @@ export class ConfiguratorDialogEthernetHubComponent implements OnInit {
|
|||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
|
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
|
||||||
this.node = node;
|
this.node = node;
|
||||||
|
this.numberOfPorts = this.node.ports.length;
|
||||||
this.getConfiguration();
|
this.getConfiguration();
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -47,27 +48,14 @@ export class ConfiguratorDialogEthernetHubComponent implements OnInit {
|
|||||||
|
|
||||||
onSaveClick() {
|
onSaveClick() {
|
||||||
if (this.inputForm.valid) {
|
if (this.inputForm.valid) {
|
||||||
|
this.node.properties.ports_mapping = [];
|
||||||
for(let i=0; i<this.numberOfPorts; i++){
|
for(let i=0; i<this.numberOfPorts; i++){
|
||||||
this.node.ports.push({
|
this.node.properties.ports_mapping.push({
|
||||||
adapter_number: 0,
|
|
||||||
link_type: 'ethernet',
|
|
||||||
name: `Ethernet${i}`,
|
name: `Ethernet${i}`,
|
||||||
port_number: i,
|
port_number: i
|
||||||
short_name: `e${i}`
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// {
|
|
||||||
// "adapter_number": 0,
|
|
||||||
// "data_link_types": {
|
|
||||||
// "Ethernet": "DLT_EN10MB"
|
|
||||||
// },
|
|
||||||
// "link_type": "ethernet",
|
|
||||||
// "name": "Ethernet0",
|
|
||||||
// "port_number": 0,
|
|
||||||
// "short_name": "e0"
|
|
||||||
// }
|
|
||||||
|
|
||||||
this.nodeService.updateNode(this.server, this.node).subscribe(() => {
|
this.nodeService.updateNode(this.server, this.node).subscribe(() => {
|
||||||
this.toasterService.success(`Node ${this.node.name} updated.`);
|
this.toasterService.success(`Node ${this.node.name} updated.`);
|
||||||
this.onCancelClick();
|
this.onCancelClick();
|
||||||
|
@ -89,7 +89,8 @@ export class NodeService {
|
|||||||
updateNode(server: Server, node: Node): Observable<Node> {
|
updateNode(server: Server, node: Node): Observable<Node> {
|
||||||
return this.httpServer.put<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}`, {
|
return this.httpServer.put<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}`, {
|
||||||
console_type: node.console_type,
|
console_type: node.console_type,
|
||||||
name: node.name
|
name: node.name,
|
||||||
|
properties: node.properties
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user