RED-5401: update common-ui & make updateViewMode to be called once

This commit is contained in:
Dan Percic 2022-10-26 16:06:38 +03:00
parent 69587413df
commit 56bc386f0d
5 changed files with 13 additions and 16 deletions

View File

@ -1,6 +1,6 @@
<ng-container *ngIf="viewModeService.viewMode$ | async as viewMode">
<button
(click)="switchView.emit(viewModes.STANDARD)"
(click)="switchView(viewModes.STANDARD)"
[class.active]="viewMode === viewModes.STANDARD"
[iqserHelpMode]="'views'"
[matTooltip]="'file-preview.standard-tooltip' | translate"
@ -10,7 +10,7 @@
</button>
<button
(click)="switchView.emit(viewModes.DELTA)"
(click)="switchView(viewModes.DELTA)"
[class.active]="viewMode === viewModes.DELTA"
[disabled]="(canSwitchToDeltaView$ | async) === false"
[iqserHelpMode]="'views'"
@ -21,7 +21,7 @@
</button>
<button
(click)="switchView.emit(viewModes.REDACTED)"
(click)="switchView(viewModes.REDACTED)"
[class.active]="viewMode === viewModes.REDACTED"
[disabled]="(canSwitchToRedactedView$ | async) === false"
[iqserHelpMode]="'views'"
@ -32,7 +32,7 @@
</button>
<button
(click)="switchView.emit(viewModes.TEXT_HIGHLIGHTS)"
(click)="switchView(viewModes.TEXT_HIGHLIGHTS)"
[class.active]="viewMode === viewModes.TEXT_HIGHLIGHTS"
[disabled]="(canSwitchToEarmarksView$ | async) === false"
[iqserHelpMode]="'views'"

View File

@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Output } from '@angular/core';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ViewMode, ViewModes } from '@red/domain';
import { ViewModeService } from '../../services/view-mode.service';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
@ -14,8 +14,6 @@ import { FileDataService } from '../../services/file-data.service';
})
export class ViewSwitchComponent {
readonly viewModes = ViewModes;
@Output() readonly switchView = new EventEmitter<ViewMode>();
readonly canSwitchToDeltaView$: Observable<boolean>;
readonly canSwitchToRedactedView$: Observable<boolean>;
readonly canSwitchToEarmarksView$: Observable<boolean>;
@ -35,4 +33,8 @@ export class ViewSwitchComponent {
map(file => file.hasHighlights && !file.analysisRequired && !file.excluded),
);
}
switchView(viewMode: ViewMode) {
this.viewModeService.viewMode = viewMode;
}
}

View File

@ -2,10 +2,10 @@
<section *ngIf="file$ | async as file" [class.fullscreen]="fullScreen">
<div class="page-header">
<div class="flex flex-1">
<redaction-view-switch (switchView)="switchView($event)"></redaction-view-switch>
<redaction-view-switch></redaction-view-switch>
</div>
<div class="flex-2 actions-container" #actionsWrapper>
<div #actionsWrapper class="flex-2 actions-container">
<redaction-processing-indicator [file]="file" class="mr-16"></redaction-processing-indicator>
<redaction-user-management></redaction-user-management>
@ -28,9 +28,9 @@
<redaction-file-actions
[dossier]="dossier"
[file]="file"
[minWidth]="width"
fileActionsHelpModeKey="document_features_in_editor"
type="file-preview"
[minWidth]="width"
></redaction-file-actions>
<iqser-circle-button

View File

@ -390,11 +390,6 @@ export class FilePreviewScreenComponent
}
}
async switchView(viewMode: ViewMode) {
this._viewModeService.viewMode = viewMode;
await this.updateViewMode();
}
async downloadOriginalFile({ cacheIdentifier, dossierId, fileId, filename }: File) {
const originalFile = this._fileManagementService.downloadOriginal(dossierId, fileId, 'response', cacheIdentifier);
download(await firstValueFrom(originalFile), filename);

@ -1 +1 @@
Subproject commit 76289b16e002506c80f83697f33ae3118b30ff1a
Subproject commit 7272130f7ace18bc4f6b4f5429f000c3eb5b0ef1