Skip to content

Commit

Permalink
v3.21.0 (#192)
Browse files Browse the repository at this point in the history
* Updates to the map editor to resolve GBAPI #360.

* Start of porting feedback report. Updated to use local dev id server

* WIP - role rework

* Add support for topomox

* Fix novnc package versions.

* Fixes to topomox

* Add NoVNCService provider to console

* Update to fix typescript compiler errors. Allow configuration of hypervisor in settings.

* Misc tweaks for proxmox

* Revert console code to match topo mks code for now.

* Fix feedback report bugs. Update role selection UI in admin -> users.

* npm audit

* Fix navigation bug

* Minor reformatting fixes from test

* Bug fixing and new admin game cards look

* Fix session reset hiding bug

* Add auto-tag for practice

* Add structural directive for permissions

* Fix new structural directive bug

* More hiding stuff for permissions

* Support binding of permission on permission structural directive

* Remove old unpublished icon

* Fix permissions show/hide bugs

* Key changes

* Fix tooltip stuff

* Fix role dropdown, hide api keys and roles as appropriate

* Style roles

* Hide game creation if you can't create

* Fix bug that prevented enroll outside registration window

* Hide add players for ineligible users

* Maybe really fix enroll thing

* Fix out of band registration

* Fix registration out of band

* Really fix out of band registration

* Hide game editor if you can't edit

* Support autotags foundations

* Add game center url to router service

* Fix user registrar false error

* Improvements to autotags and fix login repeat issue

* Update autotag stuff

* More refining autotags and refactor tools stuff

* Fix long-content-hider fadeout bug

* fix notifications admin layout

* Long-content-hider fixes

* Fix game center navigation

* Fix game mapper binding bugs

* Fix game center display issues

* Remove legacy reports link
  • Loading branch information
sei-bstein authored Sep 23, 2024
1 parent 9ea69b8 commit bbb59a9
Show file tree
Hide file tree
Showing 195 changed files with 2,806 additions and 12,190 deletions.
9,810 changes: 441 additions & 9,369 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"scripts": {
"ng": "ng",
"start": "ng serve --project gameboard-ui",
"start-web": "npx ng serve gameboard-ui --host 0.0.0.0 --disable-host-check",
"start-consoles": "npx ng serve gameboard-mks --host 0.0.0.0 --disable-host-check",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
Expand Down Expand Up @@ -32,6 +34,7 @@
"@ngneat/elf-persist-state": "^1.1.6",
"@ngneat/elf-requests": "^1.7.0",
"@ngneat/elf-state-history": "^1.3.0",
"@novnc/novnc": "1.4.0",
"bootstrap": "^4.6.2",
"chart.js": "^3.6.0",
"chartjs-adapter-luxon": "^1.3.1",
Expand Down Expand Up @@ -60,6 +63,7 @@
"@types/luxon": "^3.2.0",
"@types/marked": "^4.3.0",
"@types/node": "^14.18.23",
"@types/novnc__novnc": "1.3.5",
"@types/toastify-js": "^1.11.1",
"@types/uuid": "^9.0.2",
"@typescript-eslint/eslint-plugin": "^5.59.6",
Expand Down
1 change: 1 addition & 0 deletions projects/gameboard-mks/src/app/api.models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface ConsoleSummary {
url: string;
isRunning?: boolean;
isObserver?: boolean;
ticket: string;
error?: string;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

<div #audienceDiv class="audience overlay overlay-tr">
<div class="audience-item" *ngFor="let c of audience | async">{{c.username}}</div>
<!-- <div class="audience-item">t1-player2</div> -->
<!-- <div class="audience-item">t1-player3</div> -->
</div>

<div *ngIf="state==='stopped'||state==='disconnected'" class="align-mm" [class.hidden]="isConnected">
Expand All @@ -40,11 +38,9 @@ <h1>{{shadowstate}}</h1>
<h1 class="text-danger">{{stateIcon}}</h1>
<button class="btn" (click)="stateButtonClicked()">Retry</button>
</div>

</div>

<div *ngIf="isConnected && showTools" class="tools">

<div class="">
<button class="btn cog" (click)="showUtilities()">&#x2699;</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,27 @@ import {
Component, ViewChild, AfterViewInit,
ElementRef, Input, Injector, HostListener, OnDestroy, Renderer2
} from '@angular/core';
import { catchError, debounceTime, map, distinctUntilChanged, tap, finalize, switchMap, filter } from 'rxjs/operators';
import { throwError as ObservableThrower, fromEvent, Subscription, timer, Observable, of, Subject, firstValueFrom } from 'rxjs';
import { Title } from '@angular/platform-browser';
import { throwError as ObservableThrower, fromEvent, Subscription, timer, Observable, Subject, firstValueFrom } from 'rxjs';
import { catchError, debounceTime, map, distinctUntilChanged, tap, finalize, switchMap, filter } from 'rxjs/operators';
import { MockConsoleService } from './services/mock-console.service';
import { NoVNCConsoleService } from './services/novnc-console.service';
import { WmksConsoleService } from './services/wmks-console.service';
import { ConsoleService } from './services/console.service';
import { ConsoleActor, ConsolePresence, ConsoleRequest, ConsoleSummary } from '../../api.models';
import { ApiService } from '../../api.service';
import { ClipboardService } from '../../clipboard.service';
import { HubService } from '../../hub.service';
import { UserActivityListenerEventType } from '../user-activity-listener/user-activity-listener.component';
import { ConfigService } from '@/utility/config.service';

@Component({
selector: 'app-console',
templateUrl: './console.component.html',
styleUrls: ['./console.component.scss'],
providers: [
MockConsoleService,
NoVNCConsoleService,
WmksConsoleService
]
})
Expand Down Expand Up @@ -54,15 +57,14 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
subs: Array<Subscription> = [];
audience: Observable<ConsolePresence[]>;
private audiencePos!: MouseEvent | null;
private audienceEl: any;
private hotspot = { x: 0, y: 0, w: 8, h: 8 };

constructor(
hubSvc: HubService,
private config: ConfigService,
private injector: Injector,
private api: ApiService,
private titleSvc: Title,
private clipSvc: ClipboardService,
private hubSvc: HubService,
private renderer: Renderer2
) {
this.audience = hubSvc.audience;
Expand Down Expand Up @@ -173,14 +175,6 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {
this.changeState('loading');
this.api.action({ ...this.request, action: 'ticket' }).pipe(
catchError((err: Error) => {
// // testing
// return of({
// id: '1234',
// name: 'vm',
// isolationId: '5555',
// url: 'ws://local.mock/ticket/1234',
// isRunning: true
// });
return ObservableThrower(err);
})
).subscribe(
Expand Down Expand Up @@ -208,19 +202,22 @@ export class ConsoleComponent implements AfterViewInit, OnDestroy {

this.vmId = info.id;
this.isMock = !!(info.url.match(/mock/i));
this.console = this.isMock
? this.injector.get(MockConsoleService)
: this.injector.get(WmksConsoleService);

this.console.connect(
info.url,
(state: string) => this.changeState(state),
{
canvasId: this.canvasId,
viewOnly: !!info.isObserver || !!this.request.observer || !!this.viewOnly,
changeResolution: !!this.request.fullbleed
}
);

// resolve the appropriate console service for this hypervisor
if (this.isMock) {
this.console = this.injector.get(MockConsoleService);
} else if (info.ticket != null) {
this.console = this.injector.get(NoVNCConsoleService);
} else {
this.console = this.injector.get(WmksConsoleService);
}

this.console.connect(info.url, (state: string) => this.changeState(state), {
canvasId: this.canvasId,
viewOnly: this.viewOnly,
changeResolution: !!this.request.fullbleed,
ticket: info.ticket,
});
}

start(): void {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
// Copyright 2021 Carnegie Mellon University.
// Released under a 3 Clause BSD-style license. See LICENSE.md in the project root.

import { Injectable } from '@angular/core';
import { ConsoleService } from './console.service';
import NoVncClient from '@novnc/novnc/core/rfb';

@Injectable()
export class NoVNCConsoleService implements ConsoleService {
private client!: NoVncClient;
options: any = {
rescale: true,
changeResolution: false,
useVNCHandshake: false,
position: 0, // WMKS.CONST.Position.CENTER,
};
stateChanged!: (state: string) => void;

constructor() { }

connect(
url: string,
stateCallback: (state: string) => void,
options: any = {}
): void {
if (stateCallback) {
this.stateChanged = stateCallback;
}
this.options = { ...this.options, ...options };

this.client = new NoVncClient(
document.getElementById(this.options.canvasId)!,
url,
{
credentials: {
password: this.options.ticket,
target: '',
username: '',
},
}
);

this.client.viewOnly = this.options.viewOnly;
this.client.scaleViewport = true;

this.client.addEventListener('connect', () => {
stateCallback('connected');
});

this.client.addEventListener('disconnect', () => {
stateCallback('disconnected');
});

this.client.addEventListener('clipboard', (e: CustomEvent<{ text: string }>) => {
stateCallback('clip:' + e.detail.text);
});
}

disconnect(): void { }

sendCAD(): void {
this.client.sendCtrlAltDel();
}

copy(): void { }

async paste(text: string): Promise<void> {
console.log(text);
this.client.clipboardPasteFrom(text);
}

refresh(): void { }

toggleScale(): void {
// if (this.wmks) {
// this.options.rescale = !this.options.rescale;
// this.wmks.setOption('rescale', this.options.rescale);
// }
}

// NOTE: can't seem to set `changeResolution` dynamically
// Tried to set up a button to go fullbleed, but doesn't
// work if changeResolution is false initially
resolve(): void { }

fullscreen(): void { }

showKeyboard(): void { }

showExtKeypad(): void { }

showTrackpad(): void { }

dispose(): void { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,21 @@ <h1 class="admin-header mb-0 pl-0">Administration</h1>

<div class="container mb-4 pb-4">
<nav class="my-2">
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['overview']">Overview</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['overview']">Live</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['dashboard']">Games</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['practice']">Practice Area</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['practice']"
*appIfHasPermission="'Practice_EditSettings'">Practice Area</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['registrar', 'users']">Users</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['registrar', 'players']">Players</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['registrar', 'sponsors']">Sponsors</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['support']"
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['registrar', 'sponsors']"
*appIfHasPermission="'Sponsors_CreateEdit'">Sponsors</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['support']" *appIfHasPermission="'Teams_Observe'"
[routerLinkActiveOptions]="{exact: true}">Challenges</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['support', 'settings']"
[routerLinkActiveOptions]="{exact: true}">Support</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['notifications']">Notifications</a>
*appIfHasPermission="'Support_EditSettings'" [routerLinkActiveOptions]="{exact: true}">Support</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['notifications']"
*appIfHasPermission="'SystemNotifications_CreateEdit'">Notifications</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['permissions']">Permissions</a>
</nav>
<main>
<router-outlet></router-outlet>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,21 @@

import { Component } from '@angular/core';
import { fa } from '@/services/font-awesome.service';
import { UserService } from '@/utility/user.service';
import { Observable } from 'rxjs';
import { ApiUser } from '@/api/user-models';
import { IfHasPermissionDirective } from '@/standalone/directives/if-has-permission.directive';

@Component({
selector: 'app-admin-page',
templateUrl: './admin-page.component.html',
styleUrls: ['./admin-page.component.scss']
styleUrls: ['./admin-page.component.scss'],
})
export class AdminPageComponent {
protected fa = fa;
protected user$?: Observable<ApiUser | null>;

constructor(localUser: UserService) {
this.user$ = localUser.user$;
}
}
Loading

0 comments on commit bbb59a9

Please sign in to comment.