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