RED-9962 - RM-163: Components values are not updated in the UI until page is refreshed
This commit is contained in:
parent
dc66b8a708
commit
1b2f14ec89
@ -1,4 +1,4 @@
|
|||||||
import { Component, Input, OnInit, signal, ViewChildren } from '@angular/core';
|
import { Component, effect, Input, OnInit, signal, ViewChildren } from '@angular/core';
|
||||||
import { List } from '@common-ui/utils';
|
import { List } from '@common-ui/utils';
|
||||||
import { IconButtonTypes, LoadingService } from '@iqser/common-ui';
|
import { IconButtonTypes, LoadingService } from '@iqser/common-ui';
|
||||||
import { ComponentLogEntry, Dictionary, File, IComponentLogEntry, WorkflowFileStatuses } from '@red/domain';
|
import { ComponentLogEntry, Dictionary, File, IComponentLogEntry, WorkflowFileStatuses } from '@red/domain';
|
||||||
@ -11,6 +11,7 @@ import { map } from 'rxjs/operators';
|
|||||||
import { toObservable } from '@angular/core/rxjs-interop';
|
import { toObservable } from '@angular/core/rxjs-interop';
|
||||||
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
|
import { AsyncPipe, NgForOf, NgIf } from '@angular/common';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { FilePreviewStateService } from '../../services/file-preview-state.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'redaction-structured-component-management',
|
selector: 'redaction-structured-component-management',
|
||||||
@ -33,7 +34,13 @@ export class StructuredComponentManagementComponent implements OnInit {
|
|||||||
private readonly _loadingService: LoadingService,
|
private readonly _loadingService: LoadingService,
|
||||||
private readonly _componentLogFilterService: ComponentLogFilterService,
|
private readonly _componentLogFilterService: ComponentLogFilterService,
|
||||||
private readonly _filterService: FilterService,
|
private readonly _filterService: FilterService,
|
||||||
) {}
|
private readonly _state: FilePreviewStateService,
|
||||||
|
) {
|
||||||
|
effect(async () => {
|
||||||
|
this._state.file();
|
||||||
|
await this.#loadData();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
get canEdit() {
|
get canEdit() {
|
||||||
return this.file.workflowStatus !== WorkflowFileStatuses.APPROVED;
|
return this.file.workflowStatus !== WorkflowFileStatuses.APPROVED;
|
||||||
@ -75,7 +82,6 @@ export class StructuredComponentManagementComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async #loadData(): Promise<void> {
|
async #loadData(): Promise<void> {
|
||||||
this._loadingService.start();
|
|
||||||
const componentLogData = await firstValueFrom(
|
const componentLogData = await firstValueFrom(
|
||||||
this._componentLogService.getComponentLogData(
|
this._componentLogService.getComponentLogData(
|
||||||
this.file.dossierTemplateId,
|
this.file.dossierTemplateId,
|
||||||
@ -86,7 +92,6 @@ export class StructuredComponentManagementComponent implements OnInit {
|
|||||||
);
|
);
|
||||||
this.#computeFilters(componentLogData);
|
this.#computeFilters(componentLogData);
|
||||||
this.componentLogData.set(componentLogData);
|
this.componentLogData.set(componentLogData);
|
||||||
this._loadingService.stop();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#computeFilters(componentLogs: ComponentLogEntry[]) {
|
#computeFilters(componentLogs: ComponentLogEntry[]) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user