Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Signed-off-by: Jovan Cvetkovic <[email protected]>
  • Loading branch information
jovancvetkovic3006 committed Jun 22, 2023
1 parent 277506e commit 64aca92
Showing 1 changed file with 11 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ const ExpressionQuery = ({
...DEFAULT_EXPRESSION,
description: DEFAULT_CONDITION,
};
const EXPRESSION_CONDITIONS_MAP = [
{ description: '', label: '' },
{ description: 'AND', label: 'AND' },
{ description: 'OR', label: 'OR' },
{ description: 'NOT', label: 'NOT' },
];

const [usedExpressions, setUsedExpressions] = useState([DEFAULT_EXPRESSION]);
const [graphUi, setGraphUi] = useState(triggerValues.searchType === 'graph');
const [editorValue, setEditorValue] = useState('');
Expand Down Expand Up @@ -155,12 +162,7 @@ const ExpressionQuery = ({
]}
onChange={(selection) => changeCondition(selection, expression, idx, form)}
onBlur={() => onBlur(form, usedExpressions)}
options={[
{ description: '', label: '' },
{ description: 'AND', label: 'AND' },
{ description: 'OR', label: 'OR' },
{ description: 'NOT', label: 'NOT' },
]}
options={EXPRESSION_CONDITIONS_MAP}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>{renderMonitorOptions(expression, idx, form)}</EuiFlexItem>
Expand Down Expand Up @@ -218,9 +220,7 @@ const ExpressionQuery = ({
form={form}
rowProps={{
label: label,
isInvalid: () => {
return form.touched['expressionQueries'] && graphUi && !isValid();
},
isInvalid: () => form.touched['expressionQueries'] && graphUi && !isValid(),
error: () => graphUi && validate(),
style: {
maxWidth: 'inherit',
Expand Down Expand Up @@ -248,10 +248,7 @@ const ExpressionQuery = ({
description={expression.description}
value={expression.monitor_name}
isActive={!!selections?.length}
onClick={(e) => {
e.preventDefault();
openPopover(idx, form);
}}
onClick={(e) => openPopover(idx)}
/>
}
isOpen={expression.isOpen}
Expand Down Expand Up @@ -301,9 +298,7 @@ const ExpressionQuery = ({
_.set(triggerValues, 'triggerDefinitions[0].script.source', query);
form.setFieldValue('expressionQueries', query);
},
onBlur: (e, field, form) => {
form.setFieldTouched('expressionQueries', true);
},
onBlur: (e, field, form) => form.setFieldTouched('expressionQueries', true),
'data-test-subj': 'expressionQueriesCodeEditor',
}}
/>
Expand Down

0 comments on commit 64aca92

Please sign in to comment.