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

General: Migrate exercise group module to signals, inject and standalone #9891

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cbaaf2d
migrate exercise-group.service
coolchock Nov 27, 2024
e13c7a3
migrate exercise-group-update.component
coolchock Nov 27, 2024
e4fac27
migrate exercise-groups.component
coolchock Nov 27, 2024
e582529
migrate quiz-exercise-group-cell.component
coolchock Nov 27, 2024
cea2cf3
migrate modeling-exercise-group-cell.component
coolchock Nov 27, 2024
4cd8cea
migrate file-exercise-group-cell.component
coolchock Nov 27, 2024
361b4cc
fix file-upload-exercise-group-cell.component
coolchock Nov 27, 2024
159069d
migrate programming-exercise-group-cell.component
coolchock Nov 27, 2024
342e800
fix file-upload-exercise-group-cell.component.spec.ts
coolchock Nov 28, 2024
255172a
fix modeling-exercise-group-cell.component.spec.ts
coolchock Nov 28, 2024
ee5c569
rename variable for file-upload
coolchock Nov 28, 2024
8322b8b
fix quiz-exercise-group-cell.component.spec.ts
coolchock Nov 28, 2024
65b0e6b
fix programming-exercise-group-cell.component.spec.ts
coolchock Nov 28, 2024
e9a561c
Merge branch 'develop' into chore/exercise-groups-client-migration
coolchock Nov 30, 2024
f6a99b6
Merge branch 'develop' into chore/exercise-groups-client-migration
coolchock Dec 3, 2024
662d5db
standalone imports
coolchock Dec 3, 2024
2333679
fix exercise-group-update.component.ts
coolchock Dec 3, 2024
2ba092f
fix cell tests
coolchock Dec 3, 2024
144b991
fix exercise-group-update.component.spec.ts
coolchock Dec 3, 2024
9fb875e
Merge remote-tracking branch 'origin/develop' into chore/exercise-gro…
coolchock Dec 10, 2024
31b3233
fix exercise groups tests
coolchock Dec 10, 2024
8f5ead4
fix test
coolchock Dec 12, 2024
00e3db1
export shared components
coolchock Dec 20, 2024
2c23cbd
Merge branch 'develop' into chore/exercise-groups-client-migration
coolchock Jan 2, 2025
5d48e0c
revert changes to test runs module
coolchock Jan 2, 2025
9d5f0a8
fix tests
coolchock Jan 2, 2025
0dc158e
Merge branch 'develop' into chore/exercise-groups-client-migration
coolchock Jan 2, 2025
f3cf6fa
Merge branch 'develop' into chore/exercise-groups-client-migration
coolchock Jan 3, 2025
7e121d9
remove redundant export
coolchock Jan 3, 2025
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
14 changes: 0 additions & 14 deletions src/main/webapp/app/exam/manage/exam-management.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import { ExamManagementComponent } from 'app/exam/manage/exam-management.compone
import { examManagementState } from 'app/exam/manage/exam-management.route';
import { ExamUpdateComponent } from 'app/exam/manage/exams/exam-update.component';
import { ExamDetailComponent } from 'app/exam/manage/exams/exam-detail.component';
import { ExerciseGroupsComponent } from 'app/exam/manage/exercise-groups/exercise-groups.component';
import { ExerciseGroupUpdateComponent } from 'app/exam/manage/exercise-groups/exercise-group-update.component';
import { ExamStudentsComponent } from 'app/exam/manage/students/exam-students.component';
import { StudentExamsComponent } from 'app/exam/manage/student-exams/student-exams.component';
import { StudentExamDetailComponent } from 'app/exam/manage/student-exams/student-exam-detail.component';
Expand All @@ -26,18 +24,13 @@ import { DurationPipe } from 'app/shared/pipes/artemis-duration.pipe';
import { StudentExamStatusComponent } from 'app/exam/manage/student-exams/student-exam-status/student-exam-status.component';
import { StudentExamSummaryComponent } from 'app/exam/manage/student-exams/student-exam-summary.component';
import { ArtemisParticipationSummaryModule } from 'app/exam/participate/summary/exam-result-summary.module';
import { ExamExerciseRowButtonsComponent } from 'app/exercises/shared/exam-exercise-row-buttons/exam-exercise-row-buttons.component';
import { ArtemisProgrammingExerciseStatusModule } from 'app/exercises/programming/manage/status/programming-exercise-status.module';
import { TestRunManagementComponent } from 'app/exam/manage/test-runs/test-run-management.component';
import { CreateTestRunModalComponent } from 'app/exam/manage/test-runs/create-test-run-modal.component';
import { ArtemisMarkdownModule } from 'app/shared/markdown.module';
import { ExamChecklistComponent } from 'app/exam/manage/exams/exam-checklist-component/exam-checklist.component';
import { ExamChecklistExerciseGroupTableComponent } from 'app/exam/manage/exams/exam-checklist-component/exam-checklist-exercisegroup-table/exam-checklist-exercisegroup-table.component';
import { ArtemisTutorParticipationGraphModule } from 'app/shared/dashboards/tutor-participation-graph/tutor-participation-graph.module';
import { ProgrammingExerciseGroupCellComponent } from './exercise-groups/programming-exercise-cell/programming-exercise-group-cell.component';
import { FileUploadExerciseGroupCellComponent } from './exercise-groups/file-upload-exercise-cell/file-upload-exercise-group-cell.component';
import { ModelingExerciseGroupCellComponent } from './exercise-groups/modeling-exercise-cell/modeling-exercise-group-cell.component';
import { QuizExerciseGroupCellComponent } from './exercise-groups/quiz-exercise-cell/quiz-exercise-group-cell.component';
import { ArtemisTextSubmissionAssessmentModule } from 'app/exercises/text/assess/text-submission-assessment.module';
import { StudentExamDetailTableRowComponent } from 'app/exam/manage/student-exams/student-exam-detail-table-row/student-exam-detail-table-row.component';
import { ExampleSubmissionsModule } from 'app/exercises/shared/example-submission/example-submissions.module';
Expand Down Expand Up @@ -114,9 +107,6 @@ const ENTITY_STATES = [...examManagementState];
ExamManagementComponent,
ExamUpdateComponent,
ExamDetailComponent,
ExerciseGroupsComponent,
ExerciseGroupUpdateComponent,
ExamExerciseRowButtonsComponent,
ExamStudentsComponent,
ExamStudentsAttendanceCheckComponent,
StudentExamStatusComponent,
Expand All @@ -129,10 +119,6 @@ const ENTITY_STATES = [...examManagementState];
ExamChecklistComponent,
ExamChecklistExerciseGroupTableComponent,
ExamStatusComponent,
ProgrammingExerciseGroupCellComponent,
FileUploadExerciseGroupCellComponent,
ModelingExerciseGroupCellComponent,
QuizExerciseGroupCellComponent,
StudentExamDetailTableRowComponent,
ExamImportComponent,
ExamExerciseImportComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, OnInit } from '@angular/core';
import { Component, OnInit, inject } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
import { AlertService } from 'app/core/util/alert.service';
Expand All @@ -8,12 +8,23 @@ import { ExerciseGroupService } from 'app/exam/manage/exercise-groups/exercise-g
import { Exam } from 'app/entities/exam/exam.model';
import { onError } from 'app/shared/util/global.utils';
import { faBan, faSave } from '@fortawesome/free-solid-svg-icons';
import { TranslateDirective } from 'app/shared/language/translate.directive';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
import { NgbAlertModule } from '@ng-bootstrap/ng-bootstrap'; // Import NgbAlertModule
import { FormsModule } from '@angular/forms';

