From fdcde8741114ca20e5994b5f86677cfbc624508f Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Sat, 14 Dec 2024 15:14:10 +0100 Subject: [PATCH 1/4] Remove lecture go back to wizard mode button --- ...course-management-exercises.component.html | 5 ---- .../course-management-exercises.component.ts | 30 ++----------------- .../file-upload-exercise-update.component.ts | 21 ++----------- .../modeling-exercise-update.component.ts | 16 +--------- .../manage/quiz-exercise-update.component.ts | 13 -------- .../text-exercise-update.component.ts | 13 -------- .../create-exercise-unit.component.ts | 2 +- .../text-exercise-update.component.spec.ts | 1 - 8 files changed, 8 insertions(+), 93 deletions(-) diff --git a/src/main/webapp/app/course/manage/course-management-exercises.component.html b/src/main/webapp/app/course/manage/course-management-exercises.component.html index d267f2b04fa4..51f7c1ecfb10 100644 --- a/src/main/webapp/app/course/manage/course-management-exercises.component.html +++ b/src/main/webapp/app/course/manage/course-management-exercises.component.html @@ -10,11 +10,6 @@

- @if (showBackToWizardModeButton) { - - } diff --git a/src/main/webapp/app/course/manage/course-management-exercises.component.ts b/src/main/webapp/app/course/manage/course-management-exercises.component.ts index b22fa31fa819..70afc4bd3471 100644 --- a/src/main/webapp/app/course/manage/course-management-exercises.component.ts +++ b/src/main/webapp/app/course/manage/course-management-exercises.component.ts @@ -1,10 +1,8 @@ -import { Component, ContentChild, OnInit, TemplateRef } from '@angular/core'; +import { Component, ContentChild, OnInit, TemplateRef, inject } from '@angular/core'; import { Course } from 'app/entities/course.model'; -import { CourseManagementService } from './course-management.service'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { ExerciseFilter } from 'app/entities/exercise-filter.model'; import { DocumentationType } from 'app/shared/components/documentation-button/documentation-button.component'; -import { faHandshakeAngle } from '@fortawesome/free-solid-svg-icons'; import { ExerciseType } from 'app/entities/exercise.model'; @Component({ @@ -28,22 +26,13 @@ export class CourseManagementExercisesComponent implements OnInit { filteredModelingExercisesCount = 0; filteredFileUploadExercisesCount = 0; exerciseFilter: ExerciseFilter; - showBackToWizardModeButton = false; - lectureIdForGoingBack: number; - lectureWizardStepForGoingBack: number; - - faHandshakeAngle = faHandshakeAngle; // extension points, see shared/extension-point @ContentChild('overrideGenerateAndImportButton') overrideGenerateAndImportButton: TemplateRef; @ContentChild('overrideProgrammingExerciseCard') overrideProgrammingExerciseCard: TemplateRef; @ContentChild('overrideNonProgrammingExerciseCard') overrideNonProgrammingExerciseCard: TemplateRef; - constructor( - private courseService: CourseManagementService, - private router: Router, - private route: ActivatedRoute, - ) {} + private readonly route = inject(ActivatedRoute); /** * initializes course @@ -55,12 +44,6 @@ export class CourseManagementExercisesComponent implements OnInit { } }); - this.route.queryParams.subscribe((params) => { - this.showBackToWizardModeButton = params.shouldHaveBackButtonToWizard; - this.lectureIdForGoingBack = params.lectureId; - this.lectureWizardStepForGoingBack = params.step; - }); - this.exerciseFilter = new ExerciseFilter(''); } @@ -104,11 +87,4 @@ export class CourseManagementExercisesComponent implements OnInit { shouldHideExerciseCard(type: string): boolean { return !['all', type].includes(this.exerciseFilter.exerciseTypeSearch); } - - goBackToWizardMode() { - this.router.navigate(['/course-management', this.course.id, 'lectures', this.lectureIdForGoingBack, 'edit'], { - queryParams: { shouldBeInWizardMode: 'true', shouldOpenCreateExercise: 'true', step: this.lectureWizardStepForGoingBack }, - queryParamsHandling: '', - }); - } } diff --git a/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts b/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts index 8fc4511e452e..798a1d50f57d 100644 --- a/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts +++ b/src/main/webapp/app/exercises/file-upload/manage/file-upload-exercise-update.component.ts @@ -33,6 +33,8 @@ import { FormulaAction } from 'app/shared/monaco-editor/model/actions/formula.ac changeDetection: ChangeDetectionStrategy.OnPush, }) export class FileUploadExerciseUpdateComponent implements AfterViewInit, OnDestroy, OnInit { + protected readonly faQuestionCircle = faQuestionCircle; + readonly IncludedInOverallScore = IncludedInOverallScore; readonly documentationType: DocumentationType = 'FileUpload'; @@ -50,7 +52,6 @@ export class FileUploadExerciseUpdateComponent implements AfterViewInit, OnDestr fileUploadExercise: FileUploadExercise; backupExercise: FileUploadExercise; isSaving: boolean; - goBackAfterSaving = false; exerciseCategories: ExerciseCategory[]; existingCategories: ExerciseCategory[]; notificationText?: string; @@ -59,19 +60,14 @@ export class FileUploadExerciseUpdateComponent implements AfterViewInit, OnDestr isImport: boolean; examCourseId?: number; - saveCommand: SaveExerciseCommand; - formStatusSections: FormSectionStatus[]; - // Subcriptions + // Subscriptions titleChannelNameComponentSubscription?: Subscription; pointsSubscription?: Subscription; bonusPointsSubscription?: Subscription; teamSubscription?: Subscription; - // Icons - faQuestionCircle = faQuestionCircle; - constructor( private fileUploadExerciseService: FileUploadExerciseService, private modalService: NgbModal, @@ -104,11 +100,6 @@ export class FileUploadExerciseUpdateComponent implements AfterViewInit, OnDestr this.examCourseId = getCourseId(fileUploadExercise); }); - this.activatedRoute.queryParams.subscribe((params) => { - if (params.shouldHaveBackButtonToWizard) { - this.goBackAfterSaving = true; - } - }); this.activatedRoute.url .pipe( tap( @@ -264,12 +255,6 @@ export class FileUploadExerciseUpdateComponent implements AfterViewInit, OnDestr private onSaveSuccess(exercise: Exercise) { this.isSaving = false; - if (this.goBackAfterSaving) { - this.navigationUtilService.navigateBack(); - - return; - } - this.navigationUtilService.navigateForwardFromExerciseUpdateOrCreation(exercise); } diff --git a/src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts b/src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts index 29612cd3c373..18faee221f26 100644 --- a/src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts +++ b/src/main/webapp/app/exercises/modeling/manage/modeling-exercise-update.component.ts @@ -1,5 +1,5 @@ import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, OnDestroy, OnInit, ViewChild } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; +import { ActivatedRoute } from '@angular/router'; import { HttpErrorResponse } from '@angular/common/http'; import { ModelingExercise } from 'app/entities/modeling-exercise.model'; import { ModelingExerciseService } from './modeling-exercise.service'; @@ -70,7 +70,6 @@ export class ModelingExerciseUpdateComponent implements AfterViewInit, OnDestroy isImport: boolean; isExamMode: boolean; semiAutomaticAssessmentAvailable = true; - goBackAfterSaving = false; formSectionStatus: FormSectionStatus[]; @@ -91,7 +90,6 @@ export class ModelingExerciseUpdateComponent implements AfterViewInit, OnDestroy private exerciseGroupService: ExerciseGroupService, private eventManager: EventManager, private activatedRoute: ActivatedRoute, - private router: Router, private navigationUtilService: ArtemisNavigationUtilService, private changeDetectorRef: ChangeDetectorRef, ) {} @@ -186,12 +184,6 @@ export class ModelingExerciseUpdateComponent implements AfterViewInit, OnDestroy ) .subscribe(); - this.activatedRoute.queryParams.subscribe((params) => { - if (params.shouldHaveBackButtonToWizard) { - this.goBackAfterSaving = true; - } - }); - this.isSaving = false; this.notificationText = undefined; } @@ -292,12 +284,6 @@ export class ModelingExerciseUpdateComponent implements AfterViewInit, OnDestroy this.eventManager.broadcast({ name: 'modelingExerciseListModification', content: 'OK' }); this.isSaving = false; - if (this.goBackAfterSaving) { - this.navigationUtilService.navigateBack(); - - return; - } - this.navigationUtilService.navigateForwardFromExerciseUpdateOrCreation(exercise); } diff --git a/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts b/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts index f212b3469e6c..0c03bd54d888 100644 --- a/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts +++ b/src/main/webapp/app/exercises/quiz/manage/quiz-exercise-update.component.ts @@ -52,7 +52,6 @@ export class QuizExerciseUpdateComponent extends QuizExerciseValidationDirective notificationText?: string; isImport = false; - goBackAfterSaving = false; /** Constants for 'Add existing questions' and 'Import file' features **/ showExistingQuestions = false; @@ -149,12 +148,6 @@ export class QuizExerciseUpdateComponent extends QuizExerciseValidationDirective this.isImport = true; } - this.route.queryParams.subscribe((params) => { - if (params.shouldHaveBackButtonToWizard) { - this.goBackAfterSaving = true; - } - }); - /** Query the courseService for the participationId given by the params */ if (this.courseId) { this.courseService.find(this.courseId).subscribe((response: HttpResponse) => { @@ -520,12 +513,6 @@ export class QuizExerciseUpdateComponent extends QuizExerciseValidationDirective this.savedEntity = cloneDeep(quizExercise); this.changeDetector.detectChanges(); - if (this.goBackAfterSaving) { - this.navigationUtilService.navigateBack(); - - return; - } - // Navigate back only if it's an import // If we edit the exercise, a user might just want to save the current state of the added quiz questions without going back if (this.isImport) { diff --git a/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts b/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts index 18a5e8131205..7d0b69df31a3 100644 --- a/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts +++ b/src/main/webapp/app/exercises/text/manage/text-exercise/text-exercise-update.component.ts @@ -67,7 +67,6 @@ export class TextExerciseUpdateComponent implements OnInit, OnDestroy, AfterView examCourseId?: number; isExamMode: boolean; isImport = false; - goBackAfterSaving = false; AssessmentType = AssessmentType; isAthenaEnabled$: Observable | undefined; @@ -170,12 +169,6 @@ export class TextExerciseUpdateComponent implements OnInit, OnDestroy, AfterView ) .subscribe(); - this.activatedRoute.queryParams.subscribe((params) => { - if (params.shouldHaveBackButtonToWizard) { - this.goBackAfterSaving = true; - } - }); - this.isAthenaEnabled$ = this.athenaService.isEnabled(); this.isSaving = false; @@ -278,12 +271,6 @@ export class TextExerciseUpdateComponent implements OnInit, OnDestroy, AfterView this.eventManager.broadcast({ name: 'textExerciseListModification', content: 'OK' }); this.isSaving = false; - if (this.goBackAfterSaving) { - this.navigationUtilService.navigateBack(); - - return; - } - this.navigationUtilService.navigateForwardFromExerciseUpdateOrCreation(exercise); } diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts index 3ca8d54564fb..41b4870285f9 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts @@ -126,7 +126,7 @@ export class CreateExerciseUnitComponent implements OnInit { createNewExercise() { this.router.navigate(['/course-management', this.courseId, 'exercises'], { - queryParams: { shouldHaveBackButtonToWizard: 'true', lectureId: this.lectureId, step: this.currentWizardStep() }, + queryParams: { lectureId: this.lectureId }, queryParamsHandling: '', }); } diff --git a/src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts b/src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts index 78fea1728c50..ccd075b95b2d 100644 --- a/src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts +++ b/src/test/javascript/spec/component/text-exercise/text-exercise-update.component.spec.ts @@ -243,7 +243,6 @@ describe('TextExercise Management Update Component', () => { route.params = of({ courseId }); route.url = of([{ path: 'import' } as UrlSegment]); route.data = of({ textExercise }); - route.queryParams = of({ shouldHaveBackButtonToWizard: true }); }); it('should set isImport and remove all dates', fakeAsync(() => { From 90a8cced00f7050c611897e6cfbab82fc36ea1de Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Sat, 14 Dec 2024 15:23:15 +0100 Subject: [PATCH 2/4] Remove current wizard step variable --- .../create-exercise-unit/create-exercise-unit.component.ts | 1 - .../app/lecture/wizard-mode/lecture-wizard-units.component.html | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts index 41b4870285f9..3b1f3e60ce34 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.ts @@ -26,7 +26,6 @@ export class CreateExerciseUnitComponent implements OnInit { hasCancelButton = input(); hasCreateExerciseButton = input(); shouldNavigateOnSubmit = input(true); - currentWizardStep = input(); onCancel = output(); onExerciseUnitCreated = output(); diff --git a/src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html b/src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html index 3736d642d80e..3fa1cdd3ef3a 100644 --- a/src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html +++ b/src/main/webapp/app/lecture/wizard-mode/lecture-wizard-units.component.html @@ -61,7 +61,6 @@

Date: Sat, 14 Dec 2024 15:27:02 +0100 Subject: [PATCH 3/4] Remove translation --- src/main/webapp/i18n/de/lecture.json | 1 - src/main/webapp/i18n/en/lecture.json | 1 - 2 files changed, 2 deletions(-) diff --git a/src/main/webapp/i18n/de/lecture.json b/src/main/webapp/i18n/de/lecture.json index e5ecd6649b38..f3e1ba4d0968 100644 --- a/src/main/webapp/i18n/de/lecture.json +++ b/src/main/webapp/i18n/de/lecture.json @@ -87,7 +87,6 @@ "newLectureUnit": "Neue Vorlesungseinheit", "editLectureUnit": "Vorlesungseinheit bearbeiten", "newExercise": "Neue Übung erstellen", - "backToWizard": "Zurück zur Vorlesung", "competencyTitle": "Titel", "competencyConnectedUnits": "Verknüpfte Einheiten", "competencyNoConnectedUnits": "Keine verknüpften Einheiten" diff --git a/src/main/webapp/i18n/en/lecture.json b/src/main/webapp/i18n/en/lecture.json index 284c7d83ace3..b7463580c6ab 100644 --- a/src/main/webapp/i18n/en/lecture.json +++ b/src/main/webapp/i18n/en/lecture.json @@ -87,7 +87,6 @@ "newLectureUnit": "New Lecture Unit", "editLectureUnit": "Edit Lecture Unit", "newExercise": "Create new exercise", - "backToWizard": "Back to lecture", "competencyTitle": "Title", "competencyConnectedUnits": "Connected Units", "competencyNoConnectedUnits": "No connected units" From 6c024dfd6881ece41b39d09c00c37746be49e2bd Mon Sep 17 00:00:00 2001 From: Florian Glombik Date: Sat, 14 Dec 2024 15:58:21 +0100 Subject: [PATCH 4/4] Remove "Create new exercise" button --- .../create-exercise-unit.component.html | 9 --------- .../create-exercise-unit.component.ts | 8 -------- .../wizard-mode/lecture-wizard-units.component.html | 1 - 3 files changed, 18 deletions(-) diff --git a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html index f0f0076d89d3..2a3db2a5e78f 100644 --- a/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html +++ b/src/main/webapp/app/lecture/lecture-unit/lecture-unit-management/create-exercise-unit/create-exercise-unit.component.html @@ -21,15 +21,6 @@

  } - @if (hasCreateExerciseButton()) { - - }