Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3.15.9 #169

Merged
merged 6 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class PlayerRegistrarComponent {
switchMap(() => this.api.list(this.search)),
tap(r => this.source = r),
tap(() => this.isLoading = false),
tap(() => this.viewed = !this.viewed && this.search.term ? this.source.find(p => p.id === this.search.term) : this.viewed),
tap(() => this.review())
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class CopyOnClickDirective implements AfterViewInit {
if (existingOnClick)
existingOnClick();

const text = this.text || this.elementRef.nativeElement.innerHTML;
const text = this.text || this.elementRef.nativeElement.innerHTML.trim();
if (text) {
this.clipboardService.copy(text);
this.toastService.showMessage(`Copied "${text}" to your clipboard.`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export class ScoreboardTeamDetailModalComponent implements OnInit {
.manualBonuses
.map(b => b.pointValue)
.reduce((accumulator, nextValue) => accumulator + nextValue);

}
}

Expand Down
26 changes: 17 additions & 9 deletions projects/gameboard-ui/src/app/services/router.service.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import { ReportKey } from '@/reports/reports-models';
import { Injectable, OnDestroy } from '@angular/core';
import { NavigationEnd, ActivatedRoute, Params, Router, UrlTree } from '@angular/router';
import { Subscription, filter } from 'rxjs';
import { ReportKey } from '@/reports/reports-models';
import { BrowserService } from './browser.service';
import { ObjectService } from './object.service';
import { VmState } from '@/api/board-models';
import { PlayerMode } from '@/api/player-models';
import { ConfigService } from '@/utility/config.service';
import { UserService as LocalUser } from '@/utility/user.service';
import { slug } from "@/tools/functions";
import { PlayerMode } from '@/api/player-models';

export interface QueryParamsUpdate {
parameters: Params,
resetParams?: string[]
}
import { Subscription, filter } from 'rxjs';

@Injectable({ providedIn: 'root' })
export class RouterService implements OnDestroy {
Expand All @@ -28,7 +28,7 @@ export class RouterService implements OnDestroy {
private objectService: ObjectService) { }

public getCurrentPathBase(): string {
let urlTree = this.router.parseUrl(this.router.url);
const urlTree = this.router.parseUrl(this.router.url);
urlTree.queryParams = {};
return urlTree.toString();
}
Expand All @@ -42,11 +42,11 @@ export class RouterService implements OnDestroy {
}

public getAdminChallengeUrl(challengeId: string) {
return this.router.createUrlTree(["admin", "support"], { queryParams: { search: challengeId } }).toString();
return this.buildAppUrlWithQueryParams({ queryParams: { search: challengeId } }, "admin", "support").toString();
}

public getAdminGamePlayerUrl(gameId: string, playerId: string) {
return this.router.createUrlTree(["admin", "registrar", gameId], { queryParams: { term: playerId } });
return this.buildAppUrlWithQueryParams({ queryParams: { term: playerId } }, "admin", "registrar", gameId).toString();
}

public getCertificatePrintableUrl(mode: PlayerMode, challengeSpecOrGameId: string) {
Expand Down Expand Up @@ -143,12 +143,12 @@ export class RouterService implements OnDestroy {
return this.router.createUrlTree(["game", "board", playerId]);
}

public getGamePageUrlTree(gameId: string): UrlTree {
return this.router.parseUrl(`/game/${gameId}`);
public getGamePageUrl(gameId: string) {
return this.buildAppUrl("game", gameId);
}

public goToGamePage(gameId: string) {
this.router.navigateByUrl(this.getGamePageUrlTree(gameId));
this.router.navigateByUrl(this.getGamePageUrl(gameId).toString());
}

public getUnityBoardUrlTree(ctx: { gameId: string, playerId: string, teamId: string; sessionEnd: number }) {
Expand Down Expand Up @@ -178,6 +178,14 @@ export class RouterService implements OnDestroy {
return this.router.navigateByUrl(urlTree);
}

private buildAppUrl(...urlBits: string[]) {
return this.buildAppUrlWithQueryParams(null, ...urlBits);
}

private buildAppUrlWithQueryParams(queryParams: any, ...urlBits: string[]) {
return this.router.createUrlTree([this.config.basehref || "", ...urlBits], { ...queryParams });
}

ngOnDestroy(): void {
this._navEndSub?.unsubscribe();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ export class TicketSupportToolsComponent implements OnInit {
}

if (this.context?.game) {
this.gameboardUrl = hasGame ? this.routerService.getGamePageUrlTree(this.context.game!.id).toString() : undefined;
this.gameboardUrl = hasGame ? this.routerService.getGamePageUrl(this.context.game!.id).toString() : undefined;

if (this.context?.player) {
this.playerAdminUrl = hasGame ? this.routerService.getAdminGamePlayerUrl(this.context.game!.id, this.context.player.id).toString() : undefined;
this.playerAdminUrl = hasGame ? this.routerService.getAdminGamePlayerUrl(this.context.game!.id, this.context.player.id) : undefined;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,8 +263,11 @@ <h4 class="mt-2 d-flex justify-content-between">
<app-inplace-editor [editData]="challenges" [currentText]="changedTicket.challenge?.name || 'None'"
(startEditFunc)="startEditChallenge()"
(selectOptionFunc)="selectChallenge($event)"></app-inplace-editor>
<p *ngIf="changedTicket.challenge" class="mb-0 pt-0 mb-1 px-2 align-items-center small">Support Code:
{{(changedTicket.challenge.id | slice:0:8) + ' ' + changedTicket.challenge.tag}}</p>
<p *ngIf="changedTicket.challenge" class="mb-0 pt-0 mb-1 px-2 align-items-center small">
Support Code: <span appCopyOnClick class="text-info cursor-pointer">{{(changedTicket.challenge.id |
slice:0:8) + ' '
+ (changedTicket.challenge.tag || '')}}</span>
</p>
</div>
<div class="form-group p-0 m-0 mb-4">
<label class="font-weight-bold" for="assignee-input">Game Session <fa-icon
Expand Down
2 changes: 1 addition & 1 deletion projects/gameboard-ui/src/environments/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ export const environment = {
settings: {
appname: 'Gameboard',
apphost: 'http://localhost:5002',
basehref: "gb",
mkshost: 'http://localhost:4201',
imghost: 'http://localhost:5002/img',
tochost: 'http://localhost:5002/doc',
supporthost: 'http://localhost:5002/supportfiles',
gamebrainhost: '',
unityhost: '',
tocfile: '',
countdownStartSecondsAtMinute: 5,
Expand Down
Loading