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

Development: Extract client duplicates into re-usable components #7242

Merged
merged 25 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
8085b10
Refactor reuse of working time control and entity name confirmation
aplr Sep 21, 2023
840303b
Replace confirm component in reset-repo-button
aplr Sep 21, 2023
5a56ca3
Fix tests
aplr Sep 22, 2023
30b0e16
Fix tests
aplr Sep 22, 2023
9eb86e8
Add tests for ConfirmEntityNameComponent
aplr Sep 22, 2023
9bb23dd
Fix exam duration change translations
aplr Sep 25, 2023
4195e4a
Merge branch 'develop' into refactor/reuse-client-components
aplr Sep 26, 2023
6932a91
Merge branch 'develop' into refactor/reuse-client-components
aplr Sep 29, 2023
2c20f1b
Merge branch 'develop' into refactor/reuse-client-components
aplr Oct 6, 2023
1c54ae1
Fix data export confirmation dialog tests
aplr Oct 6, 2023
225eb91
Merge branch 'develop' into refactor/reuse-client-components
aplr Oct 10, 2023
81f09ae
Merge commit '4b8bd1511fd1c730fb9a3ae059ac0c2946d6db3e' into refactor…
aplr Oct 15, 2023
e1a9a63
Fix tests
aplr Oct 15, 2023
01d2b7e
Fix tests
aplr Oct 15, 2023
89b75da
Fix tests
aplr Oct 15, 2023
5581fcd
Remove local cypress config from git
aplr Oct 15, 2023
7c3e3d1
Merge commit '60927d04683d23e5e3f76c78efc14defa5d12bed' into refactor…
aplr Oct 15, 2023
0ed34fe
Fix cypress tests
aplr Oct 15, 2023
1549c67
Merge branch 'develop' into refactor/reuse-client-components
aplr Oct 16, 2023
8e37def
Merge branch 'develop' into refactor/reuse-client-components
aplr Oct 20, 2023
4bba37a
Merge branch 'develop' into refactor/reuse-client-components
aplr Nov 6, 2023
41c8f5d
Merge branch 'develop' into refactor/reuse-client-components
aplr Nov 8, 2023
4e736fa
Merge branch 'develop' into refactor/reuse-client-components
aplr Nov 9, 2023
4f64438
Merge branch 'develop' into refactor/reuse-client-components
aplr Nov 27, 2023
23171ba
Merge branch 'develop' into refactor/reuse-client-components
krusche Nov 27, 2023
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 @@ -20,13 +20,16 @@ <h4 class="modal-title">
/>
<label for="request-for-other-user" class="form-check-label">{{ 'artemisApp.dataExport.requestForAnotherUser' | artemisTranslate }}</label>
</div>
<jhi-type-ahead-user-search-field *ngIf="requestForAnotherUser" [(loginOrName)]="expectedLogin"></jhi-type-ahead-user-search-field>
<jhi-type-ahead-user-search-field *ngIf="requestForAnotherUser" [(loginOrName)]="expectedLogin" />
</div>
</div>
<div class="form-group">
<label for="confirm-login" [jhiTranslate]="confirmationTextHint">Please type in your login to confirm</label>
<input id="confirm-login" type="text" class="form-control" name="confirmLogin" [(ngModel)]="enteredLogin" />
</div>
<jhi-confirm-entity-name
[entityName]="expectedLogin"
[confirmationText]="confirmationTextHint"
[disabled]="submitDisabled"
[(ngModel)]="enteredLogin"
name="confirmEntityName"
/>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal" (click)="clear()" [disabled]="submitDisabled">
Expand All @@ -36,8 +39,8 @@ <h4 class="modal-title">
id="request"
type="submit"
class="btn btn-primary"
[style.cursor]="dataExportConfirmationForm.form.invalid || this.enteredLogin !== this.expectedLogin || submitDisabled ? 'not-allowed' : 'pointer'"
[disabled]="dataExportConfirmationForm.form.invalid || this.enteredLogin !== this.expectedLogin || this.enteredLogin?.trim()?.length === 0 || submitDisabled"
[style.cursor]="dataExportConfirmationForm.invalid || submitDisabled ? 'not-allowed' : 'pointer'"
[disabled]="dataExportConfirmationForm.invalid || submitDisabled"
>
<span *ngIf="submitDisabled"><fa-icon [icon]="faSpinner" [spin]="true">&nbsp;</fa-icon>&nbsp;</span>
<fa-icon [icon]="faCheck"></fa-icon>&nbsp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ <h4 class="modal-title">
durationLabelText="artemisApp.examManagement.editWorkingTime.label"
[(ngModel)]="workingTimeSeconds"
[allowNegative]="true"
[showRelative]="false"
[disabled]="isLoading"
/>
</div>
Expand All @@ -29,8 +28,8 @@ <h4 class="modal-title">
confirmationText="artemisApp.examManagement.editWorkingTime.typeNameToConfirm"
[entityName]="exam.title!"
[disabled]="isLoading"
[(ngModel)]="confirmEntityName"
name="confirmEntityName"
ngModel
/>
</div>
</div>
Expand All @@ -42,8 +41,8 @@ <h4 class="modal-title">
id="confirm"
type="submit"
class="btn btn-warning"
[style.cursor]="editForm.invalid || isLoading || !isWorkingTimeValid() ? 'not-allowed' : 'pointer'"
[disabled]="editForm.invalid || isLoading || !isWorkingTimeValid()"
[style.cursor]="editForm.invalid || isLoading || !isWorkingTimeChangeValid ? 'not-allowed' : 'pointer'"
[disabled]="editForm.invalid || isLoading || !isWorkingTimeChangeValid"
>
<span *ngIf="isLoading"><fa-icon [icon]="faSpinner" [spin]="true">&nbsp;</fa-icon>&nbsp;</span>
<fa-icon *ngIf="!isLoading" [icon]="faCheck"></fa-icon>&nbsp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export class ExamEditWorkingTimeDialogComponent {
faSpinner = faSpinner;
faCheck = faCheck;

confirmEntityName: string;

workingTimeSeconds = 0;

get oldWorkingTime() {
Expand All @@ -44,7 +42,7 @@ export class ExamEditWorkingTimeDialogComponent {
}

confirmUpdateWorkingTime(): void {
if (!this.isWorkingTimeValid()) return;
if (!this.isWorkingTimeChangeValid) return;
this.isLoading = true;
this.examManagementService.updateWorkingTime(this.exam.course!.id!, this.exam.id!, this.workingTimeSeconds).subscribe({
next: (res: HttpResponse<Exam>) => {
Expand All @@ -59,7 +57,7 @@ export class ExamEditWorkingTimeDialogComponent {
});
}

isWorkingTimeValid(): boolean {
get isWorkingTimeChangeValid(): boolean {
return Math.abs(this.workingTimeSeconds) !== 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,78 +39,25 @@ <h5><span jhiTranslate="artemisApp.studentExamDetail.student">Student</span></h5
</ol>
</div>
<div class="mb-3" *ngIf="!isTestExam">
<h5><span jhiTranslate="artemisApp.studentExams.workingTime">Working time</span></h5>
<h5 jhiTranslate="artemisApp.studentExams.workingTime">Working time</h5>
<form #form="ngForm" (ngSubmit)="saveWorkingTime()" class="ms-4">
<div class="mb-1 working-time-form">
<div class="input-group mb-1 d-flex justify-content-between align-items-center">
<label for="hours" class="me-4" jhiTranslate="artemisApp.studentExams.setWorkingTime">Absolute:</label>
<input
[(ngModel)]="workingTimeFormValues.hours"
(ngModelChange)="updateVariablesDependingOnWorkingTimeForm()"
[disabled]="isFormDisabled()"
id="hours"
name="hours"
type="number"
class="text-center form-control form-number-input"
min="0"
step="1"
required
/>
<label for="hours" class="input-group-text">h</label>
<input
[(ngModel)]="workingTimeFormValues.minutes"
(ngModelChange)="updateVariablesDependingOnWorkingTimeForm()"
[disabled]="isFormDisabled()"
id="minutes"
name="minutes"
type="number"
class="text-center form-control form-number-input"
min="0"
max="59"
step="1"
required
/>
<label for="minutes" class="input-group-text">min</label>
<input
[(ngModel)]="workingTimeFormValues.seconds"
(ngModelChange)="updateVariablesDependingOnWorkingTimeForm()"
[disabled]="isFormDisabled()"
id="seconds"
name="seconds"
type="number"
class="text-center form-control form-number-input"
min="0"
max="59"
step="1"
required
/>
<label for="seconds" class="input-group-text">s</label>
</div>
<div class="input-group d-flex justify-content-between align-items-center">
<label for="percent" class="me-4 flex-fill" jhiTranslate="artemisApp.studentExams.setWorkingTimeRelative">Addition relative to regular working time:</label>
<input
[(ngModel)]="workingTimeFormValues.percent"
(ngModelChange)="updateWorkingTimeDuration()"
[disabled]="isFormDisabled()"
id="percent"
name="percent"
type="number"
class="text-center form-control form-number-input"
min="-100"
step=".01"
required
/>
<label for="percent" class="input-group-text">%</label>
</div>
</div>
<jhi-working-time-control
name="workingTime"
[relative]="true"
[disabled]="isWorkingTimeFormDisabled"
[(ngModel)]="workingTimeSeconds"
[exam]="studentExam.exam"
durationLabelText="artemisApp.studentExams.setWorkingTime"
relativeLabelText="artemisApp.studentExams.setWorkingTimeRelative"
/>

<p *ngIf="this.workingTimeFormValues.percent">
<p *ngIf="workingTimeSeconds !== studentExam.workingTime">
{{ 'artemisApp.studentExamDetail.endOfIndividualWorkingTime' | artemisTranslate }} {{ individualEndDate | artemisDate: 'long-date' }}
-
{{ individualEndDate | artemisDate: 'time' : true }}
</p>

<button id="save" type="submit" class="btn btn-primary me-2" [disabled]="!form.valid || isFormDisabled()">
<button id="save" type="submit" class="btn btn-primary mt-2" [disabled]="!form.valid || isWorkingTimeFormDisabled">
<fa-icon [icon]="faSave"></fa-icon>
<span jhiTranslate="entity.action.save">Save</span>
</button>
Expand Down Expand Up @@ -140,7 +87,7 @@ <h5><span jhiTranslate="artemisApp.studentExams.participationStatus">Participati
{{ studentExam.submissionDate | artemisDate: 'long' : true }}
</li>
<li *ngIf="gradingScaleExists">
<strong>{{ getGradeExplanation() | artemisTranslate }}:</strong>
<strong>{{ gradeExplanation | artemisTranslate }}:</strong>
{{ grade }}
</li>
<li *ngIf="gradeAfterBonus !== undefined">
Expand All @@ -154,7 +101,7 @@ <h5><span jhiTranslate="artemisApp.studentExams.participationStatus">Participati
</ol>

<div
[ngbTooltip]="!isExamOver() ? ('artemisApp.studentExamDetail.disabledChangeSubmissionStateButtonExplanation' | artemisTranslate) : ''"
[ngbTooltip]="!isExamOver ? ('artemisApp.studentExamDetail.disabledChangeSubmissionStateButtonExplanation' | artemisTranslate) : ''"
placement="right"
class="d-inline"
>
Expand All @@ -163,7 +110,7 @@ <h5><span jhiTranslate="artemisApp.studentExams.participationStatus">Participati
type="button"
*ngIf="course?.isAtLeastInstructor"
(click)="openConfirmationModal(toggleSubmitPopUp)"
[disabled]="!isExamOver() || isSaving"
[disabled]="!isExamOver || isSaving"
id="adjust-submitted-state-button"
>
<span *ngIf="!studentExam.submitted; else toggleNotSubmitted" jhiTranslate="entity.action.toggleToSubmitted"></span>
Expand Down Expand Up @@ -205,6 +152,10 @@ <h4 class="modal-title">
</button>
</div>
</ng-template>
<button class="btn btn-danger mb-3" *ngIf="course?.isAtLeastInstructor && isExamOver" type="button" (click)="openConfirmationModal(toggleSubmitPopUp)" [disabled]="isSaving">
<span *ngIf="!studentExam.submitted" jhiTranslate="entity.action.toggleToSubmitted"></span>
<span *ngIf="studentExam.submitted" jhiTranslate="entity.action.toggleToUnsubmitted"></span>
</button>

<div class="mb-3">
<h5><span jhiTranslate="artemisApp.studentExams.summary">Student Summary</span></h5>
Expand Down Expand Up @@ -268,74 +219,72 @@ <h5><span jhiTranslate="artemisApp.studentExams.examSessions">Sessions</span></h
</div>

<div class="mb-3 mt-3">
<h5><span jhiTranslate="artemisApp.studentExamDetail.exercises">Exercises</span></h5>
<div>
<table class="table table-striped">
<thead>
<tr>
<th class="d-md-table-cell">
<span jhiTranslate="artemisApp.studentExamDetail.id">ID</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.type">Type</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.title">Title</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.result">Your points</span>
</th>
<th>
<span jhiTranslate="artemisApp.exam.examSummary.points.maxPoints">Achievable points</span>
</th>
<th>
<span jhiTranslate="artemisApp.exam.examSummary.points.maxBonus">Achievable bonus points</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.reviewer">Reviewer</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.hasComplaint">Has Complaint</span>
</th>
<th>
<span jhiTranslate="artemisApp.assessment.dashboard.columns.action">Action</span>
</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-exercise [ngForOf]="studentExam.exercises">
<tr
jhi-student-exam-detail-table-row
[course]="course"
[examId]="examId"
[exercise]="exercise"
[busy]="isSaving"
[isTestRun]="isTestRun"
[studentExam]="studentExam"
[achievedPointsPerExercise]="achievedPointsPerExercise"
></tr>
</ng-template>
<tr>
<td></td>
<td></td>
<td class="align-middle">
<span class="text-decoration-underline" jhiTranslate="artemisApp.examScores.overallPointsColumn">Overall Points</span>
</td>
<td class="align-middle">
<u> {{ achievedTotalPoints }} </u>
</td>
<td class="align-middle">
<u> {{ maxTotalPoints }} </u>
</td>
<td class="align-middle">
<u> {{ bonusTotalPoints }} </u>
</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
<h5 jhiTranslate="artemisApp.studentExamDetail.exercises">Exercises</h5>
<table class="table table-striped">
<thead>
<tr>
<th class="d-md-table-cell">
<span jhiTranslate="artemisApp.studentExamDetail.id">ID</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.type">Type</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.title">Title</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.result">Your points</span>
</th>
<th>
<span jhiTranslate="artemisApp.exam.examSummary.points.maxPoints">Achievable points</span>
</th>
<th>
<span jhiTranslate="artemisApp.exam.examSummary.points.maxBonus">Achievable bonus points</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.reviewer">Reviewer</span>
</th>
<th>
<span jhiTranslate="artemisApp.studentExamDetail.hasComplaint">Has Complaint</span>
</th>
<th>
<span jhiTranslate="artemisApp.assessment.dashboard.columns.action">Action</span>
</th>
</tr>
</thead>
<tbody>
<ng-template ngFor let-exercise [ngForOf]="studentExam.exercises">
<tr
jhi-student-exam-detail-table-row
[course]="course"
[examId]="examId"
[exercise]="exercise"
[busy]="isSaving"
[isTestRun]="isTestRun"
[studentExam]="studentExam"
[achievedPointsPerExercise]="achievedPointsPerExercise"
></tr>
</ng-template>
<tr>
<td></td>
<td></td>
<td class="align-middle">
<span class="text-decoration-underline" jhiTranslate="artemisApp.examScores.overallPointsColumn">Overall Points</span>
</td>
<td class="align-middle">
<u> {{ achievedTotalPoints }} </u>
</td>
<td class="align-middle">
<u> {{ maxTotalPoints }} </u>
</td>
<td class="align-middle">
<u> {{ bonusTotalPoints }} </u>
</td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
Loading
Loading