RED-3800 small rename
This commit is contained in:
parent
532ee9fa06
commit
cc789aabf0
@ -1,7 +1,6 @@
|
||||
import { computed, effect, Injectable, Injector, Signal } from '@angular/core';
|
||||
import { computed, effect, inject, Injectable, Signal } from '@angular/core';
|
||||
import { firstValueFrom, from, merge, Observable, of, pairwise, Subject, switchMap } from 'rxjs';
|
||||
import { Dictionary, Dossier, DOSSIER_ID, DOSSIER_TEMPLATE_ID, File, FILE_ID } from '@red/domain';
|
||||
import { Router } from '@angular/router';
|
||||
import { FilesMapService } from '@services/files/files-map.service';
|
||||
import { PermissionsService } from '@services/permissions.service';
|
||||
import { getParam, LoadingService, wipeCache } from '@iqser/common-ui';
|
||||
@ -34,7 +33,6 @@ function isDownload(event: HttpEvent<Blob>): event is HttpProgressEvent {
|
||||
export class FilePreviewStateService {
|
||||
readonly file$: Observable<File>;
|
||||
readonly file: Signal<File>;
|
||||
readonly dossier$: Observable<Dossier>;
|
||||
readonly dossier: Signal<Dossier>;
|
||||
readonly isReadonly: Signal<boolean>;
|
||||
readonly isWritable: Signal<boolean>;
|
||||
@ -54,23 +52,17 @@ export class FilePreviewStateService {
|
||||
// );
|
||||
|
||||
constructor(
|
||||
router: Router,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
private readonly _injector: Injector,
|
||||
private readonly _permissionsService: PermissionsService,
|
||||
private readonly _filesService: FilesService,
|
||||
private readonly _dossiersService: DossiersService,
|
||||
private readonly _fileManagementService: FileManagementService,
|
||||
private readonly _dossierDictionariesMapService: DossierDictionariesMapService,
|
||||
private readonly _dictionariesMapService: DictionariesMapService,
|
||||
private readonly _translateService: TranslateService,
|
||||
private readonly _loadingService: LoadingService,
|
||||
private readonly _viewModeService: ViewModeService,
|
||||
) {
|
||||
const dossiersService = dossiersServiceResolver(_injector, router);
|
||||
this.dossier$ = dossiersService.getEntityChanged$(this.dossierId);
|
||||
this.dossier = toSignal(this.dossier$);
|
||||
this.file$ = _filesMapService.watch$(this.dossierId, this.fileId);
|
||||
this.dossier = toSignal(dossiersServiceResolver().getEntityChanged$(this.dossierId));
|
||||
this.file$ = inject(FilesMapService).watch$(this.dossierId, this.fileId);
|
||||
this.file = toSignal(this.file$);
|
||||
// this.file$ = combineLatest([this.isAttached, file$]).pipe(
|
||||
// filter(([isAttached]) => isAttached),
|
||||
@ -83,7 +75,7 @@ export class FilePreviewStateService {
|
||||
|
||||
this.blob$ = this.#blob$;
|
||||
|
||||
this.dossierDictionary = toSignal(this._dossierDictionariesMapService.watch$(this.dossierId, 'dossier_redaction'));
|
||||
this.dossierDictionary = toSignal(inject(DossierDictionariesMapService).watch$(this.dossierId, 'dossier_redaction'));
|
||||
this.#dossierFileChange = toSignal(this.#dossierFilesChange$);
|
||||
effect(() => {
|
||||
if (this.#dossierFileChange()) {
|
||||
|
||||
@ -42,9 +42,8 @@ export class EditorComponent implements OnInit, OnChanges {
|
||||
editorOptions: IStandaloneEditorConstructionOptions = {};
|
||||
codeEditor: ICodeEditor;
|
||||
value: string;
|
||||
protected _initialEntriesMap = new Set<string>();
|
||||
|
||||
protected readonly _editorTextChanged$ = new Subject<string>();
|
||||
#initialEntriesSet = new Set<string>();
|
||||
private _diffEditor: IDiffEditor;
|
||||
private _decorations: string[] = [];
|
||||
|
||||
@ -120,7 +119,7 @@ export class EditorComponent implements OnInit, OnChanges {
|
||||
|
||||
revert() {
|
||||
this.value = this.initialEntries.join('\n');
|
||||
this._initialEntriesMap = new Set<string>(this.initialEntries);
|
||||
this.#initialEntriesSet = new Set<string>(this.initialEntries);
|
||||
this.diffValue = this.value;
|
||||
this._diffEditor?.getModifiedEditor().setValue(this.diffValue);
|
||||
this._editorTextChanged$.next(this.value);
|
||||
@ -136,7 +135,7 @@ export class EditorComponent implements OnInit, OnChanges {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this._initialEntriesMap.has(entry)) {
|
||||
if (this.#initialEntriesSet.has(entry)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
import { Router } from '@angular/router';
|
||||
import { Injector, ProviderToken } from '@angular/core';
|
||||
import { inject, Injector, ProviderToken } from '@angular/core';
|
||||
import { DossiersService } from '../dossiers/dossiers.service';
|
||||
|
||||
/** Usage in components or services is only allowed in guards or in constructors.
|
||||
* Otherwise, it causes errors on navigation to other screens if the component is reused. */
|
||||
export const dossiersServiceResolver = (injector: Injector, router: Router) => {
|
||||
export const dossiersServiceResolver = (injector = inject(Injector), router = inject(Router)) => {
|
||||
let route = router.routerState.root;
|
||||
while (route.firstChild) {
|
||||
route = route.firstChild;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user