mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-19 17:14:45 +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 { 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 { MinimalNodeEntity } from 'alfresco-js-api';
|
||||||
|
|
||||||
import { VersionManagerDialogAdapterComponent } from '../../components/versions-dialog/version-manager-dialog-adapter.component';
|
import { VersionManagerDialogAdapterComponent } from '../../components/versions-dialog/version-manager-dialog-adapter.component';
|
||||||
@ -48,14 +48,27 @@ export class NodeVersionsDirective {
|
|||||||
}
|
}
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private apiService: AlfrescoApiService,
|
||||||
private dialog: MatDialog,
|
private dialog: MatDialog,
|
||||||
private notification: NotificationService,
|
private notification: NotificationService,
|
||||||
private translation: TranslationService
|
private translation: TranslationService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
onManageVersions() {
|
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) {
|
if (contentEntry.isFile) {
|
||||||
this.dialog.open(
|
this.dialog.open(
|
||||||
VersionManagerDialogAdapterComponent,
|
VersionManagerDialogAdapterComponent,
|
||||||
|
@ -81,6 +81,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
|
*ngIf="isFileSelected(documentList.selection)"
|
||||||
[app-node-versions]="documentList.selection">
|
[app-node-versions]="documentList.selection">
|
||||||
<mat-icon>storage</mat-icon>
|
<mat-icon>storage</mat-icon>
|
||||||
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
||||||
|
@ -136,13 +136,20 @@ export abstract class PageComponent {
|
|||||||
return this.isFileSelected(selection);
|
return this.isFileSelected(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
canManageVersions(selection: Array<MinimalNodeEntity>): boolean {
|
canUpdateFile(selection: Array<MinimalNodeEntity>): boolean {
|
||||||
const lastItem = selection.length && selection[selection.length - 1].entry;
|
return this.isFileSelected(selection) && this.nodeHasPermission(selection[0].entry, 'update');
|
||||||
return lastItem && lastItem.isFile && this.userHasPermissionToManageVersions(lastItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userHasPermissionToManageVersions(nodeEntry): boolean {
|
canUpdateFileShared(selection: Array<MinimalNodeEntity>): boolean {
|
||||||
return this.nodeHasPermission(nodeEntry, 'update');
|
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 {
|
nodeHasPermission(node: MinimalNodeEntryEntity, permission: string): boolean {
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
mat-menu-item
|
mat-menu-item
|
||||||
*ngIf="canManageVersions(documentList.selection)"
|
*ngIf="canManageVersionsOfShared(documentList.selection)"
|
||||||
[app-node-versions]="documentList.selection">
|
[app-node-versions]="documentList.selection">
|
||||||
<mat-icon>storage</mat-icon>
|
<mat-icon>storage</mat-icon>
|
||||||
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
<span>{{ 'APP.ACTIONS.VERSIONS' | translate }}</span>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user