DM-360 - Remove OCR workload in document and Stop auto-analysis button
This commit is contained in:
parent
62fe3fb048
commit
6bd2ea477b
@ -3,7 +3,7 @@ import { AnnotationWrapper } from '@models/file/annotation.wrapper';
|
||||
import { AnnotationProcessingService } from '../../services/annotation-processing.service';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import scrollIntoView from 'scroll-into-view-if-needed';
|
||||
import { CircleButtonTypes, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { CircleButtonTypes, getConfig, IconButtonTypes } from '@iqser/common-ui';
|
||||
import { combineLatest, delay, Observable } from 'rxjs';
|
||||
import { map } from 'rxjs/operators';
|
||||
import { ExcludedPagesService } from '../../services/excluded-pages.service';
|
||||
@ -24,6 +24,7 @@ import { PageRotationService } from '../../../pdf-viewer/services/page-rotation.
|
||||
import { getLocalStorageDataByFileId } from '@utils/local-storage';
|
||||
import { FilterService, INestedFilter } from '@iqser/common-ui/lib/filtering';
|
||||
import { AutoUnsubscribe, bool, Debounce, IqserEventTarget } from '@iqser/common-ui/lib/utils';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
|
||||
const COMMAND_KEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Escape'];
|
||||
const ALL_HOTKEY_ARRAY = ['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown'];
|
||||
@ -46,6 +47,8 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
|
||||
this.viewModeService.isEarmarks() ? _('file-preview.tabs.highlights.label') : _('file-preview.tabs.annotations.label'),
|
||||
);
|
||||
readonly currentPageIsExcluded = computed(() => this.state.file().excludedPages.includes(this.pdf.currentPage()));
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
readonly #devMode = this._userPreferenceService.areDevFeaturesEnabled;
|
||||
|
||||
constructor(
|
||||
readonly filterService: FilterService,
|
||||
@ -65,6 +68,7 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
|
||||
private readonly _annotationProcessingService: AnnotationProcessingService,
|
||||
private readonly _suggestionsService: SuggestionsService,
|
||||
private readonly _pageRotationService: PageRotationService,
|
||||
private readonly _userPreferenceService: UserPreferenceService,
|
||||
) {
|
||||
super();
|
||||
|
||||
@ -358,6 +362,10 @@ export class FileWorkloadComponent extends AutoUnsubscribe implements OnInit, On
|
||||
annotations = this._suggestionsService.filterWorkloadSuggestionsInPreview(annotations);
|
||||
}
|
||||
|
||||
if (this.#isDocumine && !this.#devMode) {
|
||||
annotations = annotations.filter(a => !a.isOCR);
|
||||
}
|
||||
|
||||
this.displayedAnnotations = this._annotationProcessingService.filterAndGroupAnnotations(annotations, primary, secondary);
|
||||
const pagesThatDisplayAnnotations = [...this.displayedAnnotations.keys()];
|
||||
const enabledFilters = this.filterService.enabledFlatFilters;
|
||||
|
||||
@ -5,6 +5,7 @@ import { DossiersDialogService } from '../../services/dossiers-dialog.service';
|
||||
import {
|
||||
CircleButtonType,
|
||||
CircleButtonTypes,
|
||||
getConfig,
|
||||
IConfirmationDialogData,
|
||||
IqserPermissionsService,
|
||||
LoadingService,
|
||||
@ -50,6 +51,7 @@ export class FileActionsComponent implements OnChanges {
|
||||
@Input() fileActionsHelpModeKey: 'document_features_in_dossier' | 'editor_document_features' = 'document_features_in_dossier';
|
||||
readonly circleButtonTypes = CircleButtonTypes;
|
||||
readonly currentUser = getCurrentUser<User>();
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
toggleTooltip?: string;
|
||||
assignTooltip?: string;
|
||||
buttonType?: CircleButtonType;
|
||||
@ -427,7 +429,7 @@ export class FileActionsComponent implements OnChanges {
|
||||
this.showDelete = this._permissionsService.canSoftDeleteFile(this.file, this.dossier);
|
||||
this.showOCR = this._permissionsService.canOcrFile(this.file, this.dossier);
|
||||
this.canReanalyse = this._permissionsService.canReanalyseFile(this.file, this.dossier);
|
||||
this.canDisableAutoAnalysis = this._permissionsService.canDisableAutoAnalysis([this.file], this.dossier);
|
||||
this.canDisableAutoAnalysis = !this.#isDocumine && this._permissionsService.canDisableAutoAnalysis([this.file], this.dossier);
|
||||
this.canEnableAutoAnalysis = this._permissionsService.canEnableAutoAnalysis([this.file], this.dossier);
|
||||
|
||||
this.showStatusBar = !this.file.isError && !this.file.isUnprocessed && this.isDossierOverviewList;
|
||||
|
||||
@ -1,15 +1,27 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { UserService } from '@users/user.service';
|
||||
import { DashboardStats, Dictionary, Dossier, DOSSIERS_ARCHIVE, DossierTemplate, File, IComment, IDossier } from '@red/domain';
|
||||
import {
|
||||
DashboardStats,
|
||||
Dictionary,
|
||||
Dossier,
|
||||
DOSSIERS_ARCHIVE,
|
||||
DossierTemplate,
|
||||
File,
|
||||
IComment,
|
||||
IDossier,
|
||||
ProcessingFileStatuses,
|
||||
WorkflowFileStatuses,
|
||||
} from '@red/domain';
|
||||
import { FilesMapService } from '@services/files/files-map.service';
|
||||
import { FeaturesService } from '@services/features.service';
|
||||
import { IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { getConfig, IqserPermissionsService } from '@iqser/common-ui';
|
||||
import { Roles } from '@users/roles';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { DossierDictionariesMapService } from '@services/entity-services/dossier-dictionaries-map.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class PermissionsService {
|
||||
readonly #isDocumine = getConfig().IS_DOCUMINE;
|
||||
constructor(
|
||||
private readonly _userService: UserService,
|
||||
private readonly _filesMapService: FilesMapService,
|
||||
@ -397,9 +409,13 @@ export class PermissionsService {
|
||||
}
|
||||
|
||||
#canEnableAutoAnalysis(file: File, dossier: Dossier): boolean {
|
||||
return (
|
||||
dossier.isActive && file.excludedFromAutomaticAnalysis && this.isFileAssignee(file) && !file.isApproved && !!file.lastProcessed
|
||||
);
|
||||
const canEnable = dossier.isActive && this.isFileAssignee(file) && !file.isApproved && !!file.lastProcessed;
|
||||
|
||||
if (this.#isDocumine) {
|
||||
return canEnable && file.processingStatus === ProcessingFileStatuses.ERROR;
|
||||
}
|
||||
|
||||
return canEnable && file.excludedFromAutomaticAnalysis;
|
||||
}
|
||||
|
||||
#canDisableAutoAnalysis(file: File, dossier: Dossier): boolean {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user