Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Alert details page] Correct spacing between components (#195208) #195402

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,24 +218,22 @@ export function AlertDetails() {
<EuiFlexGroup direction="column" gutterSize="m">
<SourceBar alert={alertDetail.formatted} sources={sources} />
<AlertDetailContextualInsights alert={alertDetail} />
{rule && alertDetail.formatted && (
<>
<AlertDetailsAppSection
alert={alertDetail.formatted}
rule={rule}
timeZone={timeZone}
setSources={setSources}
setRelatedAlertsKuery={setRelatedAlertsKuery}
/>
<AlertHistoryChart
alert={alertDetail.formatted}
rule={rule as unknown as CustomThresholdRule}
/>
</>
)}
</EuiFlexGroup>
<EuiSpacer size="m" />
{rule && alertDetail.formatted && (
<>
<AlertDetailsAppSection
alert={alertDetail.formatted}
rule={rule}
timeZone={timeZone}
setSources={setSources}
setRelatedAlertsKuery={setRelatedAlertsKuery}
/>
<EuiSpacer size="l" />
<AlertHistoryChart
alert={alertDetail.formatted}
rule={rule as unknown as CustomThresholdRule}
/>
</>
)}
</>
) : (
<EuiPanel hasShadow={false} data-test-subj="overviewTabPanel" paddingSize="none">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
* 2.0.
*/

import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';

import React, { useCallback } from 'react';
import { i18n } from '@kbn/i18n';
import { ALERT_RULE_PARAMETERS } from '@kbn/rule-data-utils';
Expand Down Expand Up @@ -88,21 +86,17 @@ export function AlertDetailContextualInsights({ alert }: { alert: AlertData | nu
}
}, [alert, http, observabilityAIAssistant]);

if (!ObservabilityAIAssistantContextualInsight) {
if (!ObservabilityAIAssistantContextualInsight || !getAlertContextMessages()) {
return null;
}

return (
<EuiFlexGroup direction="column" gutterSize="m">
<EuiFlexItem grow={false}>
<ObservabilityAIAssistantContextualInsight
title={i18n.translate(
'xpack.observability.alertDetailContextualInsights.InsightButtonLabel',
{ defaultMessage: 'Help me understand this alert' }
)}
messages={getAlertContextMessages}
/>
</EuiFlexItem>
</EuiFlexGroup>
<ObservabilityAIAssistantContextualInsight
title={i18n.translate(
'xpack.observability.alertDetailContextualInsights.InsightButtonLabel',
{ defaultMessage: 'Help me understand this alert' }
)}
messages={getAlertContextMessages}
/>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,31 @@ export function SourceBar({ alert, sources = [] }: SourceBarProps) {
}, [alertStart, alertEnd]);

return (
<>
{groups && groups.length > 0 && (
<EuiPanel data-test-subj="alert-summary-container" hasShadow={false} hasBorder={true}>
<EuiFlexGroup gutterSize="l" direction="row" wrap>
<EuiTitle size="xs">
<h5>
<FormattedMessage
id="xpack.observability.alertDetails.sourceBar.source"
defaultMessage="Source"
/>
</h5>
</EuiTitle>
<Groups
groups={groups}
timeRange={alertEnd ? timeRange : { ...timeRange, to: 'now' }}
/>
{sources.map((field, idx) => {
return (
<EuiFlexItem key={`sources-${idx}`} grow={false}>
<EuiText>
{field.label}: {field.value}
</EuiText>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
</EuiPanel>
)}
</>
groups &&
groups.length > 0 && (
<EuiPanel data-test-subj="alert-summary-container" hasShadow={false} hasBorder={true}>
<EuiFlexGroup gutterSize="l" direction="row" wrap>
<EuiTitle size="xs">
<h5>
<FormattedMessage
id="xpack.observability.alertDetails.sourceBar.source"
defaultMessage="Source"
/>
</h5>
</EuiTitle>
<Groups groups={groups} timeRange={alertEnd ? timeRange : { ...timeRange, to: 'now' }} />
{sources.map((field, idx) => {
return (
<EuiFlexItem key={`sources-${idx}`} grow={false}>
<EuiText>
{field.label}: {field.value}
</EuiText>
</EuiFlexItem>
);
})}
</EuiFlexGroup>
</EuiPanel>
)
);
}

Expand Down
Loading