Skip to content

Commit

Permalink
Merge branch 'next' into test
Browse files Browse the repository at this point in the history
  • Loading branch information
sei-bstein committed Dec 5, 2023
2 parents e258af9 + c1fd648 commit f9ee06b
Show file tree
Hide file tree
Showing 25 changed files with 594 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Copyright 2021 Carnegie Mellon University. All Rights Reserved. -->
<!-- Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. -->

<div class="mb-4">
<h1 class="admin-header mb-0">Administration</h1>
<div class="mb-4 container">
<h1 class="admin-header mb-0 pl-0">Administration</h1>
</div>

<div class="container mb-4 pb-4">
Expand All @@ -13,6 +13,7 @@ <h1 class="admin-header mb-0">Administration</h1>
<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']">Challenges</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['notifications']">Notifications</a>
<a class="btn btn-link" routerLinkActive="active" [routerLink]="['report']">Reports</a>
</nav>
<main>
Expand Down
8 changes: 6 additions & 2 deletions projects/gameboard-ui/src/app/admin/admin.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ChallengeObserverComponent } from './challenge-observer/challenge-obser
import { ChallengeReportComponent } from './challenge-report/challenge-report.component';
import { ChallengeSpecEditorComponent } from './components/challenge-spec-editor/challenge-spec-editor.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { DeploymentAdminTeamContextMenuComponent } from './components/deployment-admin-team-context-menu/deployment-admin-team-context-menu.component';
import { ExternalGameAdminComponent } from './components/external-game-admin/external-game-admin.component';
import { ExternalGameAdminPlayerContextMenuComponent } from './components/external-game-admin-player-context-menu/external-game-admin-player-context-menu.component';
import { ExternalGamePlayerStatusToStatusLightPipe } from './pipes/external-game-player-status-to-status-light.pipe';
Expand All @@ -44,12 +45,13 @@ import { ReportPageComponent } from './report-page/report-page.component';
import { SpecBrowserComponent } from './spec-browser/spec-browser.component';
import { SponsorBrowserComponent } from './sponsor-browser/sponsor-browser.component';
import { SupportReportLegacyComponent } from './support-report-legacy/support-report-legacy.component';
import { SystemNotificationsModule } from '@/system-notifications/system-notifications.module';
import { TeamAdminContextMenuComponent } from './components/team-admin-context-menu/team-admin-context-menu.component';
import { TeamObserverComponent } from './team-observer/team-observer.component';
import { UserApiKeysComponent } from './user-api-keys/user-api-keys.component';
import { UserRegistrarComponent } from './user-registrar/user-registrar.component';
import { UserReportComponent } from './user-report/user-report.component';
import { DeploymentAdminTeamContextMenuComponent } from './components/deployment-admin-team-context-menu/deployment-admin-team-context-menu.component';
import { AdminSystemNotificationsComponent } from '@/system-notifications/components/admin-system-notifications/admin-system-notifications.component';

@NgModule({
declarations: [
Expand All @@ -60,6 +62,7 @@ import { DeploymentAdminTeamContextMenuComponent } from './components/deployment
ChallengeReportComponent,
ChallengeSpecEditorComponent,
DashboardComponent,
DeploymentAdminTeamContextMenuComponent,
ExternalGameAdminComponent,
ExternalGameAdminPlayerContextMenuComponent,
ExternalGamePlayerStatusToStatusLightPipe,
Expand Down Expand Up @@ -91,7 +94,6 @@ import { DeploymentAdminTeamContextMenuComponent } from './components/deployment
UserApiKeysComponent,
UserRegistrarComponent,
UserReportComponent,
DeploymentAdminTeamContextMenuComponent,
],
imports: [
CommonModule,
Expand Down Expand Up @@ -122,6 +124,7 @@ import { DeploymentAdminTeamContextMenuComponent } from './components/deployment
{ path: 'report/feedback', component: FeedbackReportComponent },
{ path: 'report/support', component: SupportReportLegacyComponent },
{ path: 'report/participation', component: ParticipationReportComponent },
{ path: "notifications", component: AdminSystemNotificationsComponent },
{ path: 'support', component: ChallengeBrowserComponent }
]
},
Expand All @@ -130,6 +133,7 @@ import { DeploymentAdminTeamContextMenuComponent } from './components/deployment
ApiModule,
UtilityModule,
SponsorsModule,
SystemNotificationsModule,
]
})
export class AdminModule { }
18 changes: 12 additions & 6 deletions projects/gameboard-ui/src/app/api/support-models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information.

import { Challenge, ChallengeOverview, ChallengeSummary } from "./board-models";
import { Player, PlayerOverview } from "./player-models";
import { PlayerOverview } from "./player-models";
import { UserSummary } from "./user-models";

