[ADF-5354] Content node selector is not working properly for read-only folders (#6777)

* disable button when no permission

* test

* breadcrumb fallback when selection is not valid

* test
This commit is contained in:
Cilibiu Bogdan
2021-03-06 11:37:42 +02:00
committed by GitHub
parent 994b4555af
commit e21b777a3c
4 changed files with 45 additions and 5 deletions

View File

@@ -77,6 +77,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
private showSiteList = true;
private showSearchField = true;
private breadcrumbFolderNodeFallback: Node ;
/** If true will restrict the search and breadcrumbs to the currentFolderId */
@Input()
@@ -445,7 +446,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
let folderNode: Node;
if (this.showingSearchResults && this.chosenNode) {
folderNode = this.chosenNode[0];
folderNode = this.chosenNode[0] || this.breadcrumbFolderNodeFallback;
} else {
folderNode = this.documentList.folderNode;
}
@@ -465,6 +466,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
this.loadingSearchResults = true;
this.addCorrespondingNodeIdsQuery();
this.resetChosenNode();
this.breadcrumbFolderNodeFallback = null ;
}
/**
@@ -606,8 +608,12 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
* @param nodesEntries
*/
onCurrentSelection(nodesEntries: NodeEntry[]): void {
this.breadcrumbFolderNodeFallback = null;
const validNodesEntity = nodesEntries.filter((node) => this.isSelectionValid(node.entry));
this.chosenNode = validNodesEntity.map((node) => node.entry);
if (!this.chosenNode.length) {
this.breadcrumbFolderNodeFallback = nodesEntries[0].entry;
}
}
setTitleIfCustomSite(site: SiteEntry) {