[ADF-2755] Fix preview overlay (#3208)

* Fix overlay in the new sidenav

* Update wrong url

* Enrich BlobPreviewService

* Fix another previews

* Filepreview use the same router outlet
This commit is contained in:
Popovics András
2018-04-17 17:04:24 +01:00
committed by Eugenio Romano
parent adfc5adba8
commit fba23c4377
15 changed files with 105 additions and 62 deletions

View File

@@ -51,4 +51,4 @@
</ng-template>
</adf-sidenav-layout-content>
</adf-sidenav-layout>
</adf-sidenav-layout>

View File

@@ -0,0 +1,21 @@
import { Component } from '@angular/core';
import { PreviewService } from '../../services/preview.service';
import { Router } from '@angular/router';
@Component({
templateUrl: 'bob-preview.component.html'
})
export class BlobPreviewComponent {
content: Blob;
name: string;
constructor(preview: PreviewService, router: Router) {
if (preview.content === null || preview.name === null) {
router.navigate([{ outlets: { overlay: null } }]);
return;
}
this.content = preview.content;
this.name = preview.name;
}
}

View File

@@ -0,0 +1,5 @@
<adf-viewer
[showViewer]="true"
[blobFile]="content"
[displayName]="name">
</adf-viewer>

View File

@@ -38,6 +38,7 @@ import { SelectAppsDialogComponent } from '@alfresco/adf-process-services';
import { VersionManagerDialogAdapterComponent } from './version-manager-dialog-adapter.component';
import { MetadataDialogAdapterComponent } from './metadata-dialog-adapter.component';
import { Subscription } from 'rxjs/Subscription';
import { PreviewService } from '../../services/preview.service';
const DEFAULT_FOLDER_TO_SHOW = '-my-';
@@ -163,6 +164,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
private logService: LogService,
private preference: UserPreferencesService,
private appConfig: AppConfigService,
private preview: PreviewService,
@Optional() private route: ActivatedRoute,
public authenticationService: AuthenticationService) {
this.preference.select(UserPreferenceValues.SupportedPageSizes)
@@ -174,7 +176,7 @@ export class FilesComponent implements OnInit, OnChanges, OnDestroy {
showFile(event) {
const entry = event.value.entry;
if (entry && entry.isFile) {
this.router.navigate(['/files', entry.id, 'view']);
this.preview.showResource(entry.id);
}
}

View File

@@ -35,13 +35,4 @@
</adf-create-process-attachment>
</div>
</div>
<div *ngIf="fileShowed">
<adf-viewer
[(showViewer)]="fileShowed"
[blobFile]="content"
[displayName]="contentName"
[overlayMode]="true">
</adf-viewer>
</div>
</div>

View File

@@ -21,6 +21,7 @@ import { ProcessInstance, ProcessService ,
import { UploadService } from '@alfresco/adf-core';
import { AlfrescoApiService } from '@alfresco/adf-core';
import { AppConfigService } from '@alfresco/adf-core';
import { PreviewService } from '../../services/preview.service';
export function processUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) {
return new ProcessUploadService(api, config);
@@ -47,14 +48,13 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges {
@Input()
processInstanceId: string;
fileShowed = false;
content: Blob;
contentName: string;
processInstance: ProcessInstance;
constructor(private uploadService: UploadService, private processService: ProcessService) {
}
constructor(
private uploadService: UploadService,
private processService: ProcessService,
private preview: PreviewService
) {}
ngOnInit() {
this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
@@ -74,9 +74,7 @@ export class ProcessAttachmentsComponent implements OnInit, OnChanges {
}
onAttachmentClick(content: any): void {
this.fileShowed = true;
this.content = content.contentBlob;
this.contentName = content.name;
this.preview.showBlob(content.name, content.contentBlob);
}
isCompletedProcess(): boolean {

View File

@@ -233,12 +233,3 @@
</div>
</mat-tab>
</mat-tab-group>
<div *ngIf="fileShowed">
<adf-viewer
[(showViewer)]="fileShowed"
[blobFile]="content"
[displayName]="contentName"
[overlayMode]="true">
</adf-viewer>
</div>

View File

@@ -63,6 +63,7 @@ import {
import { Subscription } from 'rxjs/Subscription';
import { /*CustomEditorComponent*/ CustomStencil01 } from './custom-editor/custom-editor.component';
import { DemoFieldValidator } from './demo-field-validator';
import { PreviewService } from '../../services/preview.service';
const currentProcessIdNew = '__NEW__';
const currentTaskIdNew = '__NEW__';
@@ -111,14 +112,10 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
@Output()
changePageSize: EventEmitter<Pagination> = new EventEmitter();
fileShowed = false;
selectFirstReport = false;
private tabs = { tasks: 0, processes: 1, reports: 2 };
content: Blob;
contentName: string;
layoutType: string;
currentTaskId: string;
currentProcessInstanceId: string;
@@ -161,6 +158,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
private apiService: AlfrescoApiService,
private logService: LogService,
private appConfig: AppConfigService,
private preview: PreviewService,
formRenderingService: FormRenderingService,
formService: FormService,
private preferenceService: UserPreferencesService) {
@@ -385,9 +383,7 @@ export class ProcessServiceComponent implements AfterViewInit, OnDestroy, OnInit
}
onContentClick(content: any): void {
this.fileShowed = true;
this.content = content.contentBlob;
this.contentName = content.name;
this.preview.showBlob(content.name, content.contentBlob);
}
onAuditClick(event: any) {

View File

@@ -33,12 +33,3 @@
</div>
</div>
<div *ngIf="fileShowed">
<adf-viewer
[(showViewer)]="fileShowed"
[blobFile]="content"
[displayName]="contentName"
[overlayMode]="true">
</adf-viewer>
</div>

View File

@@ -18,6 +18,7 @@
import { Component, Input, OnChanges, OnInit, ViewChild } from '@angular/core';
import { TaskListService, TaskAttachmentListComponent, TaskDetailsModel, TaskUploadService } from '@alfresco/adf-process-services';
import { UploadService, AlfrescoApiService, AppConfigService } from '@alfresco/adf-core';
import { PreviewService } from '../../services/preview.service';
export function taskUploadServiceFactory(api: AlfrescoApiService, config: AppConfigService) {
return new TaskUploadService(api, config);
@@ -44,14 +45,12 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges {
@Input()
taskId: string;
fileShowed = false;
content: Blob;
contentName: string;
taskDetails: any;
constructor(private uploadService: UploadService, private activitiTaskList: TaskListService) {
}
constructor(
private uploadService: UploadService,
private activitiTaskList: TaskListService,
private preview: PreviewService) {}
ngOnInit() {
this.uploadService.fileUploadComplete.subscribe(value => this.onFileUploadComplete(value.data));
@@ -71,9 +70,7 @@ export class TaskAttachmentsComponent implements OnInit, OnChanges {
}
onAttachmentClick(content: any): void {
this.fileShowed = true;
this.content = content.contentBlob;
this.contentName = content.name;
this.preview.showBlob(content.name, content.contentBlob);
}
isCompletedTask(): boolean {