From ab2af31f28bf7faccbb68a26d574fa948aab0906 Mon Sep 17 00:00:00 2001 From: Nicoleta Panaghiu Date: Thu, 14 Nov 2024 11:04:10 +0200 Subject: [PATCH] RED-10363: fixed cosmetical issue, added tooltips to and disabled btns. --- apps/red-ui/src/app/app.module.ts | 1 + .../dossier-overview-bulk-actions.component.ts | 8 ++++++-- .../file-header/file-header.component.ts | 1 - .../components/pages/pages.component.ts | 14 ++++++++------ .../file-actions/file-actions.component.ts | 5 ++--- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/apps/red-ui/src/app/app.module.ts b/apps/red-ui/src/app/app.module.ts index 52a8534ed..82d09377f 100644 --- a/apps/red-ui/src/app/app.module.ts +++ b/apps/red-ui/src/app/app.module.ts @@ -258,6 +258,7 @@ export const appModuleFactory = (config: AppConfig) => { provide: MAT_TOOLTIP_DEFAULT_OPTIONS, useValue: { disableTooltipInteractivity: true, + showDelay: 1, }, }, BaseDatePipe, diff --git a/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts b/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts index 52fcb2097..ee0d2ca94 100644 --- a/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts +++ b/apps/red-ui/src/app/modules/dossier-overview/components/bulk-actions/dossier-overview-bulk-actions.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, OnChanges } from '@angular/core'; +import { Component, computed, Input, OnChanges } from '@angular/core'; import { marker as _ } from '@biesbjerg/ngx-translate-extract-marker'; import { CircleButtonType, CircleButtonTypes } from '@iqser/common-ui'; import { Action, ActionTypes, Dossier, File, ProcessingFileStatuses } from '@red/domain'; @@ -9,6 +9,7 @@ import { BulkActionsService } from '../../services/bulk-actions.service'; import { ExpandableFileActionsComponent } from '@shared/components/expandable-file-actions/expandable-file-actions.component'; import { IqserTooltipPositions } from '@common-ui/utils'; import { NgIf } from '@angular/common'; +import { RulesService } from '../../../admin/services/rules.service'; @Component({ selector: 'redaction-dossier-overview-bulk-actions [dossier] [selectedFiles]', @@ -43,11 +44,13 @@ export class DossierOverviewBulkActionsComponent implements OnChanges { @Input() maxWidth: number; buttons: Action[]; readonly IqserTooltipPositions = IqserTooltipPositions; + readonly areRulesLocked = computed(() => this._rulesService.currentTemplateRules().timeoutDetected); constructor( private readonly _permissionsService: PermissionsService, private readonly _userPreferenceService: UserPreferenceService, private readonly _bulkActionsService: BulkActionsService, + private readonly _rulesService: RulesService, ) {} private get _buttons(): Action[] { @@ -136,8 +139,9 @@ export class DossierOverviewBulkActionsComponent implements OnChanges { id: 'reanalyse-files-btn', type: ActionTypes.circleBtn, action: () => this._bulkActionsService.reanalyse(this.selectedFiles), - tooltip: _('dossier-overview.bulk.reanalyse'), + tooltip: this.areRulesLocked() ? _('dossier-listing.rules.timeoutError') : _('dossier-overview.bulk.reanalyse'), icon: 'iqser:refresh', + disabled: this.areRulesLocked(), show: this.#canReanalyse && (this.#analysisForced || this.#canEnableAutoAnalysis || this.selectedFiles.every(file => file.isError)), diff --git a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts index c62b29a40..da73d183e 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/file-header/file-header.component.ts @@ -19,7 +19,6 @@ import { getConfig, HelpModeService, IqserAllowDirective, - IqserDialog, IqserPermissionsService, isIqserDevMode, LoadingService, diff --git a/apps/red-ui/src/app/modules/file-preview/components/pages/pages.component.ts b/apps/red-ui/src/app/modules/file-preview/components/pages/pages.component.ts index 9c8725e46..1a3d4876a 100644 --- a/apps/red-ui/src/app/modules/file-preview/components/pages/pages.component.ts +++ b/apps/red-ui/src/app/modules/file-preview/components/pages/pages.component.ts @@ -34,12 +34,14 @@ export class PagesComponent implements AfterViewInit { // TODO: looks like this is not working scrollToLastViewedPage() { const currentPdfPage = this._pdf.currentPage(); - scrollIntoView(document.getElementById(`quick-nav-page-${currentPdfPage}`), { - behavior: 'smooth', - scrollMode: 'if-needed', - block: 'start', - inline: 'start', - }); + const currentElement = document.getElementById(`quick-nav-page-${currentPdfPage}`); + if (currentElement) + scrollIntoView(currentElement, { + behavior: 'smooth', + scrollMode: 'if-needed', + block: 'start', + inline: 'start', + }); } pageSelectedByClick($event: number): void { diff --git a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts index 8a43d507c..9a0eec5a6 100644 --- a/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts +++ b/apps/red-ui/src/app/modules/shared-dossiers/components/file-actions/file-actions.component.ts @@ -252,11 +252,10 @@ export class FileActionsComponent implements OnChanges { id: 'btn-reanalyse_file_preview', type: ActionTypes.circleBtn, action: () => this.#reanalyseFile(), - tooltip: _('file-preview.reanalyse-notification'), - tooltipClass: 'small', + tooltip: this.areRulesLocked() ? _('dossier-listing.rules.timeoutError') : _('file-preview.reanalyse-notification'), icon: 'iqser:refresh', show: this.showReanalyseFilePreview, - disabled: this.file.isProcessing, + disabled: this.file.isProcessing || this.areRulesLocked(), helpModeKey: 'stop_analysis', }, {