[ACS-4130] Added autocomplete to folder rules 'Has Category' condition (#3464)

* [ACS-4130] Added autocomplete for 'Has Category' option in manage rules

* [ACS-4130] Added loading spinner and 'No options found' template for Has Category rule condition. Options are now fetched as soon as user selected 'Has Category' option

* [ACS-4130] Added code to fetch category name when viewing/editing existing rule with has category option selected

* [ACS-4130] Resolved issues related to editing existing rules with 'Has Category' condition

* [ACS-4130] Added safety checks and minor code refactoring

* [ACS-4130] Added unit tests for new autocomplete functionality

* [ACS-4130] Added feature to auto select first option from autocomplete dropdown when user focuses out of autocomplete input field

* [ACS-4130] Minor code refactoring. Moved constants from global scope to local scope

* [ACS-4130] Moved mock data to conditions.mock.ts. Removed redundant return type

* [ACS-4130] Resolved PR review comments - AutoCompleteOption is now an interface. Changed occurences of autocomplete with auto-complete. Removed/Added types

* [ACS-4130] Resolved PR review comments - AutoCompleteOption is now built using a single common helper method

* [ACS-4130] Added missed types
This commit is contained in:
swapnil-verma-gl
2023-10-11 18:00:44 +05:30
committed by GitHub
parent c7e2912759
commit ec18f6b9cb
7 changed files with 350 additions and 23 deletions

View File

@@ -37,12 +37,65 @@ export const mimeTypeMock: RuleSimpleCondition = {
parameter: ''
};
export const categoryMock: RuleSimpleCondition = {
field: 'category',
export const tagMock: RuleSimpleCondition = {
field: 'tag',
comparator: 'equals',
parameter: ''
};
export const categoriesListMock = {
list: {
pagination: {
count: 3,
hasMoreItems: false,
totalItems: 0,
skipCount: 0,
maxItems: 25
},
entries: [
{
entry: {
path: {
name: '/a/fake/category/path/1'
},
hasChildren: false,
name: 'FakeCategory1',
id: 'fake-category-id-1',
nodeType: 'cm:category',
isFile: false,
isFolder: false
}
},
{
entry: {
path: {
name: '/a/fake/category/path/2'
},
hasChildren: false,
name: 'FakeCategory2',
id: 'fake-category-id-2',
nodeType: 'cm:category',
isFile: false,
isFolder: false
}
},
{
entry: {
path: {
name: '/a/fake/category/path/3'
},
hasChildren: false,
name: 'FakeCategory3',
id: 'fake-category-id-3',
nodeType: 'cm:category',
isFile: false,
isFolder: false
}
}
]
}
};
export const simpleConditionUnknownFieldMock: RuleSimpleCondition = {
field: 'unknown-field',
comparator: 'equals',