mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-01 23:10:47 +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() {
|
addTemplate() {
|
||||||
debugger
|
|
||||||
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
||||||
this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value;
|
this.qemuTemplate.ram = +this.memoryForm.get('ramMemory').value;
|
||||||
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
||||||
|
@ -1,26 +1,10 @@
|
|||||||
<div
|
<div *ngIf="isDraggingEnabled" (document:mousemove)="dragWidget($event)" (document:mouseup)="toggleDragging(false)">
|
||||||
*ngIf="isDraggingEnabled"
|
</div>
|
||||||
(document:mousemove)="dragWidget($event)"
|
|
||||||
(document:mouseup)="toggleDragging(false)"
|
|
||||||
></div>
|
|
||||||
<!-- Option with resizing -->
|
<!-- Option with resizing -->
|
||||||
<div
|
<div class="consoleWrapper" [ngClass]="{ lightTheme: isLightThemeEnabled }" (mousedown)="toggleDragging(true)"
|
||||||
class="consoleWrapper"
|
[ngStyle]="style" mwlResizable [validateResize]="validate"
|
||||||
[ngClass]="{ lightTheme: isLightThemeEnabled }"
|
[resizeEdges]="{ right: true, left: true, bottom: true, top: true }" [enableGhostResize]="true"
|
||||||
(mousedown)="toggleDragging(true)"
|
(resizeStart)="toggleDragging(false)" (resizeEnd)="onResizeEnd($event)">
|
||||||
[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="consoleHeader" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }">
|
<div class="consoleHeader" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }">
|
||||||
<mat-tab-group class="tabs" [selectedIndex]="selected.value" (selectedIndexChange)="selected.setValue($event)">
|
<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">
|
<mat-tab *ngFor="let node of nodes; let index = index" [label]="tab">
|
||||||
<ng-template mat-tab-label>
|
<ng-template mat-tab-label>
|
||||||
<div class="col" style="margin-left: 20px">{{ node.name }}</div>
|
<div class="col" style="margin-left: 20px">{{ node.name }}</div>
|
||||||
<button
|
<button [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white" mat-icon-button
|
||||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
(click)="removeTab(index)">
|
||||||
style="color: white"
|
|
||||||
mat-icon-button
|
|
||||||
(click)="removeTab(index)"
|
|
||||||
>
|
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</mat-tab>
|
</mat-tab>
|
||||||
</mat-tab-group>
|
</mat-tab-group>
|
||||||
|
|
||||||
<button
|
<button *ngIf="!isMinimized" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white"
|
||||||
*ngIf="!isMinimized"
|
mat-icon-button (click)="minimize(true)">
|
||||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
|
||||||
style="color: white"
|
|
||||||
mat-icon-button
|
|
||||||
(click)="minimize(true)"
|
|
||||||
>
|
|
||||||
<mat-icon>remove</mat-icon>
|
<mat-icon>remove</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button *ngIf="isMinimized" [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white"
|
||||||
*ngIf="isMinimized"
|
mat-icon-button (click)="minimize(false)">
|
||||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
|
||||||
style="color: white"
|
|
||||||
mat-icon-button
|
|
||||||
(click)="minimize(false)"
|
|
||||||
>
|
|
||||||
<mat-icon>web_asset</mat-icon>
|
<mat-icon>web_asset</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button [ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }" style="color: white" mat-icon-button
|
||||||
[ngClass]="{ lightThemeConsoleHeader: isLightThemeEnabled }"
|
(click)="close()">
|
||||||
style="color: white"
|
|
||||||
mat-icon-button
|
|
||||||
(click)="close()"
|
|
||||||
>
|
|
||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<app-log-console
|
<app-log-console [hidden]="!(selected.value === 0) || isMinimized" [server]="server" [project]="project">
|
||||||
[hidden]="!(selected.value === 0) || isMinimized"
|
</app-log-console>
|
||||||
[server]="server"
|
|
||||||
[project]="project"
|
|
||||||
></app-log-console>
|
|
||||||
|
|
||||||
<div
|
<div (mouseover)="disableScroll($event)" (mouseout)="enableScroll($event)" class="xterm-console"
|
||||||
(mouseover)="disableScroll($event)"
|
[hidden]="isMinimized" *ngFor="let node of nodes; let index = index">
|
||||||
(mouseout)="enableScroll($event)"
|
<app-web-console [hidden]="!(selected.value === index + 1)" [server]="server" [node]="nodes[index]">
|
||||||
class="xterm-console"
|
</app-web-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>
|
</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() server: Server;
|
||||||
@Input() project: Project;
|
@Input() project: Project;
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
private computeService: ComputeService,
|
private computeService: ComputeService,
|
||||||
private changeDetectorRef: ChangeDetectorRef,
|
private changeDetectorRef: ChangeDetectorRef,
|
||||||
private progressService: ProgressService
|
private progressService: ProgressService
|
||||||
) {}
|
) { }
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.applianceService.getAppliances(this.server).subscribe((appliances) => {
|
this.applianceService.getAppliances(this.server).subscribe((appliances) => {
|
||||||
@ -109,7 +109,6 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.dataSource.paginator = this.paginator;
|
this.dataSource.paginator = this.paginator;
|
||||||
});
|
});
|
||||||
|
|
||||||
if(!this.server.authToken){
|
|
||||||
this.templateService.list(this.server).subscribe((templates) => {
|
this.templateService.list(this.server).subscribe((templates) => {
|
||||||
this.templates = templates;
|
this.templates = templates;
|
||||||
});
|
});
|
||||||
@ -123,7 +122,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.qemuService.getBinaries(this.server).subscribe((binaries) => {
|
this.qemuService.getBinaries(this.server).subscribe((binaries) => {
|
||||||
this.qemuBinaries = binaries;
|
this.qemuBinaries = binaries;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
||||||
this.qemuImages = qemuImages;
|
this.qemuImages = qemuImages;
|
||||||
});
|
});
|
||||||
@ -195,8 +194,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.progressService.deactivate();
|
this.progressService.deactivate();
|
||||||
this.uploaderImage.clearQueue();
|
this.uploaderImage.clearQueue();
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
updateAppliances() {
|
updateAppliances() {
|
||||||
@ -215,6 +213,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
refreshImages() {
|
refreshImages() {
|
||||||
|
|
||||||
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
this.qemuService.getImages(this.server).subscribe((qemuImages) => {
|
||||||
this.qemuImages = qemuImages;
|
this.qemuImages = qemuImages;
|
||||||
});
|
});
|
||||||
@ -226,6 +225,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
this.iouService.getImages(this.server).subscribe((iouImages) => {
|
||||||
this.iouImages = iouImages;
|
this.iouImages = iouImages;
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getAppliance(url: string) {
|
getAppliance(url: string) {
|
||||||
@ -258,7 +258,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.uploader.queue.forEach((elem) => (elem.url = url));
|
this.uploader.queue.forEach((elem) => (elem.url = url));
|
||||||
|
|
||||||
const itemToUpload = this.uploader.queue[0];
|
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);
|
this.uploader.uploadItem(itemToUpload);
|
||||||
};
|
};
|
||||||
@ -397,7 +397,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
this.uploaderImage.queue.forEach((elem) => (elem.url = url));
|
this.uploaderImage.queue.forEach((elem) => (elem.url = url));
|
||||||
|
|
||||||
const itemToUpload = this.uploaderImage.queue[0];
|
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.uploaderImage.uploadItem(itemToUpload);
|
||||||
this.progressService.activate();
|
this.progressService.activate();
|
||||||
@ -409,11 +409,11 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
checkImageFromVersion(image: string): boolean {
|
checkImageFromVersion(image: string): boolean {
|
||||||
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0];
|
let imageToInstall = this.applianceToInstall.images.filter((n) => n.filename === image)[0];
|
||||||
if (this.applianceToInstall.qemu) {
|
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) {
|
} 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) {
|
} 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;
|
return false;
|
||||||
@ -429,8 +429,11 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.checkImageFromVersion(version.images.hda_disk_image)) return true;
|
if (this.checkImageFromVersion(version.images.hda_disk_image)) {
|
||||||
return false;
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
openConfirmationDialog(message: string, link: string) {
|
openConfirmationDialog(message: string, link: string) {
|
||||||
|
@ -106,6 +106,7 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
public toolbarVisibility: boolean = true;
|
public toolbarVisibility: boolean = true;
|
||||||
public symbolScaling: boolean = true;
|
public symbolScaling: boolean = true;
|
||||||
private instance: ComponentRef<TopologySummaryComponent>;
|
private instance: ComponentRef<TopologySummaryComponent>;
|
||||||
|
// private instance: any
|
||||||
|
|
||||||
tools = {
|
tools = {
|
||||||
selection: true,
|
selection: true,
|
||||||
@ -175,10 +176,16 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
private nodeConsoleService: NodeConsoleService,
|
private nodeConsoleService: NodeConsoleService,
|
||||||
private symbolService: SymbolService,
|
private symbolService: SymbolService,
|
||||||
private cd: ChangeDetectorRef,
|
private cd: ChangeDetectorRef,
|
||||||
private cfr: ComponentFactoryResolver,
|
// private cfr: ComponentFactoryResolver,
|
||||||
private injector: Injector
|
// private injector: Injector,
|
||||||
|
private viewContainerRef: ViewContainerRef
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// constructor(private viewContainerRef: ViewContainerRef) {}
|
||||||
|
// createMyComponent() {this.viewContainerRef.createComponent(MyComponent);}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
this.getSettings();
|
this.getSettings();
|
||||||
this.progressService.activate();
|
this.progressService.activate();
|
||||||
@ -221,8 +228,10 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
|||||||
async lazyLoadTopologySummary() {
|
async lazyLoadTopologySummary() {
|
||||||
if (this.isTopologySummaryVisible) {
|
if (this.isTopologySummaryVisible) {
|
||||||
const {TopologySummaryComponent} = await import('../topology-summary/topology-summary.component');
|
const {TopologySummaryComponent} = await import('../topology-summary/topology-summary.component');
|
||||||
const componentFactory = this.cfr.resolveComponentFactory(TopologySummaryComponent);
|
this.instance = this.viewContainerRef.createComponent(TopologySummaryComponent)
|
||||||
this.instance = this.topologySummaryContainer.createComponent(componentFactory, null, this.injector);
|
|
||||||
|
// const componentFactory = this.cfr.resolveComponentFactory(TopologySummaryComponent);
|
||||||
|
// this.instance = this.topologySummaryContainer.createComponent(componentFactory, null, this.injector);
|
||||||
this.instance.instance.server = this.server;
|
this.instance.instance.server = this.server;
|
||||||
this.instance.instance.project = this.project;
|
this.instance.instance.project = this.project;
|
||||||
} else if (this.instance) {
|
} else if (this.instance) {
|
||||||
|
@ -5,6 +5,7 @@ export interface Image {
|
|||||||
filename: string;
|
filename: string;
|
||||||
filesize: any;
|
filesize: any;
|
||||||
md5sum: string;
|
md5sum: string;
|
||||||
|
checksum: string;
|
||||||
version: string;
|
version: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export class ApplianceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getUploadPath(server: Server, emulator: string, filename: string) {
|
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[]> {
|
updateAppliances(server: Server): Observable<Appliance[]> {
|
||||||
|
@ -10,11 +10,11 @@ export class IosService {
|
|||||||
constructor(private httpServer: HttpServer) {}
|
constructor(private httpServer: HttpServer) {}
|
||||||
|
|
||||||
getImages(server: Server): Observable<any> {
|
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 {
|
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[]> {
|
getTemplates(server: Server): Observable<IosTemplate[]> {
|
||||||
|
@ -18,11 +18,11 @@ export class IouService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getImages(server: Server): Observable<any> {
|
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 {
|
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> {
|
addTemplate(server: Server, iouTemplate: any): Observable<any> {
|
||||||
|
@ -20,7 +20,7 @@ export class QemuService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getImagePath(server: Server, filename: string): string {
|
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[]> {
|
getBinaries(server: Server): Observable<QemuBinary[]> {
|
||||||
@ -28,7 +28,7 @@ export class QemuService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getImages(server: Server): Observable<any> {
|
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> {
|
addImage(server: Server, qemuImg: QemuImg): Observable<QemuImg> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user