Skip to content

Commit

Permalink
Use correct image upload endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Dec 31, 2024
1 parent 7b633c2 commit e959a94
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ 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);
};
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}`;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
4 changes: 2 additions & 2 deletions src/app/services/appliances.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export class ApplianceService {
return this.httpController.get<Appliance>(controller, url) as Observable<Appliance>;
}

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<Appliance[]> {
Expand Down
4 changes: 0 additions & 4 deletions src/app/services/compute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export class ComputeService {
return this.httpController.get<Compute[]>(controller, '/computes') as Observable<Compute[]>;
}

getUploadPath(controller:Controller , emulator: string, filename: string) {
return `${controller.protocol}//${controller.host}:${controller.port}/${environment.current_version}/${emulator}/images/${filename}`;
}

getStatistics(controller:Controller ): Observable<ComputeStatistics[]> {
return this.httpController.get(controller, `/statistics`);
}
Expand Down
4 changes: 0 additions & 4 deletions src/app/services/image-manager.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Image[]>(controller, `/images/upload/${image_path}?install_appliances=${install_appliance}`,flie) as Observable<Image[]>;
}
Expand Down

0 comments on commit e959a94

Please sign in to comment.