mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-23 23:02:22 +00:00
Fix for adding appliances
This commit is contained in:
parent
8687c0b1f0
commit
0ccae1dde7
@ -7,7 +7,7 @@
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, 0.5);
|
||||
z-index: 1000;
|
||||
z-index: 2000;
|
||||
}
|
||||
|
||||
.loading-spinner,
|
||||
|
@ -28,6 +28,7 @@ import { TemplateService } from '../../../services/template.service';
|
||||
import { Template } from '../../../models/template';
|
||||
import { ComputeService } from '../../../services/compute.service';
|
||||
import { InformationDialogComponent } from '../../../components/dialogs/information-dialog.component';
|
||||
import { ProgressService } from '../../../common/progress/progress.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-template-dialog',
|
||||
@ -91,7 +92,9 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
private iouService: IouService,
|
||||
private templateService: TemplateService,
|
||||
public dialog: MatDialog,
|
||||
private computeService: ComputeService
|
||||
private computeService: ComputeService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private progressService: ProgressService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
@ -155,13 +158,30 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
|
||||
this.uploaderImage.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
this.toasterService.error('An error has occured');
|
||||
this.progressService.deactivate();
|
||||
};
|
||||
|
||||
this.uploaderImage.onSuccessItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
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) {
|
||||
let str = url.split('/v2');
|
||||
let appliancePath = str[str.length-1];
|
||||
@ -288,6 +308,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
(itemToUpload as any).options.disableMultipart = true;
|
||||
|
||||
this.uploaderImage.uploadItem(itemToUpload);
|
||||
this.progressService.activate();
|
||||
};
|
||||
|
||||
fileReader.readAsText(file);
|
||||
|
Loading…
Reference in New Issue
Block a user