diff --git a/projects/aca-shared/store/src/actions/viewer.actions.ts b/projects/aca-shared/store/src/actions/viewer.actions.ts index 0bbc1a0cb..7c6c05eda 100644 --- a/projects/aca-shared/store/src/actions/viewer.actions.ts +++ b/projects/aca-shared/store/src/actions/viewer.actions.ts @@ -32,6 +32,7 @@ export enum ViewerActionTypes { ViewNodeVersion = 'VIEW_NODE_VERSION', FullScreen = 'FULLSCREEN_VIEWER', ClosePreview = 'CLOSE_PREVIEW', + RefreshPreview = 'REFRESH_PREVIEW', PluginPreview = 'PLUGIN_PREVIEW' } @@ -69,6 +70,11 @@ export class ClosePreviewAction implements Action { constructor(public payload?: MinimalNodeEntity) {} } +export class RefreshPreviewAction implements Action { + readonly type = ViewerActionTypes.RefreshPreview; + constructor(public payload?: MinimalNodeEntity) {} +} + export class PluginPreviewAction implements Action { readonly type = ViewerActionTypes.PluginPreview; diff --git a/src/app/components/viewer/viewer.component.ts b/src/app/components/viewer/viewer.component.ts index 6726be160..253ea6492 100644 --- a/src/app/components/viewer/viewer.component.ts +++ b/src/app/components/viewer/viewer.component.ts @@ -33,7 +33,8 @@ import { ViewerActionTypes, ViewNodeAction, ReloadDocumentListAction, - SetCurrentNodeVersionAction + SetCurrentNodeVersionAction, + RefreshPreviewAction } from '@alfresco/aca-shared/store'; import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions'; import { MinimalNodeEntryEntity, SearchRequest, VersionEntry } from '@alfresco/js-api'; @@ -166,6 +167,12 @@ export class AppViewerComponent implements OnInit, OnDestroy { this.navigateToFileLocation(); }); + this.actions$ + .pipe(ofType(ViewerActionTypes.RefreshPreview), takeUntil(this.onDestroy$)) + .subscribe((action: RefreshPreviewAction) => { + this.displayNode(action?.payload?.entry?.id); + }); + this.content.nodesDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation()); this.uploadService.fileUploadDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());