Merge branch 'VM/DM-545' into 'master'
DM-535 - Components without references not displayed in Component View Closes DM-545 See merge request redactmanager/red-ui!159
This commit is contained in:
commit
604c7bdff9
@ -49,7 +49,7 @@
|
||||
'component-log-dialog.annotations'
|
||||
| translate
|
||||
: {
|
||||
type: parseType(reference.type),
|
||||
type: parseType(reference.displayValue),
|
||||
page: reference.page,
|
||||
ruleNumber: reference.entityRuleId
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@ import { MAT_DIALOG_DATA, MatDialogModule, MatDialogRef } from '@angular/materia
|
||||
import { ReplaceNbspPipe } from '@common-ui/pipes/replace-nbsp.pipe';
|
||||
import { BaseDialogComponent, CircleButtonComponent, EditableInputComponent, IconButtonComponent } from '@iqser/common-ui';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ComponentLogEntry, IFile, WorkflowFileStatuses } from '@red/domain';
|
||||
import { ComponentLogEntry, Dictionary, IFile, WorkflowFileStatuses } from '@red/domain';
|
||||
import { FilesMapService } from '@services/files/files-map.service';
|
||||
import { UserPreferenceService } from '@users/user-preference.service';
|
||||
import { firstValueFrom } from 'rxjs';
|
||||
@ -13,6 +13,7 @@ import { ComponentLogService } from '@services/files/component-log.service';
|
||||
|
||||
interface ScmData {
|
||||
file: IFile;
|
||||
dictionaries: Dictionary[];
|
||||
}
|
||||
|
||||
@Component({
|
||||
@ -130,7 +131,24 @@ export class StructuredComponentManagementDialogComponent extends BaseDialogComp
|
||||
this.data.file.fileId,
|
||||
),
|
||||
);
|
||||
this.#updateDisplayValue(componentLogData);
|
||||
this.componentLogData.set(componentLogData);
|
||||
this._loadingService.stop();
|
||||
}
|
||||
|
||||
#updateDisplayValue(componentLogs: ComponentLogEntry[]) {
|
||||
const dictionaries = this.data.dictionaries;
|
||||
for (const componentLog of componentLogs) {
|
||||
let foundDictionary: Dictionary;
|
||||
for (const reference of componentLog.componentValues[0].entityReferences) {
|
||||
if (foundDictionary) {
|
||||
reference.displayValue = foundDictionary.label;
|
||||
continue;
|
||||
}
|
||||
foundDictionary = dictionaries.find(dict => dict.type === reference.type);
|
||||
foundDictionary = foundDictionary ?? ({ label: reference.type } as Dictionary);
|
||||
reference.displayValue = foundDictionary.label;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
<!-- TODO: mode these actions to a separate component -->
|
||||
<iqser-circle-button
|
||||
(action)="openRSSView()"
|
||||
(action)="openComponentLogView()"
|
||||
*allow="roles.getRss"
|
||||
[tooltip]="'file-preview.open-rss-view' | translate"
|
||||
class="ml-8"
|
||||
|
||||
@ -338,7 +338,7 @@ export class FilePreviewScreenComponent
|
||||
this.#restoreOldFilters();
|
||||
document.documentElement.addEventListener('fullscreenchange', this.fullscreenListener);
|
||||
|
||||
this.#openRssDialogIfDefault();
|
||||
this.#openComponentLogDialogIfDefault();
|
||||
this._viewerHeaderService.resetLayers();
|
||||
}
|
||||
|
||||
@ -453,8 +453,8 @@ export class FilePreviewScreenComponent
|
||||
download(await firstValueFrom(originalFile), filename);
|
||||
}
|
||||
|
||||
openRSSView() {
|
||||
this._dialogService.openDialog('rss', { file: this.state.file() });
|
||||
openComponentLogView() {
|
||||
this._dialogService.openDialog('componentLog', { file: this.state.file(), dictionaries: this.state.dictionaries });
|
||||
}
|
||||
|
||||
loadAnnotations$() {
|
||||
@ -870,9 +870,9 @@ export class FilePreviewScreenComponent
|
||||
});
|
||||
}
|
||||
|
||||
#openRssDialogIfDefault() {
|
||||
#openComponentLogDialogIfDefault() {
|
||||
if (this.permissionsService.canViewRssDialog() && this.userPreferenceService.getOpenScmDialogByDefault()) {
|
||||
this.openRSSView();
|
||||
this.openComponentLogView();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,7 +8,14 @@ import { HighlightActionDialogComponent } from '../dialogs/highlight-action-dial
|
||||
import { ManualAnnotationDialogComponent } from '../dialogs/manual-redaction-dialog/manual-annotation-dialog.component';
|
||||
import { StructuredComponentManagementDialogComponent } from '../dialogs/structured-component-management-dialog/structured-component-management-dialog.component';
|
||||
|
||||
type DialogType = 'confirm' | 'documentInfo' | 'rss' | 'changeLegalBasis' | 'forceAnnotation' | 'manualAnnotation' | 'highlightAction';
|
||||
type DialogType =
|
||||
| 'confirm'
|
||||
| 'documentInfo'
|
||||
| 'componentLog'
|
||||
| 'changeLegalBasis'
|
||||
| 'forceAnnotation'
|
||||
| 'manualAnnotation'
|
||||
| 'highlightAction';
|
||||
|
||||
@Injectable()
|
||||
export class FilePreviewDialogService extends DialogService<DialogType> {
|
||||
@ -34,7 +41,7 @@ export class FilePreviewDialogService extends DialogService<DialogType> {
|
||||
highlightAction: {
|
||||
component: HighlightActionDialogComponent,
|
||||
},
|
||||
rss: {
|
||||
componentLog: {
|
||||
component: StructuredComponentManagementDialogComponent,
|
||||
dialogConfig: { width: '90vw' },
|
||||
},
|
||||
|
||||
@ -3,6 +3,7 @@ export interface EntityReference {
|
||||
readonly type: string;
|
||||
readonly entityRuleId: string;
|
||||
readonly page: number;
|
||||
displayValue?: string;
|
||||
}
|
||||
|
||||
export interface IComponentValue {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user