activate current file in appStateService
This commit is contained in:
parent
b4532dab85
commit
160220ce4e
@ -7,7 +7,6 @@ import { debounce } from '../../../../utils/debounce';
|
||||
import { MatDialogRef, MatDialogState } from '@angular/material/dialog';
|
||||
import { ManualRedactionEntryWrapper } from '../../../../models/file/manual-redaction-entry.wrapper';
|
||||
import { AnnotationWrapper } from '../../../../models/file/annotation.wrapper';
|
||||
import { ManualAnnotationService } from '../../services/manual-annotation.service';
|
||||
import { ManualAnnotationResponse } from '../../../../models/file/manual-annotation-response';
|
||||
import { AnnotationData, FileDataModel } from '../../../../models/file/file-data.model';
|
||||
import { FileActionService } from '../../services/file-action.service';
|
||||
@ -16,7 +15,6 @@ import { AnnotationProcessingService } from '../../services/annotation-processin
|
||||
import { FilterModel } from '../../../shared/components/filter/model/filter.model';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { NotificationService } from '../../../../services/notification.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { FileStatusWrapper } from '../../../../models/file/file-status.wrapper';
|
||||
import { PermissionsService } from '../../../../services/permissions.service';
|
||||
import { Subscription, timer } from 'rxjs';
|
||||
@ -86,21 +84,12 @@ export class FilePreviewScreenComponent implements OnInit, OnDestroy {
|
||||
private readonly _ngZone: NgZone,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService
|
||||
) {
|
||||
this._activatedRoute.params.subscribe((params) => {
|
||||
this.projectId = params.projectId;
|
||||
this.fileId = params.fileId;
|
||||
this.appStateService.activateFile(this.projectId, this.fileId);
|
||||
|
||||
this.reviewerForm = this._formBuilder.group({
|
||||
reviewer: [this.appStateService.activeFile.currentReviewer]
|
||||
});
|
||||
this.reviewerForm = this._formBuilder.group({
|
||||
reviewer: [this.appStateService.activeFile.currentReviewer]
|
||||
});
|
||||
}
|
||||
|
||||
get activeFile() {
|
||||
// if (this.appStateService.activeFile === undefined && !!this.fileId && !!this.projectId) {
|
||||
this.appStateService.activateFile(this.projectId, this.fileId);
|
||||
// }
|
||||
return this.appStateService.activeFile;
|
||||
}
|
||||
|
||||
|
||||
@ -3,7 +3,6 @@ import {
|
||||
DictionaryControllerService,
|
||||
FileAttributeConfig,
|
||||
FileAttributesControllerService,
|
||||
FileManagementControllerService,
|
||||
FileStatus,
|
||||
Project,
|
||||
ProjectControllerService,
|
||||
@ -16,7 +15,7 @@ import {
|
||||
} from '@redaction/red-ui-http';
|
||||
import { NotificationService, NotificationType } from '../services/notification.service';
|
||||
import { TranslateService } from '@ngx-translate/core';
|
||||
import { Router } from '@angular/router';
|
||||
import { ActivatedRoute, Event, ResolveStart, Router } from '@angular/router';
|
||||
import { UserService } from '../services/user.service';
|
||||
import { forkJoin, Observable } from 'rxjs';
|
||||
import { tap } from 'rxjs/operators';
|
||||
@ -50,7 +49,6 @@ export class AppStateService {
|
||||
constructor(
|
||||
private readonly _router: Router,
|
||||
private readonly _userService: UserService,
|
||||
private readonly _fileManagementControllerService: FileManagementControllerService,
|
||||
private readonly _projectControllerService: ProjectControllerService,
|
||||
private readonly _notificationService: NotificationService,
|
||||
private readonly _reanalysisControllerService: ReanalysisControllerService,
|
||||
@ -71,6 +69,18 @@ export class AppStateService {
|
||||
activeDictionaryType: null,
|
||||
versions: {}
|
||||
};
|
||||
|
||||
this._router.events.subscribe((event: Event) => {
|
||||
if (event instanceof ResolveStart) {
|
||||
console.log(event);
|
||||
if (event.url.includes('/ui/projects/') && event.url.includes('/file/')) {
|
||||
const url = event.url.replace('/ui/projects/', '').split('/');
|
||||
const projectId = url[0];
|
||||
const fileId = url[2];
|
||||
this.activateFile(projectId, fileId);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async reloadActiveProjectFilesIfNecessary() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user