Fix for issue in docker configurator

This commit is contained in:
piotrpekala7 2022-04-27 10:35:54 +02:00
parent b5e4972bdb
commit a08a7e1476

View File

@ -51,12 +51,12 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
this.node = node; this.node = node;
this.name = node.name; this.name = node.name;
this.getConfiguration(); this.getConfiguration();
if (this.node.properties.extra_volumes) { 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++) { 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[index] + "\n";
} }
}
this.additionalDirectories = this.additionalDirectories + this.node.properties.extra_volumes[this.node.properties.extra_volumes.length - 1]; this.additionalDirectories = this.additionalDirectories + this.node.properties.extra_volumes[this.node.properties.extra_volumes.length - 1];
}
}); });
} }
@ -79,8 +79,15 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
} }
onSaveClick() { onSaveClick() {
if (this.generalSettingsForm.valid) {
var extraVolumes = this.additionalDirectories.split("\n").filter(elem => elem != ""); 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.node.properties.extra_volumes = extraVolumes;
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.`);