diff --git a/projects/aca-folder-rules/assets/i18n/en.json b/projects/aca-folder-rules/assets/i18n/en.json index c71a88751..34b394b9b 100644 --- a/projects/aca-folder-rules/assets/i18n/en.json +++ b/projects/aca-folder-rules/assets/i18n/en.json @@ -33,8 +33,8 @@ "OUTBOUND": "Items are deleted or leave this folder" }, "OPTIONS": { - "CASCADE": "Rule applies to subfolders", - "ASYNCHRONOUS": "Run rule in the background", + "IS_INHERITABLE": "Rule applies to subfolders", + "IS_ASYNCHRONOUS": "Run rule in the background", "DISABLE_RULE": "Disable rule", "ERROR_SCRIPT": "If errors occur run script", "SELECT_ACTION": "Select action" diff --git a/projects/aca-folder-rules/src/lib/mock/rules.mock.ts b/projects/aca-folder-rules/src/lib/mock/rules.mock.ts index 6fd4758ea..911545ed6 100644 --- a/projects/aca-folder-rules/src/lib/mock/rules.mock.ts +++ b/projects/aca-folder-rules/src/lib/mock/rules.mock.ts @@ -38,8 +38,8 @@ export const dummyResponse = { { entry: { isShared: false, - cascade: false, - asynchronous: false, + isInheritable: false, + isAsynchronous: false, name: 'rule1', id: 'd388ed54-a522-410f-a158-6dbf5a833731', triggers: ['inbound'], @@ -53,14 +53,14 @@ export const dummyResponse = { } } ], - enabled: true + isEnabled: true } }, { entry: { isShared: false, - cascade: false, - asynchronous: false, + isInheritable: false, + isAsynchronous: false, name: 'rule2', id: 'e0e645ca-e6c0-47d4-9936-1a8872a6c30b', triggers: ['inbound'], @@ -73,7 +73,7 @@ export const dummyResponse = { } } ], - enabled: true + isEnabled: true } } ] @@ -85,9 +85,9 @@ export const dummyRules: Rule[] = [ id: 'd388ed54-a522-410f-a158-6dbf5a833731', name: 'rule1', description: '', - enabled: true, - cascade: false, - asynchronous: false, + isEnabled: true, + isInheritable: false, + isAsynchronous: false, errorScript: '', isShared: false, triggers: ['inbound'], @@ -112,9 +112,9 @@ export const dummyRules: Rule[] = [ id: 'e0e645ca-e6c0-47d4-9936-1a8872a6c30b', name: 'rule2', description: '', - enabled: true, - cascade: false, - asynchronous: false, + isEnabled: true, + isInheritable: false, + isAsynchronous: false, errorScript: '', isShared: false, triggers: ['inbound'], diff --git a/projects/aca-folder-rules/src/lib/model/rule.model.ts b/projects/aca-folder-rules/src/lib/model/rule.model.ts index 532d43bc1..872f54585 100644 --- a/projects/aca-folder-rules/src/lib/model/rule.model.ts +++ b/projects/aca-folder-rules/src/lib/model/rule.model.ts @@ -32,9 +32,9 @@ export interface Rule { id: string; name: string; description: string; - enabled: boolean; - cascade: boolean; - asynchronous: boolean; + isEnabled: boolean; + isInheritable: boolean; + isAsynchronous: boolean; errorScript: string; isShared: boolean; triggers: RuleTrigger[]; diff --git a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html index 00c27ede7..c51c4a063 100644 --- a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html +++ b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.html @@ -1,10 +1,10 @@ <div class="options-list" [formGroup]="form"> <div class="options-list__asynchronous"> <mat-checkbox - formControlName="asynchronous" + formControlName="isAsynchronous" (change)="toggleScriptSelector()" [attr.data-automation-id]="'rule-option-checkbox-asynchronous'"> - {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.ASYNCHRONOUS' | translate }} + {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.IS_ASYNCHRONOUS' | translate }} </mat-checkbox> <div class="select-action" *ngIf="!preview"> <span>{{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.ERROR_SCRIPT' | translate}}:</span> @@ -19,14 +19,14 @@ </div> <div class="options-list__rest"> <mat-checkbox - formControlName="cascade" - [attr.data-automation-id]="'rule-option-checkbox-cascade'"> - {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.CASCADE' | translate }} + formControlName="isInheritable" + [attr.data-automation-id]="'rule-option-checkbox-inheritable'"> + {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.IS_INHERITABLE' | translate }} </mat-checkbox> <mat-checkbox [attr.data-automation-id]="'rule-option-checkbox-enabled'" - [checked]="!form.value.enabled" *ngIf="!preview" - (change)="form.get('enabled').setValue(!$event.checked)"> + [checked]="!form.value.isEnabled" *ngIf="!preview" + (change)="form.get('isEnabled').setValue(!$event.checked)"> {{ 'ACA_FOLDER_RULES.RULE_DETAILS.OPTIONS.DISABLE_RULE' | translate }} </mat-checkbox> </div> diff --git a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.spec.ts b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.spec.ts index dc282619d..4990e1157 100644 --- a/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.spec.ts +++ b/projects/aca-folder-rules/src/lib/rule-details/options/rule-options.ui-component.spec.ts @@ -56,9 +56,9 @@ describe('RuleOptionsUiComponent', () => { component = fixture.componentInstance; component.form = fb.group({ - asynchronous: [false], - cascade: [false], - enabled: [true], + isAsynchronous: [false], + isInheritable: [false], + isEnabled: [true], errorScript: [''] }); fixture.detectChanges(); @@ -68,7 +68,7 @@ describe('RuleOptionsUiComponent', () => { expect(component).toBeTruthy(); expect(getByDataAutomationId('rule-option-checkbox-asynchronous').componentInstance.checked).toBeFalsy(); - expect(getByDataAutomationId('rule-option-checkbox-cascade').componentInstance.checked).toBeFalsy(); + expect(getByDataAutomationId('rule-option-checkbox-inheritable').componentInstance.checked).toBeFalsy(); expect(getByDataAutomationId('rule-option-checkbox-enabled').componentInstance.checked).toBeFalsy(); expect(getByDataAutomationId('rule-option-select-errorScript').componentInstance.disabled).toBeTruthy(); }); @@ -87,7 +87,7 @@ describe('RuleOptionsUiComponent', () => { expect(getByDataAutomationId('rule-option-checkbox-asynchronous')).toBeTruthy(); expect(getByDataAutomationId('rule-option-checkbox-asynchronous')).toBeTruthy(); - expect(getByDataAutomationId('rule-option-checkbox-cascade')).toBeTruthy(); + expect(getByDataAutomationId('rule-option-checkbox-inheritable')).toBeTruthy(); expect(getByDataAutomationId('rule-option-checkbox-enabled')).toBeFalsy(); expect(getByDataAutomationId('rule-option-select-errorScript')).toBeFalsy(); }); diff --git a/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.spec.ts b/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.spec.ts index 4c68ed0e0..839aa249e 100644 --- a/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.spec.ts +++ b/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.spec.ts @@ -42,9 +42,9 @@ describe('RuleDetailsUiComponent', () => { name: 'Rule name', description: 'This is the description of the rule', triggers: ['update', 'outbound'], - asynchronous: true, - cascade: true, - enabled: true + isAsynchronous: true, + isInheritable: true, + isEnabled: true }; const getHtmlElement = <T>(dataAutomationId: string) => @@ -71,15 +71,15 @@ describe('RuleDetailsUiComponent', () => { const descriptionTextarea = getHtmlElement<HTMLTextAreaElement>('rule-details-description-textarea'); const ruleTriggersComponent = getComponentInstance<RuleTriggersUiComponent>('rule-details-triggers-component'); const ruleOptionAsynchronous = getComponentInstance<MatCheckbox>('rule-option-checkbox-asynchronous'); - const ruleOptionCascade = getComponentInstance<MatCheckbox>('rule-option-checkbox-cascade'); + const ruleOptionInheritable = getComponentInstance<MatCheckbox>('rule-option-checkbox-inheritable'); const ruleOptionDisabled = getComponentInstance<MatCheckbox>('rule-option-checkbox-enabled'); expect(nameInput.value).toBe(testValue.name); expect(descriptionTextarea.value).toBe(testValue.description); expect(ruleTriggersComponent.value).toEqual(testValue.triggers); - expect(ruleOptionAsynchronous.checked).toBe(testValue.asynchronous); - expect(ruleOptionCascade.checked).toBe(testValue.cascade); - expect(ruleOptionDisabled.checked).toBe(!testValue.enabled); + expect(ruleOptionAsynchronous.checked).toBe(testValue.isAsynchronous); + expect(ruleOptionInheritable.checked).toBe(testValue.isInheritable); + expect(ruleOptionDisabled.checked).toBe(!testValue.isEnabled); }); it('should modify the form if the value input property is modified', () => { @@ -107,14 +107,14 @@ describe('RuleDetailsUiComponent', () => { const descriptionTextarea = getHtmlElement<HTMLTextAreaElement>('rule-details-description-textarea'); const ruleTriggersComponent = getComponentInstance<RuleTriggersUiComponent>('rule-details-triggers-component'); const ruleOptionAsynchronous = getComponentInstance<MatCheckbox>('rule-option-checkbox-asynchronous'); - const ruleOptionCascade = getComponentInstance<MatCheckbox>('rule-option-checkbox-cascade'); + const ruleOptionInheritable = getComponentInstance<MatCheckbox>('rule-option-checkbox-inheritable'); const ruleOptionDisabled = getComponentInstance<MatCheckbox>('rule-option-checkbox-enabled'); expect(nameInput.disabled).toBeFalsy(); expect(descriptionTextarea.disabled).toBeFalsy(); expect(ruleTriggersComponent.readOnly).toBeFalsy(); expect(ruleOptionAsynchronous.disabled).toBeFalsy(); - expect(ruleOptionCascade.disabled).toBeFalsy(); + expect(ruleOptionInheritable.disabled).toBeFalsy(); expect(ruleOptionDisabled.disabled).toBeFalsy(); }); @@ -126,12 +126,12 @@ describe('RuleDetailsUiComponent', () => { const descriptionTextarea = getHtmlElement<HTMLTextAreaElement>('rule-details-description-textarea'); const ruleTriggersComponent = getComponentInstance<RuleTriggersUiComponent>('rule-details-triggers-component'); const ruleOptionAsynchronous = getComponentInstance<MatCheckbox>('rule-option-checkbox-asynchronous'); - const ruleOptionCascade = getComponentInstance<MatCheckbox>('rule-option-checkbox-cascade'); + const ruleOptionInheritable = getComponentInstance<MatCheckbox>('rule-option-checkbox-inheritable'); expect(nameInput.disabled).toBeTruthy(); expect(descriptionTextarea.disabled).toBeTruthy(); expect(ruleTriggersComponent.readOnly).toBeTruthy(); expect(ruleOptionAsynchronous.disabled).toBeTruthy(); - expect(ruleOptionCascade.disabled).toBeTruthy(); + expect(ruleOptionInheritable.disabled).toBeTruthy(); }); }); diff --git a/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.ts b/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.ts index bb66f40d9..7cd0db06d 100644 --- a/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.ts +++ b/projects/aca-folder-rules/src/lib/rule-details/rule-details.ui-component.ts @@ -65,10 +65,10 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy { description: newValue.description || FolderRulesService.emptyRule.description, triggers: newValue.triggers || FolderRulesService.emptyRule.triggers, conditions: newValue.conditions || FolderRulesService.emptyRule.conditions, - asynchronous: newValue.asynchronous || FolderRulesService.emptyRule.asynchronous, + isAsynchronous: newValue.isAsynchronous || FolderRulesService.emptyRule.isAsynchronous, errorScript: newValue.errorScript || FolderRulesService.emptyRule.errorScript, - cascade: newValue.cascade || FolderRulesService.emptyRule.cascade, - enabled: newValue.enabled || FolderRulesService.emptyRule.enabled + isInheritable: newValue.isInheritable || FolderRulesService.emptyRule.isInheritable, + isEnabled: newValue.isEnabled || FolderRulesService.emptyRule.isEnabled }; if (this.form) { this.form.setValue(newValue); @@ -99,17 +99,17 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy { get conditions(): UntypedFormControl { return this.form.get('conditions') as UntypedFormControl; } - get asynchronous(): UntypedFormControl { - return this.form.get('asynchronous') as UntypedFormControl; + get isAsynchronous(): UntypedFormControl { + return this.form.get('isAsynchronous') as UntypedFormControl; } get errorScript(): UntypedFormControl { return this.form.get('errorScript') as UntypedFormControl; } - get cascade(): UntypedFormControl { - return this.form.get('cascade') as UntypedFormControl; + get isInheritable(): UntypedFormControl { + return this.form.get('isInheritable') as UntypedFormControl; } - get enabled(): UntypedFormControl { - return this.form.get('enabled') as UntypedFormControl; + get isEnabled(): UntypedFormControl { + return this.form.get('isEnabled') as UntypedFormControl; } ngOnInit() { @@ -126,10 +126,10 @@ export class RuleDetailsUiComponent implements OnInit, OnDestroy { }, ruleCompositeConditionValidator() ), - asynchronous: new UntypedFormControl(this.value.asynchronous), + isAsynchronous: new UntypedFormControl(this.value.isAsynchronous), errorScript: new UntypedFormControl(this.value.errorScript), - cascade: new UntypedFormControl(this.value.cascade), - enabled: new UntypedFormControl(this.value.enabled) + isInheritable: new UntypedFormControl(this.value.isInheritable), + isEnabled: new UntypedFormControl(this.value.isEnabled) }); this.readOnly = this._readOnly; diff --git a/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.html b/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.html index 09650096f..fe3f5abf4 100644 --- a/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.html +++ b/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.html @@ -2,7 +2,7 @@ <div class="rule-info"> <div class="rule-info__header"> <span class="rule-info__header__title">{{rule.name}}</span> - <mat-slide-toggle [(ngModel)]="rule.enabled" (click)="onToggleClick(!rule.enabled)"></mat-slide-toggle> + <mat-slide-toggle [(ngModel)]="rule.isEnabled" (click)="onToggleClick(!rule.isEnabled)"></mat-slide-toggle> </div> <p>{{rule.description}}</p> </div> diff --git a/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.ts b/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.ts index 93a139f6a..9724cfebb 100644 --- a/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.ts +++ b/projects/aca-folder-rules/src/lib/rules-list/rule/rule-list-item.ui-component.ts @@ -39,7 +39,7 @@ export class RuleListItemUiComponent { constructor(private folderRulesService: FolderRulesService) {} - onToggleClick(enabled: boolean) { - this.folderRulesService.toggleRule(this.nodeId, this.rule.id, { ...this.rule, enabled }); + onToggleClick(isEnabled: boolean) { + this.folderRulesService.toggleRule(this.nodeId, this.rule.id, { ...this.rule, isEnabled }); } } diff --git a/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts b/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts index 59a95d87a..2bb47ccc2 100644 --- a/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts +++ b/projects/aca-folder-rules/src/lib/services/folder-rules.service.ts @@ -52,9 +52,9 @@ export class FolderRulesService { id: '', name: '', description: '', - enabled: true, - cascade: false, - asynchronous: false, + isEnabled: true, + isInheritable: false, + isAsynchronous: false, errorScript: '', isShared: false, triggers: ['inbound'], @@ -170,9 +170,9 @@ export class FolderRulesService { id: obj.id, name: obj.name ?? FolderRulesService.emptyRule.name, description: obj.description ?? FolderRulesService.emptyRule.description, - enabled: obj.enabled ?? FolderRulesService.emptyRule.enabled, - cascade: obj.cascade ?? FolderRulesService.emptyRule.cascade, - asynchronous: obj.asynchronous ?? FolderRulesService.emptyRule.asynchronous, + isEnabled: obj.isEnabled ?? FolderRulesService.emptyRule.isEnabled, + isInheritable: obj.isInheritable ?? FolderRulesService.emptyRule.isInheritable, + isAsynchronous: obj.isAsynchronous ?? FolderRulesService.emptyRule.isAsynchronous, errorScript: obj.errorScript ?? FolderRulesService.emptyRule.errorScript, isShared: obj.isShared ?? FolderRulesService.emptyRule.isShared, triggers: obj.triggers ?? FolderRulesService.emptyRule.triggers,