mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-24 17:31:52 +00:00
[MNT-22574] Conditional AI Search (#2339)
* [MNT-22574] Support rules for search forms * * fix lints * Patch version increment Co-authored-by: dhrn <dharan.g@muraai.com>
This commit is contained in:
@@ -888,6 +888,11 @@ describe('AppExtensionService', () => {
|
||||
|
||||
describe('search', () => {
|
||||
beforeEach(() => {
|
||||
extensions.setEvaluators({
|
||||
visible: () => true,
|
||||
notVisible: () => false
|
||||
});
|
||||
|
||||
applyConfig({
|
||||
$id: 'test',
|
||||
$name: 'test',
|
||||
@@ -916,14 +921,25 @@ describe('AppExtensionService', () => {
|
||||
{
|
||||
id: 'app.search-1',
|
||||
order: 200,
|
||||
name: 'default',
|
||||
name: 'search extension 1',
|
||||
rules: {
|
||||
visible: 'visible'
|
||||
},
|
||||
default: false
|
||||
},
|
||||
{
|
||||
id: 'app.search-2',
|
||||
order: 200,
|
||||
name: 'default',
|
||||
name: 'search extension 2',
|
||||
disabled: true
|
||||
},
|
||||
{
|
||||
id: 'app.search-3',
|
||||
order: 300,
|
||||
name: 'search extension 3',
|
||||
rules: {
|
||||
visible: 'notVisible'
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -939,6 +955,10 @@ describe('AppExtensionService', () => {
|
||||
it('should not load the disabled search extension', () => {
|
||||
expect(service.search.find(({ id }) => id === 'app.search-2')).toBe(undefined, 'disabled configuration shown in the result');
|
||||
});
|
||||
|
||||
it('should not load the not visible search extension', () => {
|
||||
expect(service.search.find(({ id }) => id === 'app.search-3')).toBe(undefined, 'not visible configuration shown in the result');
|
||||
});
|
||||
});
|
||||
|
||||
describe('rule disable', () => {
|
||||
|
@@ -295,7 +295,10 @@ export class AppExtensionService implements RuleContext {
|
||||
return null;
|
||||
}
|
||||
|
||||
const search = mergeArrays([], elements).filter((entry) => !entry.disabled);
|
||||
const search = mergeArrays([], elements)
|
||||
.filter((entry) => !entry.disabled)
|
||||
.filter((entry) => this.filterVisible(entry))
|
||||
.sort(sortByOrder);
|
||||
|
||||
try {
|
||||
this.appConfig.config['search'] = search;
|
||||
|
Reference in New Issue
Block a user