diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx b/x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx index 0b08ca68dc6f7..0b81072d661ab 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx +++ b/x-pack/solutions/observability/plugins/streams_app/public/components/condition_editor/index.tsx @@ -7,6 +7,7 @@ import { EuiBadge, + EuiButton, EuiFieldText, EuiFlexGroup, EuiFlexItem, @@ -14,6 +15,7 @@ import { EuiSelect, EuiSwitch, EuiText, + EuiToolTip, } from '@elastic/eui'; import { AndCondition, @@ -32,9 +34,6 @@ export function ConditionEditor(props: { readonly?: boolean; onConditionChange?: (condition: Condition) => void; }) { - if (!props.condition) { - return null; - } if (props.readonly) { return ( @@ -67,7 +66,7 @@ export function ConditionForm(props: { }, [syntaxEditor, props.condition]); return ( - + + + props.onConditionChange(undefined)} + disabled={props.condition === undefined} + > + {i18n.translate('xpack.streams.conditionEditor.disable', { + defaultMessage: 'Disable routing', + })} + + + + ) : !props.condition || 'operator' in props.condition ? ( + ) : ( - props.condition && - ('operator' in props.condition ? ( - - ) : ( -
{JSON.stringify(props.condition, null, 2)}
- )) +
{JSON.stringify(props.condition, null, 2)}
)}
); @@ -213,7 +227,13 @@ function FilterForm(props: { export function ConditionDisplay(props: { condition: Condition }) { if (!props.condition) { - return null; + return ( + <> + {i18n.translate('xpack.streams.streamDetailRouting.noCondition', { + defaultMessage: 'No condition, no documents will be routed', + })} + + ); } return ( <> diff --git a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx b/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx index 5c9d5f0931585..2c848575eb570 100644 --- a/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx +++ b/x-pack/solutions/observability/plugins/streams_app/public/components/stream_detail_routing/index.tsx @@ -906,25 +906,16 @@ function RoutingStreamEntry({ })} />
- {child.condition && ( - { - onChildChange({ - ...child, - condition, - }); - }} - /> - )} - {!child.condition && ( - - {i18n.translate('xpack.streams.streamDetailRouting.noCondition', { - defaultMessage: 'No condition, no documents will be routed', - })} - - )} + { + onChildChange({ + ...child, + condition, + }); + }} + />
); } @@ -958,25 +949,16 @@ function NewRoutingStreamEntry({ }} /> - {child.condition && ( - { - onChildChange({ - ...child, - condition, - }); - }} - /> - )} - {!child.condition && ( - - {i18n.translate('xpack.streams.streamDetailRouting.noCondition', { - defaultMessage: 'No condition, no documents will be routed', - })} - - )} + { + onChildChange({ + ...child, + condition, + }); + }} + /> );