mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-09-17 14:21:29 +00:00
[AAE-3966] FE - Disable the upload button when the user doesn't have permissions in a folder (#6304)
* [AAE-3966] FE - Disable the upload button when the user doesn't have permissions in a folder * * Handled both error messages while searching * * Refactored names * * Fixed unit tests and added some * Updated doc * * Fixed comment
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
import { Component, Inject, ViewEncapsulation } from '@angular/core';
|
||||
import { MAT_DIALOG_DATA } from '@angular/material/dialog';
|
||||
import { TranslationService, NotificationService } from '@alfresco/adf-core';
|
||||
import { TranslationService, NotificationService, AllowableOperationsEnum, ContentService } from '@alfresco/adf-core';
|
||||
import { Node } from '@alfresco/js-api';
|
||||
import { ContentNodeSelectorComponentData } from './content-node-selector.component-data.interface';
|
||||
import { NodeEntryEvent } from '../document-list/components/node.event';
|
||||
@@ -34,9 +34,11 @@ export class ContentNodeSelectorComponent {
|
||||
buttonActionName: string;
|
||||
chosenNode: Node[];
|
||||
currentDirectoryId: string;
|
||||
disableUploadButton = false;
|
||||
showingSearch = false;
|
||||
hasAllowableOperations = false;
|
||||
|
||||
constructor(private translation: TranslationService,
|
||||
private contentService: ContentService,
|
||||
private notificationService: NotificationService,
|
||||
@Inject(MAT_DIALOG_DATA) public data: ContentNodeSelectorComponentData) {
|
||||
this.action = data.actionName ? data.actionName.toUpperCase() : 'CHOOSE';
|
||||
@@ -89,6 +91,14 @@ export class ContentNodeSelectorComponent {
|
||||
}
|
||||
|
||||
onShowingSearch(value: boolean) {
|
||||
this.disableUploadButton = value;
|
||||
this.showingSearch = value;
|
||||
}
|
||||
|
||||
onCurrentFolder(currentFolder: Node) {
|
||||
this.hasAllowableOperations = this.contentService.hasAllowableOperations(currentFolder, AllowableOperationsEnum.CREATE);
|
||||
}
|
||||
|
||||
isNotAllowedToUpload() {
|
||||
return this.showingSearch || !this.hasAllowableOperations;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user