mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-30 01:38:50 +00:00
Qemu preferences page added
This commit is contained in:
parent
bee62ef726
commit
8977750d90
@ -8,6 +8,7 @@ import { DefaultLayoutComponent } from './layouts/default-layout/default-layout.
|
||||
import { SettingsComponent } from './components/settings/settings.component';
|
||||
import { LocalServerComponent } from './components/local-server/local-server.component';
|
||||
import { PreferencesComponent } from './components/preferences/preferences.component';
|
||||
import { QemuPreferencesComponent } from './components/preferences/qemu/qemu-preferences/qemu-preferences.component';
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@ -19,7 +20,8 @@ const routes: Routes = [
|
||||
{ path: 'local', component: LocalServerComponent },
|
||||
{ path: 'server/:server_id/projects', component: ProjectsComponent },
|
||||
{ path: 'settings', component: SettingsComponent },
|
||||
{ path: 'preferences', component: PreferencesComponent }
|
||||
{ path: 'server/:server_id/preferences', component: PreferencesComponent },
|
||||
{ path: 'server/:server_id/preferences/qemu', component: QemuPreferencesComponent }
|
||||
]
|
||||
},
|
||||
{ path: 'server/:server_id/project/:project_id', component: ProjectMapComponent }
|
||||
|
@ -89,6 +89,8 @@ import { StyleEditorDialogComponent } from './components/project-map/drawings-ed
|
||||
import { EditTextActionComponent } from './components/project-map/context-menu/actions/edit-text-action/edit-text-action.component';
|
||||
import { TextEditorDialogComponent } from './components/project-map/drawings-editors/text-editor/text-editor.component';
|
||||
import { PreferencesComponent } from './components/preferences/preferences.component';
|
||||
import { QemuPreferencesComponent } from './components/preferences/qemu/qemu-preferences/qemu-preferences.component';
|
||||
import { ServerSettingsService } from './services/server-settings.service';
|
||||
|
||||
if (environment.production) {
|
||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||
@ -141,7 +143,8 @@ if (environment.production) {
|
||||
LinkCreatedComponent,
|
||||
InterfaceLabelDraggedComponent,
|
||||
StyleEditorDialogComponent,
|
||||
TextEditorDialogComponent
|
||||
TextEditorDialogComponent,
|
||||
QemuPreferencesComponent
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
@ -187,7 +190,8 @@ if (environment.production) {
|
||||
ServerErrorHandler,
|
||||
ServerDatabase,
|
||||
ProjectNameValidator,
|
||||
ToolsService
|
||||
ToolsService,
|
||||
ServerSettingsService
|
||||
],
|
||||
entryComponents: [
|
||||
AddServerDialogComponent,
|
||||
|
@ -5,22 +5,29 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="default-content">
|
||||
<mat-sidenav-container class="sidenav-container" style="height:500px;">
|
||||
|
||||
<mat-sidenav
|
||||
opened="true"
|
||||
disableClose="true">
|
||||
<mat-nav-list>
|
||||
<a mat-list-item href="/first-page">General</a>
|
||||
<a mat-list-item href="/second-page">QEMU</a>
|
||||
<a mat-list-item href="/third-page">VirtualBox</a>
|
||||
</mat-nav-list>
|
||||
</mat-sidenav>
|
||||
|
||||
<mat-sidenav-content>
|
||||
<router-outlet></router-outlet>
|
||||
</mat-sidenav-content>
|
||||
|
||||
</mat-sidenav-container>
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<mat-nav-list>
|
||||
<mat-list-item>
|
||||
<button mat-button routerLink="/server/{{serverId}}/preferences/general">
|
||||
General
|
||||
</button>
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<button mat-button routerLink="/server/{{serverId}}/preferences/qemu">
|
||||
QEMU
|
||||
</button>
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<button mat-button routerLink="/server/{{serverId}}/preferences/virtualbox">
|
||||
VirtualBox
|
||||
</button>
|
||||
</mat-list-item>
|
||||
<mat-list-item>
|
||||
<button mat-button routerLink="/server/{{serverId}}/preferences/vmware">
|
||||
VMware
|
||||
</button>
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,4 +1,8 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { Server } from '../../models/server';
|
||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||
import { ServerService } from '../../services/server.service';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -7,9 +11,13 @@ import { Component, OnInit } from "@angular/core";
|
||||
styleUrls: ['./preferences.component.scss']
|
||||
})
|
||||
export class PreferencesComponent implements OnInit {
|
||||
public serverId: string = "";
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {}
|
||||
constructor(
|
||||
private route: ActivatedRoute
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.serverId = this.route.snapshot.paramMap.get("server_id");
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
<div class="content">
|
||||
<div class="default-header">
|
||||
<div class="row">
|
||||
<h1 class="col">QEMU preferences</h1>
|
||||
<button class="top-button" mat-raised-button color="primary">QEMU Virtual Machines</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="default-content">
|
||||
<div class="example-container mat-elevation-z8">
|
||||
<mat-nav-list *ngIf="settings">
|
||||
<mat-list-item>
|
||||
<mat-checkbox class="example-margin" [(ngModel)]="settings.Qemu.enable_hardware_acceleration">
|
||||
Enable Hardware Acceleration (KVM/HAXM)
|
||||
</mat-checkbox>
|
||||
</mat-list-item>
|
||||
<mat-list-item *ngIf="settings.Qemu.enable_hardware_acceleration">
|
||||
<mat-checkbox class="example-margin" [(ngModel)]="settings.Qemu.require_hardware_acceleration">
|
||||
Require Hardware Acceleration (KVM/HAXM)
|
||||
</mat-checkbox>
|
||||
</mat-list-item>
|
||||
</mat-nav-list>
|
||||
</div>
|
||||
|
||||
<div class="buttons-bar">
|
||||
<button mat-button color="accent" (click)="restoreDefaults()">Restore defaults</button>
|
||||
<button mat-raised-button color="primary" (click)="apply()">Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
@ -0,0 +1,4 @@
|
||||
.top-button {
|
||||
height: 36px;
|
||||
margin-top: 22px
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
import { Component, OnInit } from "@angular/core";
|
||||
import { ServerSettingsService } from '../../../../services/server-settings.service';
|
||||
import { ActivatedRoute, ParamMap } from '@angular/router';
|
||||
import { Server } from '../../../../models/server';
|
||||
import { switchMap } from 'rxjs/operators';
|
||||
import { ServerService } from '../../../../services/server.service';
|
||||
import { ServerSettings } from '../../../../models/serverSettings';
|
||||
import { Qemu } from '../../../../models/server-settings-models/qemu';
|
||||
import { ToasterService } from '../../../../services/toaster.service';
|
||||
|
||||
|
||||
@Component({
|
||||
selector: 'app-qemu-preferences',
|
||||
templateUrl: './qemu-preferences.component.html',
|
||||
styleUrls: ['./qemu-preferences.component.scss']
|
||||
})
|
||||
export class QemuPreferencesComponent implements OnInit {
|
||||
server: Server;
|
||||
settings: ServerSettings;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private serverService: ServerService,
|
||||
private serverSettingsService: ServerSettingsService,
|
||||
private toasterService: ToasterService
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.route.paramMap
|
||||
.pipe(
|
||||
switchMap((params: ParamMap) => {
|
||||
const server_id = params.get('server_id');
|
||||
return this.serverService.get(parseInt(server_id, 10));
|
||||
})
|
||||
)
|
||||
.subscribe((server: Server) => {
|
||||
this.server = server;
|
||||
this.serverSettingsService.get(this.server).subscribe((settings: ServerSettings) => {
|
||||
this.settings = settings;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
apply(){
|
||||
if(!this.settings.Qemu.enable_hardware_acceleration){
|
||||
this.settings.Qemu.require_hardware_acceleration = false;
|
||||
}
|
||||
|
||||
this.serverSettingsService.update(this.server, this.settings)
|
||||
.subscribe((serverSettings: ServerSettings) => {
|
||||
this.toasterService.success(`Changes applied`);
|
||||
});
|
||||
}
|
||||
|
||||
restoreDefaults(){
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
import { Component } from "@angular/core";
|
||||
|
||||
|
||||
|
@ -79,8 +79,8 @@
|
||||
<app-template [server]="server" (onNodeCreation)="onNodeCreation($event)"></app-template>
|
||||
</mat-toolbar-row>
|
||||
|
||||
<mat-toolbar-row *ngIf="!readonly">
|
||||
<button mat-icon-button routerLink="/preferences">
|
||||
<mat-toolbar-row>
|
||||
<button mat-icon-button routerLink="/server/{{server.id}}/preferences">
|
||||
<mat-icon>settings_applications</mat-icon>
|
||||
</button>
|
||||
</mat-toolbar-row>
|
||||
|
3
src/app/models/server-settings-models/builtin.ts
Normal file
3
src/app/models/server-settings-models/builtin.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export class Builtin {
|
||||
default_nat_interface: string;
|
||||
}
|
3
src/app/models/server-settings-models/docker.ts
Normal file
3
src/app/models/server-settings-models/docker.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export class Docker {
|
||||
containers: any[];
|
||||
}
|
7
src/app/models/server-settings-models/dynamips.ts
Normal file
7
src/app/models/server-settings-models/dynamips.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export class Dynamips {
|
||||
allocate_aux_console_ports: string;
|
||||
dynamips_path: string;
|
||||
ghost_ios_support: string;
|
||||
mmap_support: string;
|
||||
sparse_memory_support: string
|
||||
}
|
17
src/app/models/server-settings-models/graphics-view.ts
Normal file
17
src/app/models/server-settings-models/graphics-view.ts
Normal file
@ -0,0 +1,17 @@
|
||||
export class GraphicsView {
|
||||
default_label_color: string;
|
||||
default_label_font: string;
|
||||
default_note_color: string;
|
||||
default_note_font: string;
|
||||
draw_link_status_points: boolean;
|
||||
draw_rectangle_selected_item: boolean;
|
||||
grid_size: number;
|
||||
scene_height: number;
|
||||
scene_width: 2000;
|
||||
show_grid: boolean;
|
||||
show_interface_labels: boolean;
|
||||
show_interface_labels_on_new_project: boolean;
|
||||
show_layers: boolean;
|
||||
snap_to_grid: boolean;
|
||||
zoom: any
|
||||
}
|
4
src/app/models/server-settings-models/iou.ts
Normal file
4
src/app/models/server-settings-models/iou.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export class IOU {
|
||||
iourc_content: "";
|
||||
license_check: boolean
|
||||
}
|
7
src/app/models/server-settings-models/qemu.ts
Normal file
7
src/app/models/server-settings-models/qemu.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export class Qemu {
|
||||
enable_hardware_acceleration: boolean;
|
||||
enable_kvm: boolean;
|
||||
require_hardware_acceleration: boolean;
|
||||
require_kvm: boolean;
|
||||
vms: any[]
|
||||
}
|
3
src/app/models/server-settings-models/virtual-box.ts
Normal file
3
src/app/models/server-settings-models/virtual-box.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export class VirtualBox {
|
||||
vboxmanage_path: string;
|
||||
}
|
7
src/app/models/server-settings-models/vmware.ts
Normal file
7
src/app/models/server-settings-models/vmware.ts
Normal file
@ -0,0 +1,7 @@
|
||||
export class VMware {
|
||||
block_host_traffic: boolean;
|
||||
host_type: string;
|
||||
vmnet_end_range: number;
|
||||
vmnet_start_range: number;
|
||||
vmrun_path: string
|
||||
}
|
3
src/app/models/server-settings-models/vpcs.ts
Normal file
3
src/app/models/server-settings-models/vpcs.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export class VPCS {
|
||||
vpcs_path: string;
|
||||
}
|
22
src/app/models/serverSettings.ts
Normal file
22
src/app/models/serverSettings.ts
Normal file
@ -0,0 +1,22 @@
|
||||
import { Builtin } from './server-settings-models/builtin';
|
||||
import { Docker } from './server-settings-models/docker';
|
||||
import { Dynamips } from './server-settings-models/dynamips';
|
||||
import { GraphicsView } from './server-settings-models/graphics-view';
|
||||
import { IOU } from './server-settings-models/iou';
|
||||
import { Qemu } from './server-settings-models/qemu';
|
||||
import { VMware } from './server-settings-models/vmware';
|
||||
import { VPCS } from './server-settings-models/vpcs';
|
||||
import { VirtualBox } from './server-settings-models/virtual-box';
|
||||
|
||||
export class ServerSettings {
|
||||
Builtin: Builtin;
|
||||
Docker: Docker;
|
||||
Dynamips: Dynamips;
|
||||
Graphicsview: GraphicsView;
|
||||
IOU: IOU;
|
||||
Qemu: Qemu;
|
||||
VMware: VMware;
|
||||
VPCS: VPCS;
|
||||
VirtualBox: VirtualBox;
|
||||
modification_uuid: string
|
||||
}
|
0
src/app/services/server-settings.service.spec.ts
Normal file
0
src/app/services/server-settings.service.spec.ts
Normal file
19
src/app/services/server-settings.service.ts
Normal file
19
src/app/services/server-settings.service.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import { HttpServer } from './http-server.service';
|
||||
import { Server } from '../models/server';
|
||||
import { ServerSettings } from '../models/serverSettings';
|
||||
|
||||
@Injectable()
|
||||
export class ServerSettingsService {
|
||||
constructor(
|
||||
private httpServer: HttpServer
|
||||
){}
|
||||
|
||||
get(server: Server) {
|
||||
return this.httpServer.get<ServerSettings>(server, `/settings`);
|
||||
}
|
||||
|
||||
update(server: Server, serverSettings: ServerSettings) {
|
||||
return this.httpServer.post<ServerSettings>(server, `/settings`, serverSettings);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user