chore(ui): clear final prefer-inject bucket
Convert the remaining feature and core constructors flagged by prefer-inject to field injection so the last Angular inject() violations are removed across upload dialogs, core services, and bookdrop flows. Validation: just ui lint
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { Pipe, PipeTransform } from '@angular/core';
|
import {inject, Pipe, PipeTransform} from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
@@ -9,7 +9,8 @@ import { map } from 'rxjs/operators';
|
|||||||
pure: true
|
pure: true
|
||||||
})
|
})
|
||||||
export class SecurePipe implements PipeTransform {
|
export class SecurePipe implements PipeTransform {
|
||||||
constructor(private http: HttpClient, private sanitizer: DomSanitizer) {}
|
private http = inject(HttpClient);
|
||||||
|
private sanitizer = inject(DomSanitizer);
|
||||||
|
|
||||||
transform(url: string): Observable<SafeUrl> {
|
transform(url: string): Observable<SafeUrl> {
|
||||||
return this.http.get(url, { responseType: 'blob' }).pipe(
|
return this.http.get(url, { responseType: 'blob' }).pipe(
|
||||||
|
|||||||
+6
-9
@@ -42,6 +42,12 @@ interface UploadingFile {
|
|||||||
})
|
})
|
||||||
export class AdditionalFileUploaderComponent implements OnInit, OnDestroy {
|
export class AdditionalFileUploaderComponent implements OnInit, OnDestroy {
|
||||||
private readonly t = inject(TranslocoService);
|
private readonly t = inject(TranslocoService);
|
||||||
|
private dialogRef = inject(DynamicDialogRef);
|
||||||
|
private config = inject(DynamicDialogConfig);
|
||||||
|
private bookFileService = inject(BookFileService);
|
||||||
|
private appSettingsService = inject(AppSettingsService);
|
||||||
|
private messageService = inject(MessageService);
|
||||||
|
private cdr = inject(ChangeDetectorRef);
|
||||||
|
|
||||||
book!: Book;
|
book!: Book;
|
||||||
files: UploadingFile[] = [];
|
files: UploadingFile[] = [];
|
||||||
@@ -57,15 +63,6 @@ export class AdditionalFileUploaderComponent implements OnInit, OnDestroy {
|
|||||||
@ViewChild(FileUpload) private fileUpload!: FileUpload;
|
@ViewChild(FileUpload) private fileUpload!: FileUpload;
|
||||||
private destroy$ = new Subject<void>();
|
private destroy$ = new Subject<void>();
|
||||||
|
|
||||||
constructor(
|
|
||||||
private dialogRef: DynamicDialogRef,
|
|
||||||
private config: DynamicDialogConfig,
|
|
||||||
private bookFileService: BookFileService,
|
|
||||||
private appSettingsService: AppSettingsService,
|
|
||||||
private messageService: MessageService,
|
|
||||||
private cdr: ChangeDetectorRef
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.book = this.config.data.book;
|
this.book = this.config.data.book;
|
||||||
this.fileTypeOptions = [
|
this.fileTypeOptions = [
|
||||||
|
|||||||
+5
-8
@@ -40,14 +40,11 @@ export class BookFileAttacherComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private readonly t = inject(TranslocoService);
|
private readonly t = inject(TranslocoService);
|
||||||
private readonly appSettingsService = inject(AppSettingsService);
|
private readonly appSettingsService = inject(AppSettingsService);
|
||||||
|
private dialogRef = inject(DynamicDialogRef);
|
||||||
constructor(
|
private config = inject(DynamicDialogConfig);
|
||||||
private dialogRef: DynamicDialogRef,
|
private bookService = inject(BookService);
|
||||||
private config: DynamicDialogConfig,
|
private bookFileService = inject(BookFileService);
|
||||||
private bookService: BookService,
|
private messageService = inject(MessageService);
|
||||||
private bookFileService: BookFileService,
|
|
||||||
private messageService: MessageService
|
|
||||||
) {}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
// Support both single book and multiple books
|
// Support both single book and multiple books
|
||||||
|
|||||||
+4
-6
@@ -1,4 +1,4 @@
|
|||||||
import {Component, OnDestroy} from '@angular/core';
|
import {Component, inject, OnDestroy} from '@angular/core';
|
||||||
import {DatePipe, NgClass} from '@angular/common';
|
import {DatePipe, NgClass} from '@angular/common';
|
||||||
import {BookdropFinalizeResult} from '../../service/bookdrop.service';
|
import {BookdropFinalizeResult} from '../../service/bookdrop.service';
|
||||||
import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog";
|
import {DynamicDialogConfig, DynamicDialogRef} from "primeng/dynamicdialog";
|
||||||
@@ -17,12 +17,10 @@ import {TranslocoDirective} from '@jsverse/transloco';
|
|||||||
styleUrl: './bookdrop-finalize-result-dialog.component.scss'
|
styleUrl: './bookdrop-finalize-result-dialog.component.scss'
|
||||||
})
|
})
|
||||||
export class BookdropFinalizeResultDialogComponent implements OnDestroy {
|
export class BookdropFinalizeResultDialogComponent implements OnDestroy {
|
||||||
|
public ref = inject(DynamicDialogRef);
|
||||||
|
public config = inject(DynamicDialogConfig);
|
||||||
|
|
||||||
result: BookdropFinalizeResult;
|
result: BookdropFinalizeResult = this.config.data.result;
|
||||||
|
|
||||||
constructor(public ref: DynamicDialogRef, public config: DynamicDialogConfig) {
|
|
||||||
this.result = config.data.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
ngOnDestroy(): void {
|
ngOnDestroy(): void {
|
||||||
this.ref?.close();
|
this.ref?.close();
|
||||||
|
|||||||
@@ -1,17 +1,14 @@
|
|||||||
import { Injectable, ComponentRef, ApplicationRef, createComponent, EnvironmentInjector } from '@angular/core';
|
import {Injectable, ComponentRef, ApplicationRef, createComponent, EnvironmentInjector, inject} from '@angular/core';
|
||||||
import { LibraryLoadingComponent } from './library-loading/library-loading.component';
|
import { LibraryLoadingComponent } from './library-loading/library-loading.component';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class LibraryLoadingService {
|
export class LibraryLoadingService {
|
||||||
|
private appRef = inject(ApplicationRef);
|
||||||
|
private injector = inject(EnvironmentInjector);
|
||||||
private componentRef: ComponentRef<LibraryLoadingComponent> | null = null;
|
private componentRef: ComponentRef<LibraryLoadingComponent> | null = null;
|
||||||
|
|
||||||
constructor(
|
|
||||||
private appRef: ApplicationRef,
|
|
||||||
private injector: EnvironmentInjector
|
|
||||||
) {}
|
|
||||||
|
|
||||||
showBookLoadingProgress(bookTitle: string, current: number, total: number): void {
|
showBookLoadingProgress(bookTitle: string, current: number, total: number): void {
|
||||||
if (this.componentRef) {
|
if (this.componentRef) {
|
||||||
this.updateProgress(bookTitle, current, total);
|
this.updateProgress(bookTitle, current, total);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import {Injectable} from '@angular/core';
|
import {inject, Injectable} from '@angular/core';
|
||||||
import {HttpClient} from '@angular/common/http';
|
import {HttpClient} from '@angular/common/http';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {API_CONFIG} from '../../../core/config/api-config';
|
import {API_CONFIG} from '../../../core/config/api-config';
|
||||||
@@ -76,10 +76,9 @@ export type SidecarSyncStatus = 'IN_SYNC' | 'OUTDATED' | 'MISSING' | 'CONFLICT'
|
|||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class SidecarService {
|
export class SidecarService {
|
||||||
|
private http = inject(HttpClient);
|
||||||
private readonly apiUrl = `${API_CONFIG.BASE_URL}/api/v1`;
|
private readonly apiUrl = `${API_CONFIG.BASE_URL}/api/v1`;
|
||||||
|
|
||||||
constructor(private http: HttpClient) {}
|
|
||||||
|
|
||||||
getSidecarContent(bookId: number): Observable<SidecarMetadata> {
|
getSidecarContent(bookId: number): Observable<SidecarMetadata> {
|
||||||
return this.http.get<SidecarMetadata>(`${this.apiUrl}/books/${bookId}/sidecar`);
|
return this.http.get<SidecarMetadata>(`${this.apiUrl}/books/${bookId}/sidecar`);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user