[ACA-2180] Viewer toolbar - rearrange actions layout (#962)

* merge action in toolbar submenu

* viewer add info drawer action

* toggle infoDrawer extension action

* hide viewer toolbar info drawer action

* fix typo

* allow to  unsubscribe from infoDrawerOpened event
This commit is contained in:
Cilibiu Bogdan
2019-02-24 16:20:21 +02:00
committed by Denys Vuika
parent 525ba7e73e
commit 2be93af273
5 changed files with 43 additions and 16 deletions

View File

@@ -51,18 +51,23 @@
} }
], ],
"viewer": { "viewer": {
"openWith": [ "toolbarActions": [
{ {
"id": "aos.viewer.openWith.office", "id": "app.viewer.toolbar.more",
"type": "button", "children": [
"icon": "adf:application/msword", {
"title": "Microsoft Office", "id": "aos.viewer.openWith.office",
"actions": { "order": 1,
"click": "aos.openWith.office" "icon": "adf:application/msword",
}, "title": "Microsoft Office™",
"rules": { "actions": {
"visible": "aos.canOpenWithOffice" "click": "aos.openWith.office"
} },
"rules": {
"visible": "aos.canOpenWithOffice"
}
}
]
} }
] ]
} }

View File

@@ -2,8 +2,9 @@
<adf-viewer <adf-viewer
[nodeId]="nodeId" [nodeId]="nodeId"
[allowNavigate]="navigateMultiple" [allowNavigate]="navigateMultiple"
[allowRightSidebar]="hasRightSidebar" [allowRightSidebar]="showRightSide"
[allowPrint]="false" [allowPrint]="false"
[showRightSidebar]="showRightSide"
[allowDownload]="false" [allowDownload]="false"
[allowFullScreen]="false" [allowFullScreen]="false"
[canNavigateBefore]="previousNodeId" [canNavigateBefore]="previousNodeId"
@@ -12,9 +13,9 @@
(showViewerChange)="onVisibilityChanged($event)" (showViewerChange)="onVisibilityChanged($event)"
(navigateBefore)="onNavigateBefore()" (navigateBefore)="onNavigateBefore()"
(navigateNext)="onNavigateNext()" (navigateNext)="onNavigateNext()"
[ngClass]="hasRightSidebar ? 'hide-last-divider' : ''" [ngClass]="showRightSide ? 'hide-last-divider' : ''"
> >
<adf-viewer-sidebar> <adf-viewer-sidebar *ngIf="(infoDrawerOpened$ | async)">
<aca-info-drawer [node]="selection.file"></aca-info-drawer> <aca-info-drawer [node]="selection.file"></aca-info-drawer>
</adf-viewer-sidebar> </adf-viewer-sidebar>

View File

@@ -16,3 +16,8 @@
display: inline; display: inline;
} }
} }
// todo: remove this when viewer supports extensions
.adf-viewer-toolbar .mat-toolbar > button:last-child {
display: none;
}

View File

@@ -38,7 +38,7 @@ import {
UrlSegment, UrlSegment,
PRIMARY_OUTLET PRIMARY_OUTLET
} from '@angular/router'; } from '@angular/router';
import { debounceTime } from 'rxjs/operators'; import { debounceTime, takeUntil } from 'rxjs/operators';
import { import {
UserPreferencesService, UserPreferencesService,
ObjectUtils, ObjectUtils,
@@ -55,6 +55,7 @@ import { ContentManagementService } from '../../services/content-management.serv
import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions'; import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
import { SearchRequest } from '@alfresco/js-api'; import { SearchRequest } from '@alfresco/js-api';
import { AppDataService } from '../../services/data.service'; import { AppDataService } from '../../services/data.service';
import { from } from 'rxjs';
@Component({ @Component({
selector: 'app-preview', selector: 'app-preview',
@@ -82,7 +83,7 @@ export class PreviewComponent extends PageComponent
navigateMultiple = false; navigateMultiple = false;
openWith: Array<ContentActionRef> = []; openWith: Array<ContentActionRef> = [];
contentExtensions: Array<ViewerExtensionRef> = []; contentExtensions: Array<ViewerExtensionRef> = [];
hasRightSidebar = true; showRightSide = false;
constructor( constructor(
private contentApi: ContentApiService, private contentApi: ContentApiService,
@@ -102,6 +103,12 @@ export class PreviewComponent extends PageComponent
ngOnInit() { ngOnInit() {
super.ngOnInit(); super.ngOnInit();
from(this.infoDrawerOpened$)
.pipe(takeUntil(this.onDestroy$))
.subscribe(val => {
this.showRightSide = val;
});
this.previewLocation = this.router.url this.previewLocation = this.router.url
.substr(0, this.router.url.indexOf('/', 1)) .substr(0, this.router.url.indexOf('/', 1))
.replace(/\//g, ''); .replace(/\//g, '');

View File

@@ -1016,6 +1016,15 @@
"visible": "app.toolbar.canViewFile" "visible": "app.toolbar.canViewFile"
} }
}, },
{
"id": "app.viewer.infoDrawer",
"type": "custom",
"order": 500,
"component": "app.toolbar.toggleInfoDrawer",
"rules": {
"visible": "app.toolbar.info"
}
},
{ {
"id": "app.viewer.toolbar.more", "id": "app.viewer.toolbar.more",
"type": "menu", "type": "menu",