Skip to content

Commit

Permalink
Merge branch 'master' of github.com:elastic/kibana into apm-servicema…
Browse files Browse the repository at this point in the history
…p-test
  • Loading branch information
cauemarcondes committed Sep 16, 2020
2 parents 21b6eb8 + 53a2175 commit 7a9214a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import React from 'react';
import { EuiFlexItem, EuiFlexGroup } from '@elastic/eui';
import { EuiFlexItem, EuiFlexGroup, EuiAccordion } from '@elastic/eui';
import { IFieldType } from 'src/plugins/data/public';
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
import { IErrorObject } from '../../../../../../triggers_actions_ui/public/types';
Expand Down Expand Up @@ -44,23 +44,29 @@ export const Criteria: React.FC<Props> = ({
<EuiFlexItem grow>
{criteria.map((criterion, idx) => {
return (
<React.Fragment key={idx}>
<Criterion
idx={idx}
fields={fields}
criterion={criterion}
updateCriterion={updateCriterion}
removeCriterion={removeCriterion}
canDelete={criteria.length > 1}
errors={errors[idx.toString()] as IErrorObject}
/>
<EuiAccordion
id={`criterion-${idx}`}
buttonContent={
<Criterion
idx={idx}
fields={fields}
criterion={criterion}
updateCriterion={updateCriterion}
removeCriterion={removeCriterion}
canDelete={criteria.length > 1}
errors={errors[idx.toString()] as IErrorObject}
/>
}
key={idx}
arrowDisplay="right"
>
<CriterionPreview
alertParams={alertParams}
context={context}
chartCriterion={criterion}
sourceId={sourceId}
/>
</React.Fragment>
</EuiAccordion>
);
})}
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ export const Criterion: React.FC<Props> = ({
value={criterion.field}
isActive={isFieldPopoverOpen}
color={errors.field.length === 0 ? 'secondary' : 'danger'}
onClick={() => setIsFieldPopoverOpen(true)}
onClick={(e) => {
e.stopPropagation();
setIsFieldPopoverOpen(true);
}}
/>
}
isOpen={isFieldPopoverOpen}
Expand Down Expand Up @@ -202,7 +205,10 @@ export const Criterion: React.FC<Props> = ({
? 'secondary'
: 'danger'
}
onClick={() => setIsComparatorPopoverOpen(true)}
onClick={(e) => {
e.stopPropagation();
setIsComparatorPopoverOpen(true);
}}
/>
}
isOpen={isComparatorPopoverOpen}
Expand Down Expand Up @@ -260,7 +266,10 @@ export const Criterion: React.FC<Props> = ({
})}
color={'danger'}
iconType={'trash'}
onClick={() => removeCriterion(idx)}
onClick={(e: React.MouseEvent) => {
e.stopPropagation();
removeCriterion(idx);
}}
/>
</EuiFlexItem>
)}
Expand Down

0 comments on commit 7a9214a

Please sign in to comment.