Skip to content

Commit

Permalink
improve graph visualization in create alert flyout
Browse files Browse the repository at this point in the history
  • Loading branch information
andreadelrio committed Mar 5, 2020
1 parent 6b77c88 commit 42e5be4
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 14 deletions.
3 changes: 2 additions & 1 deletion x-pack/legacy/plugins/triggers_actions_ui/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
// Styling within the app
@import '../../../../plugins/triggers_actions_ui/public/application/sections/actions_connectors_list/components/index';

@import '../../../../plugins/triggers_actions_ui/public/application/sections/action_connector_form/index';
@import '../../../../plugins/triggers_actions_ui/public/application/sections/alert_add/index';

@import '../../../../plugins/triggers_actions_ui/public/application/sections/action_connector_form/index';
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import {
EuiComboBoxOptionProps,
EuiFormRow,
EuiCallOut,
EuiEmptyPrompt,
EuiText,
} from '@elastic/eui';
import { COMPARATORS, builtInComparators } from '../../../../common/constants';
import {
Expand Down Expand Up @@ -435,6 +437,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
thresholdComparator={thresholdComparator ?? DEFAULT_VALUES.THRESHOLD_COMPARATOR}
threshold={threshold}
errors={errors}
popupPosition={'upLeft'}
onChangeSelectedThreshold={selectedThresholds =>
setAlertParams('threshold', selectedThresholds)
}
Expand All @@ -445,6 +448,7 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
</EuiFlexItem>
<EuiFlexItem grow={false}>
<ForLastExpression
popupPosition={'upLeft'}
timeWindowSize={timeWindowSize || 1}
timeWindowUnit={timeWindowUnit || ''}
errors={errors}
Expand All @@ -457,16 +461,34 @@ export const IndexThresholdAlertTypeExpression: React.FunctionComponent<IndexThr
/>
</EuiFlexItem>
</EuiFlexGroup>
{canShowVizualization ? null : (
<Fragment>
<ThresholdVisualization
alertParams={alertParams}
aggregationTypes={builtInAggregationTypes}
comparators={builtInComparators}
alertsContext={alertsContext}
/>
</Fragment>
)}
<EuiSpacer size="l" />
<div className="alertVisualizationChart">
{canShowVizualization ? (
<div>
<EuiSpacer size="xl" />
<EuiEmptyPrompt
iconType="visBarVertical"
body={
<EuiText color="subdued">
<FormattedMessage
id="xpack.triggersActionsUI.sections.alertAdd.loadingAlertVisualizationDescription"
defaultMessage="Preview alert visualization here"
/>
</EuiText>
}
/>
</div>
) : (
<Fragment>
<ThresholdVisualization
alertParams={alertParams}
aggregationTypes={builtInAggregationTypes}
comparators={builtInComparators}
alertsContext={alertsContext}
/>
</Fragment>
)}
</div>
</Fragment>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
const aggLabel = aggregationTypes[aggType].text;
return (
<div data-test-subj="alertVisualizationChart">
<EuiSpacer size="l" />
{alertVisualizationDataKeys.length ? (
<Chart size={['100%', 200]} renderer="canvas">
<Settings
Expand Down Expand Up @@ -309,7 +308,6 @@ export const ThresholdVisualization: React.FunctionComponent<Props> = ({
/>
</EuiCallOut>
)}
<EuiSpacer size="l" />
</div>
);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import 'alert_add';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.alertVisualizationChart {
height: $euiSize * 15;
}
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,6 @@ export const AlertForm = ({
alertsContext={alertsContext}
/>
) : null}
<EuiSpacer size="xl" />
{selectedGroupActions}
{isAddActionPanelOpen ? (
<Fragment>
Expand Down

0 comments on commit 42e5be4

Please sign in to comment.