Skip to content

Commit

Permalink
fixes for read only mode when following a user (#659)
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-aschlackman authored Apr 26, 2024
1 parent 2f186a9 commit 9796a70
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/app/components/console/console.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
[vmId]="vmId"
(readOnlyChanged)="onReadOnlyChanged($event)"
></app-options-bar>
<app-wmks [readOnly]="readOnly$ | async" [vmId]="vmId"></app-wmks>
<app-wmks [readOnly]="readOnlyInternal" [vmId]="vmId"></app-wmks>
}
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/app/components/console/console.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import { OptionsBar2Component } from '../options-bar2/options-bar2.component';
],
})
export class ConsoleComponent {
@Input() readOnly = false;
@Input({ required: true }) readOnly;

@Input() set vmId(value: string) {
@Input({ required: true }) set vmId(value: string) {
this._vmId = value;
this.vsphereVm$ = this.vsphereQuery.selectEntity(value);
this.virtualMachine$ = this.vmService.get(value);
Expand All @@ -47,17 +47,18 @@ export class ConsoleComponent {
vsphereVm$: Observable<VsphereVirtualMachine>;
virtualMachine$: Observable<Vm>;

readOnlyInternal = false;
readOnlySubject = new BehaviorSubject(this.readOnly);
readOnly$ = this.readOnlySubject.asObservable();
readOnlyManual = false;

get readOnlyInternal() {
return this.readOnlyManual || this.readOnly;
}

constructor(
private vsphereQuery: VsphereQuery,
private vmService: VmService,
) {}

onReadOnlyChanged(event: boolean) {
this.readOnlyInternal = event;
this.readOnlySubject.next(this.readOnlyInternal || this.readOnly);
this.readOnlyManual = event;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<app-novnc
[url]="proxmoxConsole.value?.url"
[ticket]="proxmoxConsole.value?.ticket"
[readOnly]="readOnly"
(reconnect)="getConsole($event)"
></app-novnc>
}

0 comments on commit 9796a70

Please sign in to comment.