diff --git a/desktop/src/features/workflows/ui/ChannelCombobox.tsx b/desktop/src/features/workflows/ui/ChannelCombobox.tsx index 50172eb4e..45a44b2f5 100644 --- a/desktop/src/features/workflows/ui/ChannelCombobox.tsx +++ b/desktop/src/features/workflows/ui/ChannelCombobox.tsx @@ -1,4 +1,4 @@ -import { Check, ChevronDown, Hash, Lock, Search } from "lucide-react"; +import { Asterisk, Check, ChevronDown, Hash, Lock, Search } from "lucide-react"; import * as React from "react"; import type { Channel } from "@/shared/api/types"; @@ -21,6 +21,7 @@ type ChannelComboboxProps = { id?: string; isChannelDisabled?: (channel: Channel) => boolean; onChange: (value: string) => void; + required?: boolean; variant?: "header" | "field"; value: string; }; @@ -34,6 +35,7 @@ export function ChannelCombobox({ id, isChannelDisabled, onChange, + required = false, variant = "header", value, }: ChannelComboboxProps) { @@ -107,6 +109,7 @@ export function ChannelCombobox({ - - {isExpanded ? ( -
- -
- ) : null} - - ); - })} - -
- + + Basic + + + Advanced + + - {activeEditor?.kind === "custom" ? ( -
-
- updateCustomEditor(event.target.value)} - placeholder='e.g. str_contains(trigger_text, "deploy")' - value={activeEditor.draft} - /> -

- Use an evalexpr expression with {evalexprFields}. + {editorMode === "basic" ? ( +

+ {editorState.custom ? ( +

+ An advanced expression is active. Choosing a basic filter will + replace it.

+ ) : null} +
+ {fields.map((field) => { + const editor = editorState.custom + ? undefined + : editorState.editors.find( + (candidate) => candidate.field === field.value, + ); + const isExpanded = activeEditor?.draft.field === field.value; + return ( +
+ + + {isExpanded && activeEditor ? ( +
+ +
+ ) : null} +
+ ); + })}
- ) : null} -
-
+ ) : ( +
+ + Expression + + updateCustomEditor(event.target.value)} + placeholder='e.g. str_contains(trigger_text, "deploy")' + value={advancedDraft} + /> +

+ Use an evalexpr expression with {evalexprFields}. +

+
+ )} + + + { + if (!open) setPendingBasicField(null); + }} + open={pendingBasicField !== null} + > + + + Replace advanced expression? + + Choosing a basic filter will replace the entire advanced + expression. This cannot be undone. + + + + + + + + + + + + + ); } diff --git a/desktop/src/features/workflows/ui/WorkflowDialog.tsx b/desktop/src/features/workflows/ui/WorkflowDialog.tsx index fcd29dcc4..5c9a76047 100644 --- a/desktop/src/features/workflows/ui/WorkflowDialog.tsx +++ b/desktop/src/features/workflows/ui/WorkflowDialog.tsx @@ -276,6 +276,7 @@ export function WorkflowDialog({ mutation.reset(); setSelectedChannelId(value); }} + required value={selectedChannelId} /> {channels.length === 0 ? (