mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +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:
parent
f89833461c
commit
46a179c75a
@ -10,6 +10,7 @@ In this tutorial, we are going to implement the following features:
|
|||||||
- [Add a new search form](#add-a-new-search-form)
|
- [Add a new search form](#add-a-new-search-form)
|
||||||
- [Replace a search form](#replace-a-search-form)
|
- [Replace a search form](#replace-a-search-form)
|
||||||
- [Replace default search](#replace-default-search)
|
- [Replace default search](#replace-default-search)
|
||||||
|
- [Adding rule to search form](#adding-rule-to-search-form)
|
||||||
|
|
||||||
### Extension Properties
|
### Extension Properties
|
||||||
|
|
||||||
@ -80,3 +81,23 @@ To replace the default search with your configuration set to true the default fi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
### Adding rule to search form
|
||||||
|
|
||||||
|
It support the visible rule to show the configuration
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"features": {
|
||||||
|
"search": [
|
||||||
|
{
|
||||||
|
"id": "app.search.custom_search",
|
||||||
|
"order": 200,
|
||||||
|
"name": "APP.SEARCH.MY_CUSTOM_SEARCH",
|
||||||
|
"rules": {
|
||||||
|
"visible": "<name of the rule>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
@ -684,7 +684,7 @@
|
|||||||
"description": "Element rules",
|
"description": "Element rules",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"disabled": {
|
"visible": {
|
||||||
"description": "Rule to evaluate the visibility state",
|
"description": "Rule to evaluate the visibility state",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
|
2
package-lock.json
generated
2
package-lock.json
generated
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "alfresco-content-app",
|
"name": "alfresco-content-app",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "alfresco-content-app",
|
"name": "alfresco-content-app",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"commit": "",
|
"commit": "",
|
||||||
"license": "LGPL-3.0",
|
"license": "LGPL-3.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alfresco/aca-about",
|
"name": "@alfresco/aca-about",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^10.0.14",
|
"@angular/common": "^10.0.14",
|
||||||
"@angular/core": "^10.0.14"
|
"@angular/core": "^10.0.14"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alfresco/aca-settings",
|
"name": "@alfresco/aca-settings",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@angular/common": "^10.0.14",
|
"@angular/common": "^10.0.14",
|
||||||
"@angular/core": "^10.0.14"
|
"@angular/core": "^10.0.14"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alfresco/aca-shared",
|
"name": "@alfresco/aca-shared",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
},
|
},
|
||||||
|
@ -888,6 +888,11 @@ describe('AppExtensionService', () => {
|
|||||||
|
|
||||||
describe('search', () => {
|
describe('search', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
extensions.setEvaluators({
|
||||||
|
visible: () => true,
|
||||||
|
notVisible: () => false
|
||||||
|
});
|
||||||
|
|
||||||
applyConfig({
|
applyConfig({
|
||||||
$id: 'test',
|
$id: 'test',
|
||||||
$name: 'test',
|
$name: 'test',
|
||||||
@ -916,14 +921,25 @@ describe('AppExtensionService', () => {
|
|||||||
{
|
{
|
||||||
id: 'app.search-1',
|
id: 'app.search-1',
|
||||||
order: 200,
|
order: 200,
|
||||||
name: 'default',
|
name: 'search extension 1',
|
||||||
|
rules: {
|
||||||
|
visible: 'visible'
|
||||||
|
},
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'app.search-2',
|
id: 'app.search-2',
|
||||||
order: 200,
|
order: 200,
|
||||||
name: 'default',
|
name: 'search extension 2',
|
||||||
disabled: true
|
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', () => {
|
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');
|
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', () => {
|
describe('rule disable', () => {
|
||||||
|
@ -295,7 +295,10 @@ export class AppExtensionService implements RuleContext {
|
|||||||
return null;
|
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 {
|
try {
|
||||||
this.appConfig.config['search'] = search;
|
this.appConfig.config['search'] = search;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "aca-testing-shared",
|
"name": "aca-testing-shared",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"main": "src/index.ts",
|
"main": "src/index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"tslib": "^2.0.0"
|
"tslib": "^2.0.0"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@alfresco/adf-office-services-ext",
|
"name": "@alfresco/adf-office-services-ext",
|
||||||
"version": "2.6.0",
|
"version": "2.6.1",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"homepage": "https://github.com/Alfresco/alfresco-content-app",
|
"homepage": "https://github.com/Alfresco/alfresco-content-app",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
|
Loading…
x
Reference in New Issue
Block a user