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

CSCEXAM-1400 Limit navbar item visibility when on exam machine #1185

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion app/controllers/user/SessionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,9 @@ public class SessionController extends BaseController {
"x-exam-wrong-room",
"wrongRoomData",
"x-exam-wrong-agent-config",
"wrongAgent"
"wrongAgent",
"x-exam-aquarium-login",
"aquariumLogin"
);

@Inject
Expand Down
2 changes: 2 additions & 0 deletions app/repository/EnrolmentRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ private void handleUpcomingEnrolment(
if (
enrolment.getExam() != null && enrolment.getExam().getImplementation() == Exam.Implementation.AQUARIUM
) {
// If user is on a correct aquarium machine then always set a header
headers.put("x-exam-aquarium-login", "true");
// Aquarium exam, don't set headers unless it starts in 5 minutes
DateTime threshold = DateTime.now().plusMinutes(5);
DateTime start = dateTimeHandler.normalize(
Expand Down
3 changes: 2 additions & 1 deletion app/system/SystemFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class SystemFilter @Inject() (implicit val mat: Materializer, ec: ExecutionConte
("x-exam-wrong-machine", "wrongMachineData"),
("x-exam-unknown-machine", "unknownMachineData"),
("x-exam-wrong-room", "wrongRoomData"),
("x-exam-wrong-agent-config", "wrongAgent")
("x-exam-wrong-agent-config", "wrongAgent"),
("x-exam-aquarium-login", "aquariumLogin")
)

import ResultImplicits._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { format } from 'date-fns';
import { DatePickerComponent } from 'src/app/shared/date/date-picker.component';
Expand Down Expand Up @@ -39,7 +38,7 @@ import { FileService } from 'src/app/shared/file/file.service';
`,
selector: 'xm-answers-report',
standalone: true,
imports: [DatePickerComponent, NgbPopover, TranslateModule],
imports: [DatePickerComponent, TranslateModule],
})
export class AnswersReportComponent {
startDate: Date | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component, Input } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { FileService } from 'src/app/shared/file/file.service';
Expand Down Expand Up @@ -36,7 +35,7 @@ import { Option } from 'src/app/shared/select/select.model';
`,
selector: 'xm-enrolments-report',
standalone: true,
imports: [DropdownSelectComponent, NgbPopover, TranslateModule],
imports: [DropdownSelectComponent, TranslateModule],
})
export class EnrolmentsReportComponent {
@Input() examNames: Option<string, number>[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component, Input } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { FileService } from 'src/app/shared/file/file.service';
Expand Down Expand Up @@ -39,7 +38,7 @@ import { Option } from 'src/app/shared/select/select.model';
`,
selector: 'xm-exams-report',
standalone: true,
imports: [DropdownSelectComponent, NgbPopover, TranslateModule],
imports: [DropdownSelectComponent, TranslateModule],
})
export class ExamsReportComponent {
@Input() examNames: Option<string, number>[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { DatePickerComponent } from 'src/app/shared/date/date-picker.component';
import { FileService } from 'src/app/shared/file/file.service';
Expand Down Expand Up @@ -38,7 +37,7 @@ import { FileService } from 'src/app/shared/file/file.service';
`,
selector: 'xm-records-report',
standalone: true,
imports: [DatePickerComponent, NgbPopover, TranslateModule],
imports: [DatePickerComponent, TranslateModule],
})
export class RecordsReportComponent {
startDate: Date | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { format } from 'date-fns';
import { DatePickerComponent } from 'src/app/shared/date/date-picker.component';
Expand Down Expand Up @@ -38,7 +37,7 @@ import { FileService } from 'src/app/shared/file/file.service';
`,
selector: 'xm-reviews-report',
standalone: true,
imports: [DatePickerComponent, NgbPopover, TranslateModule],
imports: [DatePickerComponent, TranslateModule],
})
export class ReviewsReportComponent {
startDate: Date | null = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component, Input } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { format } from 'date-fns';
import { ToastrService } from 'ngx-toastr';
Expand Down Expand Up @@ -53,7 +52,7 @@ import { Option } from 'src/app/shared/select/select.model';
`,
selector: 'xm-rooms-report',
standalone: true,
imports: [DropdownSelectComponent, DatePickerComponent, NgbPopover, TranslateModule],
imports: [DropdownSelectComponent, DatePickerComponent, TranslateModule],
})
export class RoomsReportComponent {
@Input() rooms: Option<ExamRoom, number>[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component, Input } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { format } from 'date-fns';
import { ToastrService } from 'ngx-toastr';
Expand Down Expand Up @@ -51,7 +50,7 @@ import { Option } from 'src/app/shared/select/select.model';
`,
selector: 'xm-students-report',
standalone: true,
imports: [DropdownSelectComponent, DatePickerComponent, NgbPopover, TranslateModule],
imports: [DropdownSelectComponent, DatePickerComponent, TranslateModule],
})
export class StudentsReportComponent {
@Input() students: Option<User, number>[] = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// SPDX-License-Identifier: EUPL-1.2

import { Component, Input } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { format } from 'date-fns';
import { ToastrService } from 'ngx-toastr';
Expand Down Expand Up @@ -51,7 +50,7 @@ import { Option } from 'src/app/shared/select/select.model';
`,
selector: 'xm-teachers-report',
standalone: true,
imports: [DropdownSelectComponent, DatePickerComponent, NgbPopover, TranslateModule],
imports: [DropdownSelectComponent, DatePickerComponent, TranslateModule],
})
export class TeachersReportComponent {
@Input() teachers: Option<User, number>[] = [];
Expand Down
8 changes: 8 additions & 0 deletions ui/src/app/app.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ export const APP_ROUTES: Route[] = [
import('./enrolment/waiting-room/waiting-room.component').then((mod) => mod.WaitingRoomComponent),
title: () => buildTitle('i18n_waiting_room_title'),
},
{
path: 'early',
loadComponent: () =>
import('./enrolment/waiting-room/waiting-room-early.component').then(
(mod) => mod.WaitingRoomEarlyComponent,
),
title: () => buildTitle('i18n_waiting_room_title'),
},
{
path: 'wrongroom/:eid/:mid',
loadComponent: () =>
Expand Down
4 changes: 0 additions & 4 deletions ui/src/app/calendar/calendar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ import { PageContentComponent } from 'src/app/shared/components/page-content.com
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { DateTimeService } from 'src/app/shared/date/date.service';
import { ConfirmationDialogService } from 'src/app/shared/dialogs/confirmation-dialog.service';
import { HistoryBackComponent } from 'src/app/shared/history/history-back.component';
import { CourseCodeComponent } from 'src/app/shared/miscellaneous/course-code.component';
import { AutoFocusDirective } from 'src/app/shared/select/auto-focus.directive';
import { ExamInfo, Organisation } from './calendar.model';
import { CalendarService } from './calendar.service';
import { CalendarExamInfoComponent } from './helpers/exam-info.component';
Expand All @@ -32,8 +30,6 @@ import { SlotPickerComponent } from './helpers/slot-picker.component';
styleUrls: ['./calendar.component.scss'],
standalone: true,
imports: [
HistoryBackComponent,
AutoFocusDirective,
CalendarExamInfoComponent,
OptionalSectionsComponent,
OrganisationPickerComponent,
Expand Down
8 changes: 5 additions & 3 deletions ui/src/app/calendar/helpers/selected-room.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: EUPL-1.2

import { DatePipe, NgClass, NgIf, UpperCasePipe } from '@angular/common';
import { DatePipe, NgClass, UpperCasePipe } from '@angular/common';
import { Component, Input, OnChanges, OnInit, signal } from '@angular/core';
import { NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
Expand Down Expand Up @@ -71,7 +71,9 @@ import { OrderByPipe } from 'src/app/shared/sorting/order-by.pipe';
{{ period.startsAt | date: 'dd.MM.yyyy HH:mm' }} -
{{ period.endsAt | date: 'dd.MM.yyyy HH:mm' }}
{{ period.description }}
<span *ngIf="period.remote" class="text-danger">(remote)</span>
@if (period.remote) {
<span class="text-danger">(remote)</span>
}
</div>
}
</div>
Expand All @@ -96,7 +98,7 @@ import { OrderByPipe } from 'src/app/shared/sorting/order-by.pipe';
`,
styleUrls: ['../calendar.component.scss'],
standalone: true,
imports: [NgClass, NgIf, NgbPopover, UpperCasePipe, DatePipe, TranslateModule, OrderByPipe],
imports: [NgClass, NgbPopover, UpperCasePipe, DatePipe, TranslateModule, OrderByPipe],
})
export class SelectedRoomComponent implements OnInit, OnChanges {
@Input() room!: ExamRoom;
Expand Down
9 changes: 1 addition & 8 deletions ui/src/app/calendar/helpers/slot-picker.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,7 @@ import type { SimpleChanges } from '@angular/core';
import { Component, EventEmitter, Input, OnChanges, OnInit, Output, ViewEncapsulation, signal } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { EventApi, EventInput } from '@fullcalendar/core';
import {
NgbCollapse,
NgbDropdown,
NgbDropdownItem,
NgbDropdownMenu,
NgbDropdownToggle,
} from '@ng-bootstrap/ng-bootstrap';
import { NgbDropdown, NgbDropdownItem, NgbDropdownMenu, NgbDropdownToggle } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { DateTime } from 'luxon';
import { ToastrService } from 'ngx-toastr';
Expand All @@ -39,7 +33,6 @@ type AvailableSlot = Slot & { availableMachines: number };
standalone: true,
imports: [
NgClass,
NgbCollapse,
NgbDropdown,
NgbDropdownToggle,
NgbDropdownMenu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import type { OnInit } from '@angular/core';
import { Component, EventEmitter, Input, OnDestroy, Output } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Router, RouterLink } from '@angular/router';
import { NgbModal, NgbPopover } from '@ng-bootstrap/ng-bootstrap';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { ToastrService } from 'ngx-toastr';
import { Subject, from } from 'rxjs';
Expand Down Expand Up @@ -37,7 +37,6 @@ import { TeacherListComponent } from 'src/app/shared/user/teacher-list.component
RouterLink,
CourseCodeComponent,
TeacherListComponent,
NgbPopover,
DatePipe,
TranslateModule,
OrderByPipe,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { EnrolmentService } from 'src/app/enrolment/enrolment.service';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { DateTimeService } from 'src/app/shared/date/date.service';
import { HistoryBackComponent } from 'src/app/shared/history/history-back.component';
import { MathJaxDirective } from 'src/app/shared/math/math-jax.directive';
import { CommonExamService } from 'src/app/shared/miscellaneous/common-exam.service';
import { CourseCodeComponent } from 'src/app/shared/miscellaneous/course-code.component';
Expand All @@ -22,7 +21,6 @@ import { TeacherListComponent } from 'src/app/shared/user/teacher-list.component
templateUrl: './exam-enrolment-details.component.html',
standalone: true,
imports: [
HistoryBackComponent,
CourseCodeComponent,
TeacherListComponent,
MathJaxDirective,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import { EnrolmentService } from 'src/app/enrolment/enrolment.service';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { PaginatorComponent } from 'src/app/shared/paginator/paginator.component';
import { AutoFocusDirective } from 'src/app/shared/select/auto-focus.directive';
import { OrderByPipe } from 'src/app/shared/sorting/order-by.pipe';
import { ExamParticipationComponent } from './exam-participation.component';

Expand All @@ -24,7 +23,6 @@ import { ExamParticipationComponent } from './exam-participation.component';
standalone: true,
imports: [
FormsModule,
AutoFocusDirective,
NgbDropdown,
NgbDropdownToggle,
NgbDropdownMenu,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: EUPL-1.2

import { NgFor, NgIf, SlicePipe } from '@angular/common';
import { SlicePipe } from '@angular/common';
import type { OnInit } from '@angular/core';
import { Component, OnDestroy } from '@angular/core';
import { FormsModule } from '@angular/forms';
Expand All @@ -16,7 +16,6 @@ import { EnrolmentService } from 'src/app/enrolment/enrolment.service';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';
import { PaginatorComponent } from 'src/app/shared/paginator/paginator.component';
import { AutoFocusDirective } from 'src/app/shared/select/auto-focus.directive';
import { OrderByPipe } from 'src/app/shared/sorting/order-by.pipe';
import { ExamParticipationComponent } from './exam-participation.component';

Expand All @@ -26,14 +25,11 @@ import { ExamParticipationComponent } from './exam-participation.component';
standalone: true,
imports: [
FormsModule,
AutoFocusDirective,
NgbDropdown,
NgbDropdownToggle,
NgbDropdownMenu,
NgbDropdownItem,
NgFor,
ExamParticipationComponent,
NgIf,
PaginatorComponent,
SlicePipe,
TranslateModule,
Expand Down
28 changes: 28 additions & 0 deletions ui/src/app/enrolment/waiting-room/waiting-room-early.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium
//
// SPDX-License-Identifier: EUPL-1.2

import { Component } from '@angular/core';
import { TranslateModule } from '@ngx-translate/core';
import { PageContentComponent } from 'src/app/shared/components/page-content.component';
import { PageHeaderComponent } from 'src/app/shared/components/page-header.component';

@Component({
selector: 'xm-waiting-room-early',
template: `
<xm-page-header text="i18n_exam_is_about_to_begin" />
<xm-page-content [content]="content" />
<ng-template #content>
<div class="waitingroom-info">
<div class="alert alert-secondary" [attr.aria-live]="'polite'">
<i class="bi bi-exclamation-circle-fill me-2"></i>
<span [attr.aria-live]="'polite'">{{ 'i18n_redirect_to_exam_notice' | translate }}</span>
</div>
</div>
</ng-template>
`,
styleUrls: ['../enrolment.shared.scss'],
standalone: true,
imports: [TranslateModule, PageHeaderComponent, PageContentComponent],
})
export class WaitingRoomEarlyComponent {}
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium
//
// SPDX-License-Identifier: EUPL-1.2

import { NgClass } from '@angular/common';
import { HttpClient } from '@angular/common/http';
import { Component, OnDestroy, OnInit } from '@angular/core';
Expand All @@ -12,10 +16,6 @@ import { ExamService } from 'src/app/exam/exam.service';
import { AutoEvaluationComponent } from './auto-evaluation.component';
import { ExamFeedbackConfigComponent } from './exam-feedback-config.component';

// SPDX-FileCopyrightText: 2024 The members of the EXAM Consortium
//
// SPDX-License-Identifier: EUPL-1.2

@Component({
selector: 'xm-exam-assessment',
templateUrl: './exam-assessment.component.html',
Expand Down
4 changes: 1 addition & 3 deletions ui/src/app/exam/editor/common/course-picker.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ export class CoursePickerService {
constructor(private http: HttpClient) {}

getCourses$ = (filter: string, criteria: string) =>
this.http.get<Course[]>('/app/courses', {
params: { filter: filter, q: criteria },
});
this.http.get<Course[]>('/app/courses', { params: { filter: filter, q: criteria } });
}
Loading
Loading