mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[REPO-5552] more filtering capabilities for aspect/type api (#6713)
* [REPO-5552] more filtering capabilities for aspect/type api * * fix BC
This commit is contained in:
@@ -45,27 +45,35 @@ export class AspectListService {
|
||||
}
|
||||
|
||||
getStandardAspects(whiteList: string[]): Observable<AspectEntry[]> {
|
||||
const where = `(modelIds in ('cm:contentmodel', 'emailserver:emailserverModel', 'smf:smartFolder', 'app:applicationmodel' ))`;
|
||||
return from(this.alfrescoApiService.aspectsApi.listAspects({where}))
|
||||
.pipe(
|
||||
map((result: AspectPaging) => this.filterAspectByConfig(whiteList, result?.list?.entries)),
|
||||
catchError((error) => {
|
||||
this.logService.error(error);
|
||||
return of([]);
|
||||
})
|
||||
);
|
||||
const where = `(modelId in ('cm:contentmodel', 'emailserver:emailserverModel', 'smf:smartFolder', 'app:applicationmodel' ))`;
|
||||
const opts: any = {
|
||||
where,
|
||||
include: ['properties']
|
||||
};
|
||||
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
|
||||
.pipe(
|
||||
map((result: AspectPaging) => this.filterAspectByConfig(whiteList, result?.list?.entries)),
|
||||
catchError((error) => {
|
||||
this.logService.error(error);
|
||||
return of([]);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
getCustomAspects(): Observable<AspectEntry[]> {
|
||||
const where = `(not namespaceUri matches('http://www.alfresco.*'))`;
|
||||
return from(this.alfrescoApiService.aspectsApi.listAspects({where}))
|
||||
.pipe(
|
||||
map((result: AspectPaging) => result?.list?.entries),
|
||||
catchError((error) => {
|
||||
this.logService.error(error);
|
||||
return of([]);
|
||||
})
|
||||
);
|
||||
const opts: any = {
|
||||
where,
|
||||
include: ['properties']
|
||||
};
|
||||
return from(this.alfrescoApiService.aspectsApi.listAspects(opts))
|
||||
.pipe(
|
||||
map((result: AspectPaging) => result?.list?.entries),
|
||||
catchError((error) => {
|
||||
this.logService.error(error);
|
||||
return of([]);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
private filterAspectByConfig(visibleAspectList: string[], aspectEntries: AspectEntry[]): AspectEntry[] {
|
||||
|
@@ -38,7 +38,7 @@ export class ContentTypePropertiesService {
|
||||
pipe(
|
||||
map((contentType) => {
|
||||
const contentTypesOptions$ = this.getContentTypesAsSelectOption(contentType);
|
||||
const contentTypeCard = this.buildContentTypeSelectCardModel(contentType.entry.id, contentTypesOptions$);
|
||||
const contentTypeCard = this.buildContentTypeSelectCardModel(contentType.entry.id, contentTypesOptions$);
|
||||
return [contentTypeCard];
|
||||
}));
|
||||
}
|
||||
@@ -61,7 +61,7 @@ export class ContentTypePropertiesService {
|
||||
distinctUntilChanged(),
|
||||
map(([contentTypesEntries, currentContentType]) => {
|
||||
const updatedTypes = this.appendCurrentType(currentContentType, contentTypesEntries);
|
||||
return updatedTypes.map((contentType) => <CardViewSelectItemOption<string>> { key: contentType.entry.id, label: contentType.entry.title ?? contentType.entry.id});
|
||||
return updatedTypes.map((contentType) => <CardViewSelectItemOption<string>> { key: contentType.entry.id, label: contentType.entry.title ?? contentType.entry.id });
|
||||
}));
|
||||
}
|
||||
|
||||
|
@@ -58,7 +58,10 @@ describe('ContentTypeService', () => {
|
||||
expect(results).not.toBeNull();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].entry.id).toBe('fake-type-id');
|
||||
expect(mockTypesApi.listTypes).toHaveBeenCalledWith({ where: '(parentIds in (\'whatever-whenever\') and not namespaceUri matches(\'http://www.alfresco.org/model.*\'))' });
|
||||
expect(mockTypesApi.listTypes).toHaveBeenCalledWith({
|
||||
where: '(parentId in (\'whatever-whenever\') and not namespaceUri matches(\'http://www.alfresco.*\'))',
|
||||
include: [ 'properties']
|
||||
});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@@ -33,7 +33,11 @@ export class ContentTypeService {
|
||||
}
|
||||
|
||||
getContentTypeChildren(nodeType: string): Observable<TypeEntry[]> {
|
||||
const opts = {where : `(parentIds in ('${nodeType}') and not namespaceUri matches('http://www.alfresco.org/model.*'))`};
|
||||
const where = `(parentId in ('${nodeType}') and not namespaceUri matches('http://www.alfresco.*'))`;
|
||||
const opts: any = {
|
||||
where,
|
||||
include: ['properties']
|
||||
};
|
||||
return from(this.alfrescoApiService.typesApi.listTypes(opts)).pipe(
|
||||
map((result: TypePaging) => result.list.entries)
|
||||
);
|
||||
|
Reference in New Issue
Block a user