export interface Ticket {
Expand All @@ -29,9 +29,9 @@ export interface Ticket {
attachments: string[];
attachmentFiles: AttachmentFile[]

requester?: UserSummary;
assignee?: UserSummary;
creator?: UserSummary;
requester?: TicketUser;
assignee?: TicketUser;
creator?: TicketUser;
challenge?: ChallengeOverview;
player?: PlayerOverview;

Expand Down Expand Up @@ -126,8 +126,8 @@ export interface TicketActivity {
attachments: string[];
attachmentFiles: AttachmentFile[]

user: UserSummary;
assignee: UserSummary;
user: TicketUser;
assignee: TicketUser;
}

export interface TicketDayReport {
Expand Down Expand Up @@ -185,3 +185,9 @@ export interface TicketNotification {
status: string;
lastUpdated: string;
}

export interface TicketUser {
id: string;
approvedName: string;
isSupportPersonnel: boolean;
}
2 changes: 1 addition & 1 deletion projects/gameboard-ui/src/app/api/support.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable, of } from 'rxjs';
import { catchError, first, last, map, switchMap, tap } from 'rxjs/operators';
import { catchError, first, last, map, tap } from 'rxjs/operators';
import { ConfigService } from '../utility/config.service';
import { ChallengeOverview } from './board-models';
import { PlayerService } from './player.service';
Expand Down
1 change: 1 addition & 0 deletions projects/gameboard-ui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<app-sponsor-select-banner></app-sponsor-select-banner>
<app-nav></app-nav>
</div>
<app-system-notifications></app-system-notifications>
<app-message-board></app-message-board>
<router-outlet></router-outlet>
<footer></footer>
Expand Down
2 changes: 2 additions & 0 deletions projects/gameboard-ui/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { SponsorSelectBannerComponent } from './components/sponsor-select-banner
import { GameboardSignalRHubsComponent } from './components/gameboard-signalr-hubs/gameboard-signalr-hubs.component';
import { SignalRService } from './services/signalR/signalr.service';
import { LogService } from './services/log.service';
import { SystemNotificationsModule } from './system-notifications/system-notifications.module';

@NgModule({
declarations: [
Expand All @@ -52,6 +53,7 @@ import { LogService } from './services/log.service';
AppRoutingModule,
ApiModule,
FontAwesomeModule,
SystemNotificationsModule,
CoreModule,
UtilityModule,
TooltipModule.forRoot(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
<!-- Copyright 2021 Carnegie Mellon University. All Rights Reserved. -->
<!-- Released under a MIT (SEI)-style license. See LICENSE.md in the project root for license information. -->

<div class="mb-4">
<h1 class="support-header mb-0">Support</h1>
<div class="mb-4 container">
<h1 class="support-header mb-0 pl-0">Support</h1>
</div>

<main class=" mb-4 pb-4">

<router-outlet></router-outlet>

</main>

<footer class="p-4 mt-4"></footer>
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,9 @@ <h4 class="mt-2 d-flex justify-content-between">
</span>
</div>
</div>
<div class="card-body" [class.bg-light]="activity.user.id != ctx.ticket.creatorId"
[class.text-dark]="activity.user.id != ctx.ticket.creatorId">
<div class="card-body"
[class.bg-light]="activity.user.isSupportPersonnel && !ctx.ticket.creator?.isSupportPersonnel"
[class.text-dark]="activity.user.isSupportPersonnel && !ctx.ticket.creator?.isSupportPersonnel">
<app-long-content-hider>
<p class="card-text">
<app-render-links-in-text [text]="activity.message"></app-render-links-in-text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { ClipboardService } from "../../utility/services/clipboard.service";
import { ToastService } from '../../utility/services/toast.service';
import { fa } from '../../services/font-awesome.service';
import { LogService } from '../../services/log.service';
import { AppTitleService } from '@/services/app-title.service';

@Component({
selector: 'app-ticket-details',
Expand Down Expand Up @@ -83,6 +84,7 @@ export class TicketDetailsComponent implements AfterViewInit, OnDestroy {
selectedIndex: number = 0;

constructor(
appTitleService: AppTitleService,
private api: SupportService,
private clipboard: ClipboardService,
private logService: LogService,
Expand Down Expand Up @@ -114,6 +116,9 @@ export class TicketDetailsComponent implements AfterViewInit, OnDestroy {
this.savingContent = false;
this.changedTicket = { ...t };
this.id = t.id;

// set the page title
appTitleService.set(`${t.fullKey} | Support`);
}),
tap(t => {
this.currentLabels.clear();
Expand Down Expand Up @@ -360,7 +365,11 @@ export class TicketDetailsComponent implements AfterViewInit, OnDestroy {

selectAssignToMe() {
if (!!this.currentUser) {
this.changedTicket!.assignee = { id: this.currentUser.id, approvedName: this.currentUser.approvedName } as UserSummary;
this.changedTicket!.assignee = {
id: this.currentUser.id,
approvedName: this.currentUser.approvedName,
isSupportPersonnel: true
};
this.changedTicket!.assigneeId = this.currentUser.id;
this.changed$.next(this.changedTicket!);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { faCaretDown, faCaretUp, faCaretLeft, faCaretRight, faComments, faPaperclip, faSearch, faExclamationCircle, faFileDownload } from '@fortawesome/free-solid-svg-icons';
import { Component, OnDestroy } from '@angular/core';
import { BehaviorSubject, Observable, timer, combineLatest, Subscription } from 'rxjs';
import { debounceTime, switchMap, map, tap, first } from 'rxjs/operators';
import { ReportService } from '../../api/report.service';
Expand All @@ -17,7 +16,7 @@ import { fa } from '@/services/font-awesome.service';
templateUrl: './ticket-list.component.html',
styleUrls: ['./ticket-list.component.scss']
})
export class TicketListComponent implements OnInit, OnDestroy {
export class TicketListComponent implements OnDestroy {
subs: Subscription[] = [];
refresh$ = new BehaviorSubject<any>(true);
ctx$: Observable<{ tickets: TicketSummary[]; nextTicket: TicketSummary[]; canManage: boolean; }>;
Expand Down Expand Up @@ -119,9 +118,6 @@ export class TicketListComponent implements OnInit, OnDestroy {
);
}

ngOnInit(): void {
}

ngOnDestroy(): void {
this.subs.forEach(s => s.unsubscribe());
this.config.updateLocal({ lastSeenSupport: Date.now() });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<ng-container>
<h1 class="mt-3">Notifications</h1>

<p>
You can use the Notifications system to post general announcements to players. When they log in, they'll see
a banner for each notification you create (as long as the date is within the start and end date you can
optionally configure below). Once a player dismisses a notification, they won't see it again.
</p>

<div class="notification-controls-container my-4">
<div class="d-flex justify-content-end">
<button type="button" class="btn btn-lg btn-info" (click)="handleCreateNotificationClick()">
&plus; Create Notification
</button>
</div>

<hr class="light" />
</div>

<table class="mt-5">
<col> <!--notification text-->
<col> <!--type-->
<col> <!--dates-->
<col> <!--views-->
<col> <!--edit-->

<thead class="thead-light">
<tr>
<th scope="col">Notification</th>
<th scope="col">Type</th>
<th scope="col">Visible Dates</th>
<th scope="col">Views</th>
<th scope="col"></th>
</tr>
</thead>

<tbody>
<tr class="data-row" *ngFor="let notification of (notifications$ | async)">
<td class="notification-content-cell">
<div class="fs-11">{{notification.title}}</div>
<p class="notification-content m-0">{{ notification.markdownContent }}</p>
</td>

<td>
<span class="badge text-capitalize"
[class.badge-info]="notification.notificationType == 'generalInfo'"
[class.badge-warning]="notification.notificationType == 'warning'"
[class.badge-danger]="notification.notificationType == 'emergency'">
{{notification.notificationType | systemNotificationTypeToText}}
</span>
</td>

<td>
<span *ngIf="notification.startsOn || notification.endsOn; else noValue">
{{ notification.startsOn ? (notification.startsOn | shortdate ) : "?" }}
-
{{ notification.endsOn ? (notification.endsOn | shortdate ) : "?" }}
</span>
</td>

<td>
<div><strong>{{notification.calloutViewCount}}</strong> callout views</div>
<div><strong>{{notification.fullViewCount}}</strong> full views</div>
</td>

<td>
<button type="button" class="btn btn-sm btn-info mr-2"
(click)="handleEditNotificationClick(notification)">Edit</button>
<app-confirm-button btnClass="btn btn-sm btn-danger"
(confirm)="handleDelete(notification.id)">Delete</app-confirm-button>
</td>
</tr>
</tbody>
</table>
</ng-container>

<ng-template #noNotifications>
<p class="text-center">You haven't created any notifications yet. Use the button above to add one!</p>
</ng-template>

<ng-template #noValue>
<p class="text-center">--</p>
</ng-template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.notification-content-cell {
width: 35%;
}

.notification-content {
color: #bababa;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
max-width: 35vw;
}

td, th {
margin: 4px 0;
border-bottom: solid 1px #dedede;
}

tbody td {
padding: 4px;
}
Loading

0 comments on commit f9ee06b

Please sign in to comment.