Skip to content

Conversation

@ArchishmanSengupta
Copy link
Contributor

@ArchishmanSengupta ArchishmanSengupta commented Nov 5, 2025

Description & motivation 💭

Add "Contains" filter option to workflow search UI for substring matching in WorkflowId and WorkflowType fields.

Changes:

  • i18n/locales/en/common.ts: Add "contains" translation
  • utilities/is.ts: Add contains to operators/conditionals and isContains() helper
  • workflow/filter-bar/dropdown-filter-chip.svelte: Add CONTAINS to filter options and display logic
  • search-attribute-filter/text-filter.svelte: Add CONTAINS option to text filter dropdown
  • search-attribute-filter/filter-list.svelte: Add CONTAINS display support in filter chips
  • query/filter-workflow-query.ts: Add query generation logic for CONTAINS operator

Motivation:
Users need to search for workflows by substring matching, not just exact matches or prefix matching. Common use cases:

  • Workflow IDs contain identifiers in the middle: ai-agent-azure-ad-1, service-azure-ad-sync
  • Multiple workflows share a common substring: azure-ad, prod, us-east
  • Users only remember part of the workflow name

Current limitation: Only "Equals", "Not Equals", and "Starts With" are available.
Solution: Add "Contains" for substring matching anywhere in the value.

Related PRs:
This PR is part of a feature implementation across multiple repositories:

  1. sqlparser ([PR Link]): Add CONTAINS operator to SQL grammar
  2. Temporal Server (PR Link): Backend support for CONTAINS in visibility queries
  3. Temporal UI (this PR): Frontend filter UI for CONTAINS operator

All three PRs need to be merged together for the feature to work end-to-end.

Screenshots (if applicable) 📸

Screenshot 2025-11-05 at 10 11 10 PM

Example Usage:

  • Field: WorkflowId
  • Operator: Contains
  • Value: azure-ad
  • Generated Query: `WorkflowId` CONTAINS "azure-ad"
  • Results: Shows atom-agent-azure-ad-1, service-azure-ad-sync, azure-ad-integration-v2

Design Considerations 🎨

  • ✅ Follows existing pattern from "Starts With" implementation
  • ✅ Only shows for KEYWORD field types (WorkflowId, WorkflowType)
  • ✅ Consistent UI/UX with other filter operators
  • ✅ Filter chip displays "contains" in lowercase to match other operators

Testing 🧪

How was this tested 👻

  • Manual testing
  • E2E tests added (existing E2E test framework covers filter functionality)
  • Unit tests added (component tests would be ideal but not blocking)

Testing performed:

  • ✅ UI renders "Contains" option in filter dropdown for KEYWORD fields
  • ✅ Filter selection generates correct query syntax: `WorkflowId` CONTAINS "value"
  • ✅ Filter chips display "contains" label correctly
  • ✅ Works with both WorkflowId and WorkflowType filters
  • ✅ Integrated testing with local Temporal server
  • ✅ Verified with test data: searching for "azure-ad" returns 3 workflows containing that substring
  • ✅ Verified it doesn't appear for non-KEYWORD fields

Steps for others to test: 🚶🏽‍♂️🚶🏽‍♀️

Prerequisites:

  • Temporal server with CONTAINS support running (requires sqlparser + temporal server PRs)
  • Some test workflows with IDs containing common substrings

Test Steps:

  1. Navigate to Workflows page: http://localhost:3000/namespaces/default/workflows
  2. Click "+ Add Filter" button
  3. Select "WorkflowId" from field dropdown
  4. Click the operator dropdown - verify "Contains" appears in the list
  5. Select "Contains"
  6. Enter a substring that exists in some workflow IDs (e.g., "azure-ad")
  7. Verify:
    • Query bar shows: `WorkflowId` CONTAINS "azure-ad"
    • Results show only workflows containing that substring
    • Filter chip displays "WorkflowId contains "azure-ad""
  8. Try with "WorkflowType" field as well
  9. Test removal of the filter chip
  10. Test editing the filter value

Checklists

Draft Checklist

  • Code changes complete
  • Manually tested locally
  • Works with backend CONTAINS implementation
  • UI displays correctly
  • Filter generation works

Merge Checklist

  • sqlparser PR merged with CONTAINS operator
  • Temporal server PR merged with CONTAINS backend support
  • Code review complete
  • No linter errors
  • Translations added (en locale)

Docs

Any docs updates needed?

  • Update workflow filtering documentation to mention CONTAINS operator
  • Add to list of available filter operators in user guide
  • Include example use cases for substring matching

Note: UI change is mostly self-documenting through the interface, but documentation should be updated to inform users of the new filtering capability.

Documentation points:

  • CONTAINS operator available for WorkflowId and WorkflowType
  • Enables substring matching (not just prefix or exact match)
  • Example: WorkflowId CONTAINS "azure" finds workflows with "azure" anywhere in the ID

@vercel
Copy link

vercel bot commented Nov 5, 2025

@ArchishmanSengupta is attempting to deploy a commit to the Temporal Team on Vercel.

A member of the Team first needs to authorize it.

@ArchishmanSengupta
Copy link
Contributor Author

@Alex-Tideman @rossedfort can you please take a look at this? Happy to discuss more about the implementation details.

@Alex-Tideman
Copy link
Collaborator

Contains isn't supported for all visibility stores. We'll need to decide if we want to allow this for only certain dbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants