Fix for adding appliances

This commit is contained in:
piotrpekala7
2020-09-03 12:50:07 +02:00
parent 8687c0b1f0
commit 0ccae1dde7
2 changed files with 23 additions and 2 deletions

View File

@ -7,7 +7,7 @@
right: 0; right: 0;
bottom: 0; bottom: 0;
background-color: rgba(0, 0, 0, 0.5); background-color: rgba(0, 0, 0, 0.5);
z-index: 1000; z-index: 2000;
} }
.loading-spinner, .loading-spinner,

View File

@ -28,6 +28,7 @@ import { TemplateService } from '../../../services/template.service';
import { Template } from '../../../models/template'; import { Template } from '../../../models/template';
import { ComputeService } from '../../../services/compute.service'; import { ComputeService } from '../../../services/compute.service';
import { InformationDialogComponent } from '../../../components/dialogs/information-dialog.component'; import { InformationDialogComponent } from '../../../components/dialogs/information-dialog.component';
import { ProgressService } from '../../../common/progress/progress.service';
@Component({ @Component({
selector: 'app-new-template-dialog', selector: 'app-new-template-dialog',
@ -91,7 +92,9 @@ export class NewTemplateDialogComponent implements OnInit {
private iouService: IouService, private iouService: IouService,
private templateService: TemplateService, private templateService: TemplateService,
public dialog: MatDialog, public dialog: MatDialog,
private computeService: ComputeService private computeService: ComputeService,
private changeDetectorRef: ChangeDetectorRef,
private progressService: ProgressService
) {} ) {}
ngOnInit() { ngOnInit() {
@ -155,13 +158,30 @@ export class NewTemplateDialogComponent implements OnInit {
this.uploaderImage.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => { this.uploaderImage.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
this.toasterService.error('An error has occured'); this.toasterService.error('An error has occured');
this.progressService.deactivate();
}; };
this.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => { this.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
this.toasterService.success('Image imported succesfully'); this.toasterService.success('Image imported succesfully');
this.refreshImages();
this.progressService.deactivate();
}; };
} }
refreshImages() {
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
this.qemuImages = qemuImages;
});
this.iosService.getImages(this.server).subscribe((iosImages) => {
this.iosImages = iosImages;
});
this.iouService.getImages(this.server).subscribe((iouImages) => {
this.iouImages = iouImages;
});
}
getAppliance(url: string) { getAppliance(url: string) {
let str = url.split('/v2'); let str = url.split('/v2');
let appliancePath = str[str.length-1]; let appliancePath = str[str.length-1];
@ -288,6 +308,7 @@ export class NewTemplateDialogComponent implements OnInit {
(itemToUpload as any).options.disableMultipart = true; (itemToUpload as any).options.disableMultipart = true;
this.uploaderImage.uploadItem(itemToUpload); this.uploaderImage.uploadItem(itemToUpload);
this.progressService.activate();
}; };
fileReader.readAsText(file); fileReader.readAsText(file);