I added checksum key instead of md5sum key

This commit is contained in:
Rajnikant 2022-04-28 17:55:15 +05:30
parent 0df6294cc7
commit a7e637a466
2 changed files with 29 additions and 24 deletions

View File

@ -246,7 +246,7 @@ export class NewTemplateDialogComponent implements OnInit {
let fileReader: FileReader = new FileReader();
let emulator;
fileReader.onloadend= () => {
fileReader.onloadend = () => {
let appliance = JSON.parse(fileReader.result as string);
if (appliance.docker) emulator = 'docker';
@ -409,11 +409,11 @@ export class NewTemplateDialogComponent implements OnInit {
checkImageFromVersion(image: string): boolean {
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0];
if (this.applianceToInstall.qemu) {
if (this.qemuImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
if (this.qemuImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
} else if (this.applianceToInstall.dynamips) {
if (this.iosImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
if (this.iosImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
} else if (this.applianceToInstall.iou) {
if (this.iouImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
if (this.iouImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
}
return false;
@ -429,9 +429,12 @@ export class NewTemplateDialogComponent implements OnInit {
return false;
}
if (this.checkImageFromVersion(version.images.hda_disk_image)) return true;
if (this.checkImageFromVersion(version.images.hda_disk_image)) {
return true;
} else {
return false;
}
}
openConfirmationDialog(message: string, link: string) {
const dialogRef = this.dialog.open(InformationDialogComponent, {
@ -607,6 +610,7 @@ export class NewTemplateDialogComponent implements OnInit {
}
createQemuTemplateFromVersion(version: Version) {
debugger
if (!this.checkImages(version)) {
this.toasterService.error('Please install required images first');
return;

View File

@ -5,6 +5,7 @@ export interface Image {
filename: string;
filesize: any;
md5sum: string;
checksum: string;
version: string;
}