mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-12 17:04:46 +00:00
[ACS-3586] ACA/Folder Rules: Adding a rule to a Folder seems to break the Folder Rules UI (#2663)
* [ACS-3586] ACA/Folder Rules: Adding a rule to a Folder seems to break the Folder Rules UI * refactored condition statement * linter * parseSimpleCondition fn
This commit is contained in:
parent
dc215dc034
commit
1f0d590a84
@ -175,10 +175,21 @@ export class FolderRulesService {
|
|||||||
inverted: obj.inverted ?? false,
|
inverted: obj.inverted ?? false,
|
||||||
booleanMode: obj.booleanMode ?? 'and',
|
booleanMode: obj.booleanMode ?? 'and',
|
||||||
compositeConditions: (obj.compositeConditions || []).map((condition) => this.formatCompositeCondition(condition)),
|
compositeConditions: (obj.compositeConditions || []).map((condition) => this.formatCompositeCondition(condition)),
|
||||||
simpleConditions: (obj.simpleConditions || []).map((condition) => this.formatSimpleCondition(condition))
|
simpleConditions: this.parseSimpleCondition(obj.simpleConditions)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private parseSimpleCondition(arr) {
|
||||||
|
if (arr) {
|
||||||
|
if (arr.every((element) => element === null)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
return arr.map((condition) => this.formatSimpleCondition(condition));
|
||||||
|
} else {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private formatSimpleCondition(obj): RuleSimpleCondition {
|
private formatSimpleCondition(obj): RuleSimpleCondition {
|
||||||
return {
|
return {
|
||||||
field: obj.field || 'cm:name',
|
field: obj.field || 'cm:name',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user