mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 05:27:56 +00:00
Update add-docker-template.component.ts
This commit is contained in:
parent
455a13b96f
commit
7625ff5cfa
@ -25,6 +25,7 @@ export class AddDockerTemplateComponent implements OnInit {
|
||||
consoleTypes: string[] = [];
|
||||
isRemoteComputerChosen: boolean = false;
|
||||
dockerImages: DockerImage[] = [];
|
||||
selectedImage: DockerImage;
|
||||
newImageSelected: boolean = false;
|
||||
|
||||
virtualMachineForm: FormGroup;
|
||||
@ -101,9 +102,15 @@ export class AddDockerTemplateComponent implements OnInit {
|
||||
}
|
||||
|
||||
addTemplate() {
|
||||
if ((!this.virtualMachineForm.invalid || !this.newImageSelected) && !this.containerNameForm.invalid && !this.networkAdaptersForm.invalid) {
|
||||
if ((!this.virtualMachineForm.invalid || (!this.newImageSelected && this.selectedImage)) && !this.containerNameForm.invalid && !this.networkAdaptersForm.invalid) {
|
||||
this.dockerTemplate.template_id = uuid();
|
||||
this.dockerTemplate.image = this.virtualMachineForm.get('filename').value;
|
||||
|
||||
if (this.newImageSelected) {
|
||||
this.dockerTemplate.image = this.virtualMachineForm.get('filename').value;
|
||||
} else {
|
||||
this.dockerTemplate.image = this.selectedImage.image;
|
||||
}
|
||||
|
||||
this.dockerTemplate.name = this.containerNameForm.get('templateName').value;
|
||||
this.dockerTemplate.adapters = this.networkAdaptersForm.get('adapters').value;
|
||||
this.dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||
|
Loading…
Reference in New Issue
Block a user