Skip to content

FE: Display event trigger details for event-based automations #88

@malhotra5

Description

@malhotra5

Summary

When viewing an automation detail page in the frontend, event-based automations do not display their event trigger configuration. The backend provides several fields for event triggers that the frontend does not currently render.

Backend Event Trigger Fields

The EventTrigger schema in automation/schemas.py includes the following fields:

Field Type Description
type "event" Trigger type identifier
source string Event source - "github" for built-in integration or custom webhook source name (e.g., "linear", "stripe")
on string | string[] Event key pattern(s) to match, e.g., "pull_request.opened", "push", "issue_comment.created", or ["pull_request.opened", "pull_request.synchronize"]
filter string | null Optional JMESPath filter expression evaluated against the raw payload, e.g., "icontains(comment.body, '@openhands')" or "repository.full_name == 'myorg/myrepo'"

Current Frontend State

The frontend AutomationTrigger interface in frontend/src/types/automation.ts only has:

export interface AutomationTrigger {
  type: string;
  schedule?: string;
  schedule_human?: string;
}

This is cron-specific and lacks the event trigger fields.

Current Display Issue

In ConfigurationSection.tsx, the trigger display logic shows:

  • Trigger type: "Schedule" for cron, otherwise just the raw type string ("event")
  • Schedule: Only displays schedule/schedule_human (cron-specific fields)

For event-based automations, users cannot see:

  1. What event source is being listened to (GitHub, Linear, custom webhook, etc.)
  2. What event types will trigger the automation
  3. What filter conditions are applied

Proposed Solution

1. Update TypeScript Types

Update AutomationTrigger interface to include event fields:

export interface AutomationTrigger {
  type: string;
  // Cron fields
  schedule?: string;
  schedule_human?: string;
  // Event fields
  source?: string;
  on?: string | string[];
  filter?: string | null;
}

2. Update ConfigurationSection Component

Add conditional rendering for event triggers in configuration-section.tsx:

For event triggers, display:

  • Source: Show the event source (e.g., "GitHub", "Linear", or custom webhook name)
  • Event(s): Show the event pattern(s) being listened to (e.g., pull_request.opened, push)
  • Filter: If present, show the filter expression (potentially with a code/monospace font since it's a JMESPath expression)

Example display for an event automation:

Field Value
Trigger Event
Source GitHub
Event(s) issue_comment.created
Filter icontains(comment.body, '@openhands')

3. Consider UX for Complex Values

  • For on field with multiple patterns (array), consider displaying as a comma-separated list or as individual badges/chips
  • For filter field, consider using a monospace font and potentially truncation with expand/tooltip for long expressions

Acceptance Criteria

  • Frontend types updated to include source, on, and filter fields in AutomationTrigger
  • ConfigurationSection renders event source when trigger type is "event"
  • ConfigurationSection renders event pattern(s) when trigger type is "event"
  • ConfigurationSection renders filter expression when present (with appropriate styling)
  • Hide schedule-specific fields when trigger type is "event"
  • Add appropriate i18n keys for new labels

References

  • Backend schema: automation/schemas.py (EventTrigger class, lines 57-173)
  • Frontend types: frontend/src/types/automation.ts
  • Frontend component: frontend/src/components/automations/detail/configuration-section.tsx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions