From e959a947cc5c0cc725bc01ac8d4fe350552f3b0e Mon Sep 17 00:00:00 2001 From: grossmj Date: Tue, 31 Dec 2024 18:57:36 +0700 Subject: [PATCH] Use correct image upload endpoint --- .../import-appliance/import-appliance.component.ts | 6 +++--- .../new-template-dialog/new-template-dialog.component.ts | 4 ++-- src/app/services/appliances.service.ts | 4 ++-- src/app/services/compute.service.ts | 4 ---- src/app/services/image-manager.service.ts | 4 ---- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/app/components/project-map/import-appliance/import-appliance.component.ts b/src/app/components/project-map/import-appliance/import-appliance.component.ts index 03c733c2..fe2304ca 100644 --- a/src/app/components/project-map/import-appliance/import-appliance.component.ts +++ b/src/app/components/project-map/import-appliance/import-appliance.component.ts @@ -142,7 +142,7 @@ export class ImportApplianceComponent implements OnInit { } this.template = template; - const url = this.getUploadPath(this.controller, template.template_type, name); + const url = this.getUploadPath(this.controller, name); this.uploader.queue.forEach((elem) => (elem.url = url)); const itemToUpload = this.uploader.queue[0]; this.uploader.uploadItem(itemToUpload); @@ -150,7 +150,7 @@ export class ImportApplianceComponent implements OnInit { fileReader.readAsText(file); } - private getUploadPath(controller:Controller , emulator: string, filename: string) { - return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/${emulator}/images/${filename}`; + private getUploadPath(controller:Controller , filename: string) { + return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`; } } diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts index bc228340..dc7d7fd5 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts @@ -266,7 +266,7 @@ export class NewTemplateDialogComponent implements OnInit { if (appliance.iou) emulator = 'iou'; if (appliance.qemu) emulator = 'qemu'; - const url = this.applianceService.getUploadPath(this.controller, emulator, fileName); + const url = this.applianceService.getUploadPath(this.controller, fileName); this.uploader.queue.forEach((elem) => (elem.url = url)); const itemToUpload = this.uploader.queue[0]; @@ -381,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, imageName); + const url = this.applianceService.getUploadPath(this.controller, imageName); this.uploaderImage.queue.forEach((elem) => (elem.url = url)); const itemToUpload = this.uploaderImage.queue[0]; diff --git a/src/app/services/appliances.service.ts b/src/app/services/appliances.service.ts index cf0508ff..f6903515 100644 --- a/src/app/services/appliances.service.ts +++ b/src/app/services/appliances.service.ts @@ -17,8 +17,8 @@ export class ApplianceService { return this.httpController.get(controller, url) as Observable; } - getUploadPath(controller:Controller , emulator: string, filename: string) { - return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}?allow_raw_image=true`; + getUploadPath(controller:Controller, filename: string) { + return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`; } updateAppliances(controller:Controller ): Observable { diff --git a/src/app/services/compute.service.ts b/src/app/services/compute.service.ts index d921943f..69658b64 100644 --- a/src/app/services/compute.service.ts +++ b/src/app/services/compute.service.ts @@ -14,10 +14,6 @@ export class ComputeService { return this.httpController.get(controller, '/computes') as Observable; } - getUploadPath(controller:Controller , emulator: string, filename: string) { - return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/${emulator}/images/${filename}`; - } - getStatistics(controller:Controller ): Observable { return this.httpController.get(controller, `/statistics`); } diff --git a/src/app/services/image-manager.service.ts b/src/app/services/image-manager.service.ts index d0939ae2..640ac5eb 100644 --- a/src/app/services/image-manager.service.ts +++ b/src/app/services/image-manager.service.ts @@ -20,10 +20,6 @@ export class ImageManagerService { return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${image_path}?install_appliances=${install_appliance}`; } - getUploadPath(controller:Controller , emulator: string, filename: string) { - return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/images/upload/${filename}`; - } - uploadedImage(controller :Controller, install_appliance, image_path, flie){ return this.httpController.post(controller, `/images/upload/${image_path}?install_appliances=${install_appliance}`,flie) as Observable; }