From a5579eb89ce54397da6e3e9a326bda02e2d00504 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20S=C3=B6lch?= Date: Sun, 5 Jan 2025 21:06:27 +0100 Subject: [PATCH] Development: Migrate client code for complaints (#10085) --- .../assessment/assessment-shared.module.ts | 4 +-- .../complaints/complaint-response.service.ts | 10 +++--- .../app/complaints/complaint.service.ts | 10 +++--- .../complaints-student-view.component.ts | 22 +++++++----- .../complaints-for-tutor.component.ts | 24 +++++++------ .../complaints-for-tutor.module.ts | 14 -------- .../app/complaints/complaints.module.ts | 3 +- .../form/complaints-form.component.ts | 16 +++++---- .../list-of-complaints.component.ts | 34 +++++++++++-------- .../list-of-complaints.module.ts | 4 +-- .../request/complaint-request.component.ts | 7 ++++ .../response/complaint-response.component.ts | 6 ++++ .../course/manage/course-management.module.ts | 4 +-- .../assess/programming-assessment.module.ts | 4 +-- .../programming-repository.module.ts | 6 ++-- .../text-submission-assessment.module.ts | 4 +-- .../assessment-layout.component.spec.ts | 5 +-- .../complaints-for-tutor.component.spec.ts | 19 +++++++---- .../complaints-form.component.spec.ts | 8 +---- .../list-of-complaints.component.spec.ts | 9 ++--- 20 files changed, 110 insertions(+), 103 deletions(-) delete mode 100644 src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts diff --git a/src/main/webapp/app/assessment/assessment-shared.module.ts b/src/main/webapp/app/assessment/assessment-shared.module.ts index a2df1e03cc23..fe386487df8c 100644 --- a/src/main/webapp/app/assessment/assessment-shared.module.ts +++ b/src/main/webapp/app/assessment/assessment-shared.module.ts @@ -6,7 +6,6 @@ import { AssessmentComplaintAlertComponent } from './assessment-complaint-alert/ import { ScoreDisplayComponent } from '../shared/score-display/score-display.component'; import { UnreferencedFeedbackDetailComponent } from 'app/assessment/unreferenced-feedback-detail/unreferenced-feedback-detail.component'; import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module'; -import { ArtemisComplaintsForTutorModule } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.module'; import { AssessmentLocksComponent } from 'app/assessment/assessment-locks/assessment-locks.component'; import { RouterModule } from '@angular/router'; import { assessmentLocksRoute } from 'app/assessment/assessment-locks/assessment-locks.route'; @@ -18,13 +17,14 @@ import { ArtemisFeedbackModule } from 'app/exercises/shared/feedback/feedback.mo import { AssessmentNoteComponent } from 'app/assessment/assessment-note/assessment-note.component'; import { FeedbackContentPipe } from 'app/shared/pipes/feedback-content.pipe'; import { QuotePipe } from 'app/shared/pipes/quote.pipe'; +import { ComplaintsForTutorComponent } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component'; const ENTITY_STATES = [...assessmentLocksRoute]; @NgModule({ imports: [ ArtemisSharedModule, - ArtemisComplaintsForTutorModule, + ComplaintsForTutorComponent, ArtemisSharedComponentModule, RouterModule.forChild(ENTITY_STATES), ArtemisMarkdownModule, diff --git a/src/main/webapp/app/complaints/complaint-response.service.ts b/src/main/webapp/app/complaints/complaint-response.service.ts index 54e801ba687f..4ab4cb080f2e 100644 --- a/src/main/webapp/app/complaints/complaint-response.service.ts +++ b/src/main/webapp/app/complaints/complaint-response.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; @@ -12,12 +12,10 @@ type EntityResponseType = HttpResponse; @Injectable({ providedIn: 'root' }) export class ComplaintResponseService { - private resourceUrl = 'api/complaints'; + private http = inject(HttpClient); + private accountService = inject(AccountService); - constructor( - private http: HttpClient, - private accountService: AccountService, - ) {} + private resourceUrl = 'api/complaints'; /** * Checks if a complaint response is locked for the currently logged-in user diff --git a/src/main/webapp/app/complaints/complaint.service.ts b/src/main/webapp/app/complaints/complaint.service.ts index 496cdaeacc6d..5ea2662dca9f 100644 --- a/src/main/webapp/app/complaints/complaint.service.ts +++ b/src/main/webapp/app/complaints/complaint.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import dayjs from 'dayjs/esm'; @@ -31,12 +31,10 @@ export interface IComplaintService { @Injectable({ providedIn: 'root' }) export class ComplaintService implements IComplaintService { - private resourceUrl = 'api/complaints'; + private http = inject(HttpClient); + private complaintResponseService = inject(ComplaintResponseService); - constructor( - private http: HttpClient, - private complaintResponseService: ComplaintResponseService, - ) {} + private resourceUrl = 'api/complaints'; /** * Checks if a complaint is locked for the currently logged-in user diff --git a/src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts b/src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts index b469dcab432f..ed0bef126614 100644 --- a/src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts +++ b/src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit, inject } from '@angular/core'; import { Exercise, getCourseFromExercise } from 'app/entities/exercise.model'; import { Complaint, ComplaintType } from 'app/entities/complaint.model'; import { ComplaintService } from 'app/complaints/complaint.service'; @@ -14,13 +14,26 @@ import dayjs from 'dayjs/esm'; import { HttpResponse } from '@angular/common/http'; import { faInfoCircle } from '@fortawesome/free-solid-svg-icons'; import { CourseManagementService } from 'app/course/manage/course-management.service'; +import { TranslateDirective } from 'app/shared/language/translate.directive'; +import { FaIconComponent } from '@fortawesome/angular-fontawesome'; +import { ComplaintsFormComponent } from 'app/complaints/form/complaints-form.component'; +import { ComplaintRequestComponent } from 'app/complaints/request/complaint-request.component'; +import { ComplaintResponseComponent } from 'app/complaints/response/complaint-response.component'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; @Component({ selector: 'jhi-complaint-student-view', templateUrl: './complaints-student-view.component.html', styleUrls: ['../complaints.scss'], + standalone: true, + imports: [TranslateDirective, FaIconComponent, ComplaintsFormComponent, ComplaintRequestComponent, ComplaintResponseComponent, ArtemisTranslatePipe], }) export class ComplaintsStudentViewComponent implements OnInit { + private complaintService = inject(ComplaintService); + private serverDateService = inject(ArtemisServerDateService); + private accountService = inject(AccountService); + private courseService = inject(CourseManagementService); + @Input() exercise: Exercise; @Input() participation: StudentParticipation; @Input() result?: Result; @@ -46,13 +59,6 @@ export class ComplaintsStudentViewComponent implements OnInit { // Icons faInfoCircle = faInfoCircle; - constructor( - private complaintService: ComplaintService, - private serverDateService: ArtemisServerDateService, - private accountService: AccountService, - private courseService: CourseManagementService, - ) {} - /** * Loads the number of allowed complaints and feedback requests */ diff --git a/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts b/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts index 71c185e7d488..a98e34d60b17 100644 --- a/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts +++ b/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts @@ -1,4 +1,4 @@ -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'; import { AlertService } from 'app/core/util/alert.service'; import { HttpErrorResponse } from '@angular/common/http'; import { ComplaintResponseService } from 'app/complaints/complaint-response.service'; @@ -13,15 +13,27 @@ import { Submission } from 'app/entities/submission.model'; import { isAllowedToRespondToComplaintAction } from 'app/assessment/assessment.service'; import { Course } from 'app/entities/course.model'; import { ComplaintAction, ComplaintResponseUpdateDTO } from 'app/entities/complaint-response-dto.model'; +import { TranslateDirective } from 'app/shared/language/translate.directive'; +import { FormsModule } from '@angular/forms'; +import { TextareaModule } from 'app/shared/textarea/textarea.module'; +import { ArtemisSharedCommonModule } from 'app/shared/shared-common.module'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; export type AssessmentAfterComplaint = { complaintResponse: ComplaintResponse; onSuccess: () => void; onError: () => void }; @Component({ selector: 'jhi-complaints-for-tutor-form', templateUrl: './complaints-for-tutor.component.html', - providers: [], + standalone: true, + imports: [TranslateDirective, FormsModule, TextareaModule, ArtemisSharedCommonModule, ArtemisTranslatePipe], }) export class ComplaintsForTutorComponent implements OnInit { + private alertService = inject(AlertService); + private complaintResponseService = inject(ComplaintResponseService); + private activatedRoute = inject(ActivatedRoute); + private router = inject(Router); + private location = inject(Location); + @Input() complaint: Complaint; @Input() isTestRun = false; @Input() isAssessor = false; @@ -43,14 +55,6 @@ export class ComplaintsForTutorComponent implements OnInit { course?: Course; maxComplaintResponseTextLimit: number; - constructor( - private alertService: AlertService, - private complaintResponseService: ComplaintResponseService, - private activatedRoute: ActivatedRoute, - private router: Router, - private location: Location, - ) {} - ngOnInit(): void { this.course = getCourseFromExercise(this.exercise!); diff --git a/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts b/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts deleted file mode 100644 index 6b3e0eef93f4..000000000000 --- a/src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { ArtemisSharedModule } from 'app/shared/shared.module'; -import { ComplaintsForTutorComponent } from './complaints-for-tutor.component'; -import { ComplaintResponseService } from 'app/complaints/complaint-response.service'; -import { ComplaintService } from 'app/complaints/complaint.service'; -import { TextareaModule } from 'app/shared/textarea/textarea.module'; - -@NgModule({ - imports: [ArtemisSharedModule, TextareaModule], - declarations: [ComplaintsForTutorComponent], - exports: [ComplaintsForTutorComponent], - providers: [ComplaintService, ComplaintResponseService], -}) -export class ArtemisComplaintsForTutorModule {} diff --git a/src/main/webapp/app/complaints/complaints.module.ts b/src/main/webapp/app/complaints/complaints.module.ts index e851a892a538..709ea3322cc7 100644 --- a/src/main/webapp/app/complaints/complaints.module.ts +++ b/src/main/webapp/app/complaints/complaints.module.ts @@ -9,8 +9,7 @@ import { ComplaintResponseComponent } from 'app/complaints/response/complaint-re import { TextareaModule } from 'app/shared/textarea/textarea.module'; @NgModule({ - imports: [ArtemisSharedModule, TextareaModule], - declarations: [ComplaintsFormComponent, ComplaintsStudentViewComponent, ComplaintRequestComponent, ComplaintResponseComponent], + imports: [ArtemisSharedModule, TextareaModule, ComplaintsFormComponent, ComplaintsStudentViewComponent, ComplaintRequestComponent, ComplaintResponseComponent], exports: [ComplaintsStudentViewComponent], providers: [ComplaintService], }) diff --git a/src/main/webapp/app/complaints/form/complaints-form.component.ts b/src/main/webapp/app/complaints/form/complaints-form.component.ts index 015b05f95a95..5d5265a527e1 100644 --- a/src/main/webapp/app/complaints/form/complaints-form.component.ts +++ b/src/main/webapp/app/complaints/form/complaints-form.component.ts @@ -1,5 +1,5 @@ import { HttpErrorResponse } from '@angular/common/http'; -import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core'; +import { Component, EventEmitter, Input, OnInit, Output, inject } from '@angular/core'; import { ComplaintService } from 'app/complaints/complaint.service'; import { AlertService } from 'app/core/util/alert.service'; import { ComplaintType } from 'app/entities/complaint.model'; @@ -7,13 +7,22 @@ import { Course } from 'app/entities/course.model'; import { Exercise, getCourseFromExercise } from 'app/entities/exercise.model'; import { onError } from 'app/shared/util/global.utils'; import { ComplaintRequestDTO } from 'app/entities/complaint-request-dto.model'; +import { TranslateDirective } from 'app/shared/language/translate.directive'; +import { FormsModule } from '@angular/forms'; +import { TextareaModule } from 'app/shared/textarea/textarea.module'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; @Component({ selector: 'jhi-complaint-form', templateUrl: './complaints-form.component.html', styleUrls: ['../complaints.scss'], + standalone: true, + imports: [TranslateDirective, FormsModule, TextareaModule, ArtemisTranslatePipe], }) export class ComplaintsFormComponent implements OnInit { + private complaintService = inject(ComplaintService); + private alertService = inject(AlertService); + @Input() exercise: Exercise; @Input() resultId: number; @Input() examId?: number; @@ -27,11 +36,6 @@ export class ComplaintsFormComponent implements OnInit { readonly ComplaintType = ComplaintType; - constructor( - private complaintService: ComplaintService, - private alertService: AlertService, - ) {} - ngOnInit(): void { this.course = getCourseFromExercise(this.exercise); this.maxComplaintTextLimit = this.course?.maxComplaintTextLimit ?? 0; diff --git a/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts b/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts index 131d552ffc4c..a2a3c2197a0b 100644 --- a/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts +++ b/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { AlertService } from 'app/core/util/alert.service'; import { ComplaintService } from 'app/complaints/complaint.service'; import { CourseManagementService } from 'app/course/manage/course-management.service'; @@ -8,20 +8,36 @@ import { ActivatedRoute, Router } from '@angular/router'; import { Course } from 'app/entities/course.model'; import { Observable, combineLatestWith } from 'rxjs'; import { StudentParticipation } from 'app/entities/participation/student-participation.model'; -import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModal, NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; import { SortService } from 'app/shared/service/sort.service'; import { ArtemisDatePipe } from 'app/shared/pipes/artemis-date.pipe'; import { TranslateService } from '@ngx-translate/core'; import { onError } from 'app/shared/util/global.utils'; import { getLinkToSubmissionAssessment } from 'app/utils/navigation.utils'; import { faExclamationTriangle, faFolderOpen, faSort } from '@fortawesome/free-solid-svg-icons'; +import { TranslateDirective } from 'app/shared/language/translate.directive'; +import { FormsModule } from '@angular/forms'; +import { ArtemisSharedCommonModule } from 'app/shared/shared-common.module'; +import { FaIconComponent } from '@fortawesome/angular-fontawesome'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; @Component({ selector: 'jhi-complaint-list', templateUrl: './list-of-complaints.component.html', - providers: [], + standalone: true, + imports: [TranslateDirective, FormsModule, ArtemisSharedCommonModule, FaIconComponent, NgbTooltip, ArtemisTranslatePipe], }) export class ListOfComplaintsComponent implements OnInit { + complaintService = inject(ComplaintService); + private alertService = inject(AlertService); + private route = inject(ActivatedRoute); + private router = inject(Router); + private modalService = inject(NgbModal); + private sortService = inject(SortService); + private translateService = inject(TranslateService); + private artemisDatePipe = inject(ArtemisDatePipe); + private courseManagementService = inject(CourseManagementService); + readonly ComplaintType = ComplaintType; public complaints: Complaint[] = []; @@ -49,18 +65,6 @@ export class ListOfComplaintsComponent implements OnInit { readonly FILTER_OPTION_ADDRESSED_COMPLAINTS = 4; // the number passed by the chart through the route indicating that only addressed complaints should be shown - constructor( - public complaintService: ComplaintService, - private alertService: AlertService, - private route: ActivatedRoute, - private router: Router, - private modalService: NgbModal, - private sortService: SortService, - private translateService: TranslateService, - private artemisDatePipe: ArtemisDatePipe, - private courseManagementService: CourseManagementService, - ) {} - ngOnInit(): void { this.route.params.pipe(combineLatestWith(this.route.queryParams, this.route.data)).subscribe((result) => { const params = result[0]; diff --git a/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts b/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts index df108f196b51..94122fae0136 100644 --- a/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts +++ b/src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts @@ -3,13 +3,11 @@ import { ListOfComplaintsComponent } from './list-of-complaints.component'; import { ComplaintService } from 'app/complaints/complaint.service'; import { RouterModule } from '@angular/router'; import { listOfComplaintsRoute } from 'app/complaints/list-of-complaints/list-of-complaints.route'; -import { ArtemisSharedModule } from 'app/shared/shared.module'; const ENTITY_STATES = [...listOfComplaintsRoute]; @NgModule({ - imports: [ArtemisSharedModule, RouterModule.forChild(ENTITY_STATES)], - declarations: [ListOfComplaintsComponent], + imports: [RouterModule.forChild(ENTITY_STATES), ListOfComplaintsComponent], exports: [ListOfComplaintsComponent], providers: [ComplaintService], }) diff --git a/src/main/webapp/app/complaints/request/complaint-request.component.ts b/src/main/webapp/app/complaints/request/complaint-request.component.ts index ab9817fd3794..61065c172d4e 100644 --- a/src/main/webapp/app/complaints/request/complaint-request.component.ts +++ b/src/main/webapp/app/complaints/request/complaint-request.component.ts @@ -1,9 +1,16 @@ import { Component, Input } from '@angular/core'; import { Complaint, ComplaintType } from 'app/entities/complaint.model'; +import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateDirective } from 'app/shared/language/translate.directive'; +import { FormsModule } from '@angular/forms'; +import { ArtemisSharedCommonModule } from 'app/shared/shared-common.module'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; @Component({ selector: 'jhi-complaint-request', templateUrl: './complaint-request.component.html', + standalone: true, + imports: [NgbTooltip, TranslateDirective, FormsModule, ArtemisSharedCommonModule, ArtemisTranslatePipe], }) export class ComplaintRequestComponent { @Input() complaint: Complaint; diff --git a/src/main/webapp/app/complaints/response/complaint-response.component.ts b/src/main/webapp/app/complaints/response/complaint-response.component.ts index aabdeb3e3073..c2443cf7ea60 100644 --- a/src/main/webapp/app/complaints/response/complaint-response.component.ts +++ b/src/main/webapp/app/complaints/response/complaint-response.component.ts @@ -1,9 +1,15 @@ import { Component, Input } from '@angular/core'; import { Complaint, ComplaintType } from 'app/entities/complaint.model'; +import { NgbTooltip } from '@ng-bootstrap/ng-bootstrap'; +import { FormsModule } from '@angular/forms'; +import { ArtemisSharedCommonModule } from 'app/shared/shared-common.module'; +import { ArtemisTranslatePipe } from 'app/shared/pipes/artemis-translate.pipe'; @Component({ selector: 'jhi-complaint-response', templateUrl: './complaint-response.component.html', + standalone: true, + imports: [NgbTooltip, FormsModule, ArtemisSharedCommonModule, ArtemisTranslatePipe], }) export class ComplaintResponseComponent { @Input() complaint: Complaint; diff --git a/src/main/webapp/app/course/manage/course-management.module.ts b/src/main/webapp/app/course/manage/course-management.module.ts index 68b0ce410db3..3aeca48c59d3 100644 --- a/src/main/webapp/app/course/manage/course-management.module.ts +++ b/src/main/webapp/app/course/manage/course-management.module.ts @@ -23,7 +23,6 @@ import { ArtemisParticipationModule } from 'app/exercises/shared/participation/p import { ArtemisModelingExerciseManagementModule } from 'app/exercises/modeling/manage/modeling-exercise-management.module'; import { ArtemisCourseScoresModule } from 'app/course/course-scores/course-scores.module'; import { ArtemisExerciseScoresModule } from 'app/exercises/shared/exercise-scores/exercise-scores.module'; -import { ArtemisComplaintsForTutorModule } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.module'; import { ArtemisFileUploadAssessmentModule } from 'app/exercises/file-upload/assess/file-upload-assessment.module'; import { ArtemisModelingAssessmentEditorModule } from 'app/exercises/modeling/assess/modeling-assessment-editor/modeling-assessment-editor.module'; import { NgxDatatableModule } from '@siemens/ngx-datatable'; @@ -68,6 +67,7 @@ import { SubmissionResultStatusModule } from 'app/overview/submission-result-sta import { ImageCropperModalComponent } from 'app/course/manage/image-cropper-modal.component'; import { HeaderCourseComponent } from 'app/overview/header-course.component'; import { ArtemisMarkdownEditorModule } from 'app/shared/markdown-editor/markdown-editor.module'; +import { ComplaintsForTutorComponent } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component'; @NgModule({ imports: [ @@ -95,7 +95,7 @@ import { ArtemisMarkdownEditorModule } from 'app/shared/markdown-editor/markdown ArtemisColorSelectorModule, ArtemisDashboardsModule, ArtemisParticipationModule, - ArtemisComplaintsForTutorModule, + ComplaintsForTutorComponent, ArtemisListOfComplaintsModule, ArtemisFileUploadAssessmentModule, ArtemisModelingAssessmentEditorModule, diff --git a/src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts b/src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts index 944d2a220e60..7ae991b6ac22 100644 --- a/src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts +++ b/src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts @@ -5,7 +5,6 @@ import { FormDateTimePickerModule } from 'app/shared/date-time-picker/date-time- import { FormsModule } from '@angular/forms'; import { FeatureToggleModule } from 'app/shared/feature-toggle/feature-toggle.module'; import { ProgrammingAssessmentRepoExportButtonComponent } from 'app/exercises/programming/assess/repo-export/programming-assessment-repo-export-button.component'; -import { ArtemisComplaintsForTutorModule } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.module'; import { ProgrammingAssessmentRepoExportDialogComponent } from 'app/exercises/programming/assess/repo-export/programming-assessment-repo-export-dialog.component'; import { ArtemisProgrammingAssessmentRoutingModule } from 'app/exercises/programming/assess/programming-assessment.route'; import { ArtemisAssessmentSharedModule } from 'app/assessment/assessment-shared.module'; @@ -18,6 +17,7 @@ import { AssessmentInstructionsModule } from 'app/assessment/assessment-instruct import { ArtemisHeaderExercisePageWithDetailsModule } from 'app/exercises/shared/exercise-headers/exercise-headers.module'; import { OrionTutorAssessmentComponent } from 'app/orion/assessment/orion-tutor-assessment.component'; import { SubmissionResultStatusModule } from 'app/overview/submission-result-status.module'; +import { ComplaintsForTutorComponent } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component'; @NgModule({ imports: [ @@ -26,7 +26,7 @@ import { SubmissionResultStatusModule } from 'app/overview/submission-result-sta FormDateTimePickerModule, FormsModule, FeatureToggleModule, - ArtemisComplaintsForTutorModule, + ComplaintsForTutorComponent, ArtemisProgrammingAssessmentRoutingModule, ArtemisAssessmentSharedModule, ArtemisCodeEditorModule, diff --git a/src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts b/src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts index 49617d7f20b1..a765439ae8c9 100644 --- a/src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts +++ b/src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts @@ -10,7 +10,6 @@ import { RepositoryViewComponent } from 'app/localvc/repository-view/repository- import { ArtemisProgrammingRepositoryRoutingModule } from 'app/exercises/programming/participate/programming-repository-routing.module'; import { FormDateTimePickerModule } from 'app/shared/date-time-picker/date-time-picker.module'; import { FeatureToggleModule } from 'app/shared/feature-toggle/feature-toggle.module'; -import { ArtemisComplaintsForTutorModule } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.module'; import { ArtemisAssessmentSharedModule } from 'app/assessment/assessment-shared.module'; import { ArtemisProgrammingManualAssessmentModule } from 'app/exercises/programming/assess/programming-manual-assessment.module'; import { AssessmentInstructionsModule } from 'app/assessment/assessment-instructions/assessment-instructions.module'; @@ -19,7 +18,8 @@ import { ArtemisProgrammingExerciseModule } from 'app/exercises/programming/shar import { CommitHistoryComponent } from 'app/localvc/commit-history/commit-history.component'; import { CommitDetailsViewComponent } from 'app/localvc/commit-details-view/commit-details-view.component'; import { ArtemisProgrammingExerciseActionsModule } from 'app/exercises/programming/shared/actions/programming-exercise-actions.module'; -import { GitDiffReportComponent } from 'app/exercises/programming/git-diff-report/git-diff-report.component'; +import { GitDiffReportComponent } from 'app/exercises/programming/hestia/git-diff-report/git-diff-report.component'; +import { ComplaintsForTutorComponent } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component'; @NgModule({ imports: [ @@ -28,7 +28,7 @@ import { GitDiffReportComponent } from 'app/exercises/programming/git-diff-repor FormDateTimePickerModule, FormsModule, FeatureToggleModule, - ArtemisComplaintsForTutorModule, + ComplaintsForTutorComponent, ArtemisProgrammingRepositoryRoutingModule, ArtemisAssessmentSharedModule, ArtemisCodeEditorModule, diff --git a/src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts b/src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts index 0c119a592dbe..a4492e2e7ad7 100644 --- a/src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts +++ b/src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts @@ -14,13 +14,13 @@ import { ManualTextblockSelectionComponent } from 'app/exercises/text/assess/man import { ArtemisConfirmIconModule } from 'app/shared/confirm-icon/confirm-icon.module'; import { TextSharedModule } from 'app/exercises/text/shared/text-shared.module'; import { ArtemisResultModule } from 'app/exercises/shared/result/result.module'; -import { ArtemisComplaintsForTutorModule } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.module'; import { ArtemisSharedComponentModule } from 'app/shared/components/shared-component.module'; import { ArtemisGradingInstructionLinkIconModule } from 'app/shared/grading-instruction-link-icon/grading-instruction-link-icon.module'; import { SubmissionResultStatusModule } from 'app/overview/submission-result-status.module'; import { TextblockFeedbackDropdownComponent } from 'app/exercises/text/assess/textblock-feedback-editor/dropdown/textblock-feedback-dropdown.component'; import { ArtemisAssessmentProgressLabelModule } from 'app/exercises/shared/assessment-progress-label/assessment-progress-label.module'; import { ArtemisFeedbackModule } from 'app/exercises/shared/feedback/feedback.module'; +import { ComplaintsForTutorComponent } from 'app/complaints/complaints-for-tutor/complaints-for-tutor.component'; const ENTITY_STATES = [...textSubmissionAssessmentRoutes]; @@ -30,7 +30,7 @@ const ENTITY_STATES = [...textSubmissionAssessmentRoutes]; RouterModule.forChild(ENTITY_STATES), ArtemisSharedModule, ArtemisResultModule, - ArtemisComplaintsForTutorModule, + ComplaintsForTutorComponent, ArtemisSharedComponentModule, ArtemisAssessmentSharedModule, AssessmentInstructionsModule, diff --git a/src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts b/src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts index 8d05c1958d04..31021c4ce9b2 100644 --- a/src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts +++ b/src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts @@ -9,7 +9,6 @@ import { Complaint } from 'app/entities/complaint.model'; import { MockComponent, MockDirective, MockModule, MockProvider } from 'ng-mocks'; import { AssessmentWarningComponent } from 'app/assessment/assessment-warning/assessment-warning.component'; import { TranslateDirective } from 'app/shared/language/translate.directive'; -import { TranslatePipeMock } from '../../helpers/mocks/service/mock-translate.service'; import { MockQueryParamsDirective, MockRouterLinkDirective } from '../../helpers/mocks/directive/mock-router-link.directive'; import { TextAssessmentAnalytics } from 'app/exercises/text/assess/analytics/text-assesment-analytics.service'; import { ActivatedRoute } from '@angular/router'; @@ -23,16 +22,14 @@ describe('AssessmentLayoutComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - imports: [ArtemisTestModule, MockModule(NgbTooltipModule)], + imports: [ArtemisTestModule, MockModule(NgbTooltipModule), MockComponent(ComplaintsForTutorComponent)], declarations: [ AssessmentLayoutComponent, AssessmentHeaderComponent, AssessmentNoteComponent, - MockComponent(ComplaintsForTutorComponent), MockComponent(AssessmentComplaintAlertComponent), MockComponent(AssessmentWarningComponent), MockDirective(TranslateDirective), - TranslatePipeMock, MockRouterLinkDirective, MockQueryParamsDirective, ], diff --git a/src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts b/src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts index 867a683b12d1..6e46424e9514 100644 --- a/src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts +++ b/src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts @@ -18,6 +18,8 @@ import { Course } from 'app/entities/course.model'; import { Exercise } from 'app/entities/exercise.model'; import { TranslateDirective } from 'app/shared/language/translate.directive'; import { provideRouter } from '@angular/router'; +import { TranslateService } from '@ngx-translate/core'; +import { MockTranslateService } from '../../helpers/mocks/service/mock-translate.service'; describe('ComplaintsForTutorComponent', () => { let complaintsForTutorComponent: ComplaintsForTutorComponent; @@ -30,14 +32,17 @@ describe('ComplaintsForTutorComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [FormsModule], - declarations: [ - ComplaintsForTutorComponent, - MockPipe(ArtemisTranslatePipe), - MockPipe(ArtemisDatePipe), - MockComponent(TextareaCounterComponent), - MockDirective(TranslateDirective), + declarations: [MockPipe(ArtemisTranslatePipe), MockPipe(ArtemisDatePipe), MockComponent(TextareaCounterComponent), MockDirective(TranslateDirective)], + providers: [ + provideRouter([]), + MockProvider(ComplaintResponseService), + MockProvider(ComplaintService), + MockProvider(AlertService), + { + provide: TranslateService, + useClass: MockTranslateService, + }, ], - providers: [provideRouter([]), MockProvider(ComplaintResponseService), MockProvider(ComplaintService), MockProvider(AlertService)], }) .compileComponents() .then(() => { diff --git a/src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts b/src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts index 488c740be038..2139f0157523 100644 --- a/src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts +++ b/src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts @@ -32,13 +32,7 @@ describe('ComplaintsFormComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ imports: [ArtemisTestModule], - declarations: [ - ComplaintsFormComponent, - MockPipe(ArtemisTranslatePipe), - MockDirective(NgModel), - MockDirective(TranslateDirective), - MockComponent(TextareaCounterComponent), - ], + declarations: [MockPipe(ArtemisTranslatePipe), MockDirective(NgModel), MockDirective(TranslateDirective), MockComponent(TextareaCounterComponent)], providers: [ MockProvider(AlertService), { diff --git a/src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts b/src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts index e3abe463b09d..c2ca0a831fec 100644 --- a/src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts +++ b/src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts @@ -1,7 +1,6 @@ import { ComponentFixture, TestBed, fakeAsync, tick } from '@angular/core/testing'; import { ActivatedRoute, Router } from '@angular/router'; import { FaIconComponent } from '@fortawesome/angular-fontawesome'; -import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { TranslateService } from '@ngx-translate/core'; import { ComplaintService, EntityResponseTypeArray, IComplaintService } from 'app/complaints/complaint.service'; import { ListOfComplaintsComponent } from 'app/complaints/list-of-complaints/list-of-complaints.component'; @@ -24,8 +23,8 @@ import { MockActivatedRoute } from '../../helpers/mocks/activated-route/mock-act import { MockRouter } from '../../helpers/mocks/mock-router'; import { MockComplaintService } from '../../helpers/mocks/service/mock-complaint.service'; import { MockCourseManagementService } from '../../helpers/mocks/service/mock-course-management.service'; -import { MockNgbModalService } from '../../helpers/mocks/service/mock-ngb-modal.service'; import { MockTranslateService, TranslatePipeMock } from '../../helpers/mocks/service/mock-translate.service'; +import { ArtemisSharedCommonModule } from 'app/shared/shared-common.module'; describe('ListOfComplaintsComponent', () => { let fixture: ComponentFixture; @@ -65,19 +64,21 @@ describe('ListOfComplaintsComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ListOfComplaintsComponent, TranslatePipeMock, MockComponent(FaIconComponent)], + declarations: [TranslatePipeMock, MockComponent(FaIconComponent)], providers: [ MockProvider(AlertService), MockProvider(SortService), { provide: ComplaintService, useClass: MockComplaintService }, { provide: Router, useClass: MockRouter }, - { provide: NgbModal, useClass: MockNgbModalService }, { provide: ActivatedRoute, useValue: new MockActivatedRoute() }, { provide: TranslateService, useClass: MockTranslateService }, { provide: ArtemisDatePipe, useClass: TranslatePipeMock }, { provide: CourseManagementService, useClass: MockCourseManagementService }, ], }) + .overrideComponent(ListOfComplaintsComponent, { + remove: { imports: [ArtemisSharedCommonModule] }, + }) .compileComponents() .then(() => { fixture = TestBed.createComponent(ListOfComplaintsComponent);