[ACA-100] View a previous version (#1562)

* added a feature to view a previous node version

* added latest versions

* added single selection to match the latest ADF change

* hide version list dialog when opening the viewer

* pass versionId to adf-viewer

* add view versions rendition routes for: shared, recent files, favorites, search.

* added functionality to download a previous version of a node

* small fix - no need to clear the store

* remove unused import

* removed changes

* Delete package-lock.json

* revert

* update to last dependencies

* ACA-3601: Add e2e tests for Preview of a file's previous version

* Address comments

* ACA-3601: Make sub-tests execute independently

* update dependencies

* ACA-3601: Add licenses

* Add type

* ACA-3601: Refactor execution

Co-authored-by: kristian <kristian.dimitrov@alfresco.com>
Co-authored-by: Denys Vuika <denys.vuika@alfresco.com>
This commit is contained in:
Urse Daniel
2020-08-05 16:15:20 +03:00
committed by GitHub
parent 3c5522821e
commit f59abb4228
23 changed files with 560 additions and 54 deletions

View File

@@ -6,6 +6,7 @@
[fileName]="fileName"
[maxRetries]="'viewer.maxRetries' | adfAppConfig"
[nodeId]="nodeId"
[versionId]="versionId"
[allowNavigate]="navigateMultiple"
[allowRightSidebar]="true"
[allowPrint]="false"

View File

@@ -32,10 +32,11 @@ import {
ClosePreviewAction,
ViewerActionTypes,
ViewNodeAction,
ReloadDocumentListAction
ReloadDocumentListAction,
SetCurrentNodeVersionAction
} from '@alfresco/aca-shared/store';
import { ContentActionRef, SelectionState } from '@alfresco/adf-extensions';
import { MinimalNodeEntryEntity, SearchRequest } from '@alfresco/js-api';
import { MinimalNodeEntryEntity, SearchRequest, VersionEntry } from '@alfresco/js-api';
import { Component, HostListener, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router';
import { UserPreferencesService, ObjectUtils, UploadService, AlfrescoApiService } from '@alfresco/adf-core';
@@ -58,6 +59,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
fileName: string;
folderId: string = null;
nodeId: string = null;
versionId: string = null;
node: MinimalNodeEntryEntity;
selection: SelectionState;
infoDrawerOpened$: Observable<boolean>;
@@ -135,6 +137,14 @@ export class AppViewerComponent implements OnInit, OnDestroy {
this.route.params.subscribe((params) => {
this.folderId = params.folderId;
const { nodeId } = params;
this.versionId = params.versionId;
if (this.versionId) {
this.apiService.versionsApi.getVersion(nodeId, this.versionId).then((version: VersionEntry) => {
if (version) {
this.store.dispatch(new SetCurrentNodeVersionAction(version));
}
});
}
if (nodeId) {
this.displayNode(nodeId);
}
@@ -151,9 +161,10 @@ export class AppViewerComponent implements OnInit, OnDestroy {
}
}
this.actions$
.pipe(ofType<ClosePreviewAction>(ViewerActionTypes.ClosePreview), takeUntil(this.onDestroy$))
.subscribe(() => this.navigateToFileLocation());
this.actions$.pipe(ofType<ClosePreviewAction>(ViewerActionTypes.ClosePreview), takeUntil(this.onDestroy$)).subscribe(() => {
this.store.dispatch(new SetCurrentNodeVersionAction(null));
this.navigateToFileLocation();
});
this.content.nodesDeleted.pipe(takeUntil(this.onDestroy$)).subscribe(() => this.navigateToFileLocation());
@@ -173,6 +184,7 @@ export class AppViewerComponent implements OnInit, OnDestroy {
}
ngOnDestroy() {
this.store.dispatch(new SetCurrentNodeVersionAction(null));
this.onDestroy$.next(true);
this.onDestroy$.complete();
}