@Component({
selector: 'jhi-exercise-group-update',
templateUrl: './exercise-group-update.component.html',
standalone: true,
imports: [TranslateDirective, FaIconComponent, NgbAlertModule, FormsModule],
})
export class ExerciseGroupUpdateComponent implements OnInit {
private route = inject(ActivatedRoute);
private router = inject(Router);
private exerciseGroupService = inject(ExerciseGroupService);
private alertService = inject(AlertService);

readonly alertType = 'info';
courseId: number;
exam: Exam;
Expand All @@ -23,13 +34,6 @@ export class ExerciseGroupUpdateComponent implements OnInit {
faBan = faBan;
faSave = faSave;

constructor(
private route: ActivatedRoute,
private router: Router,
private exerciseGroupService: ExerciseGroupService,
private alertService: AlertService,
) {}

/**
* Initialize the courseId and exerciseGroup
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
import { Injectable, inject } from '@angular/core';
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs';
import { ExerciseGroup } from 'app/entities/exercise-group.model';
Expand All @@ -9,12 +8,9 @@ type EntityArrayResponseType = HttpResponse<ExerciseGroup[]>;

@Injectable({ providedIn: 'root' })
export class ExerciseGroupService {
public resourceUrl = 'api/courses';
private http = inject(HttpClient);

constructor(
private router: Router,
private http: HttpClient,
) {}
public resourceUrl = 'api/courses';

/**
* Create an exercise group on the server using a POST request.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnInit, inject } from '@angular/core';
import { ActivatedRoute, Router, RouterLink } from '@angular/router';
import { Subject, forkJoin, of } from 'rxjs';
import { catchError } from 'rxjs/operators';
import { ExerciseGroupService } from 'app/exam/manage/exercise-groups/exercise-group.service';
Expand All @@ -13,7 +13,6 @@ import { Course } from 'app/entities/course.model';
import { Exam } from 'app/entities/exam/exam.model';
import dayjs from 'dayjs/esm';
import { ExerciseService } from 'app/exercises/shared/exercise/exercise.service';
import { ProgrammingExerciseParticipationType } from 'app/entities/programming/programming-exercise-participation.model';
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { AlertService } from 'app/core/util/alert.service';
import { EventManager } from 'app/core/util/event-manager.service';
Expand All @@ -34,14 +33,43 @@ import { ExamImportComponent } from 'app/exam/manage/exams/exam-import/exam-impo
import { ExerciseImportWrapperComponent } from 'app/exercises/shared/import/exercise-import-wrapper/exercise-import-wrapper.component';
import { ProfileService } from 'app/shared/layouts/profiles/profile.service';
import { PROFILE_LOCALCI, PROFILE_LOCALVC } from 'app/app.constants';
import { ProgrammingExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/programming-exercise-cell/programming-exercise-group-cell.component';
import { QuizExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/quiz-exercise-cell/quiz-exercise-group-cell.component';
import { ModelingExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/modeling-exercise-cell/modeling-exercise-group-cell.component';
import { FileUploadExerciseGroupCellComponent } from 'app/exam/manage/exercise-groups/file-upload-exercise-cell/file-upload-exercise-group-cell.component';
import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe';
import { ArtemisSharedModule } from 'app/shared/shared.module';
import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module';
import { ExamExerciseRowButtonsComponent } from 'app/exercises/shared/exam-exercise-row-buttons/exam-exercise-row-buttons.component';

@Component({
selector: 'jhi-exercise-groups',
templateUrl: './exercise-groups.component.html',
styleUrls: ['./exercise-groups.component.scss'],
standalone: true,
imports: [
ProgrammingExerciseGroupCellComponent,
QuizExerciseGroupCellComponent,
ModelingExerciseGroupCellComponent,
FileUploadExerciseGroupCellComponent,
ArtemisTranslatePipe,
RouterLink,
ArtemisSharedModule,
ArtemisSharedComponentModule,
ExamExerciseRowButtonsComponent,
],
})
export class ExerciseGroupsComponent implements OnInit {
participationType = ProgrammingExerciseParticipationType;
private route = inject(ActivatedRoute);
private exerciseGroupService = inject(ExerciseGroupService);
exerciseService = inject(ExerciseService);
private examManagementService = inject(ExamManagementService);
private eventManager = inject(EventManager);
private alertService = inject(AlertService);
private modalService = inject(NgbModal);
private router = inject(Router);
private profileService = inject(ProfileService);

courseId: number;
course: Course;
examId: number;
Expand Down Expand Up @@ -69,18 +97,6 @@ export class ExerciseGroupsComponent implements OnInit {
faAngleDown = faAngleDown;
faFileImport = faFileImport;

constructor(
private route: ActivatedRoute,
private exerciseGroupService: ExerciseGroupService,
public exerciseService: ExerciseService,
private examManagementService: ExamManagementService,
private eventManager: EventManager,
private alertService: AlertService,
private modalService: NgbModal,
private router: Router,
private profileService: ProfileService,
) {}

/**
* Initialize the courseId and examId. Get all exercise groups for the exam. Setup dictionary for exercise groups which contain programming exercises.
* See {@link setupExerciseGroupToExerciseTypesDict}.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@if (fileUploadExercise.type === exerciseType.FILE_UPLOAD) {
{{ fileUploadExercise.filePattern || '' }}
@if (exercise().type === exerciseType.FILE_UPLOAD) {
{{ exercise().filePattern || '' }}
}
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
import { Component, Input } from '@angular/core';
import { Component, input } from '@angular/core';
import { ExerciseType } from 'app/entities/exercise.model';
import { FileUploadExercise } from 'app/entities/file-upload-exercise.model';
import { Exercise, ExerciseType } from 'app/entities/exercise.model';

@Component({
selector: 'jhi-file-upload-exercise-group-cell',
templateUrl: './file-upload-exercise-group-cell.component.html',
styles: [':host{display: contents}'],
standalone: true,
})
export class FileUploadExerciseGroupCellComponent {
exerciseType = ExerciseType;

fileUploadExercise: FileUploadExercise;

@Input()
set exercise(exercise: Exercise) {
this.fileUploadExercise = exercise as FileUploadExercise;
}
exercise = input.required<FileUploadExercise>();
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@if (modelingExercise.type === exerciseType.MODELING) {
{{ 'artemisApp.DiagramType.' + modelingExercise.diagramType | artemisTranslate }}
@if (exercise().type === exerciseType.MODELING) {
{{ 'artemisApp.DiagramType.' + exercise().diagramType | artemisTranslate }}
}
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
import { Component, Input } from '@angular/core';
import { Exercise, ExerciseType } from 'app/entities/exercise.model';
import { Component, input } from '@angular/core';
import { ExerciseType } from 'app/entities/exercise.model';
import { ModelingExercise } from 'app/entities/modeling-exercise.model';
import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe';

@Component({
selector: 'jhi-modeling-exercise-group-cell',
templateUrl: './modeling-exercise-group-cell.component.html',
styles: [':host{display: contents}'],
standalone: true,
imports: [ArtemisTranslatePipe],
})
export class ModelingExerciseGroupCellComponent {
exerciseType = ExerciseType;
modelingExercise: ModelingExercise;

@Input()
set exercise(exercise: Exercise) {
this.modelingExercise = exercise as ModelingExercise;
}
exercise = input.required<ModelingExercise>();
}
Loading
Loading