diff --git a/projects/gameboard-mks/src/app/components/console/console.component.ts b/projects/gameboard-mks/src/app/components/console/console.component.ts
index 6a440e3a6..223dcc5ff 100644
--- a/projects/gameboard-mks/src/app/components/console/console.component.ts
+++ b/projects/gameboard-mks/src/app/components/console/console.component.ts
@@ -32,7 +32,6 @@ import { LogService } from '@/services/log.service';
})
export class ConsoleComponent implements AfterViewInit, OnDestroy {
@Input() index = 0;
- @Input() viewOnly = false;
@Input() request!: ConsoleRequest;
@ViewChild('consoleCanvas') consoleCanvas!: ElementRef;
@ViewChild('audienceDiv') audienceDiv!: ElementRef;
@@ -40,6 +39,8 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
vmId = '';
console!: ConsoleService;
+ protected isReadOnly = false;
+
state = 'loading';
shadowstate = 'loading';
shadowTimer: any;
@@ -93,19 +94,7 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
this.canvasId = el.id + this.index;
el.id += this.index;
- let teamNameBit = "";
- if (this.request.teamName)
- teamNameBit = `${this.request.teamName} on`
-
- let onConsoleBit = "console";
- if (this.request?.name)
- onConsoleBit = this.request.name;
-
- let challengeNameBit = "";
- if (this.request.challengeName)
- challengeNameBit = ` :: ${this.request.challengeName}`;
-
- this.titleSvc.setTitle(teamNameBit + onConsoleBit + challengeNameBit);
+ this.titleSvc.setTitle(this.buildTitle());
if (!!this.request.observer) {
this.showCog = false;
@@ -121,6 +110,8 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
e.preventDefault();
this.audiencePos = e;
};
+
+ this.isReadOnly = (this.request.observer || "false").toString() === "1";
}
ngOnDestroy(): void {
@@ -219,7 +210,7 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
this.console.connect(info.url, (state: string) => this.changeState(state), {
canvasId: this.canvasId,
- viewOnly: this.viewOnly,
+ viewOnly: this.isReadOnly,
changeResolution: !!this.request.fullbleed,
ticket: info.ticket,
});
@@ -373,4 +364,20 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
this.audiencePos = e;
}
}
+
+ private buildTitle() {
+ let teamNameBit = "";
+ if (this.request.teamName)
+ teamNameBit = `${this.request.teamName} on`
+
+ let onConsoleBit = "console";
+ if (this.request?.name)
+ onConsoleBit = this.request.name;
+
+ let challengeNameBit = "";
+ if (this.request.challengeName)
+ challengeNameBit = ` :: ${this.request.challengeName}`;
+
+ return `${teamNameBit}${onConsoleBit}${challengeNameBit}`
+ }
}
diff --git a/projects/gameboard-mks/src/app/components/console/services/console.service.ts b/projects/gameboard-mks/src/app/components/console/services/console.service.ts
index 498fd252d..93a59f5c6 100644
--- a/projects/gameboard-mks/src/app/components/console/services/console.service.ts
+++ b/projects/gameboard-mks/src/app/components/console/services/console.service.ts
@@ -1,7 +1,6 @@
// Copyright 2021 Carnegie Mellon University.
// Released under a MIT (SEI)-style license. See LICENSE.md in the project root.
-
export interface ConsoleService {
connect(url: string, stateCallback: (state: string) => void, options: any): void;
disconnect(): void;
diff --git a/projects/gameboard-mks/src/app/components/console/services/wmks-console.service.ts b/projects/gameboard-mks/src/app/components/console/services/wmks-console.service.ts
index bd36d0f1d..055bfcc48 100644
--- a/projects/gameboard-mks/src/app/components/console/services/wmks-console.service.ts
+++ b/projects/gameboard-mks/src/app/components/console/services/wmks-console.service.ts
@@ -17,52 +17,50 @@ export class WmksConsoleService implements ConsoleService {
};
stateChanged!: (state: string) => void;
- constructor() { }
-
- connect(url: string, stateCallback: (state: string) => void, options: any = {} ): void {
+ connect(url: string, stateCallback: (state: string) => void, options: any = {}): void {
if (stateCallback) { this.stateChanged = stateCallback; }
- this.options = {...this.options, ...options};
+ this.options = { ...this.options, ...options };
if (this.wmks) {
this.wmks.destroy();
this.wmks = null;
}
- let wmks = WMKS.createWMKS(options.canvasId, this.options)
- .register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, (event: any, data: any) => {
-
- switch (data.state) {
- case WMKS.CONST.ConnectionState.CONNECTED:
- stateCallback('connected');
- break;
-
- case WMKS.CONST.ConnectionState.DISCONNECTED:
- stateCallback('disconnected');
- wmks.destroy();
- wmks = null;
- break;
- }
- })
- .register(WMKS.CONST.Events.REMOTE_SCREEN_SIZE_CHANGE, (e: any, data: any) => {
- // console.log('wmks remote_screen_size_change: ' + data.width + 'x' + data.height);
- // TODO: if embedded, pass along dimension to canvas wrapper element
- })
- .register(WMKS.CONST.Events.HEARTBEAT, (e: any, data: any) => {
+ let wmks = WMKS
+ .createWMKS(options.canvasId, this.options)
+ .register(WMKS.CONST.Events.CONNECTION_STATE_CHANGE, (event: any, data: any) => {
+ switch (data.state) {
+ case WMKS.CONST.ConnectionState.CONNECTED:
+ stateCallback('connected');
+ break;
+
+ case WMKS.CONST.ConnectionState.DISCONNECTED:
+ stateCallback('disconnected');
+ wmks.destroy();
+ wmks = null;
+ break;
+ }
+ })
+ .register(WMKS.CONST.Events.REMOTE_SCREEN_SIZE_CHANGE, (e: any, data: any) => {
+ // console.log('wmks remote_screen_size_change: ' + data.width + 'x' + data.height);
+ // TODO: if embedded, pass along dimension to canvas wrapper element
+ })
+ .register(WMKS.CONST.Events.HEARTBEAT, (e: any, data: any) => {
// debug('wmks heartbeat: ' + data);
// console.log('wmks heartbeat: ' + data);
- })
- .register(WMKS.CONST.Events.COPY, (e: any, data: any) => {
+ })
+ .register(WMKS.CONST.Events.COPY, (e: any, data: any) => {
// console.log('wmks copy: ' + data);
stateCallback('clip:' + data);
- })
- .register(WMKS.CONST.Events.ERROR, (e: any, data: any) => {
+ })
+ .register(WMKS.CONST.Events.ERROR, (e: any, data: any) => {
// debug('wmks error: ' + data.errorType);
- })
- .register(WMKS.CONST.Events.FULL_SCREEN_CHANGE, (e: any, data: any) => {
+ })
+ .register(WMKS.CONST.Events.FULL_SCREEN_CHANGE, (e: any, data: any) => {
// debug('wmks full_screen_change: ' + data.isFullScreen);
- });
+ });
this.wmks = wmks;
@@ -77,7 +75,7 @@ export class WmksConsoleService implements ConsoleService {
if (this.wmks) {
this.wmks.disconnect();
this.stateChanged('disconnected');
- if (this.options.hideDisconnectedScreen ) {
+ if (this.options.hideDisconnectedScreen) {
this.dispose();
}
}
diff --git a/projects/gameboard-ui/src/app/game/components/session-start-controls/session-start-controls.component.html b/projects/gameboard-ui/src/app/game/components/session-start-controls/session-start-controls.component.html
index fc9a22f8b..6d2392741 100644
--- a/projects/gameboard-ui/src/app/game/components/session-start-controls/session-start-controls.component.html
+++ b/projects/gameboard-ui/src/app/game/components/session-start-controls/session-start-controls.component.html
@@ -50,7 +50,7 @@
Game Connection Error
-
Start Session
diff --git a/projects/gameboard-ui/src/app/game/pages/gameboard-page/gameboard-page.component.ts b/projects/gameboard-ui/src/app/game/pages/gameboard-page/gameboard-page.component.ts
index c617b728a..1a030d65c 100644
--- a/projects/gameboard-ui/src/app/game/pages/gameboard-page/gameboard-page.component.ts
+++ b/projects/gameboard-ui/src/app/game/pages/gameboard-page/gameboard-page.component.ts
@@ -116,6 +116,7 @@ export class GameboardPageComponent {
this.unsub.add(
this.selecting$.pipe(
// If s.instance does not exist, fetch; otherwise, preview
+ tap(() => this.deploying = false),
switchMap(s => !!s.instance && !!s.instance.state
? of(s)
: (!!s.instance
@@ -143,7 +144,7 @@ export class GameboardPageComponent {
}
}
- syncOne = (c: Challenge): BoardSpec => {
+ syncOne(c: Challenge): BoardSpec {
this.deploying = false;
if (!c) {
@@ -164,7 +165,7 @@ export class GameboardPageComponent {
}
return s || {} as BoardSpec;
- };
+ }
select(spec: BoardSpec): void {
if (!spec.disabled && !spec.locked && (!this.selected?.id || this.selected.id !== spec.id)) {
@@ -241,7 +242,7 @@ export class GameboardPageComponent {
try {
new URL(vm.id);
isUrl = true;
- } catch (_) {
+ } catch {
isUrl = false;
}
diff --git a/projects/gameboard-ui/src/app/game/player-session/player-session.component.html b/projects/gameboard-ui/src/app/game/player-session/player-session.component.html
index a60274c08..86a56be5e 100644
--- a/projects/gameboard-ui/src/app/game/player-session/player-session.component.html
+++ b/projects/gameboard-ui/src/app/game/player-session/player-session.component.html
@@ -32,7 +32,7 @@
+ btnClass="btn btn-sm btn-danger" (confirm)="handleReset(ctx.player)">
Reset Session