Collapse alert chart previews by default (#77479)
This commit is contained in:
parent
b162cca68d
commit
3c555e2ca2
|
@ -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';
|
||||
|
@ -44,7 +44,9 @@ export const Criteria: React.FC<Props> = ({
|
|||
<EuiFlexItem grow>
|
||||
{criteria.map((criterion, idx) => {
|
||||
return (
|
||||
<React.Fragment key={idx}>
|
||||
<EuiAccordion
|
||||
id={`criterion-${idx}`}
|
||||
buttonContent={
|
||||
<Criterion
|
||||
idx={idx}
|
||||
fields={fields}
|
||||
|
@ -54,13 +56,17 @@ export const Criteria: React.FC<Props> = ({
|
|||
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>
|
||||
|
|
|
@ -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}
|
||||
|
@ -202,7 +205,10 @@ export const Criterion: React.FC<Props> = ({
|
|||
? 'secondary'
|
||||
: 'danger'
|
||||
}
|
||||
onClick={() => setIsComparatorPopoverOpen(true)}
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
setIsComparatorPopoverOpen(true);
|
||||
}}
|
||||
/>
|
||||
}
|
||||
isOpen={isComparatorPopoverOpen}
|
||||
|
@ -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>
|
||||
)}
|
||||
|
|
Loading…
Reference in a new issue