Skip to content

Commit

Permalink
[FEATURE] Add composite monitor type opensearch-project#573
Browse files Browse the repository at this point in the history
Signed-off-by: Jovan Cvetkovic <[email protected]>
  • Loading branch information
jovancvetkovic3006 committed Jun 16, 2023
1 parent 83d6eb6 commit 567db1d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const ExpressionQuery = ({
value,
defaultText,
label,
name = 'expressionQueries',
triggerValues,
formikName = 'expressionQueries',
}) => {
const DEFAULT_DESCRIPTION = defaultText ? defaultText : 'Select';
const OPERATORS = ['AND', 'OR', 'NOT'];
Expand Down Expand Up @@ -79,7 +78,7 @@ const ExpressionQuery = ({

const onBlur = (form, expressions) => {
form.setFieldTouched('expressionQueries', true);
form.setFieldValue('triggerDefinitions[0].triggerConditions', getValue(expressions));
form.setFieldValue(formikName, getValue(expressions));
form.setFieldError('expressionQueries', validate());
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export function formikToDocumentLevelTriggerCondition(values, monitorUiMetadata)
};
}

export function formikToCompositeTriggerCondition(values, monitorUiMetadata) {
export function formikToCompositeTriggerCondition(values) {
const conditionMap = {
and: '&&',
or: '||',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import _ from 'lodash';
import { EuiSpacer, EuiText } from '@elastic/eui';
import { FormikFieldText, FormikSelect } from '../../../../components/FormControls';
import { hasError, isInvalid } from '../../../../utils/validate';
import { DEFAULT_TRIGGER_NAME, SEVERITY_OPTIONS } from '../../utils/constants';
import { SEVERITY_OPTIONS } from '../../utils/constants';
import ExpressionQuery from '../../components/ExpressionQuery/ExpressionQuery';
import TriggerNotifications from './TriggerNotifications';
import ContentPanel from '../../../../components/ContentPanel';
Expand Down Expand Up @@ -123,7 +123,7 @@ class DefineCompositeLevelTrigger extends Component {
<EuiSpacer size={'l'} />

<ExpressionQuery
name={`${fieldPath}triggerConditions`}
formikName={`${fieldPath}triggerConditions`}
label={titleTemplate(
'Trigger condition',
'An alert will trigger when the following monitors generate active alerts.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const TriggerNotificationsContent = ({
});
};

const showConfig = (channels) => setIsModalVisible(true);
const showConfig = () => setIsModalVisible(true);

return (
<Fragment>
Expand Down

0 comments on commit 567db1d

Please sign in to comment.