RED-3525: Disable switch to highlights if no highlights in file

This commit is contained in:
Adina Țeudan 2022-04-06 17:40:46 +03:00
parent cf2d935c0b
commit 2a46fdb95a
5 changed files with 11 additions and 2 deletions

View File

@ -34,7 +34,7 @@
<button
(click)="switchView.emit('TEXT_HIGHLIGHTS')"
[class.active]="viewModeService.isTextHighlights"
[disabled]="(canSwitchToRedactedView$ | async) === false"
[disabled]="(canSwitchToHighlightsView$ | async) === false"
[matTooltip]="'file-preview.text-highlights-tooltip' | translate"
class="red-tab"
iqserHelpMode="highlights_view"

View File

@ -17,6 +17,7 @@ export class ViewSwitchComponent {
readonly canSwitchToDeltaView$: Observable<boolean>;
readonly canSwitchToRedactedView$: Observable<boolean>;
readonly canSwitchToHighlightsView$: Observable<boolean>;
constructor(
readonly viewModeService: ViewModeService,
@ -28,5 +29,9 @@ export class ViewSwitchComponent {
);
this.canSwitchToRedactedView$ = _stateService.file$.pipe(map(file => !file.analysisRequired && !file.excluded));
this.canSwitchToHighlightsView$ = _stateService.file$.pipe(
map(file => file.hasHighlights && !file.analysisRequired && !file.excluded),
);
}
}

@ -1 +1 @@
Subproject commit 70b61282309cb290406c538b5218341cb4f1c40a
Subproject commit 37edb34d0fc3cf49dd889e98f5ec3d39227649f5

View File

@ -50,6 +50,7 @@ export class File extends Entity<IFile> implements IFile, IRouterPath {
readonly fileManipulationDate: string;
readonly redactionModificationDate: string;
readonly lastManualChangeDate?: string;
readonly hasHighlights: boolean;
readonly statusSort: number;
readonly cacheIdentifier?: string;
@ -110,6 +111,7 @@ export class File extends Entity<IFile> implements IFile, IRouterPath {
this.fileManipulationDate = file.fileManipulationDate ?? '';
this.redactionModificationDate = file.redactionModificationDate ?? '';
this.lastManualChangeDate = file.lastManualChangeDate;
this.hasHighlights = file.hasHighlights;
this.statusSort = StatusSorter[this.workflowStatus];
this.cacheIdentifier = btoa(this.fileManipulationDate ?? '');

View File

@ -147,6 +147,8 @@ export interface IFile {
readonly workflowStatus: WorkflowFileStatus;
readonly hasHighlights: boolean;
/**
* Last time the actual file was touched
*/