mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-30 09:48:53 +00:00
Merge branch 'master-3.0' into bugfix/all-CVE
This commit is contained in:
commit
dc382348b8
@ -150,7 +150,6 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
||||
}
|
||||
|
||||
addTemplate() {
|
||||
debugger
|
||||
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
||||
this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value;
|
||||
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
||||
|
@ -1,26 +1,10 @@
|
||||
<div
|
||||
*ngIf="isDraggingEnabled"
|
||||
(document:mousemove)="dragWidget($event)"
|
||||
(document:mouseup)="toggleDragging(false)"
|
||||
></div>
|
||||
<div *ngIf="isDraggingEnabled" (document:mousemove)="dragWidget($event)" (document:mouseup)="toggleDragging(false)">
|
||||
</div>
|
||||
<!-- Option with resizing -->
|
||||
<div
|
||||
class="consoleWrapper"
|
||||
[ngClass]="{ lightTheme: isLightThemeEnabled }"
|
||||
(mousedown)="toggleDragging(true)"
|
||||
[ngStyle]="style"
|
||||
mwlResizable
|
||||
[validateResize]="validate"
|
||||
[resizeEdges]="{ right: true, left: true, bottom: true, top: true }"
|
||||
[enableGhostResize]="true"
|
||||
(resizeStart)="toggleDragging(false)"
|
||||
(resizeEnd)="onResizeEnd($event)"
|
||||
>
|
||||
<!-- <div
|
||||
class="consoleWrapper"
|
||||
[ngClass]="{lightTheme: isLightThemeEnabled}"
|
||||
(mousedown)="toggleDragging(true)"
|
||||
[ngStyle]="style"> -->
|
||||
<div class="consoleWrapper" [ngClass]="{ lightTheme: isLightThemeEnabled }" (mousedown)="toggleDragging(true)"
|
||||
[ngStyle]="style" mwlResizable [validateResize]="validate"
|
||||
[resizeEdges]="{ right: true, left: true, bottom: true, top: true }" [enableGhostResize]="true"
|
||||
(resizeStart)="toggleDragging(false)" (resizeEnd)="onResizeEnd($event)">
|
||||
|
||||
<div class="consoleHeader" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }">
|
||||
<mat-tab-group class="tabs" [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)">
|
||||
@ -33,63 +17,34 @@
|
||||
<mat-tab *ngFor="let node of nodes; let index = index" [label]="tab">
|
||||
<ng-template mat-tab-label>
|
||||
<div class="col" style="margin-left: 20px">{{ node.name }}</div>
|
||||
<button
|
||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
||||
style="color: white"
|
||||
mat-icon-button
|
||||
(click)="removeTab(index)"
|
||||
>
|
||||
<button [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white" mat-icon-button
|
||||
(click)="removeTab(index)">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</ng-template>
|
||||
</mat-tab>
|
||||
</mat-tab-group>
|
||||
|
||||
<button
|
||||
*ngIf="!isMinimized"
|
||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
||||
style="color: white"
|
||||
mat-icon-button
|
||||
(click)="minimize(true)"
|
||||
>
|
||||
<button *ngIf="!isMinimized" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white"
|
||||
mat-icon-button (click)="minimize(true)">
|
||||
<mat-icon>remove</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
*ngIf="isMinimized"
|
||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
||||
style="color: white"
|
||||
mat-icon-button
|
||||
(click)="minimize(false)"
|
||||
>
|
||||
<button *ngIf="isMinimized" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white"
|
||||
mat-icon-button (click)="minimize(false)">
|
||||
<mat-icon>web_asset</mat-icon>
|
||||
</button>
|
||||
<button
|
||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
||||
style="color: white"
|
||||
mat-icon-button
|
||||
(click)="close()"
|
||||
>
|
||||
<button [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white" mat-icon-button
|
||||
(click)="close()">
|
||||
<mat-icon>close</mat-icon>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<app-log-console
|
||||
[hidden]="!(selected.value === 0) || isMinimized"
|
||||
[server]="server"
|
||||
[project]="project"
|
||||
></app-log-console>
|
||||
<app-log-console [hidden]="!(selected.value === 0) || isMinimized" [server]="server" [project]="project">
|
||||
</app-log-console>
|
||||
|
||||
<div
|
||||
(mouseover)="disableScroll($event)"
|
||||
(mouseout)="enableScroll($event)"
|
||||
class="xterm-console"
|
||||
[hidden]="isMinimized"
|
||||
*ngFor="let node of nodes; let index = index"
|
||||
>
|
||||
<app-web-console
|
||||
[hidden]="!(selected.value === index + 1)"
|
||||
[server]="server"
|
||||
[node]="nodes[index]"
|
||||
></app-web-console>
|
||||
<div (mouseover)="disableScroll($event)" (mouseout)="enableScroll($event)" class="xterm-console"
|
||||
[hidden]="isMinimized" *ngFor="let node of nodes; let index = index">
|
||||
<app-web-console [hidden]="!(selected.value === index + 1)" [server]="server" [node]="nodes[index]">
|
||||
</app-web-console>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -42,7 +42,7 @@ import { TemplateNameDialogComponent } from './template-name-dialog/template-nam
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class NewTemplateDialogComponent implements OnInit {
|
||||
export class NewTemplateDialogComponent implements OnInit {
|
||||
@Input() server: Server;
|
||||
@Input() project: Project;
|
||||
|
||||
@ -93,7 +93,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
private computeService: ComputeService,
|
||||
private changeDetectorRef: ChangeDetectorRef,
|
||||
private progressService: ProgressService
|
||||
) {}
|
||||
) { }
|
||||
|
||||
ngOnInit() {
|
||||
this.applianceService.getAppliances(this.server).subscribe((appliances) => {
|
||||
@ -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;
|
||||
});
|
||||
@ -123,7 +122,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
this.qemuService.getBinaries(this.server).subscribe((binaries) => {
|
||||
this.qemuBinaries = binaries;
|
||||
});
|
||||
|
||||
|
||||
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
||||
this.qemuImages = qemuImages;
|
||||
});
|
||||
@ -195,8 +194,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
this.progressService.deactivate();
|
||||
this.uploaderImage.clearQueue();
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
updateAppliances() {
|
||||
@ -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();
|
||||
@ -409,11 +409,11 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
checkImageFromVersion(image: string): boolean {
|
||||
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0];
|
||||
if (this.applianceToInstall.qemu) {
|
||||
if (this.qemuImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
|
||||
if (this.qemuImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
|
||||
} else if (this.applianceToInstall.dynamips) {
|
||||
if (this.iosImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
|
||||
if (this.iosImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
|
||||
} else if (this.applianceToInstall.iou) {
|
||||
if (this.iouImages.filter((n) => n.md5sum === imageToInstall.md5sum).length > 0) return true;
|
||||
if (this.iouImages.filter((n) => n.checksum === imageToInstall.md5sum).length > 0) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -429,8 +429,11 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.checkImageFromVersion(version.images.hda_disk_image)) return true;
|
||||
return false;
|
||||
if (this.checkImageFromVersion(version.images.hda_disk_image)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
openConfirmationDialog(message: string, link: string) {
|
||||
|
@ -106,6 +106,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
public toolbarVisibility: boolean = true;
|
||||
public symbolScaling: boolean = true;
|
||||
private instance: ComponentRef<TopologySummaryComponent>;
|
||||
// private instance: any
|
||||
|
||||
tools = {
|
||||
selection: true,
|
||||
@ -175,10 +176,16 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
private nodeConsoleService: NodeConsoleService,
|
||||
private symbolService: SymbolService,
|
||||
private cd: ChangeDetectorRef,
|
||||
private cfr: ComponentFactoryResolver,
|
||||
private injector: Injector
|
||||
// private cfr: ComponentFactoryResolver,
|
||||
// private injector: Injector,
|
||||
private viewContainerRef: ViewContainerRef
|
||||
) {}
|
||||
|
||||
|
||||
|
||||
// constructor(private viewContainerRef: ViewContainerRef) {}
|
||||
// createMyComponent() {this.viewContainerRef.createComponent(MyComponent);}
|
||||
|
||||
ngOnInit() {
|
||||
this.getSettings();
|
||||
this.progressService.activate();
|
||||
@ -221,8 +228,10 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
async lazyLoadTopologySummary() {
|
||||
if (this.isTopologySummaryVisible) {
|
||||
const {TopologySummaryComponent} = await import('../topology-summary/topology-summary.component');
|
||||
const componentFactory = this.cfr.resolveComponentFactory(TopologySummaryComponent);
|
||||
this.instance = this.topologySummaryContainer.createComponent(componentFactory, null, this.injector);
|
||||
this.instance = this.viewContainerRef.createComponent(TopologySummaryComponent)
|
||||
|
||||
// const componentFactory = this.cfr.resolveComponentFactory(TopologySummaryComponent);
|
||||
// this.instance = this.topologySummaryContainer.createComponent(componentFactory, null, this.injector);
|
||||
this.instance.instance.server = this.server;
|
||||
this.instance.instance.project = this.project;
|
||||
} else if (this.instance) {
|
||||
|
@ -5,6 +5,7 @@ export interface Image {
|
||||
filename: string;
|
||||
filesize: any;
|
||||
md5sum: string;
|
||||
checksum: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
|
@ -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[]> {
|
||||
|
@ -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?image_type=ios') 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}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
getTemplates(server: Server): Observable<IosTemplate[]> {
|
||||
|
@ -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?image_type=iou') 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}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
addTemplate(server: Server, iouTemplate: any): Observable<any> {
|
||||
|
@ -20,7 +20,7 @@ export class QemuService {
|
||||
}
|
||||
|
||||
getImagePath(server: Server, filename: string): string {
|
||||
return `${server.protocol}//${server.host}:${server.port}/v3/images/upload/${filename}`;
|
||||
return `${server.protocol}//${server.host}:${server.port}/images/upload/${filename}`;
|
||||
}
|
||||
|
||||
getBinaries(server: Server): Observable<QemuBinary[]> {
|
||||
@ -28,7 +28,7 @@ export class QemuService {
|
||||
}
|
||||
|
||||
getImages(server: Server): Observable<any> {
|
||||
return this.httpServer.get<QemuImage[]>(server, '/images') as Observable<QemuImage[]>;
|
||||
return this.httpServer.get<QemuImage[]>(server, '/images?image_type=qemu') as Observable<QemuImage[]>;
|
||||
}
|
||||
|
||||
addImage(server: Server, qemuImg: QemuImg): Observable<QemuImg> {
|
||||
|
Loading…
Reference in New Issue
Block a user