mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACA-1236] Manage Versions - of Shared Files (#251)
* you can't open version history for multiple files selected * update node-version directive to handle the node versions of shared files
This commit is contained in:
parent
abe244fed9
commit
15c361c962
@ -25,7 +25,7 @@
|
||||
|
||||
import { Directive, EventEmitter, HostListener, Input, Output } from '@angular/core';
|
||||
|
||||
import { TranslationService, NotificationService } from '@alfresco/adf-core';
|
||||
import { TranslationService, NotificationService, AlfrescoApiService } from '@alfresco/adf-core';
|
||||
import { MinimalNodeEntity } from 'alfresco-js-api';
|
||||
|
||||
import { VersionManagerDialogAdapterComponent } from '../../components/versions-dialog/version-manager-dialog-adapter.component';
|
||||
@ -48,14 +48,27 @@ export class NodeVersionsDirective {
|
||||
}
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private dialog: MatDialog,
|
||||
private notification: NotificationService,
|
||||
private translation: TranslationService
|
||||
) {}
|
||||
|
||||
onManageVersions() {
|
||||
const contentEntry = this.selection[this.selection.length - 1].entry;
|
||||
const contentEntry = this.selection[0].entry;
|
||||
const nodeId = (<any>contentEntry).nodeId;
|
||||
|
||||
if (nodeId) {
|
||||
// get the node entry that was shared:
|
||||
this.apiService.getInstance().nodes.getNodeInfo(nodeId).then(entry => this.openVersionManagerDialog(entry));
|
||||
|
||||
} else {
|
||||
this.openVersionManagerDialog(contentEntry);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
openVersionManagerDialog(contentEntry) {
|
||||
if (contentEntry.isFile) {
|
||||
this.dialog.open(
|
||||
VersionManagerDialogAdapterComponent,
|
||||
|
@ -81,6 +81,7 @@
|
||||
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="isFileSelected(documentList.selection)"
|
||||
[app-node-versions]="documentList.selection">
|
||||
<mat-icon>storage</mat-icon>
|
||||
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
||||
|
@ -136,13 +136,20 @@ export abstract class PageComponent {
|
||||
return this.isFileSelected(selection);
|
||||
}
|
||||
|
||||
canManageVersions(selection: Array<MinimalNodeEntity>): boolean {
|
||||
const lastItem = selection.length && selection[selection.length - 1].entry;
|
||||
return lastItem && lastItem.isFile && this.userHasPermissionToManageVersions(lastItem);
|
||||
canUpdateFile(selection: Array<MinimalNodeEntity>): boolean {
|
||||
return this.isFileSelected(selection) && this.nodeHasPermission(selection[0].entry, 'update');
|
||||
}
|
||||
|
||||
userHasPermissionToManageVersions(nodeEntry): boolean {
|
||||
return this.nodeHasPermission(nodeEntry, 'update');
|
||||
canUpdateFileShared(selection: Array<MinimalNodeEntity>): boolean {
|
||||
return this.isFileSelected(selection) && this.nodeSharedHasPermission(selection[0].entry, 'update');
|
||||
}
|
||||
|
||||
canManageVersions(selection: Array<MinimalNodeEntity>): boolean {
|
||||
return this.canUpdateFile(selection);
|
||||
}
|
||||
|
||||
canManageVersionsOfShared(selection: Array<MinimalNodeEntity>): boolean {
|
||||
return this.canUpdateFileShared(selection);
|
||||
}
|
||||
|
||||
nodeHasPermission(node: MinimalNodeEntryEntity, permission: string): boolean {
|
||||
|
@ -83,7 +83,7 @@
|
||||
|
||||
<button
|
||||
mat-menu-item
|
||||
*ngIf="canManageVersions(documentList.selection)"
|
||||
*ngIf="canManageVersionsOfShared(documentList.selection)"
|
||||
[app-node-versions]="documentList.selection">
|
||||
<mat-icon>storage</mat-icon>
|
||||
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
||||
|
Loading…
x
Reference in New Issue
Block a user