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