diff --git a/src/app/components/console-page/console-page.component.html b/src/app/components/console-page/console-page.component.html index 7275cf4..77c060e 100644 --- a/src/app/components/console-page/console-page.component.html +++ b/src/app/components/console-page/console-page.component.html @@ -6,7 +6,11 @@ @if ({ value: readOnly$ | async }; as readOnly) { @if (readOnly.value != null) { - + } } diff --git a/src/app/components/console-page/console-page.component.ts b/src/app/components/console-page/console-page.component.ts index ebf740d..7586a11 100644 --- a/src/app/components/console-page/console-page.component.ts +++ b/src/app/components/console-page/console-page.component.ts @@ -41,14 +41,15 @@ export class ConsolePageComponent implements OnInit, OnDestroy { private signalrRService: SignalRService, private vmQuery: VmQuery, private titleService: Title, - private vmService: VmService, - private authService: ComnAuthService, + public vmService: VmService, ) {} ngOnInit() { this.vmId = this.routerQuery.getParams('id'); this.signalrRService.startConnection().then(() => { + this.signalrRService.joinVm(this.vmId); + if (document.hasFocus()) { this.signalrRService.setActiveVirtualMachine(this.vmId); } @@ -69,6 +70,8 @@ export class ConsolePageComponent implements OnInit, OnDestroy { } ngOnDestroy(): void { + this.signalrRService.leaveVm(this.vmId); + this.unsubscribe$.next(null); this.unsubscribe$.complete(); } diff --git a/src/app/components/console/console.component.html b/src/app/components/console/console.component.html index 1c4bc13..bb30d7e 100644 --- a/src/app/components/console/console.component.html +++ b/src/app/components/console/console.component.html @@ -25,11 +25,11 @@ ) { - + } } } diff --git a/src/app/components/console/console.component.ts b/src/app/components/console/console.component.ts index e21b2d1..84be061 100644 --- a/src/app/components/console/console.component.ts +++ b/src/app/components/console/console.component.ts @@ -27,6 +27,7 @@ import { OptionsBar2Component } from '../options-bar2/options-bar2.component'; }) export class ConsoleComponent { @Input({ required: true }) readOnly; + @Input({ required: true }) allowReadOnlyToggle; @Input({ required: true }) set vmId(value: string) { this._vmId = value; @@ -47,18 +48,8 @@ export class ConsoleComponent { vsphereVm$: Observable; virtualMachine$: Observable; - readOnlyManual = false; - - get readOnlyInternal() { - return this.readOnlyManual || this.readOnly; - } - constructor( private vsphereQuery: VsphereQuery, private vmService: VmService, ) {} - - onReadOnlyChanged(event: boolean) { - this.readOnlyManual = event; - } } diff --git a/src/app/components/options-bar/options-bar.component.html b/src/app/components/options-bar/options-bar.component.html index 165cad7..6086f44 100644 --- a/src/app/components/options-bar/options-bar.component.html +++ b/src/app/components/options-bar/options-bar.component.html @@ -10,7 +10,7 @@ {{ vm?.name }}{{ readOnlyInternal ? ' (Read Only)' : '' }}{{ vm?.name }}{{ readOnly ? ' (Read Only)' : '' }}
@@ -21,7 +21,7 @@
- @if (!readOnly) { + @if (allowReadOnlyToggle) {
- @if (vmService.model.networkCards) { + @if (vsphereService.model.networkCards) { @if ( - vmService.model.canAccessNicConfiguration && - vmService.model.networkCards.availableNetworks.length > 0 + vsphereService.model.canAccessNicConfiguration && + vsphereService.model.networkCards.availableNetworks.length > 0 ) { @for ( - subItem of vmService.model.networkCards + subItem of vsphereService.model.networkCards .availableNetworks; track subItem ) { @@ -271,7 +271,7 @@

{{ task.taskName }} ... {{ task.progress }}%

}
- @if (!readOnlyInternal) { + @if (!readOnly) {