mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
[ACA-2077] viewer - filter recent files (#866)
* [ACA-2077] get filtered recent files from viewer * [ACA-2077] use same filters
This commit is contained in:
parent
9c5bc74fbe
commit
caa44b1fc2
@ -47,6 +47,8 @@ import { ContentApiService } from '../../services/content-api.service';
|
||||
import { AppExtensionService } from '../../extensions/extension.service';
|
||||
import { ContentManagementService } from '../../services/content-management.service';
|
||||
import { ContentActionRef, ViewerExtensionRef } from '@alfresco/adf-extensions';
|
||||
import { SearchRequest } from 'alfresco-js-api';
|
||||
import { AppDataService } from '../../services/data.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-preview',
|
||||
@ -79,6 +81,7 @@ export class PreviewComponent extends PageComponent
|
||||
constructor(
|
||||
private contentApi: ContentApiService,
|
||||
private preferences: UserPreferencesService,
|
||||
private appDataService: AppDataService,
|
||||
private route: ActivatedRoute,
|
||||
private router: Router,
|
||||
store: Store<AppStore>,
|
||||
@ -336,8 +339,7 @@ export class PreviewComponent extends PageComponent
|
||||
const sortingDirection =
|
||||
this.preferences.get('recent-files.sorting.direction') || 'desc';
|
||||
|
||||
const nodes = await this.contentApi
|
||||
.search({
|
||||
const query: SearchRequest = {
|
||||
query: {
|
||||
query: '*',
|
||||
language: 'afts'
|
||||
@ -346,10 +348,11 @@ export class PreviewComponent extends PageComponent
|
||||
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
||||
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
||||
{
|
||||
query: `TYPE:"content" AND -TYPE:"app:filelink" AND -TYPE:"fm:post"`
|
||||
query: this.appDataService.recentFileFilters.join(' AND ')
|
||||
}
|
||||
],
|
||||
fields: ['id', this.getRootField(sortingKey)],
|
||||
include: ['path', 'properties', 'allowableOperations'],
|
||||
sort: [
|
||||
{
|
||||
type: 'FIELD',
|
||||
@ -357,8 +360,8 @@ export class PreviewComponent extends PageComponent
|
||||
ascending: false
|
||||
}
|
||||
]
|
||||
})
|
||||
.toPromise();
|
||||
};
|
||||
const nodes = await this.contentApi.search(query).toPromise();
|
||||
|
||||
const entries = nodes.list.entries.map(obj => obj.entry);
|
||||
this.sort(entries, sortingKey, sortingDirection);
|
||||
|
@ -37,15 +37,7 @@ import { PersonEntry, SearchRequest, ResultSetPaging } from 'alfresco-js-api';
|
||||
providedIn: 'root'
|
||||
})
|
||||
export class AppDataService extends CustomResourcesService {
|
||||
constructor(private api: AlfrescoApiService, logService: LogService) {
|
||||
super(api, logService);
|
||||
}
|
||||
|
||||
getRecentFiles(
|
||||
personId: string,
|
||||
pagination: PaginationModel
|
||||
): Observable<ResultSetPaging> {
|
||||
const filters = [
|
||||
recentFileFilters = [
|
||||
'TYPE:"content"',
|
||||
'-PNAME:"0/wiki"',
|
||||
'-TYPE:"app:filelink"',
|
||||
@ -68,6 +60,14 @@ export class AppDataService extends CustomResourcesService {
|
||||
'-TYPE:"lnk:link"'
|
||||
];
|
||||
|
||||
constructor(private api: AlfrescoApiService, logService: LogService) {
|
||||
super(api, logService);
|
||||
}
|
||||
|
||||
getRecentFiles(
|
||||
personId: string,
|
||||
pagination: PaginationModel
|
||||
): Observable<ResultSetPaging> {
|
||||
return new Observable(observer => {
|
||||
this.api.peopleApi.getPerson(personId).then(
|
||||
(person: PersonEntry) => {
|
||||
@ -81,7 +81,7 @@ export class AppDataService extends CustomResourcesService {
|
||||
{ query: `cm:modified:[NOW/DAY-30DAYS TO NOW/DAY+1DAY]` },
|
||||
{ query: `cm:modifier:${username} OR cm:creator:${username}` },
|
||||
{
|
||||
query: filters.join(' AND ')
|
||||
query: this.recentFileFilters.join(' AND ')
|
||||
}
|
||||
],
|
||||
include: ['path', 'properties', 'allowableOperations'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user