[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

@@ -200,6 +200,10 @@ export class ContentApiService {
return this.api.contentApi.getContentUrl(nodeId, attachment);
}
getVersionContentUrl(nodeId: string, versionId: string, attachment?: boolean): string {
return this.api.contentApi.getVersionContentUrl(nodeId, versionId, attachment);
}
deleteSite(siteId?: string, opts?: { permanent?: boolean }): Observable<any> {
return from(this.api.sitesApi.deleteSite(siteId, opts));
}

View File

@@ -24,7 +24,7 @@
*/
import { Action } from '@ngrx/store';
import { Node, Person, Group, RepositoryInfo } from '@alfresco/js-api';
import { Node, Person, Group, RepositoryInfo, VersionEntry } from '@alfresco/js-api';
import { AppState } from '../states/app.state';
export enum AppActionTypes {
@@ -32,6 +32,7 @@ export enum AppActionTypes {
SetInitialState = 'SET_INITIAL_STATE',
SetHeaderColor = 'SET_HEADER_COLOR',
SetCurrentFolder = 'SET_CURRENT_FOLDER',
SetCurrentVersion = 'SET_CURRENT_VERSION',
SetCurrentUrl = 'SET_CURRENT_URL',
SetUserProfile = 'SET_USER_PROFILE',
SetRepositoryInfo = 'SET_REPOSITORY_INFO',
@@ -69,6 +70,12 @@ export class SetCurrentFolderAction implements Action {
constructor(public payload: Node) {}
}
export class SetCurrentNodeVersionAction implements Action {
readonly type = AppActionTypes.SetCurrentVersion;
constructor(public payload: VersionEntry) {}
}
export class SetCurrentUrlAction implements Action {
readonly type = AppActionTypes.SetCurrentUrl;

View File

@@ -29,6 +29,7 @@ import { MinimalNodeEntity } from '@alfresco/js-api';
export enum ViewerActionTypes {
ViewFile = 'VIEW_FILE',
ViewNode = 'VIEW_NODE',
ViewNodeVersion = 'VIEW_NODE_VERSION',
FullScreen = 'FULLSCREEN_VIEWER',
ClosePreview = 'CLOSE_PREVIEW'
}
@@ -50,6 +51,12 @@ export class ViewNodeAction implements Action {
constructor(public nodeId: string, public viewNodeExtras?: ViewNodeExtras) {}
}
export class ViewNodeVersionAction implements Action {
readonly type = ViewerActionTypes.ViewNodeVersion;
constructor(public nodeId: string, public versionId: string, public viewNodeExtras?: ViewNodeExtras) {}
}
export class FullscreenViewerAction implements Action {
readonly type = ViewerActionTypes.FullScreen;

View File

@@ -35,6 +35,7 @@ export const getHeaderImagePath = createSelector(selectApp, (state) => state.hea
export const getLanguagePickerState = createSelector(selectApp, (state) => state.languagePicker);
export const getUserProfile = createSelector(selectApp, (state) => state.user);
export const getCurrentFolder = createSelector(selectApp, (state) => state.navigation.currentFolder);
export const getCurrentVersion = createSelector(selectApp, (state) => state.currentNodeVersion);
export const getAppSelection = createSelector(selectApp, (state) => state.selection);
export const getSharedUrl = createSelector(selectApp, (state) => state.sharedUrl);
export const getNavigationState = createSelector(selectApp, (state) => state.navigation);

View File

@@ -24,7 +24,7 @@
*/
import { SelectionState, ProfileState, NavigationState } from '@alfresco/adf-extensions';
import { RepositoryInfo } from '@alfresco/js-api';
import { RepositoryInfo, VersionEntry } from '@alfresco/js-api';
export interface AppState {
appName: string;
@@ -33,6 +33,7 @@ export interface AppState {
headerImagePath: string;
languagePicker: boolean;
sharedUrl: string;
currentNodeVersion: VersionEntry;
selection: SelectionState;
user: ProfileState;
navigation: NavigationState;

View File

@@ -0,0 +1,40 @@
/*!
* @license
* Alfresco Example Content Application
*
* Copyright (C) 2005 - 2020 Alfresco Software Limited
*
* This file is part of the Alfresco Example Content Application.
* If the software was purchased under a paid Alfresco license, the terms of
* the paid license agreement will prevail. Otherwise, the software is
* provided under the following open source license terms:
*
* The Alfresco Example Content Application is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* The Alfresco Example Content Application is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { BrowserActions, BrowserVisibility } from '@alfresco/adf-testing';
import { by, element, ElementFinder } from 'protractor';
export class VersionManagePage {
async clickActionButton(version: string): Promise<void> {
await BrowserActions.click(element(by.id(`adf-version-list-action-menu-button-${version}`)));
await BrowserVisibility.waitUntilElementIsVisible(element(by.css('.cdk-overlay-container .mat-menu-content')));
}
async viewFileVersion(version: string): Promise<void> {
await this.clickActionButton(version);
const viewButton: ElementFinder = element(by.id(`adf-version-list-action-view-${version}`));
await BrowserActions.click(viewButton);
}
}

View File

@@ -23,8 +23,8 @@
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
import { browser } from 'protractor';
import { Logger } from '@alfresco/adf-testing';
import { browser, by, element, ElementFinder } from 'protractor';
import { BrowserActions, Logger } from '@alfresco/adf-testing';
import { Component } from '../component';
import { Toolbar } from '../toolbar/toolbar';
import { waitForPresence } from '../../utilities/utils';
@@ -93,4 +93,14 @@ export class Viewer extends Component {
const count = await this.pdfViewerContentPages.count();
return count > 0;
}
async clickDownloadButton(): Promise<void> {
const downloadButton: ElementFinder = element(by.id(`app.viewer.download`));
await BrowserActions.click(downloadButton);
}
async clickCloseButton(): Promise<void> {
const closeButton: ElementFinder = element(by.css('button[data-automation-id="adf-toolbar-back"]'));
await BrowserActions.click(closeButton);
}
}