mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-16 06:36:33 +00:00
Use template image name when uploading to controller
This commit is contained in:
parent
2227d11932
commit
9043c5b97c
@ -341,8 +341,6 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
dialogRef.componentInstance.appliance = object;
|
||||
}
|
||||
|
||||
|
||||
|
||||
importImage(event, imageName) {
|
||||
this.computeChecksumMd5(event.target.files[0], false).then((output) => {
|
||||
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === imageName)[0];
|
||||
@ -359,22 +357,21 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
The MD5 sum is ${output} and should be ${imageToInstall.md5sum}. Do you want to accept it at your own risks?`;
|
||||
dialogRef.afterClosed().subscribe((answer: boolean) => {
|
||||
if (answer) {
|
||||
this.importImageFile(event);
|
||||
this.importImageFile(event, imageName);
|
||||
this.openSnackBar()
|
||||
} else {
|
||||
this.uploaderImage.clearQueue();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.importImageFile(event);
|
||||
this.importImageFile(event, imageName);
|
||||
this.openSnackBar()
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
importImageFile(event) {
|
||||
importImageFile(event, imageName) {
|
||||
let name = event.target.files[0].name.split('-')[0];
|
||||
let fileName = event.target.files[0].name;
|
||||
let file = event.target.files[0];
|
||||
let fileReader: FileReader = new FileReader();
|
||||
let emulator;
|
||||
@ -384,7 +381,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
||||
if (this.applianceToInstall.iou) emulator = 'iou';
|
||||
|
||||
const url = this.applianceService.getUploadPath(this.controller, emulator, fileName);
|
||||
const url = this.applianceService.getUploadPath(this.controller, emulator, imageName);
|
||||
this.uploaderImage.queue.forEach((elem) => (elem.url = url));
|
||||
|
||||
const itemToUpload = this.uploaderImage.queue[0];
|
||||
|
Loading…
x
Reference in New Issue
Block a user