Skip to content

Commit

Permalink
Auxiliary console support for IOS, Docker and Qemu templates/nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed May 18, 2024
1 parent 040447f commit c9c043b
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/app/cartography/models/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class Properties {
headless: boolean;
linked_clone: boolean;
on_close: string;
aux_type: boolean;
aux: number;
ram: number;
nvram: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,18 @@ <h1 class="col">New Docker container template</h1>
</mat-select>
</mat-step>

<mat-step label="Auxiliary console type" [completed]="dockerTemplate.aux_type">
<mat-select
placeholder="Auxiliary console type"
[ngModelOptions]="{ standalone: true }"
[(ngModel)]="dockerTemplate.aux_type"
>
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-step>

<mat-step label="Environment">
<mat-form-field class="form-field">
<textarea matInput type="text" [(ngModel)]="dockerTemplate.environment"></textarea>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export class AddDockerTemplateComponent implements OnInit {
controller:Controller ;
dockerTemplate: DockerTemplate;
consoleTypes: string[] = [];
auxConsoleTypes: string[] = [];
isRemoteComputerChosen: boolean = false;
dockerImages: DockerImage[] = [];
selectedImage: DockerImage;
Expand Down Expand Up @@ -64,6 +65,7 @@ export class AddDockerTemplateComponent implements OnInit {
this.controller = controller;

this.consoleTypes = this.configurationService.getConsoleTypes();
this.auxConsoleTypes = this.configurationService.getAuxConsoleTypes();

this.templateMocksService.getDockerTemplate().subscribe((dockerTemplate: DockerTemplate) => {
this.dockerTemplate = dockerTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,17 @@ <h1 class="col">Docker container template configuration</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select
[ngModelOptions]="{ standalone: true }"
placeholder="Auxiliary console type"
[(ngModel)]="dockerTemplate.aux_type"
>
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [ngModelOptions]="{ standalone: true }" [(ngModel)]="dockerTemplate.console_auto_start">
Auto start console
</mat-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class DockerTemplateDetailsComponent implements OnInit {
isSymbolSelectionOpened: boolean = false;

consoleTypes: string[] = [];
auxConsoleTypes: string[] = [];
consoleResolutions: string[] = [];
categories = [];
adapters: CustomAdapter[] = [];
Expand Down Expand Up @@ -60,6 +61,7 @@ export class DockerTemplateDetailsComponent implements OnInit {

getConfiguration() {
this.consoleTypes = this.configurationService.getConsoleTypes();
this.auxConsoleTypes = this.configurationService.getAuxConsoleTypes();
this.categories = this.configurationService.getCategories();
this.consoleResolutions = this.configurationService.getConsoleResolutions();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ <h1 class="col">IOS router template configuration</h1>
</mat-form-field>
<mat-label>Platform - {{ iosTemplate.platform }}</mat-label
><br /><br />
<div *ngIf="iosTemplate.chassis">
<mat-label>Chassis - {{ iosTemplate.chassis }}</mat-label
><br /><br />
</div>
<mat-form-field class="form-field">
<input
matInput
Expand Down Expand Up @@ -89,6 +91,13 @@ <h1 class="col">IOS router template configuration</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select placeholder="Auxiliary console type" [(ngModel)]="iosTemplate.aux_type">
<mat-option *ngFor="let type of consoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [(ngModel)]="iosTemplate.console_auto_start"> Auto start console </mat-checkbox>
</mat-expansion-panel>
<mat-expansion-panel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,20 @@ <h1 class="col">New QEMU VM template</h1>
</mat-form-field>
</mat-step>

<mat-step label="Auxiliary console type" [completed]="qemuTemplate.aux_type">
<mat-form-field class="form-field">
<mat-select
placeholder="Auxiliary console type"
[(ngModel)]="qemuTemplate.aux_type"
[ngModelOptions]="{ standalone: true }"
>
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
</mat-step>

<mat-step label="Disk image">
<form [formGroup]="diskForm">
<mat-radio-group class="radio-group">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
selectedPlatform: string;
ramMemory: number;
consoleTypes: string[] = [];
auxConsoleTypes: string[] = [];
newImageSelected: boolean = false;
qemuImages: QemuImage[] = [];
selectedImage: QemuImage;
Expand Down Expand Up @@ -113,6 +114,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
this.selectPlatform = this.configurationService.getPlatform();
this.selectedPlatform = this.selectPlatform[0];
this.consoleTypes = this.configurationService.getConsoleTypes();
this.auxConsoleTypes = this.configurationService.getAuxConsoleTypes();
});

this.uploadServiceService.currentCancelItemDetails.subscribe((isCancel) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ <h1 class="col">QEMU VM template configuration</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select placeholder="Auxiliary console type" [(ngModel)]="qemuTemplate.aux_type">
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [(ngModel)]="qemuTemplate.console_auto_start"> Auto start console </mat-checkbox>
</mat-expansion-panel>
<mat-expansion-panel>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
qemuTemplate: QemuTemplate;
isSymbolSelectionOpened: boolean = false;
consoleTypes: string[] = [];
auxConsoleTypes: string[] = [];
diskInterfaces: string[] = [];
networkTypes = [];
bootPriorities = [];
Expand Down Expand Up @@ -72,6 +73,7 @@ export class QemuVmTemplateDetailsComponent implements OnInit {

getConfiguration() {
this.consoleTypes = this.configurationService.getConsoleTypes();
this.auxConsoleTypes = this.configurationService.getAuxConsoleTypes();
this.diskInterfaces = this.configurationService.getDiskInterfaces();
this.networkTypes = this.configurationService.getNetworkTypes();
this.bootPriorities = this.configurationService.getBootPriorities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,17 @@ <h1 mat-dialog-title>Configurator for node {{ name }}</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select
[ngModelOptions]="{ standalone: true }"
placeholder="Auxiliary console type"
[(ngModel)]="node.aux_type"
>
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [ngModelOptions]="{ standalone: true }" [(ngModel)]="node.console_auto_start">
Auto start console
</mat-checkbox>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
name: string;
generalSettingsForm: UntypedFormGroup;
consoleTypes: string[] = [];
auxConsoleTypes: string[] = [];
consoleResolutions: string[] = ['2560x1440', '1920x1080', '1680x1050', '1440x900', '1366x768', '1280x1024', '1280x800', '1024x768', '800x600', '640x480'];
private conf = {
autoFocus: false,
Expand Down Expand Up @@ -60,6 +61,7 @@ export class ConfiguratorDialogDockerComponent implements OnInit {

getConfiguration() {
this.consoleTypes = this.dockerConfigurationService.getConsoleTypes();
this.auxConsoleTypes = this.dockerConfigurationService.getAuxConsoleTypes();
}

configureCustomAdapters() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ <h1 mat-dialog-title>Configurator for node {{ name }}</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select placeholder="Auxiliary console type" [(ngModel)]="node.aux_type">
<mat-option *ngFor="let type of consoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [(ngModel)]="node.console_auto_start"> Auto start console </mat-checkbox><br />
</mat-tab>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ <h1 mat-dialog-title>Configurator for node {{ name }}</h1>
</mat-option>
</mat-select>
</mat-form-field>
<mat-form-field class="select">
<mat-select placeholder="Auxiliary console type" [(ngModel)]="node.aux_type">
<mat-option *ngFor="let type of auxConsoleTypes" [value]="type">
{{ type }}
</mat-option>
</mat-select>
</mat-form-field>
<mat-checkbox [(ngModel)]="node.properties.console_auto_start"> Auto start console </mat-checkbox>
</mat-tab>
<mat-tab label="HDD">
Expand Down
1 change: 1 addition & 0 deletions src/app/models/templates/docker-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class DockerTemplate {
console_http_port: number;
console_resolution: string;
console_type: string;
aux_type: string;
custom_adapters: CustomAdapter[];
default_name_format: string;
environment: string;
Expand Down
1 change: 1 addition & 0 deletions src/app/models/templates/ios-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export class IosTemplate {
compute_id: string;
console_auto_start: boolean;
console_type: string;
aux_type: string;
default_name_format: string;
disk0: number;
disk1: number;
Expand Down
1 change: 1 addition & 0 deletions src/app/models/templates/qemu-template.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export class QemuTemplate {
compute_id: string;
console_auto_start: boolean;
console_type: string;
aux_type: string;
cpu_throttling: number;
cpus: number;
custom_adapters: CustomAdapter[];
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/docker-configuration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ export class DockerConfigurationService {
return ['telnet', 'vnc', 'http', 'https', 'none'];
}

getAuxConsoleTypes() {
return ['telnet', 'none'];
}

getCategories() {
let categories = [
['Default', 'guest'],
Expand Down
4 changes: 4 additions & 0 deletions src/app/services/qemu-configuration.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ export class QemuConfigurationService {
return ['telnet', 'vnc', 'spice', 'spice+agent', 'none'];
}

getAuxConsoleTypes() {
return ['telnet', 'none'];
}

getDiskInterfaces() {
return ['ide', 'sata', 'scsi', 'sd', 'mtd', 'floppy', 'pflash', 'virtio', 'nvme', 'none'];
}
Expand Down
2 changes: 2 additions & 0 deletions src/app/services/qemu.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ describe('QemuService', () => {
compute_id: 'local',
console_auto_start: false,
console_type: 'telnet',
aux_type: 'none',
cpu_throttling: 0,
cpus: 1,
custom_adapters: [],
Expand Down Expand Up @@ -102,6 +103,7 @@ describe('QemuService', () => {
compute_id: 'local',
console_auto_start: false,
console_type: 'telnet',
aux_type: 'none',
cpu_throttling: 0,
cpus: 1,
custom_adapters: [],
Expand Down
3 changes: 3 additions & 0 deletions src/app/services/template-mocks.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export class TemplateMocksService {
compute_id: 'local',
console_auto_start: false,
console_type: 'telnet',
aux_type: 'none',
cpu_throttling: 0,
cpus: 1,
custom_adapters: [],
Expand Down Expand Up @@ -172,6 +173,7 @@ export class TemplateMocksService {
compute_id: 'local',
console_auto_start: false,
console_type: 'telnet',
aux_type: 'none',
default_name_format: 'R{0}',
disk0: 0,
disk1: 0,
Expand Down Expand Up @@ -239,6 +241,7 @@ export class TemplateMocksService {
console_http_port: 80,
console_resolution: '1024x768',
console_type: 'telnet',
aux_type: 'none',
custom_adapters: [],
default_name_format: '{name}-{0}',
environment: '',
Expand Down

0 comments on commit c9c043b

Please sign in to comment.