mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2128] facet container component (#3094)
* (wip) facet container * shaping out the API * code lint fixes * radiobox facet example * fields selector facet * search limits support * scope locations facet example * move custom search to 'search.query' config * use facet fields and queries from the config file * use facet filters * use facet buckets in query * preserve expanded/checked states * code cleanup and binding fixes * fix apis after rebase * extract query builder into separate class * code improvements * full chip list (merge facet fields with queries) * placeholder for range requests * move search infrastructure to ADF core * cleanup code * auto-search on init * move search components to the content services * selected facets chip list * split into separate components at ADF level * move the rest of the implementation to ADF * facet builder fixes and tests * translation support for category names * docs placeholders * update language level * unit tests and packaging updates * fix after rebase * remove fdescribe * some docs on search settings * rename components as per review * simplify chip list as per review * turn query builder into service * improve search service, integrate old search results * fix node selector integration * move service to the top module * update tests * remove fdescribe * update tests * test fixes * test fixes * test updates * fix tests * code and test fixes * remove fit * fix tests * fix tests * remove obsolete test * increase bundle threshold * update docs to reflect PR changes * fix docs
This commit is contained in:
committed by
Eugenio Romano
parent
d6f51c22aa
commit
ed48994e67
@@ -51,6 +51,118 @@
|
||||
"label": "Simplified Chinese"
|
||||
}
|
||||
],
|
||||
"search": {
|
||||
"limits": {
|
||||
"permissionEvaluationTime": null,
|
||||
"permissionEvaluationCount": null
|
||||
},
|
||||
"filterQueries": [
|
||||
{ "query": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "query": "NOT cm:creator:System" }
|
||||
],
|
||||
"facetFields": {
|
||||
"facets": [
|
||||
{ "field": "content.mimetype", "mincount": 1, "label": "Type" },
|
||||
{ "field": "content.size", "mincount": 1, "label": "Size" },
|
||||
{ "field": "creator", "mincount": 1, "label": "Creator" },
|
||||
{ "field": "modifier", "mincount": 1, "label": "Modifier" }
|
||||
]
|
||||
},
|
||||
"facetQueries": [
|
||||
{ "query": "created:2018", "label": "Created This Year" },
|
||||
{ "query": "content.mimetype", "label": "Type" },
|
||||
{ "query": "content.size:[0 TO 10240]", "label": "Size: xtra small"},
|
||||
{ "query": "content.size:[10240 TO 102400]", "label": "Size: small"},
|
||||
{ "query": "content.size:[102400 TO 1048576]", "label": "Size: medium" },
|
||||
{ "query": "content.size:[1048576 TO 16777216]", "label": "Size: large" },
|
||||
{ "query": "content.size:[16777216 TO 134217728]", "label": "Size: xtra large" },
|
||||
{ "query": "content.size:[134217728 TO MAX]", "label": "Size: XX large" }
|
||||
],
|
||||
"query": {
|
||||
"categories": [
|
||||
{
|
||||
"id": "broken",
|
||||
"name": "Broken Facet",
|
||||
"enabled": false,
|
||||
"expanded": false,
|
||||
"component": {
|
||||
"selector": "adf-search-text",
|
||||
"settings": {
|
||||
"field": "fieldname"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "queryName",
|
||||
"name": "Name",
|
||||
"enabled": true,
|
||||
"expanded": true,
|
||||
"component": {
|
||||
"selector": "adf-search-text",
|
||||
"settings": {
|
||||
"pattern": "cm:name:'(.*?)'",
|
||||
"field": "cm:name",
|
||||
"placeholder": "Enter the name"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "queryFields",
|
||||
"name": "Fields",
|
||||
"enabled": true,
|
||||
"expanded": false,
|
||||
"component": {
|
||||
"selector": "adf-search-fields",
|
||||
"settings": {
|
||||
"field": null,
|
||||
"options": [
|
||||
{ "name": "Name", "value": "name", "fields": ["name"], "default": true },
|
||||
{ "name": "File Size", "value": "content.sizeInBytes", "fields": ["content"], "default": true },
|
||||
{ "name": "Modified On", "value": "modifiedAt", "fields": ["modifiedAt"], "default": true },
|
||||
{ "name": "Modified By", "value": "modifiedByUser.displayName", "fields": ["modifiedByUser"], "default": true }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "queryType",
|
||||
"name": "Type",
|
||||
"enabled": true,
|
||||
"expanded": false,
|
||||
"component": {
|
||||
"selector": "adf-search-radio",
|
||||
"settings": {
|
||||
"field": null,
|
||||
"options": [
|
||||
{ "name": "None", "value": "", "default": true },
|
||||
{ "name": "All", "value": "TYPE:'cm:folder' OR TYPE:'cm:content'" },
|
||||
{ "name": "Folder", "value": "TYPE:'cm:folder'" },
|
||||
{ "name": "Document", "value": "TYPE:'cm:content'" }
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": "queryLocations",
|
||||
"name": "Locations",
|
||||
"enabled": true,
|
||||
"expanded": false,
|
||||
"component": {
|
||||
"selector": "adf-search-scope-locations",
|
||||
"settings": {
|
||||
"field": null,
|
||||
"options": [
|
||||
{ "name": "Default", "value": "nodes", "default": true },
|
||||
{ "name": "Nodes", "value": "nodes" },
|
||||
{ "name": "Deleted Nodes", "value": "deleted-nodes" },
|
||||
{ "name": "Versions", "value": "versions" }
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"pagination": {
|
||||
"size": 25,
|
||||
"supportedPageSizes": [ 5, 10, 15, 20 ]
|
||||
|
@@ -50,20 +50,19 @@ import { ProcessAttachmentsComponent } from './components/process-service/proces
|
||||
import { SharedLinkViewComponent } from './components/shared-link-view/shared-link-view.component';
|
||||
import { DemoPermissionComponent } from './components/permissions/demo-permissions.component';
|
||||
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
BrowserModule,
|
||||
BrowserAnimationsModule,
|
||||
ReactiveFormsModule,
|
||||
BrowserModule,
|
||||
routing,
|
||||
FormsModule,
|
||||
AdfModule,
|
||||
MaterialModule,
|
||||
ThemePickerModule,
|
||||
FlexLayoutModule,
|
||||
ChartsModule,
|
||||
HttpClientModule
|
||||
HttpClientModule,
|
||||
AdfModule
|
||||
],
|
||||
declarations: [
|
||||
AppComponent,
|
||||
@@ -98,7 +97,8 @@ import { DemoPermissionComponent } from './components/permissions/demo-permissio
|
||||
OverlayViewerComponent,
|
||||
SharedLinkViewComponent,
|
||||
FormLoadingComponent,
|
||||
DemoPermissionComponent
|
||||
DemoPermissionComponent,
|
||||
FormLoadingComponent
|
||||
],
|
||||
providers: [
|
||||
{ provide: AppConfigService, useClass: DebugAppConfigService },
|
||||
|
@@ -1,3 +1,4 @@
|
||||
|
||||
<adf-search [searchTerm]="searchedWord"
|
||||
[maxResults]="maxItems"
|
||||
[skipResults]="skipCount"
|
||||
@@ -5,15 +6,25 @@
|
||||
#search>
|
||||
</adf-search>
|
||||
|
||||
<app-files-component
|
||||
[currentFolderId]="null"
|
||||
[nodeResult]="resultNodePageList"
|
||||
[disableDragArea]="true"
|
||||
[pagination]="pagination"
|
||||
(changedPageSize)="onRefreshPagination($event)"
|
||||
(changedPageNumber)="onRefreshPagination($event)"
|
||||
(turnedNextPage)="onRefreshPagination($event)"
|
||||
(loadNext)="onRefreshPagination($event)"
|
||||
(turnedPreviousPage)="onRefreshPagination($event)"
|
||||
(deleteElementSuccess)="onDeleteElementSuccess($event)">
|
||||
</app-files-component>
|
||||
<div class="adf-search-results__facets">
|
||||
<adf-search-chip-list [searchFilter]="searchFilter"></adf-search-chip-list>
|
||||
</div>
|
||||
|
||||
<div class="adf-search-results">
|
||||
<adf-search-filter #searchFilter></adf-search-filter>
|
||||
|
||||
<div class="adf-search-results__content">
|
||||
<app-files-component
|
||||
[currentFolderId]="null"
|
||||
[nodeResult]="resultNodePageList"
|
||||
[disableDragArea]="true"
|
||||
[pagination]="pagination"
|
||||
(changedPageSize)="onRefreshPagination($event)"
|
||||
(changedPageNumber)="onRefreshPagination($event)"
|
||||
(turnedNextPage)="onRefreshPagination($event)"
|
||||
(loadNext)="onRefreshPagination($event)"
|
||||
(turnedPreviousPage)="onRefreshPagination($event)"
|
||||
(deleteElementSuccess)="onDeleteElementSuccess($event)">
|
||||
</app-files-component>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -1,3 +1,20 @@
|
||||
.adf-search-results {
|
||||
display: flex;
|
||||
|
||||
.adf-search-settings {
|
||||
width: 260px;
|
||||
border: 1px solid #eee;
|
||||
}
|
||||
|
||||
&__facets {
|
||||
margin: 5px;
|
||||
}
|
||||
|
||||
&__content {
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
div.search-results-container {
|
||||
padding: 0 20px 20px 20px;
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@
|
||||
import { Component, OnInit, Optional, ViewChild } from '@angular/core';
|
||||
import { Router, ActivatedRoute, Params } from '@angular/router';
|
||||
import { NodePaging, Pagination } from 'alfresco-js-api';
|
||||
import { SearchComponent } from '@alfresco/adf-content-services';
|
||||
import { SearchComponent, SearchQueryBuilderService } from '@alfresco/adf-content-services';
|
||||
import { UserPreferencesService } from '@alfresco/adf-core';
|
||||
|
||||
@Component({
|
||||
@@ -40,6 +40,7 @@ export class SearchResultComponent implements OnInit {
|
||||
|
||||
constructor(public router: Router,
|
||||
private preferences: UserPreferencesService,
|
||||
private queryBuilder: SearchQueryBuilderService,
|
||||
@Optional() private route: ActivatedRoute) {
|
||||
this.maxItems = this.preferences.paginationSize;
|
||||
}
|
||||
@@ -48,6 +49,8 @@ export class SearchResultComponent implements OnInit {
|
||||
if (this.route) {
|
||||
this.route.params.forEach((params: Params) => {
|
||||
this.searchedWord = params.hasOwnProperty(this.queryParamName) ? params[this.queryParamName] : null;
|
||||
this.queryBuilder.queryFragments['queryName'] = `cm:name:'${this.searchedWord}'`;
|
||||
this.queryBuilder.update();
|
||||
});
|
||||
}
|
||||
this.maxItems = this.preferences.paginationSize;
|
||||
@@ -59,8 +62,8 @@ export class SearchResultComponent implements OnInit {
|
||||
}
|
||||
|
||||
onRefreshPagination(pagination: Pagination) {
|
||||
this.maxItems = pagination.maxItems;
|
||||
this.skipCount = pagination.skipCount;
|
||||
this.maxItems = pagination.maxItems;
|
||||
this.skipCount = pagination.skipCount;
|
||||
}
|
||||
|
||||
onDeleteElementSuccess(element: any) {
|
||||
|
Reference in New Issue
Block a user