mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-19 03:06:31 +00:00
Fix for delete error
This commit is contained in:
parent
72418a1a9f
commit
a0073e1d23
@ -33,11 +33,9 @@ export class DeleteTemplateComponent {
|
||||
|
||||
dialogRef.afterClosed().subscribe((answer: boolean) => {
|
||||
if (answer) {
|
||||
this.templateService.deleteTemplate(this.server, templateId).subscribe((answer: boolean) => {
|
||||
if(answer) {
|
||||
this.deleteEvent.emit(templateId);
|
||||
this.toasterService.success(`Template ${templateName} deleted.`);
|
||||
}
|
||||
this.templateService.deleteTemplate(this.server, templateId).subscribe((answer) => {
|
||||
this.deleteEvent.emit(templateId);
|
||||
this.toasterService.success(`Template ${templateName} deleted.`);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -146,7 +146,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
||||
|
||||
addTemplate() {
|
||||
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
||||
this.qemuTemplate.ram = this.memoryForm.get("ramMemory").value;
|
||||
this.qemuTemplate.ram = +this.memoryForm.get("ramMemory").value;
|
||||
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
||||
if (this.newImageSelected) {
|
||||
this.qemuTemplate.hda_disk_image = this.diskForm.get("fileName").value;
|
||||
|
@ -17,10 +17,7 @@ export class TemplateService {
|
||||
return this.httpServer.get<Template[]>(server, '/templates') as Observable<Template[]>;
|
||||
}
|
||||
|
||||
deleteTemplate(server: Server, templateId: string): Observable<boolean> {
|
||||
return this.httpServer.delete(server, `/templates/${templateId}`, { observe: 'body' }).map(response => {
|
||||
return true;
|
||||
})
|
||||
.catch((response) => { return Observable.throw(false)});
|
||||
deleteTemplate(server: Server, templateId: string): Observable<any> {
|
||||
return this.httpServer.delete(server, `/templates/${templateId}`, { observe: 'body' });
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user