Merge branch 'master' into release/4.839.x

This commit is contained in:
Dan Percic 2024-09-02 16:48:59 +03:00
commit 9dd6085bcf
17 changed files with 96 additions and 78 deletions

View File

@ -99,7 +99,7 @@ export default class RulesScreenComponent implements OnInit, ComponentCanDeactiv
private readonly _loadingService: LoadingService,
private readonly _editorThemeService: EditorThemeService,
) {
const username = this.#currentUser.username;
const username = this.#currentUser.id;
const tenant = inject(TenantsService).activeTenantId;
this.#copilotService
.listen('/user/' + username + '/queue/' + tenant + '/rules-copilot')

View File

@ -18,13 +18,10 @@
.right-content {
flex-direction: column;
height: calc(100% - 71px);
@include common-mixins.scroll-bar;
overflow: hidden;
&:hover {
overflow: auto;
}
overflow-y: auto;
&.has-scrollbar .section {
padding-right: 13px;

View File

@ -3,12 +3,16 @@
@if (!editing) {
<div class="value">
<div class="text">
@for (componentValue of entry.componentValues; track componentValue) {
<span [innerHTML]="transformNewLines(componentValue.value ?? componentValue.originalValue)"></span>
@for (componentValue of currentEntry().componentValues; track componentValue) {
<span
[innerHTML]="transformNewLines(componentValue.value ?? componentValue.originalValue) | replaceNbsp"
[matTooltip]="componentValue.valueDescription"
[matTooltipPositionAtOrigin]="true"
></span>
}
</div>
<div class="actions">
@if (canEdit) {
@if (canEdit()) {
<iqser-circle-button
(action)="edit()"
[tooltip]="'component-management.actions.edit' | translate"
@ -16,7 +20,7 @@
[class.help-mode]="helpModeService.isHelpModeActive()"
icon="iqser:edit"
></iqser-circle-button>
@if (hasUpdatedValues) {
@if (hasUpdatedValues()) {
<div class="changes-dot"></div>
}
}
@ -24,10 +28,10 @@
</div>
} @else {
<div (cdkDropListDropped)="drop($event)" cdkDropList>
@for (value of entry.componentValues; track value) {
@for (value of currentEntry().componentValues; track value) {
<div cdkDrag class="editing-value">
<mat-icon
[class.hidden-button]="entry.componentValues.length === 1"
[class.hidden-button]="currentEntry().componentValues.length === 1"
[attr.help-mode-key]="'change_component_order'"
cdkDragHandle
class="draggable"
@ -39,7 +43,7 @@
<iqser-circle-button
(action)="removeValue($index)"
[tooltip]="'component-management.actions.delete' | translate"
[class.hidden-button]="entry.componentValues.length === 1"
[class.hidden-button]="currentEntry().componentValues.length === 1"
[attr.help-mode-key]="'remove_component_value'"
class="remove-value"
icon="iqser:trash"
@ -54,9 +58,9 @@
[label]="'component-management.actions.save' | translate"
[type]="iconButtonTypes.primary"
></iqser-icon-button>
<div (click)="deselect($event)" class="all-caps-label cancel" translate="component-management.actions.cancel"></div>
<div (click)="cancel($event)" class="all-caps-label cancel" translate="component-management.actions.cancel"></div>
<div class="flex right">
@if (hasUpdatedValues && canEdit) {
@if (hasUpdatedValues() && canEdit()) {
<iqser-circle-button
(action)="undo()"
[tooltip]="'component-management.actions.undo' | translate"

View File

@ -1,6 +1,6 @@
import { CdkDrag, CdkDragDrop, CdkDragHandle, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
import { AsyncPipe, KeyValuePipe, NgClass, NgForOf, NgIf } from '@angular/common';
import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core';
import { Component, computed, input, OnInit, output, signal, WritableSignal } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { MatIcon } from '@angular/material/icon';
import { CircleButtonComponent, HelpModeService, IconButtonComponent, IconButtonTypes, IqserDialog } from '@iqser/common-ui';
@ -8,6 +8,9 @@ import { TranslateModule } from '@ngx-translate/core';
import { IComponentLogEntry, IComponentValue } from '@red/domain';
import { RevertValueDialogComponent } from '../../dialogs/docu-mine/revert-value-dialog/revert-value-dialog.component';
import { FilePreviewStateService } from '../../services/file-preview-state.service';
import { escapeHtml } from '@common-ui/utils';
import { ReplaceNbspPipe } from '@common-ui/pipes/replace-nbsp.pipe';
import { MatTooltip } from '@angular/material/tooltip';
@Component({
selector: 'redaction-editable-structured-component-value [entry] [canEdit]',
@ -28,20 +31,24 @@ import { FilePreviewStateService } from '../../services/file-preview-state.servi
CdkDragHandle,
FormsModule,
AsyncPipe,
ReplaceNbspPipe,
MatTooltip,
],
})
export class EditableStructuredComponentValueComponent implements OnInit {
readonly entry = input<IComponentLogEntry>();
currentEntry: WritableSignal<IComponentLogEntry>;
readonly canEdit = input<boolean>();
readonly deselectLast = output();
readonly overrideValue = output<IComponentLogEntry>();
readonly revertOverride = output<string>();
hasUpdatedValues = computed(() => this.currentEntry().overridden);
selected = false;
valueBeforeCurrentEdit: IComponentValue[];
protected entryLabel: string;
protected editing = false;
protected hasUpdatedValues = false;
protected initialEntry: IComponentLogEntry;
protected readonly iconButtonTypes = IconButtonTypes;
@Input() entry: IComponentLogEntry;
@Input() canEdit: boolean;
@Output() readonly deselectLast = new EventEmitter();
@Output() readonly overrideValue = new EventEmitter<IComponentLogEntry>();
@Output() readonly revertOverride = new EventEmitter<string>();
selected = false;
constructor(
readonly helpModeService: HelpModeService,
@ -50,38 +57,26 @@ export class EditableStructuredComponentValueComponent implements OnInit {
) {}
get disabled() {
for (let i = 0; i < this.entry.componentValues.length; i++) {
if (this.entry.componentValues[i].value !== this.initialEntry.componentValues[i]?.value) {
for (let i = 0; i < this.currentEntry().componentValues.length; i++) {
if (this.currentEntry().componentValues[i].value !== this.initialEntry.componentValues[i]?.value) {
return false;
}
}
return this.entry.componentValues.length === this.initialEntry.componentValues.length;
}
get #hasUpdatedValues() {
for (const value of this.entry.componentValues) {
if (value.originalValue === null && value.value === '') {
continue;
}
if (value.originalValue !== value.value) {
return true;
}
}
return false;
return this.currentEntry().componentValues.length === this.initialEntry.componentValues.length;
}
get #initialEntry() {
return JSON.parse(JSON.stringify(this.entry));
return JSON.parse(JSON.stringify(this.entry()));
}
ngOnInit() {
this.currentEntry = signal(this.entry());
this.reset();
}
reset() {
this.initialEntry = this.#initialEntry;
this.hasUpdatedValues = this.#hasUpdatedValues;
this.entryLabel = this.parseName(this.entry.name);
this.entryLabel = this.parseName(this.currentEntry().name);
this.deselect();
}
@ -93,11 +88,12 @@ export class EditableStructuredComponentValueComponent implements OnInit {
}
this.deselectLast.emit();
this.selected = true;
this._state.componentReferenceIds = this.#getUniqueReferencesIds(this.entry.componentValues);
this._state.componentReferenceIds = this.#getUniqueReferencesIds(this.currentEntry().componentValues);
}
}
edit() {
this.valueBeforeCurrentEdit = JSON.parse(JSON.stringify([...this.currentEntry().componentValues]));
this.deselectLast.emit();
this.selected = true;
this.editing = true;
@ -111,37 +107,48 @@ export class EditableStructuredComponentValueComponent implements OnInit {
this._state.componentReferenceIds = null;
}
cancel($event?: MouseEvent) {
this.currentEntry.update(value => ({ ...value, componentValues: this.valueBeforeCurrentEdit }));
this.deselect($event);
}
removeValue(index: number) {
this.entry.componentValues.splice(index, 1);
this.currentEntry.update(value => ({ ...value, componentValues: value.componentValues.filter((_, i) => i !== index) }));
}
save() {
this.entry.overridden = true;
this.overrideValue.emit(this.entry);
this.currentEntry.update(value => ({ ...value, overridden: true }));
this.overrideValue.emit(this.currentEntry());
this.reset();
}
async undo() {
const dialog = this._iqserDialog.openDefault(RevertValueDialogComponent, { data: { entry: this.entry }, width: '800px' });
const dialog = this._iqserDialog.openDefault(RevertValueDialogComponent, { data: { entry: this.currentEntry() }, width: '800px' });
const result = await dialog.result();
if (result) {
this.revertOverride.emit(this.entry.name);
this.revertOverride.emit(this.currentEntry().name);
this.reset();
}
}
add() {
this.entry.componentValues.push({
componentRuleId: null,
entityReferences: [],
originalValue: null,
value: '',
valueDescription: '',
});
this.currentEntry.update(value => ({
...value,
componentValues: [
...value.componentValues,
{
componentRuleId: null,
entityReferences: [],
originalValue: null,
value: '',
valueDescription: '',
},
],
}));
}
drop(event: CdkDragDrop<string>) {
moveItemInArray(this.entry.componentValues, event.previousIndex, event.currentIndex);
moveItemInArray(this.currentEntry().componentValues, event.previousIndex, event.currentIndex);
}
parseName(name: string) {
@ -149,7 +156,7 @@ export class EditableStructuredComponentValueComponent implements OnInit {
}
transformNewLines(value: string) {
return value.replace(/\n/g, '<br>');
return escapeHtml(value).replace(/\n/g, '<br>');
}
#getUniqueReferencesIds(values: IComponentValue[]) {
@ -164,7 +171,7 @@ export class EditableStructuredComponentValueComponent implements OnInit {
#updateTextAreaHeight() {
setTimeout(() => {
for (let i = 0; i < this.entry.componentValues.length; i++) {
for (let i = 0; i < this.currentEntry().componentValues.length; i++) {
const textArea = document.getElementById(`value-input-${i}`);
textArea.style.height = 'auto';
textArea.style.height = `${textArea.scrollHeight}px`;

View File

@ -43,7 +43,7 @@
flex-direction: column;
&.documine-width {
width: calc(var(--documine-workload-content-width));
width: calc(var(--documine-workload-content-width) - 50px);
border-right: 1px solid var(--iqser-separator);
z-index: 1;
@ -79,7 +79,7 @@
.quick-navigation {
height: 100%;
border-right: 1px solid var(--iqser-separator);
min-width: var(--qiuck-navigation-width);
min-width: var(--quick-navigation-width);
overflow: hidden;
display: flex;
flex-direction: column;

View File

@ -48,8 +48,6 @@ mat-icon {
border-bottom: 1px solid var(--iqser-separator);
}
border-bottom: 1px solid var(--iqser-separator);
margin-left: 26px;
margin-right: 26px;
}
}
}

View File

@ -32,6 +32,10 @@ export class DocumentInfoService {
},
{ allowSignalWrites: true },
);
effect(() => {
document.body.style.setProperty('--quick-navigation-width', this.shown() ? '350px' : '61px');
});
}
fileAttributes$(fileId: string, dossierId: string, dossierTemplateId: string) {

View File

@ -156,7 +156,9 @@ export class FileDataService extends EntitiesService<AnnotationWrapper, Annotati
const redactionLog = await this._entityLogService.getEntityLog(this._state.dossierId, this._state.fileId);
this.#logger.info('[REDACTION_LOG] Redaction log loaded', redactionLog);
const annotations = await this.processEntityLog(redactionLog);
let annotations = await this.#convertData(redactionLog);
if (!this.#annotations().length && annotations.length !== this.missingTypes.size) this.#checkMissingTypes();
annotations = this.#isIqserDevMode ? annotations : annotations.filter(a => !a.isFalsePositive);
this.#annotations.set(annotations);
}

View File

@ -14,7 +14,7 @@
align-items: center;
&.documine-pagination {
left: calc(100% - (var(--documine-viewer-width) / 2) - var(--qiuck-navigation-width));
left: calc(100% - (var(--documine-viewer-width) / 2) - var(--quick-navigation-width));
}
> div {

View File

@ -38,7 +38,11 @@ export class WebSocketService extends RxStomp {
}
listen<T>(topic: string): Observable<T> {
return this.watch(topic).pipe(map(msg => JSON.parse(msg.body)));
return this.watch(topic).pipe(
log('LISTEN LOG'),
tap(msg => console.log(msg.body)),
map(msg => JSON.parse(msg.body)),
);
}
connect(url: string) {

View File

@ -1,7 +1,7 @@
{
"ADMIN_CONTACT_NAME": null,
"ADMIN_CONTACT_URL": null,
"API_URL": "https://dan1.iqser.cloud",
"API_URL": "https://dom4.iqser.cloud",
"APP_NAME": "RedactManager",
"IS_DOCUMINE": false,
"RULE_EDITOR_DEV_ONLY": false,
@ -13,7 +13,7 @@
"MAX_RETRIES_ON_SERVER_ERROR": 3,
"OAUTH_CLIENT_ID": "redaction",
"OAUTH_IDP_HINT": null,
"OAUTH_URL": "https://dan1.iqser.cloud/auth",
"OAUTH_URL": "https://dom4.iqser.cloud/auth",
"RECENT_PERIOD_IN_HOURS": 24,
"SELECTION_MODE": "structural",
"MANUAL_BASE_URL": "https://docs.redactmanager.com/preview",

View File

@ -1556,7 +1556,7 @@
"select-none": "Keine",
"show-skipped": "Ignorierte im Dokument anzeigen",
"the-filters": "zurück.",
"wrong-filters": "Die ausgewählte Filterkombination ist nicht möglich. Bitte ändern Sie die Auswahl oder"
"wrong-filters": "Keine Annotationen für die ausgewählte Filterkombination. Bitte ändern Sie die Auswahl oder"
},
"document-info": {
"close": "Datei-Info schließen",
@ -1657,7 +1657,7 @@
"test-connection": "Verbindung testen"
},
"app-name": {
"label": "Workspace-Name",
"label": "Anzeigename",
"placeholder": "RedactManager"
},
"form": {
@ -2046,7 +2046,7 @@
"auto-expand-filters-on-action": "Filter ausgehend von meinen Aktionen automatisch anpassen",
"help-mode-dialog": "Dialog zur Aktivierung des Hilfemodus",
"load-all-annotations-warning": "Warnung bei gleichzeitigem Laden aller Annotationen in der Miniaturansicht",
"overwrite-file-option": "Preferred action when re-uploading of an already existing file",
"overwrite-file-option": "Bevorzugte Aktion beim erneuten Hochladen einer bereits vorhandenen Datei",
"table-extraction-type": "Art der Tabellenextraktion"
},
"label": "Präferenzen",

View File

@ -1657,7 +1657,7 @@
"test-connection": "Test connection"
},
"app-name": {
"label": "Workspace name",
"label": "Display name",
"placeholder": "RedactManager"
},
"form": {
@ -2046,7 +2046,7 @@
"auto-expand-filters-on-action": "Auto-expand filters on my actions",
"help-mode-dialog": "Help mode activation dialog",
"load-all-annotations-warning": "Warning regarding simultaneous loading of all annotations in thumbnails",
"overwrite-file-option": "Preferred action when re-uploading of an already existing file",
"overwrite-file-option": "Preferred action when re-uploading an already existing file",
"table-extraction-type": "Table extraction type"
},
"label": "Preferences",

View File

@ -2046,7 +2046,7 @@
"auto-expand-filters-on-action": "Auto expand filters on my actions",
"help-mode-dialog": "Help Mode Dialog",
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
"overwrite-file-option": "Preferred action when re-uploading of an already existing file",
"overwrite-file-option": "Preferred action when re-uploading an already existing file",
"table-extraction-type": "Table extraction type"
},
"label": "Preferences",

View File

@ -1657,7 +1657,7 @@
"test-connection": "Test connection"
},
"app-name": {
"label": "Workspace name",
"label": "Display name",
"placeholder": "RedactManager"
},
"form": {
@ -2046,7 +2046,7 @@
"auto-expand-filters-on-action": "Auto expand filters on my actions",
"help-mode-dialog": "Help Mode Dialog",
"load-all-annotations-warning": "Warning regarding loading all annotations at once in file preview",
"overwrite-file-option": "Preferred action when re-uploading of an already existing file",
"overwrite-file-option": "Preferred action when re-uploading an already existing file",
"table-extraction-type": "Table extraction type"
},
"label": "Preferences",

View File

@ -165,12 +165,14 @@ body {
--workload-width: 350px;
--documine-workload-content-width: 287px;
--structured-component-management-width: 40%;
--qiuck-navigation-width: 61px;
--quick-navigation-width: 61px;
--iqser-app-name-font-family: OpenSans Extrabold, sans-serif;
--iqser-app-name-font-size: 13px;
--iqser-logo-size: 28px;
--documine-viewer-width: calc(
100% - var(--structured-component-management-width) - var(--documine-workload-content-width) - var(--qiuck-navigation-width) - 3px
100% - var(--structured-component-management-width) - calc(var(--documine-workload-content-width) - 50px) - var(
--quick-navigation-width
) - 3px
);
--viewer-height: calc(100% - calc(var(--iqser-top-bar-height) + 50px));
}
@ -189,7 +191,7 @@ body {
width: var(--documine-viewer-width);
height: var(--viewer-height);
bottom: 0;
right: calc(var(--qiuck-navigation-width) + 3px);
right: calc(var(--quick-navigation-width) + 3px);
position: absolute;
&.document-info {

@ -1 +1 @@
Subproject commit 0ca5e7e2ad7ca2b788f7234d7a38a3b810d9b31a
Subproject commit 007e761bd597a1534599b05d28826258bfc52570