Remove dossiersServiceResolver from PermissionsService [1]
This commit is contained in:
parent
cb0e890a7d
commit
9692f449b7
@ -182,7 +182,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
|
|||||||
|
|
||||||
this.#canDelete = this._permissionsService.canDeleteFile(this.selectedFiles);
|
this.#canDelete = this._permissionsService.canDeleteFile(this.selectedFiles);
|
||||||
|
|
||||||
this.#canReanalyse = this._permissionsService.canReanalyseFile(this.selectedFiles);
|
this.#canReanalyse = this._permissionsService.canReanalyseFile(this.selectedFiles, this.dossier);
|
||||||
|
|
||||||
this.#canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis(this.selectedFiles);
|
this.#canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis(this.selectedFiles);
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ export class DossierOverviewBulkActionsComponent implements OnChanges {
|
|||||||
|
|
||||||
this.#canSetToUnderReview = this._permissionsService.canSetUnderReview(this.selectedFiles) && !isWorkflow;
|
this.#canSetToUnderReview = this._permissionsService.canSetUnderReview(this.selectedFiles) && !isWorkflow;
|
||||||
|
|
||||||
this.#canSetToUnderApproval = this._permissionsService.canSetUnderApproval(this.selectedFiles) && !isWorkflow;
|
this.#canSetToUnderApproval = this._permissionsService.canSetUnderApproval(this.selectedFiles, this.dossier) && !isWorkflow;
|
||||||
|
|
||||||
this.#isReadyForApproval = this._permissionsService.isReadyForApproval(this.selectedFiles) && !isWorkflow;
|
this.#isReadyForApproval = this._permissionsService.isReadyForApproval(this.selectedFiles) && !isWorkflow;
|
||||||
|
|
||||||
|
|||||||
@ -56,5 +56,11 @@
|
|||||||
></iqser-status-bar>
|
></iqser-status-bar>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<redaction-file-actions *ngIf="!file.isProcessing" [file]="file" class="mr-4" type="dossier-overview-list"></redaction-file-actions>
|
<redaction-file-actions
|
||||||
|
*ngIf="!file.isProcessing"
|
||||||
|
[dossier]="dossier"
|
||||||
|
[file]="file"
|
||||||
|
class="mr-4"
|
||||||
|
type="dossier-overview-list"
|
||||||
|
></redaction-file-actions>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
|
||||||
import { File, IFileAttributeConfig } from '@red/domain';
|
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
|
||||||
import { Required } from '@iqser/common-ui';
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-table-item',
|
selector: 'redaction-table-item [file] [dossier] [displayedAttributes] [dossierTemplateId]',
|
||||||
templateUrl: './table-item.component.html',
|
templateUrl: './table-item.component.html',
|
||||||
styleUrls: ['./table-item.component.scss'],
|
styleUrls: ['./table-item.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class TableItemComponent {
|
export class TableItemComponent {
|
||||||
@Input() @Required() file!: File;
|
@Input() file: File;
|
||||||
@Input() @Required() displayedAttributes!: IFileAttributeConfig[];
|
@Input() dossier: Dossier;
|
||||||
|
@Input() displayedAttributes: IFileAttributeConfig[];
|
||||||
@Input() dossierTemplateId: string;
|
@Input() dossierTemplateId: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@
|
|||||||
<div #actionsWrapper class="actions-wrapper">
|
<div #actionsWrapper class="actions-wrapper">
|
||||||
<redaction-file-actions
|
<redaction-file-actions
|
||||||
*ngIf="!file.isProcessing"
|
*ngIf="!file.isProcessing"
|
||||||
|
[dossier]="dossier"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
[maxWidth]="width"
|
[maxWidth]="width"
|
||||||
type="dossier-overview-workflow"
|
type="dossier-overview-workflow"
|
||||||
|
|||||||
@ -1,16 +1,17 @@
|
|||||||
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
import { ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core';
|
||||||
import { File, IFileAttributeConfig } from '@red/domain';
|
import { Dossier, File, IFileAttributeConfig } from '@red/domain';
|
||||||
import { Debounce, Required } from '@iqser/common-ui';
|
import { Debounce } from '@iqser/common-ui';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-workflow-item',
|
selector: 'redaction-workflow-item [file] [dossier] [displayedAttributes]',
|
||||||
templateUrl: './workflow-item.component.html',
|
templateUrl: './workflow-item.component.html',
|
||||||
styleUrls: ['./workflow-item.component.scss'],
|
styleUrls: ['./workflow-item.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
})
|
})
|
||||||
export class WorkflowItemComponent implements OnInit {
|
export class WorkflowItemComponent implements OnInit {
|
||||||
@Input() @Required() file!: File;
|
@Input() file: File;
|
||||||
@Input() @Required() displayedAttributes!: IFileAttributeConfig[];
|
@Input() dossier: Dossier;
|
||||||
|
@Input() displayedAttributes: IFileAttributeConfig[];
|
||||||
width: number;
|
width: number;
|
||||||
|
|
||||||
@ViewChild('actionsWrapper', { static: true }) private _actionsWrapper: ElementRef;
|
@ViewChild('actionsWrapper', { static: true }) private _actionsWrapper: ElementRef;
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import {
|
|||||||
TableColumnConfig,
|
TableColumnConfig,
|
||||||
WorkflowConfig,
|
WorkflowConfig,
|
||||||
} from '@iqser/common-ui';
|
} from '@iqser/common-ui';
|
||||||
import { File, IFileAttributeConfig, StatusSorter, WorkflowFileStatus, WorkflowFileStatuses } from '@red/domain';
|
import { Dossier, File, IFileAttributeConfig, StatusSorter, WorkflowFileStatus, WorkflowFileStatuses } from '@red/domain';
|
||||||
import { workflowFileStatusTranslations } from '../../translations/file-status-translations';
|
import { workflowFileStatusTranslations } from '../../translations/file-status-translations';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
@ -49,7 +49,7 @@ export class ConfigService {
|
|||||||
this._listingMode$.next(listingMode);
|
this._listingMode$.next(listingMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
get workflowConfig(): WorkflowConfig<File, WorkflowFileStatus> {
|
workflowConfig(dossier: Dossier): WorkflowConfig<File, WorkflowFileStatus> {
|
||||||
return {
|
return {
|
||||||
columnIdentifierFn: entity => entity.workflowStatus,
|
columnIdentifierFn: entity => entity.workflowStatus,
|
||||||
itemVersionFn: (entity: File) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`,
|
itemVersionFn: (entity: File) => `${entity.lastUpdated}-${entity.numberOfAnalyses}`,
|
||||||
@ -83,7 +83,7 @@ export class ConfigService {
|
|||||||
label: workflowFileStatusTranslations[WorkflowFileStatuses.UNDER_APPROVAL],
|
label: workflowFileStatusTranslations[WorkflowFileStatuses.UNDER_APPROVAL],
|
||||||
enterFn: (files: File[]) => this._bulkActionsService.setToUnderApproval(files),
|
enterFn: (files: File[]) => this._bulkActionsService.setToUnderApproval(files),
|
||||||
enterPredicate: (files: File[]) =>
|
enterPredicate: (files: File[]) =>
|
||||||
this._permissionsService.canSetUnderApproval(files) || this._permissionsService.canUndoApproval(files),
|
this._permissionsService.canSetUnderApproval(files, dossier) || this._permissionsService.canUndoApproval(files),
|
||||||
key: WorkflowFileStatuses.UNDER_APPROVAL,
|
key: WorkflowFileStatuses.UNDER_APPROVAL,
|
||||||
color: '#374C81',
|
color: '#374C81',
|
||||||
entities: new BehaviorSubject([]),
|
entities: new BehaviorSubject([]),
|
||||||
|
|||||||
@ -67,6 +67,7 @@
|
|||||||
<redaction-table-item
|
<redaction-table-item
|
||||||
[displayedAttributes]="displayedAttributes"
|
[displayedAttributes]="displayedAttributes"
|
||||||
[dossierTemplateId]="dossier.dossierTemplateId"
|
[dossierTemplateId]="dossier.dossierTemplateId"
|
||||||
|
[dossier]="dossier"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
></redaction-table-item>
|
></redaction-table-item>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
@ -79,5 +80,9 @@
|
|||||||
<input #fileInput (change)="uploadFiles($event.target['files'])" class="file-upload-input" multiple="true" type="file" />
|
<input #fileInput (change)="uploadFiles($event.target['files'])" class="file-upload-input" multiple="true" type="file" />
|
||||||
|
|
||||||
<ng-template #workflowItemTemplate let-entity="entity">
|
<ng-template #workflowItemTemplate let-entity="entity">
|
||||||
<redaction-workflow-item [displayedAttributes]="displayedAttributes" [file]="entity"></redaction-workflow-item>
|
<redaction-workflow-item
|
||||||
|
[displayedAttributes]="displayedAttributes"
|
||||||
|
[dossier]="dossier$ | async"
|
||||||
|
[file]="entity"
|
||||||
|
></redaction-workflow-item>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
|
|||||||
@ -69,11 +69,11 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
tableColumnConfigs: readonly TableColumnConfig<File>[];
|
tableColumnConfigs: readonly TableColumnConfig<File>[];
|
||||||
displayedInFileListAttributes: IFileAttributeConfig[] = [];
|
displayedInFileListAttributes: IFileAttributeConfig[] = [];
|
||||||
displayedAttributes: IFileAttributeConfig[] = [];
|
displayedAttributes: IFileAttributeConfig[] = [];
|
||||||
readonly workflowConfig: WorkflowConfig<File, WorkflowFileStatus> = this.configService.workflowConfig;
|
readonly workflowConfig: WorkflowConfig<File, WorkflowFileStatus>;
|
||||||
readonly dossier$: Observable<Dossier>;
|
readonly dossier$: Observable<Dossier>;
|
||||||
readonly dossierId: string;
|
readonly dossierId: string;
|
||||||
currentDossier: Dossier;
|
|
||||||
dossierTemplateId: string;
|
dossierTemplateId: string;
|
||||||
|
#currentDossier: Dossier;
|
||||||
@ViewChild('needsWorkFilterTemplate', { read: TemplateRef, static: true })
|
@ViewChild('needsWorkFilterTemplate', { read: TemplateRef, static: true })
|
||||||
private readonly _needsWorkFilterTemplate: TemplateRef<unknown>;
|
private readonly _needsWorkFilterTemplate: TemplateRef<unknown>;
|
||||||
@ViewChild('fileInput', { static: true }) private readonly _fileInput: ElementRef;
|
@ViewChild('fileInput', { static: true }) private readonly _fileInput: ElementRef;
|
||||||
@ -101,11 +101,15 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
) {
|
) {
|
||||||
super(_injector);
|
super(_injector);
|
||||||
this.dossierId = _route.snapshot.paramMap.get(DOSSIER_ID);
|
this.dossierId = _route.snapshot.paramMap.get(DOSSIER_ID);
|
||||||
this.dossier$ = this._dossiersService
|
this.dossier$ = this._dossiersService.getEntityChanged$(this.dossierId).pipe(
|
||||||
.getEntityChanged$(this.dossierId)
|
tap(dossier => {
|
||||||
.pipe(tap(dossier => (this.dossierTemplateId = dossier.dossierTemplateId)));
|
this.dossierTemplateId = dossier.dossierTemplateId;
|
||||||
this.currentDossier = this._dossiersService.find(this.dossierId);
|
this.#currentDossier = this._dossiersService.find(this.dossierId);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
this.#currentDossier = this._dossiersService.find(this.dossierId);
|
||||||
this._updateFileAttributes();
|
this._updateFileAttributes();
|
||||||
|
this.workflowConfig = this.configService.workflowConfig(this.#currentDossier);
|
||||||
}
|
}
|
||||||
|
|
||||||
get checkedRequiredFilters(): NestedFilter[] {
|
get checkedRequiredFilters(): NestedFilter[] {
|
||||||
@ -121,7 +125,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
lastOpenedFn = (file: File) => this._userPreferenceService.getLastOpenedFileForDossier(file.dossierId) === file.id;
|
lastOpenedFn = (file: File) => this._userPreferenceService.getLastOpenedFileForDossier(file.dossierId) === file.id;
|
||||||
|
|
||||||
async ngOnInit(): Promise<void> {
|
async ngOnInit(): Promise<void> {
|
||||||
this._loadEntitiesFromState();
|
this._computeAllFilters();
|
||||||
|
|
||||||
this._setRemovableSubscriptions();
|
this._setRemovableSubscriptions();
|
||||||
|
|
||||||
@ -133,7 +137,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
)
|
)
|
||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
if (this.currentDossier.isActive) {
|
if (this.#currentDossier.isActive) {
|
||||||
this._fileDropOverlayService.initFileDropHandling(this.dossierId);
|
this._fileDropOverlayService.initFileDropHandling(this.dossierId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,7 +153,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
this.addSubscription = this._dossierTemplatesService
|
this.addSubscription = this._dossierTemplatesService
|
||||||
.getEntityChanged$(this.currentDossier.dossierTemplateId)
|
.getEntityChanged$(this.#currentDossier.dossierTemplateId)
|
||||||
.pipe(
|
.pipe(
|
||||||
skip(1),
|
skip(1),
|
||||||
tap(() => {
|
tap(() => {
|
||||||
@ -159,7 +163,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
.subscribe();
|
.subscribe();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.currentDossier);
|
this.dossierAttributes = await this._dossierAttributesService.getWithValues(this.#currentDossier);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error from dossier overview screen: ', e);
|
console.log('Error from dossier overview screen: ', e);
|
||||||
}
|
}
|
||||||
@ -180,8 +184,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
|
|
||||||
@HostListener('drop', ['$event'])
|
@HostListener('drop', ['$event'])
|
||||||
onDrop(event: DragEvent): void {
|
onDrop(event: DragEvent): void {
|
||||||
const currentDossier = this._dossiersService.find(this.dossierId);
|
handleFileDrop(event, this.#currentDossier, this._uploadFiles.bind(this));
|
||||||
handleFileDrop(event, currentDossier, this._uploadFiles.bind(this));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('dragover', ['$event'])
|
@HostListener('dragover', ['$event'])
|
||||||
@ -191,7 +194,7 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
}
|
}
|
||||||
|
|
||||||
async uploadFiles(files: Files): Promise<void> {
|
async uploadFiles(files: Files): Promise<void> {
|
||||||
await this._uploadFiles(convertFiles(files, this.currentDossier));
|
await this._uploadFiles(convertFiles(files, this.#currentDossier));
|
||||||
(this._fileInput as any).nativeElement.value = null;
|
(this._fileInput as any).nativeElement.value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -210,18 +213,13 @@ export class DossierOverviewScreenComponent extends ListingComponent<File> imple
|
|||||||
|
|
||||||
private _updateFileAttributes(): void {
|
private _updateFileAttributes(): void {
|
||||||
this._fileAttributeConfigs =
|
this._fileAttributeConfigs =
|
||||||
this._fileAttributesService.getFileAttributeConfig(this.currentDossier.dossierTemplateId)?.fileAttributeConfigs || [];
|
this._fileAttributesService.getFileAttributeConfig(this.#currentDossier.dossierTemplateId)?.fileAttributeConfigs || [];
|
||||||
this.displayedInFileListAttributes = this._fileAttributeConfigs.filter(config => config.displayedInFileList);
|
this.displayedInFileListAttributes = this._fileAttributeConfigs.filter(config => config.displayedInFileList);
|
||||||
this.displayedAttributes = this.displayedInFileListAttributes.filter(c => c.displayedInFileList);
|
this.displayedAttributes = this.displayedInFileListAttributes.filter(c => c.displayedInFileList);
|
||||||
this.tableColumnConfigs = this.configService.tableConfig(this.displayedAttributes);
|
this.tableColumnConfigs = this.configService.tableConfig(this.displayedAttributes);
|
||||||
this._computeAllFilters();
|
this._computeAllFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _loadEntitiesFromState() {
|
|
||||||
this.currentDossier = this._dossiersService.find(this.dossierId);
|
|
||||||
this._computeAllFilters();
|
|
||||||
}
|
|
||||||
|
|
||||||
private async _uploadFiles(files: FileUploadModel[]) {
|
private async _uploadFiles(files: FileUploadModel[]) {
|
||||||
const fileCount = await this._fileUploadService.uploadFiles(files, this.dossierId);
|
const fileCount = await this._fileUploadService.uploadFiles(files, this.dossierId);
|
||||||
if (fileCount) {
|
if (fileCount) {
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
ViewChild,
|
ViewChild,
|
||||||
} from '@angular/core';
|
} from '@angular/core';
|
||||||
import { PermissionsService } from '@services/permissions.service';
|
import { PermissionsService } from '@services/permissions.service';
|
||||||
import { Action, ActionTypes, File } from '@red/domain';
|
import { Action, ActionTypes, Dossier, File } from '@red/domain';
|
||||||
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
import { DossiersDialogService } from '../../../services/dossiers-dialog.service';
|
||||||
import {
|
import {
|
||||||
AutoUnsubscribe,
|
AutoUnsubscribe,
|
||||||
@ -42,7 +42,7 @@ import { RedactionImportService } from '../../services/redaction-import.service'
|
|||||||
import { PageRotationService } from '../../../../file-preview/services/page-rotation.service';
|
import { PageRotationService } from '../../../../file-preview/services/page-rotation.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-file-actions [file] [type]',
|
selector: 'redaction-file-actions [file] [type] [dossier]',
|
||||||
templateUrl: './file-actions.component.html',
|
templateUrl: './file-actions.component.html',
|
||||||
styleUrls: ['./file-actions.component.scss'],
|
styleUrls: ['./file-actions.component.scss'],
|
||||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||||
@ -52,6 +52,7 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
readonly currentUser = this._userService.currentUser;
|
readonly currentUser = this._userService.currentUser;
|
||||||
|
|
||||||
@Input() file: File;
|
@Input() file: File;
|
||||||
|
@Input() dossier: Dossier;
|
||||||
@Input() type: 'file-preview' | 'dossier-overview-list' | 'dossier-overview-workflow';
|
@Input() type: 'file-preview' | 'dossier-overview-list' | 'dossier-overview-workflow';
|
||||||
@Input() maxWidth: number;
|
@Input() maxWidth: number;
|
||||||
@Input() fileActionsHelpModeKey: 'document_features' | 'editor_document_features' = 'document_features';
|
@Input() fileActionsHelpModeKey: 'document_features' | 'editor_document_features' = 'document_features';
|
||||||
@ -438,14 +439,14 @@ export class FileActionsComponent extends AutoUnsubscribe implements OnDestroy,
|
|||||||
this.showSetToNew = this._permissionsService.canSetToNew(this.file) && !this.isDossierOverviewWorkflow;
|
this.showSetToNew = this._permissionsService.canSetToNew(this.file) && !this.isDossierOverviewWorkflow;
|
||||||
this.showUndoApproval = this._permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow;
|
this.showUndoApproval = this._permissionsService.canUndoApproval(this.file) && !this.isDossierOverviewWorkflow;
|
||||||
this.showUnderReview = this._permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow;
|
this.showUnderReview = this._permissionsService.canSetUnderReview(this.file) && !this.isDossierOverviewWorkflow;
|
||||||
this.showUnderApproval = this._permissionsService.canSetUnderApproval(this.file) && !this.isDossierOverviewWorkflow;
|
this.showUnderApproval = this._permissionsService.canSetUnderApproval(this.file, this.dossier) && !this.isDossierOverviewWorkflow;
|
||||||
this.showApprove = this._permissionsService.isReadyForApproval(this.file) && !this.isDossierOverviewWorkflow;
|
this.showApprove = this._permissionsService.isReadyForApproval(this.file) && !this.isDossierOverviewWorkflow;
|
||||||
|
|
||||||
this.canToggleAnalysis = this._permissionsService.canToggleAnalysis(this.file);
|
this.canToggleAnalysis = this._permissionsService.canToggleAnalysis(this.file);
|
||||||
this.showToggleAnalysis = this._permissionsService.showToggleAnalysis(this.file);
|
this.showToggleAnalysis = this._permissionsService.showToggleAnalysis(this.file);
|
||||||
this.showDelete = this._permissionsService.canDeleteFile(this.file);
|
this.showDelete = this._permissionsService.canDeleteFile(this.file);
|
||||||
this.showOCR = this._permissionsService.canOcrFile(this.file);
|
this.showOCR = this._permissionsService.canOcrFile(this.file);
|
||||||
this.canReanalyse = this._permissionsService.canReanalyseFile(this.file);
|
this.canReanalyse = this._permissionsService.canReanalyseFile(this.file, this.dossier);
|
||||||
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis([this.file]);
|
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis([this.file]);
|
||||||
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis([this.file]);
|
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis([this.file]);
|
||||||
|
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { TranslateService } from '@ngx-translate/core';
|
|||||||
import { annotationChangesTranslations } from '../../../../translations/annotation-changes-translations';
|
import { annotationChangesTranslations } from '../../../../translations/annotation-changes-translations';
|
||||||
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker';
|
||||||
import { MultiSelectService } from '../../services/multi-select.service';
|
import { MultiSelectService } from '../../services/multi-select.service';
|
||||||
|
import { KeysOf } from '@iqser/common-ui';
|
||||||
|
|
||||||
interface Engine {
|
interface Engine {
|
||||||
readonly icon: string;
|
readonly icon: string;
|
||||||
@ -46,12 +47,13 @@ export class AnnotationDetailsComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private _updateChanges(): void {
|
private _updateChanges(): void {
|
||||||
const changesProperties = [
|
const changesProperties: KeysOf<AnnotationWrapper>[] = [
|
||||||
'hasBeenResized',
|
'hasBeenResized',
|
||||||
'hasBeenRecategorized',
|
'hasBeenRecategorized',
|
||||||
'hasLegalBasisChanged',
|
'hasLegalBasisChanged',
|
||||||
'hasBeenForced',
|
|
||||||
'hasBeenRemovedByManualOverride',
|
'hasBeenRemovedByManualOverride',
|
||||||
|
'hasBeenForcedRedaction',
|
||||||
|
'hasBeenForcedHint',
|
||||||
];
|
];
|
||||||
const changes = changesProperties.filter(key => this.annotation[key]);
|
const changes = changesProperties.filter(key => this.annotation[key]);
|
||||||
const header = this._translateService.instant(_('annotation-changes.header'));
|
const header = this._translateService.instant(_('annotation-changes.header'));
|
||||||
|
|||||||
@ -19,6 +19,7 @@
|
|||||||
<div class="vertical-line"></div>
|
<div class="vertical-line"></div>
|
||||||
|
|
||||||
<redaction-file-actions
|
<redaction-file-actions
|
||||||
|
[dossier]="dossier"
|
||||||
[file]="file"
|
[file]="file"
|
||||||
fileActionsHelpModeKey="editor_document_features"
|
fileActionsHelpModeKey="editor_document_features"
|
||||||
type="file-preview"
|
type="file-preview"
|
||||||
|
|||||||
@ -26,8 +26,7 @@ export class PermissionsService {
|
|||||||
return user.isAdmin;
|
return user.isAdmin;
|
||||||
}
|
}
|
||||||
|
|
||||||
isReviewerOrApprover(file: File): boolean {
|
isReviewerOrApprover(file: File, dossier: Dossier): boolean {
|
||||||
const dossier = this._getDossier(file);
|
|
||||||
return this.isFileAssignee(file) || this.isApprover(dossier);
|
return this.isFileAssignee(file) || this.isApprover(dossier);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,9 +61,9 @@ export class PermissionsService {
|
|||||||
return this._isActive(files[0]);
|
return this._isActive(files[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
canReanalyseFile(file: File | File[]): boolean {
|
canReanalyseFile(file: File | File[], dossier: Dossier): boolean {
|
||||||
const files = file instanceof File ? [file] : file;
|
const files = file instanceof File ? [file] : file;
|
||||||
return files.reduce((acc, _file) => this._canReanalyseFile(_file) && acc, true);
|
return files.reduce((acc, _file) => this._canReanalyseFile(_file, dossier) && acc, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
canEnableAutoAnalysis(files: File[]): boolean {
|
canEnableAutoAnalysis(files: File[]): boolean {
|
||||||
@ -133,9 +132,9 @@ export class PermissionsService {
|
|||||||
return this.canSetUnderReview(files);
|
return this.canSetUnderReview(files);
|
||||||
}
|
}
|
||||||
|
|
||||||
canSetUnderApproval(file: File | File[]): boolean {
|
canSetUnderApproval(file: File | File[], dossier: Dossier): boolean {
|
||||||
const files = file instanceof File ? [file] : file;
|
const files = file instanceof File ? [file] : file;
|
||||||
return files.reduce((acc, _file) => this._canSetUnderApproval(_file) && acc, true);
|
return files.reduce((acc, _file) => this._canSetUnderApproval(_file, dossier) && acc, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
isOwner(dossier: Dossier, user = this._userService.currentUser): boolean {
|
isOwner(dossier: Dossier, user = this._userService.currentUser): boolean {
|
||||||
@ -146,10 +145,6 @@ export class PermissionsService {
|
|||||||
return dossier.approverIds.indexOf(user.id) >= 0;
|
return dossier.approverIds.indexOf(user.id) >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
isDossierReviewer(dossier: Dossier, user = this._userService.currentUser): boolean {
|
|
||||||
return this.isDossierMember(dossier, user) && !this.isApprover(dossier, user);
|
|
||||||
}
|
|
||||||
|
|
||||||
isDossierMember(dossier: Dossier, user = this._userService.currentUser): boolean {
|
isDossierMember(dossier: Dossier, user = this._userService.currentUser): boolean {
|
||||||
return dossier.memberIds.includes(user.id);
|
return dossier.memberIds.includes(user.id);
|
||||||
}
|
}
|
||||||
@ -253,8 +248,8 @@ export class PermissionsService {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _canReanalyseFile(file: File): boolean {
|
private _canReanalyseFile(file: File, dossier: Dossier): boolean {
|
||||||
return this._isActive(file) && this.isReviewerOrApprover(file) && file.analysisRequired;
|
return this._isActive(file) && this.isReviewerOrApprover(file, dossier) && file.analysisRequired;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _canEnableAutoAnalysis(file: File): boolean {
|
private _canEnableAutoAnalysis(file: File): boolean {
|
||||||
@ -281,8 +276,8 @@ export class PermissionsService {
|
|||||||
return precondition && (file.isNew || file.isUnderReview || (file.isUnderApproval && this.isApprover(dossier)));
|
return precondition && (file.isNew || file.isUnderReview || (file.isUnderApproval && this.isApprover(dossier)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private _canSetUnderApproval(file: File): boolean {
|
private _canSetUnderApproval(file: File, dossier: Dossier): boolean {
|
||||||
return this._isActive(file) && file.isUnderReview && this.isReviewerOrApprover(file);
|
return this._isActive(file) && file.isUnderReview && this.isReviewerOrApprover(file, dossier);
|
||||||
}
|
}
|
||||||
|
|
||||||
private _canUndoApproval(file: File, dossier: Dossier): boolean {
|
private _canUndoApproval(file: File, dossier: Dossier): boolean {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user