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