[ADF-4424] Pdf Viewer - password dialog does not close when pressing Escape (#4622)

* return to previous page on close

* update e2e

* [ADF-4424] Improve PreviousRouteService to use it in pdfViewer

* change previous Url logic

* remove navigation logic

* remove test

* Update pdfViewer.component.spec.ts

* back button logic for viewer outlet

* unit tests

* remove fdescribe

* remove unused service

* e2e

* return to location

* remove click filter step

* remove unnecessary test steps

* remove un existen export

* unify preview between PS and CS in demo shell

* fix dispalyname property
This commit is contained in:
Cilibiu Bogdan
2019-07-11 19:33:15 +03:00
committed by Eugenio Romano
parent 72b3a75a85
commit ccdcba8778
18 changed files with 149 additions and 317 deletions

View File

@@ -1,4 +1,4 @@
<ng-container *ngIf="nodeId">
<ng-container *ngIf="nodeId || content">
<ng-template let-node="node" #sidebarRightTemplate>
<adf-info-drawer [title]="'APP.INFO_DRAWER.TITLE' | translate">
@@ -284,14 +284,16 @@
</p>
<p class="toggle">
<button mat-raised-button id="adf-switch-showrightsidebar" (click)="toggleShowRightSidebar()" color="primary">
Toggle Right Sidebar
<button mat-raised-button id="adf-switch-showrightsidebar" (click)="toggleShowRightSidebar()"
color="primary">
Toggle Right Sidebar
</button>
</p>
<p class="toggle">
<button mat-raised-button id="adf-switch-showleftsidebar" (click)="hideLeftSidebar()" color="primary">
Hide Left Sidebar
<button mat-raised-button id="adf-switch-showleftsidebar" (click)="hideLeftSidebar()"
color="primary">
Hide Left Sidebar
</button>
</p>
@@ -314,6 +316,7 @@
</ng-template>
<adf-viewer
[blobFile]="content"
[nodeId]="nodeId"
[showRightSidebar]="showRightSidebar"
[showLeftSidebar]="showLeftSidebar"
@@ -325,6 +328,7 @@
[allowRightSidebar]="allowRightSidebar"
[allowLeftSidebar]="allowLeftSidebar"
[urlFile]="urlFile"
(showViewerChange)="onViewerVisibilityChanged($event)"
[sidebarLeftTemplate]="sidebarLeftTemplate"
[sidebarRightTemplate]="sidebarRightTemplate">

View File

@@ -16,9 +16,10 @@
*/
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { ActivatedRoute, Router, PRIMARY_OUTLET } from '@angular/router';
import { ContentService, AllowableOperationsEnum, PermissionsEnum, NodesApiService } from '@alfresco/adf-core';
import { MatSnackBar } from '@angular/material';
import { PreviewService } from '../../services/preview.service';
@Component({
selector: 'app-file-view',
@@ -57,12 +58,15 @@ export class FileViewComponent implements OnInit {
showTabWithIconAndLabel = false;
desiredAspect: string = null;
showAspect: string = null;
content: Blob;
name: string;
constructor(private router: Router,
private route: ActivatedRoute,
private snackBar: MatSnackBar,
private nodeApiService: NodesApiService,
private contentServices: ContentService) {
private contentServices: ContentService,
private preview: PreviewService) {
}
ngOnInit() {
@@ -81,10 +85,18 @@ export class FileViewComponent implements OnInit {
},
() => this.router.navigate(['/files', id])
);
} else if (this.preview.content) {
this.content = this.preview.content;
this.displayName = this.preview.name;
}
});
}
onViewerVisibilityChanged() {
const primaryUrl = this.router.parseUrl(this.router.url).root.children[PRIMARY_OUTLET].toString();
this.router.navigateByUrl(primaryUrl);
}
onUploadError(errorMessage: string) {
this.snackBar.open(errorMessage, '', { duration: 4000 });
}