Skip to content

Commit

Permalink
MIsc bug fixes to external game deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Nov 17, 2023
1 parent 5caa678 commit df82d95
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h5>Challenges</h5>
</div>
<button type="button" href="#" class="btn btn-info"
(click)="handlePreDeployTeamClick(context.game.id, team.id)"
[class.disabled]="!(team.challenges | externalTeamChallengesToIsPredeployable)">Predeploy</button>
[class.disabled]="!canDeploy">Predeploy</button>
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ h3.sync-session-date {

.team-card {
flex-basis: 48%;
flex-grow: 1;
}

.team-avatars-container {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export class ExternalGameAdminComponent implements OnInit {

protected async handlePreDeployAllClick(gameId: string) {
try {
this.bindOverallDeployStatus("deploying");
await firstValueFrom(this.externalGameService.preDeployAll(gameId));
}
catch (err: any) {
Expand All @@ -98,6 +99,7 @@ export class ExternalGameAdminComponent implements OnInit {

protected async handlePreDeployTeamClick(gameId: string, teamId: string) {
try {
this.bindOverallDeployStatus("deploying");
await firstValueFrom(this.externalGameService.preDeployTeams(gameId, teamId));
}
catch (err: any) {
Expand All @@ -109,6 +111,17 @@ export class ExternalGameAdminComponent implements OnInit {
this.forceRefresh$.next();
}

private bindOverallDeployStatus(overallDeployStatus: DeployStatus) {
this.canDeploy = overallDeployStatus == "notStarted";

if (overallDeployStatus == "deploying") {
this.deployAllTooltip = "Resources are being deployed for this game. Hang tight...";
}
else if (overallDeployStatus == "deployed") {
this.deployAllTooltip = "All of this game's resources have been deployed.";
}
}

private load(gameId: string) {
this.gameId = gameId;
this.ctx$ = this.externalGameService.getAdminContext(gameId).pipe(
Expand All @@ -119,14 +132,7 @@ export class ExternalGameAdminComponent implements OnInit {
tap(ctx => {
// do some fiddly computations to dealing with them in the template
this.appTitleService.set(`${ctx.game.name} : External Game`);
this.canDeploy = ctx.overallDeployStatus == 'notStarted';

if (ctx.overallDeployStatus == "deploying") {
this.deployAllTooltip = "Resources are being deployed for this game. Hang tight...";
}
else if (ctx.overallDeployStatus == "deployed") {
this.deployAllTooltip = "All of this game's resources have been deployed.";
}
this.bindOverallDeployStatus(ctx.overallDeployStatus);

this.sessionDateDescription = "";
if (ctx.startTime && ctx.endTime) {
Expand Down

0 comments on commit df82d95

Please sign in to comment.