mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-08 02:54:16 +00:00
Dialog for ethernet hubs added
This commit is contained in:
parent
96e297ff6a
commit
0fe44b2235
@ -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 { 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 { ConfiguratorDialogEthernetHubComponent } from './components/project-map/node-editors/configurator/ethernet_hub/configurator-ethernet-hub.component';
|
||||
|
||||
if (environment.production) {
|
||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||
@ -353,7 +354,8 @@ if (environment.production) {
|
||||
ReloadNodeActionComponent,
|
||||
SuspendNodeActionComponent,
|
||||
ConfigActionComponent,
|
||||
ConfiguratorDialogVpcsComponent
|
||||
ConfiguratorDialogVpcsComponent,
|
||||
ConfiguratorDialogEthernetHubComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -454,7 +456,8 @@ if (environment.production) {
|
||||
InfoDialogComponent,
|
||||
ChangeSymbolDialogComponent,
|
||||
EditProjectDialogComponent,
|
||||
ConfiguratorDialogVpcsComponent
|
||||
ConfiguratorDialogVpcsComponent,
|
||||
ConfiguratorDialogEthernetHubComponent
|
||||
],
|
||||
bootstrap: [AppComponent]
|
||||
})
|
||||
|
@ -1,6 +1,15 @@
|
||||
import { Label } from './label';
|
||||
import { Port } from '../../models/port';
|
||||
|
||||
export class PortsMapping {
|
||||
name: string;
|
||||
port_number: number;
|
||||
}
|
||||
|
||||
export class Properties {
|
||||
ports_mapping: PortsMapping[];
|
||||
}
|
||||
|
||||
export class Node {
|
||||
command_line: string;
|
||||
compute_id: string;
|
||||
@ -19,6 +28,7 @@ export class Node {
|
||||
port_segment_size: number;
|
||||
ports: Port[];
|
||||
project_id: string;
|
||||
properties: Properties;
|
||||
status: string;
|
||||
symbol: string;
|
||||
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() {
|
||||
this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => {
|
||||
this.node = node;
|
||||
this.numberOfPorts = this.node.ports.length;
|
||||
this.getConfiguration();
|
||||
})
|
||||
}
|
||||
@ -47,27 +48,14 @@ export class ConfiguratorDialogEthernetHubComponent implements OnInit {
|
||||
|
||||
onSaveClick() {
|
||||
if (this.inputForm.valid) {
|
||||
this.node.properties.ports_mapping = [];
|
||||
for(let i=0; i<this.numberOfPorts; i++){
|
||||
this.node.ports.push({
|
||||
adapter_number: 0,
|
||||
link_type: 'ethernet',
|
||||
this.node.properties.ports_mapping.push({
|
||||
name: `Ethernet${i}`,
|
||||
port_number: i,
|
||||
short_name: `e${i}`
|
||||
port_number: 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.toasterService.success(`Node ${this.node.name} updated.`);
|
||||
this.onCancelClick();
|
||||
|
@ -89,7 +89,8 @@ export class NodeService {
|
||||
updateNode(server: Server, node: Node): Observable<Node> {
|
||||
return this.httpServer.put<Node>(server, `/projects/${node.project_id}/nodes/${node.node_id}`, {
|
||||
console_type: node.console_type,
|
||||
name: node.name
|
||||
name: node.name,
|
||||
properties: node.properties
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user