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

@ -127,13 +127,13 @@ export class NewTemplateDialogComponent implements OnInit {
this.qemuImages = qemuImages; this.qemuImages = qemuImages;
}); });
this.iosService.getImages(this.server).subscribe((iosImages) => { this.iosService.getImages(this.server).subscribe((iosImages) => {
this.iosImages = iosImages; this.iosImages = iosImages;
}); });
this.iouService.getImages(this.server).subscribe((iouImages) => { this.iouService.getImages(this.server).subscribe((iouImages) => {
this.iouImages = iouImages; this.iouImages = iouImages;
}); });
this.applianceService.getAppliances(this.server).subscribe((appliances) => { this.applianceService.getAppliances(this.server).subscribe((appliances) => {
this.appliances = appliances; this.appliances = appliances;
@ -218,13 +218,13 @@ export class NewTemplateDialogComponent implements OnInit {
this.qemuImages = qemuImages; this.qemuImages = qemuImages;
}); });
this.iosService.getImages(this.server).subscribe((iosImages) => { this.iosService.getImages(this.server).subscribe((iosImages) => {
this.iosImages = iosImages; this.iosImages = iosImages;
}); });
this.iouService.getImages(this.server).subscribe((iouImages) => { this.iouService.getImages(this.server).subscribe((iouImages) => {
this.iouImages = iouImages; this.iouImages = iouImages;
}); });
} }
@ -246,7 +246,7 @@ export class NewTemplateDialogComponent implements OnInit {
let fileReader: FileReader = new FileReader(); let fileReader: FileReader = new FileReader();
let emulator; let emulator;
fileReader.onloadend= () => { fileReader.onloadend = () => {
let appliance = JSON.parse(fileReader.result as string); let appliance = JSON.parse(fileReader.result as string);
if (appliance.docker) emulator = 'docker'; if (appliance.docker) emulator = 'docker';
@ -409,11 +409,11 @@ export class NewTemplateDialogComponent implements OnInit {
checkImageFromVersion(image: string): boolean { checkImageFromVersion(image: string): boolean {
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0]; let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0];
if (this.applianceToInstall.qemu) { 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) { } 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) { } 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; return false;
@ -429,8 +429,11 @@ export class NewTemplateDialogComponent implements OnInit {
return false; return false;
} }
if (this.checkImageFromVersion(version.images.hda_disk_image)) return true; if (this.checkImageFromVersion(version.images.hda_disk_image)) {
return false; return true;
} else {
return false;
}
} }
openConfirmationDialog(message: string, link: string) { openConfirmationDialog(message: string, link: string) {
@ -607,6 +610,7 @@ export class NewTemplateDialogComponent implements OnInit {
} }
createQemuTemplateFromVersion(version: Version) { createQemuTemplateFromVersion(version: Version) {
debugger
if (!this.checkImages(version)) { if (!this.checkImages(version)) {
this.toasterService.error('Please install required images first'); this.toasterService.error('Please install required images first');
return; return;

View File

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