mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[AAE-2202] Not able to search for files (#5569)
* [AAE-2202] Not able to search for files * * fixd test * * fixed panel test * * fixed files search options * * added docs
This commit is contained in:
@@ -227,5 +227,24 @@
|
|||||||
</adf-content-node-selector-panel>
|
</adf-content-node-selector-panel>
|
||||||
</div>
|
</div>
|
||||||
</mat-expansion-panel>
|
</mat-expansion-panel>
|
||||||
|
<mat-expansion-panel>
|
||||||
|
<mat-expansion-panel-header>
|
||||||
|
<mat-panel-title>
|
||||||
|
<h2>shows files</h2>
|
||||||
|
</mat-panel-title>
|
||||||
|
<mat-panel-description>
|
||||||
|
<label class="app-content-node-selector-demo-basic-label">
|
||||||
|
Shows files in search result
|
||||||
|
</label>
|
||||||
|
</mat-panel-description>
|
||||||
|
</mat-expansion-panel-header>
|
||||||
|
|
||||||
|
<div class="app-content-node-selector-demo-basic-table">
|
||||||
|
<adf-content-node-selector-panel
|
||||||
|
[currentFolderId]="'-root-'"
|
||||||
|
[showFilesInResult]="true">
|
||||||
|
</adf-content-node-selector-panel>
|
||||||
|
</div>
|
||||||
|
</mat-expansion-panel>
|
||||||
</mat-accordion>
|
</mat-accordion>
|
||||||
</main>
|
</main>
|
||||||
|
@@ -22,8 +22,10 @@ Displays and edits metadata related to a node.
|
|||||||
- [Aspect oriented config](#aspect-oriented-config)
|
- [Aspect oriented config](#aspect-oriented-config)
|
||||||
- [Layout oriented config](#layout-oriented-config)
|
- [Layout oriented config](#layout-oriented-config)
|
||||||
- [Displaying all properties](#displaying-all-properties)
|
- [Displaying all properties](#displaying-all-properties)
|
||||||
|
- [Making aspects and properties read only](#making-aspects-and-properties-read-only)
|
||||||
- [What happens when there is a whitelisted aspect in the config but the given node doesn't relate to that aspect](#what-happens-when-there-is-a-whitelisted-aspect-in-the-config-but-the-given-node-doesnt-relate-to-that-aspect)
|
- [What happens when there is a whitelisted aspect in the config but the given node doesn't relate to that aspect](#what-happens-when-there-is-a-whitelisted-aspect-in-the-config-but-the-given-node-doesnt-relate-to-that-aspect)
|
||||||
- [Multi value card properties](#multi-value-card-properties)
|
- [Multi value card properties](#multi-value-card-properties)
|
||||||
|
- [Use chips for multi value properties](#use-chips-for-multi-value-properties)
|
||||||
|
|
||||||
## Basic Usage
|
## Basic Usage
|
||||||
|
|
||||||
|
@@ -41,6 +41,7 @@ Opens a [Content Node Selector](content-node-selector.component.md) in its own
|
|||||||
| excludeSiteContent | `string[]` | | Custom list of site content componentIds. Used to filter out the corresponding items from the displayed nodes |
|
| excludeSiteContent | `string[]` | | Custom list of site content componentIds. Used to filter out the corresponding items from the displayed nodes |
|
||||||
| rowFilter | [`RowFilter`](../../../lib/content-services/src/lib/document-list/data/row-filter.model.ts) | | Custom row filter function. See the [Row Filter Model](row-filter.model.md) page for more information. |
|
| rowFilter | [`RowFilter`](../../../lib/content-services/src/lib/document-list/data/row-filter.model.ts) | | Custom row filter function. See the [Row Filter Model](row-filter.model.md) page for more information. |
|
||||||
| showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering |
|
| showDropdownSiteList | `boolean` | | Toggle sites list dropdown rendering |
|
||||||
|
| showFilesInResult | `boolean` | | Shows the files and folders in the search result |
|
||||||
| showSearch | `boolean` | | Toggle search input rendering |
|
| showSearch | `boolean` | | Toggle search input rendering |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
@@ -28,11 +28,11 @@ Displays and manages dialogs for selecting content to open, copy or upload.
|
|||||||
- _excludeSiteContent:_ `string[]` - (Optional) The site content that should be filtered out
|
- _excludeSiteContent:_ `string[]` - (Optional) The site content that should be filtered out
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about files that were copied/moved
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about files that were copied/moved
|
||||||
- **openFileBrowseDialogByFolderId**(folderNodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
- **openFileBrowseDialogByFolderId**(folderNodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
||||||
Opens a file browser at a chosen folder location.
|
Opens a file browser at a chosen folder location. shows files and folders in the dialog search result.
|
||||||
- _folderNodeId:_ `string` - ID of the folder to use
|
- _folderNodeId:_ `string` - ID of the folder to use
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the selected file(s)
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the selected file(s)
|
||||||
- **openFileBrowseDialogBySite**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
- **openFileBrowseDialogBySite**(): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
||||||
Opens a file browser at a chosen site location.
|
Opens a file browser at a chosen site location. shows files and folders in the dialog search result.
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the selected file(s)
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the selected file(s)
|
||||||
- **openFolderBrowseDialogByFolderId**(folderNodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
- **openFolderBrowseDialogByFolderId**(folderNodeId: `string`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
||||||
Opens a folder browser at a chosen folder location.
|
Opens a folder browser at a chosen folder location.
|
||||||
@@ -45,10 +45,11 @@ Displays and manages dialogs for selecting content to open, copy or upload.
|
|||||||
Opens a lock node dialog.
|
Opens a lock node dialog.
|
||||||
- _contentEntry:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to lock
|
- _contentEntry:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - [Node](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) to lock
|
||||||
- **Returns** [`Subject`](http://reactivex.io/documentation/subject.html)`<string>` - Error/status message (if any)
|
- **Returns** [`Subject`](http://reactivex.io/documentation/subject.html)`<string>` - Error/status message (if any)
|
||||||
- **openUploadFileDialog**(action: `string`, contentEntry: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
- **openUploadFileDialog**(action: `string`, contentEntry: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md), showFilesInResult: `boolean` = `false`): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
||||||
Opens a dialog to choose a file to upload.
|
Opens a dialog to choose a file to upload.
|
||||||
- _action:_ `string` - Name of the action to show in the title
|
- _action:_ `string` - Name of the action to show in the title
|
||||||
- _contentEntry:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - Item to upload
|
- _contentEntry:_ [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md) - Item to upload
|
||||||
|
- _showFilesInResult:_ `boolean` - Show files in dialog search result
|
||||||
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the chosen file(s)
|
- **Returns** [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>` - Information about the chosen file(s)
|
||||||
- **openUploadFolderDialog**(action: `string`, contentEntry: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
- **openUploadFolderDialog**(action: `string`, contentEntry: [`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)): [`Observable`](http://reactivex.io/documentation/observable.html)`<`[`Node`](https://github.com/Alfresco/alfresco-js-api/blob/development/src/api/content-rest-api/docs/Node.md)`[]>`<br/>
|
||||||
Opens a dialog to choose folders to upload.
|
Opens a dialog to choose folders to upload.
|
||||||
|
@@ -54,12 +54,13 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a file browser at a chosen folder location.
|
* Opens a file browser at a chosen folder location.
|
||||||
|
* shows files and folders in the dialog search result.
|
||||||
* @param folderNodeId ID of the folder to use
|
* @param folderNodeId ID of the folder to use
|
||||||
* @returns Information about the selected file(s)
|
* @returns Information about the selected file(s)
|
||||||
*/
|
*/
|
||||||
openFileBrowseDialogByFolderId(folderNodeId: string): Observable<Node[]> {
|
openFileBrowseDialogByFolderId(folderNodeId: string): Observable<Node[]> {
|
||||||
return this.documentListService.getFolderNode(folderNodeId).pipe(switchMap((nodeEntry: NodeEntry) => {
|
return this.documentListService.getFolderNode(folderNodeId).pipe(switchMap((nodeEntry: NodeEntry) => {
|
||||||
return this.openUploadFileDialog('Choose', nodeEntry.entry);
|
return this.openUploadFileDialog('Choose', nodeEntry.entry, true);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,6 +92,7 @@ export class ContentNodeDialogService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a file browser at a chosen site location.
|
* Opens a file browser at a chosen site location.
|
||||||
|
* shows files and folders in the dialog search result.
|
||||||
* @returns Information about the selected file(s)
|
* @returns Information about the selected file(s)
|
||||||
*/
|
*/
|
||||||
openFileBrowseDialogBySite(): Observable<Node[]> {
|
openFileBrowseDialogBySite(): Observable<Node[]> {
|
||||||
@@ -196,9 +198,10 @@ export class ContentNodeDialogService {
|
|||||||
* Opens a dialog to choose a file to upload.
|
* Opens a dialog to choose a file to upload.
|
||||||
* @param action Name of the action to show in the title
|
* @param action Name of the action to show in the title
|
||||||
* @param contentEntry Item to upload
|
* @param contentEntry Item to upload
|
||||||
|
* @param showFilesInResult Show files in dialog search result
|
||||||
* @returns Information about the chosen file(s)
|
* @returns Information about the chosen file(s)
|
||||||
*/
|
*/
|
||||||
openUploadFileDialog(action: string, contentEntry: Node): Observable<Node[]> {
|
openUploadFileDialog(action: string, contentEntry: Node, showFilesInResult = false): Observable<Node[]> {
|
||||||
const select = new Subject<Node[]>();
|
const select = new Subject<Node[]>();
|
||||||
select.subscribe({
|
select.subscribe({
|
||||||
complete: this.close.bind(this)
|
complete: this.close.bind(this)
|
||||||
@@ -210,7 +213,8 @@ export class ContentNodeDialogService {
|
|||||||
currentFolderId: contentEntry.id,
|
currentFolderId: contentEntry.id,
|
||||||
imageResolver: this.imageResolver.bind(this),
|
imageResolver: this.imageResolver.bind(this),
|
||||||
isSelectionValid: this.isNodeFile.bind(this),
|
isSelectionValid: this.isNodeFile.bind(this),
|
||||||
select: select
|
select: select,
|
||||||
|
showFilesInResult
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
|
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
|
||||||
|
@@ -353,7 +353,7 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
describe('Search functionality', () => {
|
describe('Search functionality', () => {
|
||||||
let getCorrespondingNodeIdsSpy;
|
let getCorrespondingNodeIdsSpy;
|
||||||
|
|
||||||
const defaultSearchOptions = (searchTerm, rootNodeId = undefined, skipCount = 0) => {
|
const defaultSearchOptions = (searchTerm, rootNodeId = undefined, skipCount = 0, showFiles = false) => {
|
||||||
|
|
||||||
const parentFiltering = rootNodeId ? [{ query: `ANCESTOR:'workspace://SpacesStore/${rootNodeId}'` }] : [];
|
const parentFiltering = rootNodeId ? [{ query: `ANCESTOR:'workspace://SpacesStore/${rootNodeId}'` }] : [];
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
skipCount: skipCount
|
skipCount: skipCount
|
||||||
},
|
},
|
||||||
filterQueries: [
|
filterQueries: [
|
||||||
{ query: "TYPE:'cm:folder'" },
|
{ query: `TYPE:'cm:folder'${ showFiles ? " OR TYPE:'cm:content'" : '' }` },
|
||||||
{ query: 'NOT cm:creator:System' },
|
{ query: 'NOT cm:creator:System' },
|
||||||
...parentFiltering
|
...parentFiltering
|
||||||
],
|
],
|
||||||
@@ -419,6 +419,16 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
expect(searchSpy).toHaveBeenCalledWith(defaultSearchOptions('kakarot'));
|
expect(searchSpy).toHaveBeenCalledWith(defaultSearchOptions('kakarot'));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should show files in results by calling the search api on search change', fakeAsync(() => {
|
||||||
|
component.showFilesInResult = true;
|
||||||
|
typeToSearchBox('kakarot');
|
||||||
|
|
||||||
|
tick(debounceSearch);
|
||||||
|
fixture.detectChanges();
|
||||||
|
|
||||||
|
expect(searchSpy).toHaveBeenCalledWith(defaultSearchOptions('kakarot', undefined, 0, true));
|
||||||
|
}));
|
||||||
|
|
||||||
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
|
it('should reset the currently chosen node in case of starting a new search', fakeAsync(() => {
|
||||||
component.chosenNode = <Node> {};
|
component.chosenNode = <Node> {};
|
||||||
typeToSearchBox('kakarot');
|
typeToSearchBox('kakarot');
|
||||||
@@ -452,8 +462,8 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
|
|
||||||
expect(cnSearchSpy).toHaveBeenCalled();
|
expect(cnSearchSpy).toHaveBeenCalled();
|
||||||
expect(cnSearchSpy.calls.count()).toBe(2);
|
expect(cnSearchSpy.calls.count()).toBe(2);
|
||||||
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', undefined, 0, 25);
|
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', undefined, 0, 25, [], false);
|
||||||
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', '-sites-', 0, 25, ['123456testId', '09876543testId']);
|
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', '-sites-', 0, 25, ['123456testId', '09876543testId'], false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should call the content node selector\'s search with the right parameters on changing the site selectBox value from a custom dropdown menu', fakeAsync(() => {
|
it('should call the content node selector\'s search with the right parameters on changing the site selectBox value from a custom dropdown menu', fakeAsync(() => {
|
||||||
@@ -470,8 +480,8 @@ describe('ContentNodeSelectorComponent', () => {
|
|||||||
|
|
||||||
expect(cnSearchSpy).toHaveBeenCalled();
|
expect(cnSearchSpy).toHaveBeenCalled();
|
||||||
expect(cnSearchSpy.calls.count()).toBe(2);
|
expect(cnSearchSpy.calls.count()).toBe(2);
|
||||||
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', undefined, 0, 25);
|
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', undefined, 0, 25, [], false);
|
||||||
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', '-sites-', 0, 25, ['123456testId', '09876543testId']);
|
expect(cnSearchSpy).toHaveBeenCalledWith('vegeta', '-sites-', 0, 25, ['123456testId', '09876543testId'], false);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
|
it('should get the corresponding node ids on search when a known alias is selected from dropdown', fakeAsync(() => {
|
||||||
|
@@ -56,6 +56,7 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
|
|
||||||
private showSiteList = true;
|
private showSiteList = true;
|
||||||
private showSearchField = true;
|
private showSearchField = true;
|
||||||
|
private showFiles = false;
|
||||||
|
|
||||||
/** Node ID of the folder currently listed. */
|
/** Node ID of the folder currently listed. */
|
||||||
@Input()
|
@Input()
|
||||||
@@ -163,6 +164,14 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
return this.showSiteList;
|
return this.showSiteList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Shows the files and folders in the search result */
|
||||||
|
@Input()
|
||||||
|
set showFilesInResult(value: boolean) {
|
||||||
|
if (value !== undefined && value !== null) {
|
||||||
|
this.showFiles = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Emitted when the user has chosen an item. */
|
/** Emitted when the user has chosen an item. */
|
||||||
@Output()
|
@Output()
|
||||||
select: EventEmitter<Node[]> = new EventEmitter<Node[]>();
|
select: EventEmitter<Node[]> = new EventEmitter<Node[]>();
|
||||||
@@ -355,14 +364,14 @@ export class ContentNodeSelectorPanelComponent implements OnInit, OnDestroy {
|
|||||||
if (this.customResourcesService.hasCorrespondingNodeIds(this.siteId)) {
|
if (this.customResourcesService.hasCorrespondingNodeIds(this.siteId)) {
|
||||||
this.customResourcesService.getCorrespondingNodeIds(this.siteId)
|
this.customResourcesService.getCorrespondingNodeIds(this.siteId)
|
||||||
.subscribe((nodeIds) => {
|
.subscribe((nodeIds) => {
|
||||||
this.contentNodeSelectorService.search(this.searchTerm, this.siteId, this.pagination.skipCount, this.pagination.maxItems, nodeIds)
|
this.contentNodeSelectorService.search(this.searchTerm, this.siteId, this.pagination.skipCount, this.pagination.maxItems, nodeIds, this.showFiles)
|
||||||
.subscribe(this.showSearchResults.bind(this));
|
.subscribe(this.showSearchResults.bind(this));
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
this.showSearchResults({ list: { entries: [] } });
|
this.showSearchResults({ list: { entries: [] } });
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.contentNodeSelectorService.search(this.searchTerm, this.siteId, this.pagination.skipCount, this.pagination.maxItems)
|
this.contentNodeSelectorService.search(this.searchTerm, this.siteId, this.pagination.skipCount, this.pagination.maxItems, [], this.showFiles)
|
||||||
.subscribe(this.showSearchResults.bind(this));
|
.subscribe(this.showSearchResults.bind(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -32,5 +32,6 @@ export interface ContentNodeSelectorComponentData {
|
|||||||
excludeSiteContent?: string[];
|
excludeSiteContent?: string[];
|
||||||
select: Subject<Node[]>;
|
select: Subject<Node[]>;
|
||||||
showSearch?: boolean;
|
showSearch?: boolean;
|
||||||
|
showFilesInResult?: boolean;
|
||||||
showDropdownSiteList?: boolean;
|
showDropdownSiteList?: boolean;
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,7 @@
|
|||||||
[where]="data?.where"
|
[where]="data?.where"
|
||||||
[showSearch]="data?.showSearch"
|
[showSearch]="data?.showSearch"
|
||||||
[showDropdownSiteList]="data?.showDropdownSiteList"
|
[showDropdownSiteList]="data?.showDropdownSiteList"
|
||||||
|
[showFilesInResult]="data?.showFilesInResult"
|
||||||
(select)="onSelect($event)">
|
(select)="onSelect($event)">
|
||||||
</adf-content-node-selector-panel>
|
</adf-content-node-selector-panel>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
|
@@ -80,12 +80,18 @@ describe('ContentNodeSelectorService', () => {
|
|||||||
expect(search.query.paging.skipCount).toEqual(0);
|
expect(search.query.paging.skipCount).toEqual(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should filter the search only for folders', () => {
|
it('should filter the search for folders', () => {
|
||||||
service.search('nuka cola quantum');
|
service.search('nuka cola quantum');
|
||||||
|
|
||||||
expect(search.query.filterQueries).toContain({ query: "TYPE:'cm:folder'" });
|
expect(search.query.filterQueries).toContain({ query: "TYPE:'cm:folder'" });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should filter the search for files', () => {
|
||||||
|
service.search('nuka cola quantum', null, 0, 25, [], true);
|
||||||
|
|
||||||
|
expect(search.query.filterQueries).toContain({ query: "TYPE:'cm:folder' OR TYPE:'cm:content'" });
|
||||||
|
});
|
||||||
|
|
||||||
it('should filter out the "system-base" entries', () => {
|
it('should filter out the "system-base" entries', () => {
|
||||||
service.search('nuka cola quantum');
|
service.search('nuka cola quantum');
|
||||||
|
|
||||||
|
@@ -41,8 +41,9 @@ export class ContentNodeSelectorService {
|
|||||||
* @param [extraNodeIds] List of extra node ids to search from. This last parameter is necessary when
|
* @param [extraNodeIds] List of extra node ids to search from. This last parameter is necessary when
|
||||||
* the rootNodeId is one of the supported aliases (e.g. '-my-', '-root-', '-mysites-', etc.)
|
* the rootNodeId is one of the supported aliases (e.g. '-my-', '-root-', '-mysites-', etc.)
|
||||||
* and search is not supported for that alias, but can be performed on its corresponding nodes.
|
* and search is not supported for that alias, but can be performed on its corresponding nodes.
|
||||||
|
* @param [showFiles] shows the files in the dialog search result
|
||||||
*/
|
*/
|
||||||
public search(searchTerm: string, rootNodeId: string = null, skipCount: number = 0, maxItems: number = 25, extraNodeIds?: string[]): Observable<ResultSetPaging> {
|
public search(searchTerm: string, rootNodeId: string = null, skipCount: number = 0, maxItems: number = 25, extraNodeIds?: string[], showFiles?: boolean): Observable<ResultSetPaging> {
|
||||||
|
|
||||||
let extraParentFiltering = '';
|
let extraParentFiltering = '';
|
||||||
|
|
||||||
@@ -66,7 +67,7 @@ export class ContentNodeSelectorService {
|
|||||||
skipCount: skipCount
|
skipCount: skipCount
|
||||||
},
|
},
|
||||||
filterQueries: [
|
filterQueries: [
|
||||||
{ query: "TYPE:'cm:folder'" },
|
{ query: `TYPE:'cm:folder'${ showFiles ? " OR TYPE:'cm:content'" : '' }` },
|
||||||
{ query: 'NOT cm:creator:System' },
|
{ query: 'NOT cm:creator:System' },
|
||||||
...parentFiltering
|
...parentFiltering
|
||||||
],
|
],
|
||||||
|
@@ -46,7 +46,8 @@ export class ContentCloudNodeSelectorService {
|
|||||||
actionName: 'Choose',
|
actionName: 'Choose',
|
||||||
currentFolderId: '-my-',
|
currentFolderId: '-my-',
|
||||||
select,
|
select,
|
||||||
isSelectionValid: this.isNodeFile.bind(this)
|
isSelectionValid: this.isNodeFile.bind(this),
|
||||||
|
showFilesInResult: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
|
this.openContentNodeDialog(data, 'adf-content-node-selector-dialog', '630px');
|
||||||
|
@@ -25,4 +25,5 @@ export interface AttachFileWidgetDialogComponentData {
|
|||||||
ecmHost: string;
|
ecmHost: string;
|
||||||
context?: string;
|
context?: string;
|
||||||
isSelectionValid?: (entry: Node) => boolean;
|
isSelectionValid?: (entry: Node) => boolean;
|
||||||
|
showFilesInResult?: boolean;
|
||||||
}
|
}
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
<adf-content-node-selector-panel *ngIf="isLoggedIn()"
|
<adf-content-node-selector-panel *ngIf="isLoggedIn()"
|
||||||
id="attach-file-content-node"
|
id="attach-file-content-node"
|
||||||
[isSelectionValid]="data?.isSelectionValid"
|
[isSelectionValid]="data?.isSelectionValid"
|
||||||
|
[showFilesInResult]="data?.showFilesInResult"
|
||||||
(select)="onSelect($event)">
|
(select)="onSelect($event)">
|
||||||
</adf-content-node-selector-panel>
|
</adf-content-node-selector-panel>
|
||||||
</mat-dialog-content>
|
</mat-dialog-content>
|
||||||
|
@@ -53,7 +53,8 @@ export class AttachFileWidgetDialogService {
|
|||||||
selected,
|
selected,
|
||||||
ecmHost,
|
ecmHost,
|
||||||
context,
|
context,
|
||||||
isSelectionValid: this.isNodeFile.bind(this)
|
isSelectionValid: this.isNodeFile.bind(this),
|
||||||
|
showFilesInResult: true
|
||||||
};
|
};
|
||||||
|
|
||||||
this.openLoginDialog(data, 'adf-attach-file-widget-dialog', '630px');
|
this.openLoginDialog(data, 'adf-attach-file-widget-dialog', '630px');
|
||||||
|
Reference in New Issue
Block a user