mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-05-09 12:02:53 +00:00
I added checksum key instead of md5sum key
This commit is contained in:
parent
0df6294cc7
commit
a7e637a466
@ -127,14 +127,14 @@ 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.iouImages = iouImages;
|
||||||
|
});
|
||||||
|
|
||||||
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
|
||||||
this.iouImages = iouImages;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.applianceService.getAppliances(this.server).subscribe((appliances) => {
|
this.applianceService.getAppliances(this.server).subscribe((appliances) => {
|
||||||
this.appliances = appliances;
|
this.appliances = appliances;
|
||||||
this.appliances.forEach((appliance) => {
|
this.appliances.forEach((appliance) => {
|
||||||
@ -217,15 +217,15 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
||||||
this.qemuImages = qemuImages;
|
this.qemuImages = qemuImages;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.iosService.getImages(this.server).subscribe((iosImages) => {
|
|
||||||
this.iosImages = iosImages;
|
|
||||||
});
|
|
||||||
|
|
||||||
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
this.iosService.getImages(this.server).subscribe((iosImages) => {
|
||||||
this.iouImages = iouImages;
|
this.iosImages = iosImages;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
||||||
|
this.iouImages = iouImages;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppliance(url: string) {
|
getAppliance(url: string) {
|
||||||
@ -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';
|
||||||
@ -256,7 +256,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
|
|
||||||
const url = this.applianceService.getUploadPath(this.server, emulator, fileName);
|
const url = this.applianceService.getUploadPath(this.server, emulator, fileName);
|
||||||
this.uploader.queue.forEach((elem) => (elem.url = url));
|
this.uploader.queue.forEach((elem) => (elem.url = url));
|
||||||
|
|
||||||
const itemToUpload = this.uploader.queue[0];
|
const itemToUpload = this.uploader.queue[0];
|
||||||
if ((itemToUpload as any).options) (itemToUpload as any).options.disableMultipart = true; ((itemToUpload as any).options.headers = [{ name: 'Authorization', value: 'Bearer ' + this.server.authToken }])
|
if ((itemToUpload as any).options) (itemToUpload as any).options.disableMultipart = true; ((itemToUpload as any).options.headers = [{ name: 'Authorization', value: 'Bearer ' + this.server.authToken }])
|
||||||
|
|
||||||
@ -388,7 +388,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
let fileReader: FileReader = new FileReader();
|
let fileReader: FileReader = new FileReader();
|
||||||
let emulator;
|
let emulator;
|
||||||
|
|
||||||
fileReader.onloadend = () => {
|
fileReader.onloadend = () => {
|
||||||
if (this.applianceToInstall.qemu) emulator = 'qemu';
|
if (this.applianceToInstall.qemu) emulator = 'qemu';
|
||||||
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
||||||
if (this.applianceToInstall.iou) emulator = 'iou';
|
if (this.applianceToInstall.iou) emulator = 'iou';
|
||||||
@ -398,7 +398,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
|
|
||||||
const itemToUpload = this.uploaderImage.queue[0];
|
const itemToUpload = this.uploaderImage.queue[0];
|
||||||
if ((itemToUpload as any).options) (itemToUpload as any).options.disableMultipart = true; ((itemToUpload as any).options.headers = [{ name: 'Authorization', value: 'Bearer ' + this.server.authToken }])
|
if ((itemToUpload as any).options) (itemToUpload as any).options.disableMultipart = true; ((itemToUpload as any).options.headers = [{ name: 'Authorization', value: 'Bearer ' + this.server.authToken }])
|
||||||
|
|
||||||
this.uploaderImage.uploadItem(itemToUpload);
|
this.uploaderImage.uploadItem(itemToUpload);
|
||||||
this.progressService.activate();
|
this.progressService.activate();
|
||||||
};
|
};
|
||||||
@ -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;
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user