RED-8365 - Create help mode links for new dialogs

This commit is contained in:
Valentin Mihai 2024-02-08 20:58:54 +02:00
parent 29606dba1c
commit 1e9e728ec7
7 changed files with 53 additions and 3 deletions

View File

@ -121,6 +121,8 @@
/>
<div [translate]="'edit-redaction.dialog.actions.cancel'" class="all-caps-label cancel" mat-dialog-close></div>
<iqser-help-button *deny="roles.getRss" [helpButtonKey]="helpButtonKey"></iqser-help-button>
</div>
</form>

View File

@ -10,6 +10,8 @@ import { getEditRedactionOptions, RedactOrHintOption } from '../../utils/dialog-
import { EditRedactionData, EditRedactResult } from '../../utils/dialog-types';
import { LegalBasisOption } from '../manual-redaction-dialog/manual-annotation-dialog.component';
import { editRedactionLabelsTranslations } from '@translations/redact-text-translations';
import { Roles } from '@users/roles';
import { DialogHelpModeKeys } from '../../utils/constants';
interface TypeSelectOptions {
type: string;
@ -34,10 +36,11 @@ export class EditRedactionDialogComponent
readonly isImage = this.annotations.reduce((acc, next) => acc && next.isImage, true);
readonly redactedTexts = !this.isImage ? this.annotations.map(annotation => annotation.value).filter(value => !!value) : null;
readonly isManualRedaction = this.annotations.every(annotation => annotation.type === SuperTypes.ManualRedaction);
readonly isHint = this.annotations.every(annotation => annotation.HINT);
readonly isHint = this.annotations.every(annotation => annotation.HINT || annotation.IMAGE_HINT);
readonly isRedacted = this.annotations.every(annotation => annotation.isRedacted);
readonly isImported: boolean = this.annotations.every(annotation => annotation.imported);
readonly allRectangles = this.annotations.reduce((acc, a) => acc && a.AREA, true);
protected readonly roles = Roles;
options: DetailsRadioOption<RedactOrHintOption>[] | undefined;
legalOptions: LegalBasisOption[] = [];
@ -52,6 +55,7 @@ export class EditRedactionDialogComponent
private readonly _dictionaryService: DictionaryService,
) {
super();
console.log(this.annotations);
}
get displayedDictionaryLabel() {
@ -111,6 +115,16 @@ export class EditRedactionDialogComponent
return editRedactionLabelsTranslations[this.label];
}
get helpButtonKey() {
if (this.isHint) {
return DialogHelpModeKeys.HINT_EDIT
}
if (this.someSkipped) {
return DialogHelpModeKeys.SKIPPED_EDIT
}
return DialogHelpModeKeys.REDACTION_EDIT;
}
async ngOnInit() {
this.#setTypes();
const data = await firstValueFrom(this._justificationsService.loadAll(this.#dossier.dossierTemplateId));

View File

@ -38,6 +38,8 @@
[type]="iconButtonTypes.primary"
>
</iqser-icon-button>
<iqser-help-button *deny="roles.getRss" [helpButtonKey]="'skipped_force'"></iqser-help-button>
</div>
</form>

View File

@ -6,6 +6,7 @@ import { JustificationsService } from '@services/entity-services/justifications.
import { Dossier, ILegalBasisChangeRequest } from '@red/domain';
import { firstValueFrom } from 'rxjs';
import { AnnotationWrapper } from '@models/file/annotation.wrapper';
import { Roles } from '@users/roles';
export interface LegalBasisOption {
label?: string;
@ -22,6 +23,7 @@ const DOCUMINE_LEGAL_BASIS = 'n-a.';
})
export class ForceAnnotationDialogComponent extends BaseDialogComponent implements OnInit {
readonly isDocumine = getConfig().IS_DOCUMINE;
protected readonly roles = Roles;
legalOptions: LegalBasisOption[] = [];
constructor(

View File

@ -70,6 +70,8 @@
</iqser-icon-button>
<div [translate]="'remove-redaction.dialog.actions.cancel'" class="all-caps-label cancel" mat-dialog-close></div>
<iqser-help-button *deny="roles.getRss" [helpButtonKey]="helpButtonKey"></iqser-help-button>
</div>
</form>

View File

@ -5,6 +5,8 @@ import { DetailsRadioOption, IconButtonTypes, IqserDialogComponent } from '@iqse
import { tap } from 'rxjs/operators';
import { getRemoveRedactionOptions, RemoveAnnotationOptions, RemoveRedactionOption } from '../../utils/dialog-options';
import { RemoveRedactionData, RemoveRedactionResult } from '../../utils/dialog-types';
import { Roles } from '@users/roles';
import { DialogHelpModeKeys } from '../../utils/constants';
@Component({
templateUrl: './remove-redaction-dialog.component.html',
@ -18,15 +20,18 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
#applyToAllDossiers: boolean;
readonly iconButtonTypes = IconButtonTypes;
readonly options: DetailsRadioOption<RemoveRedactionOption>[];
readonly recommendation;
readonly recommendation: boolean;
readonly hint: boolean;
readonly skipped: boolean;
readonly redactedTexts: string[];
protected readonly roles = Roles;
form!: UntypedFormGroup;
constructor(private readonly _formBuilder: FormBuilder) {
super();
this.recommendation = this.data.redactions[0].isRecommendation;
this.hint = this.data.redactions[0].HINT;
this.skipped = this.data.redactions.some(annotation => annotation.isSkipped);
this.options = getRemoveRedactionOptions(this.data);
this.redactedTexts = this.data.redactions.map(annotation => annotation.value);
this.form = this.#getForm();
@ -48,7 +53,20 @@ export class RemoveRedactionDialogComponent extends IqserDialogComponent<
}
get isFalsePositive(): boolean {
return this.form.get('option').value.value === RemoveAnnotationOptions.FALSE_POSITIVE;
return this.form.get('option').value.value === RemoveAnnotationOptions['FALSE' + '_POSITIVE'];
}
get helpButtonKey() {
if (this.hint) {
return DialogHelpModeKeys.HINT_REMOVE
}
if (this.recommendation) {
return DialogHelpModeKeys.RECOMMENDATION_REMOVE
}
if (this.skipped) {
return DialogHelpModeKeys.SKIPPED_REMOVE
}
return DialogHelpModeKeys.REDACTION_REMOVE;
}
save(): void {

View File

@ -19,6 +19,16 @@ export const ActionsHelpModeKeys = {
'hint-image': 'hint',
} as const;
export const DialogHelpModeKeys = {
REDACTION_EDIT: 'redaction_edit',
REDACTION_REMOVE: 'redaction_remove',
SKIPPED_EDIT: 'skipped_edit',
SKIPPED_REMOVE: 'skipped_remove',
RECOMMENDATION_REMOVE: 'recommendation_remove',
HINT_EDIT: 'hint_edit',
HINT_REMOVE: 'hint_remove',
} as const;
export const ALL_HOTKEYS: List = ['Escape', 'F', 'f', 'ArrowUp', 'ArrowDown', 'H', 'h'] as const;
export const HeaderElements = {