From e63f00446b6da5908a330a45952471569ac1022d Mon Sep 17 00:00:00 2001 From: Andrew Schlackman <72105194+sei-aschlackman@users.noreply.github.com> Date: Tue, 7 May 2024 12:30:16 -0400 Subject: [PATCH 1/2] user follow enhancements - show last vm when following an inactive user and display inactive status - only show connected users on same team (or admin) - added readOnly query param --- .../console-page/console-page.component.html | 6 +- .../console-page/console-page.component.ts | 7 +- .../components/console/console.component.html | 4 +- .../components/console/console.component.ts | 11 +- .../options-bar/options-bar.component.html | 50 +++---- .../options-bar/options-bar.component.ts | 93 ++++++------- .../user-follow-page.component.html | 10 +- .../user-follow-page.component.ts | 28 +++- src/app/components/wmks/wmks.component.ts | 2 +- .../api/vmUsageLoggingSession.service.ts | 14 +- src/app/generated/vm-api/api/vms.service.ts | 122 ++++++++++-------- src/app/generated/vm-api/model/models.ts | 7 +- .../generated/vm-api/model/proxmoxVmInfo.ts | 26 ++++ .../generated/vm-api/model/proxmoxVmType.ts | 20 +++ src/app/generated/vm-api/model/vm.ts | 15 ++- .../generated/vm-api/model/vmCreateForm.ts | 13 +- .../generated/vm-api/model/vmUpdateForm.ts | 11 +- src/app/generated/vm-api/model/vmUser.ts | 7 +- src/app/services/signalr/signalr.service.ts | 46 +++++-- src/app/state/vm/vm.service.ts | 46 ++++++- src/app/state/vsphere/vsphere.service.ts | 12 +- 21 files changed, 343 insertions(+), 207 deletions(-) create mode 100644 src/app/generated/vm-api/model/proxmoxVmInfo.ts create mode 100644 src/app/generated/vm-api/model/proxmoxVmType.ts 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) {