I resolved / Fixed add new template uploading image issue

This commit is contained in:
Rajnikant 2022-04-26 13:37:43 +05:30
parent 4c11b6c012
commit 236a9d11b3
5 changed files with 33 additions and 87 deletions

View File

@ -129,25 +129,8 @@
<mat-step *ngIf="applianceToInstall">
<ng-template matStepLabel>{{ secondActionTitle }}</ng-template>
<mat-card [hidden]="!(!isLinuxPlatform && !applianceToInstall.dynamips)">
Please configure GNS3 VM to install selected appliance
</mat-card>
<mat-card [hidden]="!(isLinuxPlatform || applianceToInstall.dynamips)">
<mat-card [hidden]="!(!isLinuxPlatform || applianceToInstall.dynamips)">
<div *ngIf="applianceToInstall.qemu">
<div>
Server type<br />
<mat-radio-group class="radio-group">
<mat-radio-button
[disabled]="!isLinuxPlatform"
[checked]="isLocalComputerChosen"
class="radio-button"
value="1"
(click)="setServerType('local')"
>Install the appliance locally</mat-radio-button
>
</mat-radio-group>
</div>
<div>
Qemu binary<br />
<mat-select
@ -321,37 +304,13 @@
</div>
<div *ngIf="applianceToInstall.docker">
<div>
Server type<br />
<mat-radio-group class="radio-group">
<mat-radio-button
[disabled]="!isLinuxPlatform"
[checked]="isLocalComputerChosen"
class="radio-button"
value="1"
(click)="setServerType('local')"
>Install the appliance locally</mat-radio-button
>
</mat-radio-group>
</div>
<button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button">
Create docker template
</button>
</div>
<div *ngIf="applianceToInstall.dynamips">
<div>
Server type<br />
<mat-radio-group class="radio-group">
<mat-radio-button
[checked]="isLocalComputerChosen"
class="radio-button"
value="1"
(click)="setServerType('local')"
>Install the appliance locally</mat-radio-button
>
</mat-radio-group>
</div>
<div>
Install required files
<button
@ -389,19 +348,6 @@
</div>
<div *ngIf="applianceToInstall.iou">
<div>
Server type<br />
<mat-radio-group class="radio-group">
<mat-radio-button
[disabled]="!isLinuxPlatform"
[checked]="isLocalComputerChosen"
class="radio-button"
value="1"
(click)="setServerType('local')"
>Install the appliance locally</mat-radio-button
>
</mat-radio-group>
</div>
<div>
Install required files
<button

View File

@ -109,7 +109,6 @@ export class NewTemplateDialogComponent implements OnInit {
this.dataSource.paginator = this.paginator;
});
if(!this.server.authToken){
this.templateService.list(this.server).subscribe((templates) => {
this.templates = templates;
});
@ -195,7 +194,6 @@ export class NewTemplateDialogComponent implements OnInit {
this.progressService.deactivate();
this.uploaderImage.clearQueue();
};
}
}
@ -215,6 +213,7 @@ export class NewTemplateDialogComponent implements OnInit {
}
refreshImages() {
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
this.qemuImages = qemuImages;
});
@ -226,6 +225,7 @@ export class NewTemplateDialogComponent implements OnInit {
this.iouService.getImages(this.server).subscribe((iouImages) => {
this.iouImages = iouImages;
});
}
getAppliance(url: string) {
@ -258,7 +258,7 @@ export class NewTemplateDialogComponent implements OnInit {
this.uploader.queue.forEach((elem) => (elem.url = url));
const itemToUpload = this.uploader.queue[0];
(itemToUpload as any).options.disableMultipart = true;
if ((itemToUpload as any).options) (itemToUpload as any).options.disableMultipart = true; ((itemToUpload as any).options.headers = [{ name: 'Authorization', value: 'Bearer ' + this.server.authToken }])
this.uploader.uploadItem(itemToUpload);
};
@ -397,7 +397,7 @@ export class NewTemplateDialogComponent implements OnInit {
this.uploaderImage.queue.forEach((elem) => (elem.url = url));
const itemToUpload = this.uploaderImage.queue[0];
(itemToUpload as any).options.disableMultipart = true;
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.progressService.activate();

View File

@ -17,7 +17,7 @@ export class ApplianceService {
}
getUploadPath(server: Server, emulator: string, filename: string) {
return `${server.protocol}//${server.host}:${server.port}/v3/compute/${emulator}/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${filename}`;
}
updateAppliances(server: Server): Observable<Appliance[]> {

View File

@ -10,11 +10,11 @@ export class IosService {
constructor(private httpServer: HttpServer) {}
getImages(server: Server): Observable<any> {
return this.httpServer.get<IosImage[]>(server, '/compute/dynamips/images') as Observable<IosImage[]>;
return this.httpServer.get<IosImage[]>(server, '/images') as Observable<IosImage[]>;
}
getImagePath(server: Server, filename: string): string {
return `${server.protocol}//${server.host}:${server.port}/v3/compute/dynamips/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${filename}`;
}
getTemplates(server: Server): Observable<IosTemplate[]> {

View File

@ -18,11 +18,11 @@ export class IouService {
}
getImages(server: Server): Observable<any> {
return this.httpServer.get<IouImage[]>(server, '/compute/iou/images') as Observable<IouImage[]>;
return this.httpServer.get<IouImage[]>(server, '/images') as Observable<IouImage[]>;
}
getImagePath(server: Server, filename: string): string {
return `${server.protocol}//${server.host}:${server.port}/v3/compute/iou/images/${filename}`;
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${filename}`;
}
addTemplate(server: Server, iouTemplate: any): Observable<any> {