-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix nav bar issue. Start adding external game hosts. * Fixed a bug that made it impossible to add manual team bonuses if the team hadn't finished any challenges. * More work on external hosts and unity cleanup * Allow console names to contain team/challenge names if provided by querystring. * More work on external hosts * Renamed "unattempted" to "remaining" challenges on the scoreboard * More work on deleting external hosts, gag. * Fix some delete host bugs * More styling for external hosts * Cleanup of console title stuff * Restyle new game controls slightly * Misc cleanup * Allow external + practice + sync start combos * Disable practice share button if no search term * Remove 'manager'. Improve invite ux. * Add site usage report. no longer restrict external games to sync start in guards * Prune a runaway scoreboard subscription * Add loading indicator for clicking the ready button * Add new team session start endpoint * Display external host url on game admin page * Change title of external game page * Improve deployment admin styling. Add missing link to deployment in table view * refactor to support individual team playability * Add report descriptions, disable export for some reports. * Finish site usage report * Updates to site usage * Changes to support deploy refactor * Minor cleanup * Improved handling for game hub events * Minor player enroll ux updates * add team ids property to game hub events * Listen to all launch events on external game page. * External loading bugs * Fix launch progress game hub service bug * Fix progress bars on external game load * Add 'copy ticket comment' * Add client info endpoint * Add UI for predeploy in players menu * Fix deploy resources event wireup * Fix error rendering on external game page * Fix bad api url * Add loading indicator for session start * Correct view logic for start session button * Fix conflicting var name collision * Change team external host url on the admin page to copy on click * Slightly improve UX of invitation code generation
- Loading branch information
1 parent
894d1d7
commit 90fa4f1
Showing
112 changed files
with
1,480 additions
and
1,107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...components/delete-external-game-host-modal/delete-external-game-host-modal.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<app-modal-content *ngIf="deleteHost; else loading" title="Delete External Host" confirmButtonText="Yes, delete" | ||
cancelButtonText="No, don't delete" (confirm)="handleConfirm(replaceHost)" [isDangerConfirm]="true"> | ||
<app-error-div [errors]="errors"></app-error-div> | ||
<div class="used-by-games-container" *ngIf="deleteHost.usedByGames.length"> | ||
This external game host is in use{{ deleteHost.usedByGames.length === 1 ? " by the game " + | ||
deleteHost!.usedByGames[0].name : "" }}. To delete it, you'll need to transfer the games | ||
it's currently hosting to another host. | ||
|
||
<ul *ngIf="deleteHost.usedByGames.length > 1"> | ||
<li *ngFor="let game of deleteHost.usedByGames">{{game.name}}</li> | ||
</ul> | ||
</div> | ||
<div class="form-group"> | ||
<label for="target-host">Transfer these games to host</label> | ||
<select id="target-host" name="target-host" class="form-control" [(ngModel)]="replaceHost"> | ||
<option *ngFor="let host of hosts" [ngValue]="host">{{host.name}} ({{host.hostUrl}})</option> | ||
</select> | ||
</div> | ||
</app-modal-content> | ||
|
||
<ng-template #loading> | ||
<app-spinner>Loading the host...</app-spinner> | ||
</ng-template> |
Empty file.
52 changes: 52 additions & 0 deletions
52
...n/components/delete-external-game-host-modal/delete-external-game-host-modal.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { ExternalGameHost } from '@/api/game-models'; | ||
import { ExternalGameService } from '@/services/external-game.service'; | ||
import { Component, OnInit } from '@angular/core'; | ||
|
||
@Component({ | ||
selector: 'app-delete-external-game-host-modal', | ||
templateUrl: './delete-external-game-host-modal.component.html', | ||
styleUrls: ['./delete-external-game-host-modal.component.scss'] | ||
}) | ||
export class DeleteExternalGameHostModalComponent implements OnInit { | ||
deleteHostId?: string; | ||
deleted?: (migratedToHostId: string) => void | Promise<void>; | ||
|
||
protected deleteHost?: ExternalGameHost; | ||
protected replaceHost?: ExternalGameHost; | ||
protected errors: any[] = []; | ||
protected hosts: ExternalGameHost[] = []; | ||
|
||
constructor(private externalGameService: ExternalGameService) { } | ||
|
||
async ngOnInit(): Promise<void> { | ||
if (!this.deleteHostId) | ||
return; | ||
|
||
const response = await this.externalGameService.getHosts(); | ||
|
||
if (response.hosts.length === 0) | ||
this.errors.push("No external hosts configured."); | ||
|
||
this.hosts = response.hosts.filter(h => h.id != this.deleteHostId); | ||
this.deleteHost = response.hosts.find(h => h.id === this.deleteHostId); | ||
this.replaceHost = response.hosts[0]; | ||
} | ||
|
||
protected async handleConfirm(replaceHost?: ExternalGameHost) { | ||
this.errors = []; | ||
|
||
if (!replaceHost) | ||
this.errors.push("Couldn't resolve a replacement host."); | ||
|
||
if (this.deleted) | ||
try { | ||
await this.deleted(replaceHost!.id); | ||
} | ||
catch (err) { | ||
this.errors.push(err); | ||
return false; | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,10 @@ h5 { | |
} | ||
} | ||
|
||
.card-section { | ||
margin: 32px 0 16px; | ||
} | ||
|
||
.team-card { | ||
flex-basis: 48%; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...c/app/admin/components/external-game-host-picker/external-game-host-picker.component.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<div class="d-flex align-items-center"> | ||
<div class="flex-grow-1"> | ||
<select id="external-host-picker" *ngIf="hosts.length; else noHosts" name="external-host-picker" #hostsSelect | ||
class="form-control d-block" [(ngModel)]="selectedHost" (ngModelChange)="handleHostSelect(selectedHost)"> | ||
<option *ngFor="let host of hosts" [ngValue]="host"> | ||
{{host.name}} ({{ host.hostUrl }}) | ||
</option> | ||
</select> | ||
</div> | ||
|
||
<div class="btn-group ml-2"> | ||
<button *ngIf="selectedHostId" class="btn btn-danger" (click)="handleDeleteClick(selectedHostId)" | ||
[disabled]="hosts.length <= 1" tooltip="Delete this host"> | ||
<fa-icon [icon]="fa.trash"></fa-icon> | ||
</button> | ||
<button *ngIf="selectedHostId" class="btn btn-info" (click)="handleEditClick(selectedHostId)" | ||
tooltip="Edit this host's settings"> | ||
<fa-icon [icon]="fa.edit"></fa-icon> | ||
</button> | ||
<button class="btn btn-info" (click)="handleAddClick()" tooltip="Create a new external host"> | ||
<fa-icon [icon]="fa.plus"></fa-icon> | ||
</button> | ||
</div> | ||
</div> | ||
|
||
<ng-template #noHosts> | ||
<span class="text-muted"> | ||
No external hosts have been created. You'll need to <button type="text" class="btn btn-link text-info px-0" | ||
(click)="handleAddClick()">add one</button> to configure this external game. | ||
</span> | ||
</ng-template> |
9 changes: 9 additions & 0 deletions
9
...c/app/admin/components/external-game-host-picker/external-game-host-picker.component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.btn-group { | ||
button { | ||
border-left: solid 1px white; | ||
} | ||
|
||
:first-child { | ||
border-left: none; | ||
} | ||
} |
92 changes: 92 additions & 0 deletions
92
...src/app/admin/components/external-game-host-picker/external-game-host-picker.component.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { Component, EventEmitter, Input, OnInit, Output, SimpleChanges } from '@angular/core'; | ||
import { ExternalGameHost, UpsertExternalGameHost } from '@/api/game-models'; | ||
import { fa } from "@/services/font-awesome.service"; | ||
import { ModalConfirmService } from '@/services/modal-confirm.service'; | ||
import { ExternalHostEditorComponent } from '../external-host-editor/external-host-editor.component'; | ||
import { ExternalGameService } from '@/services/external-game.service'; | ||
import { DeleteExternalGameHostModalComponent } from '../delete-external-game-host-modal/delete-external-game-host-modal.component'; | ||
|
||
@Component({ | ||
selector: 'app-external-game-host-picker', | ||
templateUrl: './external-game-host-picker.component.html', | ||
styleUrls: ['./external-game-host-picker.component.scss'] | ||
}) | ||
export class ExternalGameHostPickerComponent implements OnInit { | ||
@Input() selectedHostId?: string; | ||
@Output() selectedHostIdChange = new EventEmitter<string>(); | ||
@Output() selectedHostChange = new EventEmitter<ExternalGameHost>(); | ||
|
||
protected fa = fa; | ||
protected hosts: ExternalGameHost[] = []; | ||
protected selectedHost?: ExternalGameHost; | ||
|
||
constructor( | ||
private externalGameService: ExternalGameService, | ||
private modalService: ModalConfirmService) { } | ||
|
||
async ngOnInit(): Promise<void> { | ||
await this.loadHosts(this.selectedHostId); | ||
} | ||
|
||
ngOnChanges(changes: SimpleChanges) { | ||
if (changes.selectedHostId && !changes.selectedHostId.firstChange) { | ||
this.selectedHost = this.hosts.find(h => h.id === changes.selectedHostId.currentValue); | ||
} | ||
} | ||
|
||
protected async handleAddClick() { | ||
this.modalService.openComponent({ | ||
content: ExternalHostEditorComponent, | ||
context: { | ||
onSave: async (host) => await this.handleSave(host) | ||
}, | ||
},); | ||
} | ||
|
||
protected handleDeleteClick(hostId: string) { | ||
this.modalService.openComponent({ | ||
content: DeleteExternalGameHostModalComponent, | ||
context: { | ||
deleteHostId: hostId, | ||
deleted: async migratedToHostId => { | ||
await this.externalGameService.deleteHost(hostId, migratedToHostId); | ||
await this.loadHosts(migratedToHostId); | ||
} | ||
}, | ||
}); | ||
} | ||
|
||
protected handleEditClick(hostId: string) { | ||
this.modalService.openComponent({ | ||
content: ExternalHostEditorComponent, | ||
context: { | ||
hostId: hostId, | ||
onSave: async (host) => await this.handleSave(host) | ||
} | ||
}); | ||
} | ||
|
||
protected handleHostSelect(selectedHost?: ExternalGameHost) { | ||
if (!selectedHost?.id) | ||
return; | ||
|
||
this.selectedHostId = selectedHost.id; | ||
this.selectedHost = selectedHost; | ||
this.selectedHostIdChange.emit(selectedHost.id); | ||
this.selectedHostChange.emit(selectedHost); | ||
} | ||
|
||
private async handleSave(host: UpsertExternalGameHost) { | ||
await this.externalGameService.upsertExternalGameHost(host); | ||
await this.loadHosts(host.id); | ||
} | ||
|
||
private async loadHosts(selectedHostId?: string) { | ||
const response = await this.externalGameService.getHosts(); | ||
this.hosts = response?.hosts || []; | ||
|
||
if (selectedHostId) { | ||
this.handleHostSelect(this.hosts.find(h => h.id === selectedHostId)); | ||
} | ||
} | ||
} |
Oops, something went wrong.