added new action to refresh(re-render) the current node (#1913)

This commit is contained in:
Urse Daniel
2021-01-12 12:38:13 +02:00
committed by GitHub
parent b8feed47c3
commit f8eeec9e3d
2 changed files with 14 additions and 1 deletions

View File

@@ -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;

View File

@@ -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<RefreshPreviewAction>(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());