[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:
siva kumar
2020-11-04 14:35:55 +05:30
committed by GitHub
parent 64ad7923c3
commit b8cacd3b4e
7 changed files with 130 additions and 44 deletions

View File

@@ -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;
}
}