mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-05 09:39:07 +00:00
Fix import/export Dynamips configs
This commit is contained in:
parent
097efdcbcd
commit
8ec03968df
@ -27,6 +27,7 @@ export class MapNodeToNodeConverter implements Converter<MapNode, Node> {
|
||||
node.port_name_format = mapNode.portNameFormat;
|
||||
node.port_segment_size = mapNode.portSegmentSize;
|
||||
node.ports = mapNode.ports ? mapNode.ports.map((mapPort) => this.mapPortToPort.convert(mapPort)) : [];
|
||||
node.properties = mapNode.properties;
|
||||
node.project_id = mapNode.projectId;
|
||||
node.status = mapNode.status;
|
||||
node.symbol = mapNode.symbol;
|
||||
|
@ -38,6 +38,7 @@ export class NodeToMapNodeConverter implements Converter<Node, MapNode> {
|
||||
mapNode.portNameFormat = node.port_name_format;
|
||||
mapNode.portSegmentSize = node.port_segment_size;
|
||||
mapNode.ports = node.ports ? node.ports.map((port) => this.portToMapPort.convert(port)) : [];
|
||||
mapNode.properties = node.properties;
|
||||
mapNode.projectId = node.project_id;
|
||||
mapNode.status = node.status;
|
||||
mapNode.symbol = node.symbol;
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { Indexed } from '../../datasources/map-datasource';
|
||||
import { MapLabel } from './map-label';
|
||||
import { MapPort } from './map-port';
|
||||
import { Properties } from '../node';
|
||||
|
||||
export class MapNode implements Indexed {
|
||||
id: string;
|
||||
@ -19,6 +20,7 @@ export class MapNode implements Indexed {
|
||||
portNameFormat: string;
|
||||
portSegmentSize: number;
|
||||
ports: MapPort[];
|
||||
properties: Properties;
|
||||
projectId: string;
|
||||
status: string;
|
||||
symbol: string;
|
||||
|
@ -18,6 +18,7 @@ export class Properties {
|
||||
aux_type: boolean;
|
||||
ram: number;
|
||||
system_id: string;
|
||||
dynamips_id?: number;
|
||||
npe?: string;
|
||||
midplane?: string;
|
||||
nvram: number;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<input type="file" accept=".txt, .vpc" class="non-visible" #fileInput (change)="importConfig($event)" />
|
||||
<input type="file" accept=".txt, .vpc, .cfg" class="non-visible" #fileInput (change)="importConfig($event)" />
|
||||
<button mat-menu-item (click)="triggerClick()">
|
||||
<mat-icon>call_received</mat-icon>
|
||||
<span>Import config</span>
|
||||
|
@ -189,7 +189,7 @@ export class NodeService {
|
||||
} else if (node.node_type === 'iou') {
|
||||
urlPath += '/files/startup-config.cfg';
|
||||
} else if (node.node_type === 'dynamips') {
|
||||
urlPath += `/files/configs/i${node.node_id}_startup-config.cfg`;
|
||||
urlPath += `/files/configs/i${node.properties.dynamips_id}_startup-config.cfg`;
|
||||
}
|
||||
|
||||
return this.httpController.get(controller, urlPath, { responseType: 'text' as 'json' });
|
||||
@ -201,7 +201,7 @@ export class NodeService {
|
||||
if (node.node_type === 'iou') {
|
||||
urlPath += '/files/private-config.cfg';
|
||||
} else if (node.node_type === 'dynamips') {
|
||||
urlPath += `/files/configs/i${node.node_id}_private-config.cfg`;
|
||||
urlPath += `/files/configs/i${node.properties.dynamips_id}_private-config.cfg`;
|
||||
}
|
||||
|
||||
return this.httpController.get(controller, urlPath, { responseType: 'text' as 'json' });
|
||||
@ -215,7 +215,7 @@ export class NodeService {
|
||||
} else if (node.node_type === 'iou') {
|
||||
urlPath += '/files/startup-config.cfg';
|
||||
} else if (node.node_type === 'dynamips') {
|
||||
urlPath += `/files/configs/i${node.node_id}_startup-config.cfg`;
|
||||
urlPath += `/files/configs/i${node.properties.dynamips_id}_startup-config.cfg`;
|
||||
}
|
||||
|
||||
return this.httpController.post(controller, urlPath, configuration);
|
||||
@ -227,7 +227,7 @@ export class NodeService {
|
||||
if (node.node_type === 'iou') {
|
||||
urlPath += '/files/private-config.cfg';
|
||||
} else if (node.node_type === 'dynamips') {
|
||||
urlPath += `/files/configs/i${node.node_id}_private-config.cfg`;
|
||||
urlPath += `/files/configs/i${node.properties.dynamips_id}_private-config.cfg`;
|
||||
}
|
||||
|
||||
return this.httpController.post(controller, urlPath, configuration);
|
||||
|
Loading…
x
Reference in New Issue
Block a user