From e751ddd369e274ca0868a2ac34df58b2f4863106 Mon Sep 17 00:00:00 2001 From: raphaelklein Date: Sat, 30 Nov 2024 21:12:19 +0100 Subject: [PATCH] Inject for admin lti config --- .../edit-lti-configuration.component.ts | 14 ++++++-------- .../lti-configuration.component.ts | 16 +++++++--------- .../lti-configuration.service.ts | 4 ++-- 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.ts b/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.ts index b579f2fc822a..6f65f9c87969 100644 --- a/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.ts +++ b/src/main/webapp/app/admin/lti-configuration/edit-lti-configuration.component.ts @@ -1,5 +1,5 @@ import { AlertService } from 'app/core/util/alert.service'; -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { finalize } from 'rxjs'; import { FormControl, FormGroup } from '@angular/forms'; @@ -12,6 +12,11 @@ import { LtiConfigurationService } from 'app/admin/lti-configuration/lti-configu templateUrl: './edit-lti-configuration.component.html', }) export class EditLtiConfigurationComponent implements OnInit { + private route = inject(ActivatedRoute); + private ltiConfigurationService = inject(LtiConfigurationService); + private router = inject(Router); + private alertService = inject(AlertService); + platform: LtiPlatformConfiguration; platformConfigurationForm: FormGroup; @@ -22,13 +27,6 @@ export class EditLtiConfigurationComponent implements OnInit { faSave = faSave; faPlus = faPlus; - constructor( - private route: ActivatedRoute, - private ltiConfigurationService: LtiConfigurationService, - private router: Router, - private alertService: AlertService, - ) {} - /** * Gets the configuration for the course encoded in the route and prepares the form */ diff --git a/src/main/webapp/app/admin/lti-configuration/lti-configuration.component.ts b/src/main/webapp/app/admin/lti-configuration/lti-configuration.component.ts index 2d978673adbc..a18fbb8f602c 100644 --- a/src/main/webapp/app/admin/lti-configuration/lti-configuration.component.ts +++ b/src/main/webapp/app/admin/lti-configuration/lti-configuration.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Course } from 'app/entities/course.model'; import { faExclamationTriangle, faPencilAlt, faPlus, faSort, faTrash, faWrench } from '@fortawesome/free-solid-svg-icons'; @@ -17,6 +17,12 @@ import { combineLatest } from 'rxjs'; templateUrl: './lti-configuration.component.html', }) export class LtiConfigurationComponent implements OnInit { + private router = inject(Router); + private ltiConfigurationService = inject(LtiConfigurationService); + private sortService = inject(SortService); + private alertService = inject(AlertService); + private activatedRoute = inject(ActivatedRoute); + course: Course; platforms: LtiPlatformConfiguration[]; ascending!: boolean; @@ -40,14 +46,6 @@ export class LtiConfigurationComponent implements OnInit { private dialogErrorSource = new Subject(); dialogError$ = this.dialogErrorSource.asObservable(); - constructor( - private router: Router, - private ltiConfigurationService: LtiConfigurationService, - private sortService: SortService, - private alertService: AlertService, - private activatedRoute: ActivatedRoute, - ) {} - /** * Gets the configuration for the course encoded in the route and fetches the exercises */ diff --git a/src/main/webapp/app/admin/lti-configuration/lti-configuration.service.ts b/src/main/webapp/app/admin/lti-configuration/lti-configuration.service.ts index c6484edd768f..277d2a6b7031 100644 --- a/src/main/webapp/app/admin/lti-configuration/lti-configuration.service.ts +++ b/src/main/webapp/app/admin/lti-configuration/lti-configuration.service.ts @@ -1,4 +1,4 @@ -import { Injectable } from '@angular/core'; +import { Injectable, inject } from '@angular/core'; import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; import { Observable } from 'rxjs'; import { LtiPlatformConfiguration } from 'app/admin/lti-configuration/lti-configuration.model'; @@ -6,7 +6,7 @@ import { createRequestOption } from 'app/shared/util/request.util'; @Injectable({ providedIn: 'root' }) export class LtiConfigurationService { - constructor(private http: HttpClient) {} + private http = inject(HttpClient); /** * Sends a GET request to retrieve all lti platform configurations