diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
index 503d4fe57..0815a268b 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.html
@@ -164,10 +164,10 @@
}
@if (formGroup.get('type').value === WorkflowTriggerType.DocumentAdded || formGroup.get('type').value === WorkflowTriggerType.DocumentUpdated || formGroup.get('type').value === WorkflowTriggerType.Scheduled) {
- @if (patternRequired) {
+ @if (matchingPatternRequired(formGroup)) {
}
- @if (patternRequired) {
+ @if (matchingPatternRequired(formGroup)) {
}
}
@@ -188,12 +188,12 @@
Add condition
-
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
index 47d191e8a..740101993 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.spec.ts
@@ -12,7 +12,11 @@ import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'
import { NgSelectModule } from '@ng-select/ng-select'
import { of } from 'rxjs'
import { CustomFieldDataType } from 'src/app/data/custom-field'
-import { MATCHING_ALGORITHMS, MATCH_AUTO } from 'src/app/data/matching-model'
+import {
+ MATCHING_ALGORITHMS,
+ MATCH_AUTO,
+ MATCH_NONE,
+} from 'src/app/data/matching-model'
import { Workflow } from 'src/app/data/workflow'
import {
WorkflowAction,
@@ -376,6 +380,18 @@ describe('WorkflowEditDialogComponent', () => {
expect(component.objectForm.get('actions').value[0].webhook).toBeNull()
})
+ it('should require matching pattern when algorithm is not none', () => {
+ const triggerGroup = new FormGroup({
+ matching_algorithm: new FormControl(MATCH_AUTO),
+ match: new FormControl(''),
+ })
+ expect(component.matchingPatternRequired(triggerGroup)).toBe(true)
+ triggerGroup.get('matching_algorithm').setValue(MATCHING_ALGORITHMS[0].id)
+ expect(component.matchingPatternRequired(triggerGroup)).toBe(true)
+ triggerGroup.get('matching_algorithm').setValue(MATCH_NONE)
+ expect(component.matchingPatternRequired(triggerGroup)).toBe(false)
+ })
+
it('should map condition builder values into trigger filters on save', () => {
component.object = undefined
component.addTrigger()
diff --git a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
index fa66f97a4..44705b2f6 100644
--- a/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
+++ b/src-ui/src/app/components/common/edit-dialog/workflow-edit-dialog/workflow-edit-dialog.component.ts
@@ -587,6 +587,10 @@ export class WorkflowEditDialogComponent
return formValues
}
+ public matchingPatternRequired(formGroup: FormGroup): boolean {
+ return formGroup.get('matching_algorithm').value !== MATCH_NONE
+ }
+
private createConditionFormGroup(
type: TriggerConditionType,
initialValue?: number | number[]