Skip to content

Commit

Permalink
Use template image name when uploading to controller
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Dec 27, 2024
1 parent 2227d11 commit 9043c5b
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand All @@ -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;
Expand All @@ -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];
Expand Down

0 comments on commit 9043c5b

Please sign in to comment.