feat(chaining): event creation drawer (#6297)#6312
Conversation
There was a problem hiding this comment.
⚠️ Not ready to approve
There are blocking frontend issues (type-check/runtime compatibility) and a save-path logic mismatch where operator selections can be ignored or misapplied.
Pull request overview
Adds an “Event” creation/edit drawer to the chaining logic UI, including trigger-condition group building with drag & drop, and updates the logic flow graph to open the event drawer when editing an event node.
Changes:
- Introduces new event form types + UI components (drawer, condition groups, operator selector, condition rows).
- Updates chaining logic flow to support editing events and to reconstruct event condition groups from the API response.
- Extends i18n locale JSON files with new event/condition-related strings.
File summaries
| File | Description |
|---|---|
| openaev-front/src/utils/lang/zh.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/ru.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/ko.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/ja.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/it.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/fr.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/es.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/en.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/utils/lang/de.json | Adds new i18n keys for event creation/editing and condition builder UI. |
| openaev-front/src/admin/components/chaining/logic/types.ts | Refactors EventMeta to store eventId + structured EventFormData. |
| openaev-front/src/admin/components/chaining/logic/Logic.tsx | Adds editing state and wiring for editing an event from the flow. |
| openaev-front/src/admin/components/chaining/logic/logic-flow-helpers.ts | Reconstructs nested condition groups from API condition nodes when building event metas/nodes. |
| openaev-front/src/admin/components/chaining/logic/events/LogicalOperatorSelect.tsx | New AND/OR selector used between groups and within group headers. |
| openaev-front/src/admin/components/chaining/logic/events/EventCreationForm.tsx | New RHF/Zod-backed event form with group builder + DnD between groups. |
| openaev-front/src/admin/components/chaining/logic/events/EventConditionRow.tsx | New condition row editor (field/operator/value + case sensitivity + delete). |
| openaev-front/src/admin/components/chaining/logic/events/event-types.ts | New event form types, validation helpers, and API conversion helpers. |
| openaev-front/src/admin/components/chaining/logic/events/ConfigureEventDetail.tsx | New drawer wrapper around the event creation/edit form. |
| openaev-front/src/admin/components/chaining/logic/events/ConditionGroupBuilder.tsx | New condition-group component (operator + add/delete condition + droppable list). |
| openaev-front/src/admin/components/chaining/logic/chaining_flow/LogicFlow.tsx | Enables editing events via node edit action and stores event metas for edit. |
| openaev-front/src/admin/components/chaining/logic/chaining_flow/ChainingFlowConfiguration.tsx | Adds event drawer view and implements create/update event calls (via conditions endpoints). |
Copilot's findings
- Files reviewed: 20/20 changed files
- Comments generated: 8
Note
Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.
| export const OPERATOR_LABELS: Record<ComparisonOperator, string> = { | ||
| EQ: 'Equals', | ||
| NEQ: 'Not equals', | ||
| IS_NULL: 'IsNull', | ||
| IS_NOT_NULL: 'IsNotNull', | ||
| GT: 'Greater than', | ||
| GTE: 'Greater than or equals', | ||
| LT: 'Less than', | ||
| LTE: 'Less than or equals', | ||
| IN: 'Contains', | ||
| NIN: 'Not contains', | ||
| }; |
| export const createEmptyCondition = (): EventCondition => ({ | ||
| id: crypto.randomUUID(), | ||
| field: 'text', | ||
| operator: 'IN', | ||
| value: '', | ||
| caseSensitive: true, | ||
| }); | ||
|
|
||
| export const createEmptyGroup = (operator: LogicalOperator = 'AND'): ConditionGroup => ({ | ||
| id: crypto.randomUUID(), | ||
| operator, | ||
| conditions: [createEmptyCondition()], | ||
| subGroups: [], | ||
| }); |
| // Multiple groups → emit a root logical node that wraps them all | ||
| const rootTempId = nextTempId(); | ||
| result.push({ | ||
| condition_temporary_id: rootTempId, | ||
| condition_type: groupOperators[0] ?? 'AND', | ||
| }); | ||
|
|
||
| groups.forEach(group => processGroup(group, rootTempId)); |
| // Remove any top-level group that became empty after the drag | ||
| const nonEmptyIndices: number[] = []; | ||
| const cleaned = next.filter((g, i) => { | ||
| const keep = g.conditions.length > 0 || g.subGroups.length > 0; | ||
| if (keep) nonEmptyIndices.push(i); | ||
| return keep; | ||
| }); | ||
|
|
||
| // Keep only the operators between groups that both survived | ||
| setConditionGroups(cleaned.length > 0 ? cleaned : next); | ||
| if (cleaned.length < next.length) { | ||
| setGroupOperators(prev => prev.filter((_, i) => nonEmptyIndices.includes(i))); | ||
| } | ||
| }, [conditionGroups]); |
| "Event added successfully.": "Event added successfully.", | ||
| "Event conditions are based on data produced by Actions. To access more options in the \"Field to inspect\", consider adding additional.": "Event conditions are based on data produced by Actions. To access more options in the \"Field to inspect\", consider adding additional.", |
| handleCloseAll(); | ||
| onStepCreated(); | ||
| } catch { | ||
| MESSAGING$.notifyError(t('Failed to create event.')); | ||
| } |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #6312 +/- ##
============================================
- Coverage 43.93% 43.75% -0.18%
- Complexity 7204 7208 +4
============================================
Files 2282 2289 +7
Lines 62906 63184 +278
Branches 8344 8420 +76
============================================
+ Hits 27639 27648 +9
- Misses 33509 33776 +267
- Partials 1758 1760 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
91efe6f to
367b4df
Compare
1953d1a to
0d85733
Compare
|
Tested OK! |
Proposed changes
Testing Instructions
return <Logic workflowId={exercise?.exercise_workflow_id} context="simulation" />;Related issues
Checklist
Further comments
If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...