mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-21 22:07:48 +00:00
Handle additional directories for Docker
This commit is contained in:
parent
a8aef0729d
commit
fac07ceeb4
@ -110,7 +110,7 @@
|
||||
|
||||
<h6>Additional volumes</h6>
|
||||
<mat-form-field class="form-field">
|
||||
<textarea matInput type="text" [(ngModel)]="node.properties.extra_volumes"></textarea>
|
||||
<textarea matInput type="text" [(ngModel)]="additionalDirectories"></textarea>
|
||||
</mat-form-field>
|
||||
</mat-tab>
|
||||
|
||||
|
@ -55,9 +55,16 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
|
||||
this.name = node.name;
|
||||
this.getConfiguration();
|
||||
if (!this.node.properties.cpus) this.node.properties.cpus = 0.0;
|
||||
if (this.node.properties.extra_volumes && this.node.properties.extra_volumes.length>0) {
|
||||
for (let index = 0; index < this.node.properties.extra_volumes.length - 1; index++) {
|
||||
this.additionalDirectories = this.additionalDirectories + this.node.properties.extra_volumes[index] + "\n";
|
||||
}
|
||||
this.additionalDirectories = this.additionalDirectories + this.node.properties.extra_volumes[this.node.properties.extra_volumes.length - 1];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
getConfiguration() {
|
||||
this.consoleTypes = this.dockerConfigurationService.getConsoleTypes();
|
||||
}
|
||||
@ -77,7 +84,16 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
|
||||
}
|
||||
|
||||
onSaveClick() {
|
||||
var extraVolumes = this.additionalDirectories.split("\n").filter(elem => elem != "");
|
||||
for (const item of extraVolumes) {
|
||||
console.log(item);
|
||||
if (!item.startsWith("/")) {
|
||||
this.toasterService.error(`Wrong format for additional directories.`);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.generalSettingsForm.valid) {
|
||||
this.node.properties.extra_volumes = extraVolumes;
|
||||
this.nodeService.updateNode(this.controller, this.node).subscribe(() => {
|
||||
this.toasterService.success(`Node ${this.node.name} updated.`);
|
||||
this.onCancelClick();
|
||||
|
Loading…
Reference in New Issue
Block a user