Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {useSendTestNotification} from 'sentry/views/automations/hooks';
import {findConflictingConditions} from 'sentry/views/automations/hooks/utils';

export default function AutomationBuilder() {
const {state, actions} = useAutomationBuilderContext();
const {state, actions, showTriggerLogicTypeSelector} = useAutomationBuilderContext();
const {mutationErrors} = useAutomationBuilderErrorContext();
const organization = useOrganization();
const api = useApi();
Expand All @@ -49,10 +49,9 @@ export default function AutomationBuilder() {
<Flex direction="column" gap="md">
<Step>
<StepLead>
{/* TODO: Only make this a selector of "all" is originally selected */}
{tct('[when:When] [selector] of the following occur', {
when: <ConditionBadge />,
selector: (
selector: showTriggerLogicTypeSelector ? (
<EmbeddedWrapper>
<EmbeddedSelectField
styles={{
Expand All @@ -76,6 +75,8 @@ export default function AutomationBuilder() {
size="xs"
/>
</EmbeddedWrapper>
) : (
t('any')
),
})}
</StepLead>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ interface AutomationActions {

export const AutomationBuilderContext = createContext<{
actions: AutomationActions;
// Selector is only shown for existing automations with the "All" logic type
showTriggerLogicTypeSelector: boolean;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment here might help

state: AutomationBuilderState;
} | null>(null);

Expand Down
10 changes: 9 additions & 1 deletion static/app/views/automations/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {useFormField} from 'sentry/components/workflowEngine/form/useFormField';
import {useWorkflowEngineFeatureGate} from 'sentry/components/workflowEngine/useWorkflowEngineFeatureGate';
import {t} from 'sentry/locale';
import type {Automation, NewAutomation} from 'sentry/types/workflowEngine/automations';
import {DataConditionGroupLogicType} from 'sentry/types/workflowEngine/dataConditions';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';
import {useParams} from 'sentry/utils/useParams';
Expand Down Expand Up @@ -176,7 +177,14 @@ function AutomationEditForm({automation}: {automation: Automation}) {
mutationErrors: error?.responseJSON,
}}
>
<AutomationBuilderContext.Provider value={{state, actions}}>
<AutomationBuilderContext.Provider
value={{
state,
actions,
showTriggerLogicTypeSelector:
state.triggers.logicType === DataConditionGroupLogicType.ALL,
}}
>
<AutomationForm model={model} />
</AutomationBuilderContext.Provider>
</AutomationBuilderErrorContext.Provider>
Expand Down
8 changes: 7 additions & 1 deletion static/app/views/automations/new-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,13 @@ export default function AutomationNewSettings() {
mutationErrors: error?.responseJSON,
}}
>
<AutomationBuilderContext.Provider value={{state, actions}}>
<AutomationBuilderContext.Provider
value={{
state,
actions,
showTriggerLogicTypeSelector: false,
}}
>
<AutomationForm model={model} />
</AutomationBuilderContext.Provider>
</AutomationBuilderErrorContext.Provider>
Expand Down
Loading