Skip to content

Commit

Permalink
[RAM] SRE Alert feedbacks (elastic#175939)
Browse files Browse the repository at this point in the history
## Summary

- [x] In rule details page default tabs to the Alert tabs instead of the
execution history
 - [x] Default alert search bar to see the last 24 hours alerts
  • Loading branch information
XavierM authored Jan 31, 2024
1 parent 53c3907 commit 9a72723
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface AlertSearchBarStateTransitions {
}

const defaultState: AlertSearchBarContainerState = {
rangeFrom: 'now-2h',
rangeFrom: 'now-24h',
rangeTo: 'now',
kuery: '',
status: ALL_ALERTS.status,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React from 'react';
import { TIMESTAMP } from '@kbn/rule-data-utils';
import { ALERT_START } from '@kbn/rule-data-utils';
import { SortOrder } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import {
AlertsTableConfigurationRegistry,
Expand Down Expand Up @@ -35,7 +35,7 @@ export const getRuleDetailsTableConfiguration = (
}),
sort: [
{
[TIMESTAMP]: {
[ALERT_START]: {
order: 'desc' as SortOrder,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,6 @@ export function RuleDetailsTabs({
]);

const tabs: EuiTabbedContentTab[] = [
{
id: RULE_DETAILS_EXECUTION_TAB,
name: i18n.translate('xpack.observability.ruleDetails.rule.eventLogTabText', {
defaultMessage: 'Execution history',
}),
'data-test-subj': 'eventLogListTab',
content: (
<EuiFlexGroup style={{ minHeight: 600 }} direction={'column'}>
<EuiFlexItem>
{rule && ruleType ? <RuleEventLogList ruleId={rule.id} ruleType={ruleType} /> : null}
</EuiFlexItem>
</EuiFlexGroup>
),
},
{
id: RULE_DETAILS_ALERTS_TAB,
name: i18n.translate('xpack.observability.ruleDetails.rule.alertsTabText', {
Expand Down Expand Up @@ -117,6 +103,20 @@ export function RuleDetailsTabs({
</>
),
},
{
id: RULE_DETAILS_EXECUTION_TAB,
name: i18n.translate('xpack.observability.ruleDetails.rule.eventLogTabText', {
defaultMessage: 'Execution history',
}),
'data-test-subj': 'eventLogListTab',
content: (
<EuiFlexGroup style={{ minHeight: 600 }} direction={'column'}>
<EuiFlexItem>
{rule && ruleType ? <RuleEventLogList ruleId={rule.id} ruleType={ruleType} /> : null}
</EuiFlexItem>
</EuiFlexGroup>
),
},
];

const handleTabIdChange = (newTabId: TabId) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function RuleDetailsPage() {

return urlTabId && [RULE_DETAILS_EXECUTION_TAB, RULE_DETAILS_ALERTS_TAB].includes(urlTabId)
? (urlTabId as TabId)
: RULE_DETAILS_EXECUTION_TAB;
: RULE_DETAILS_ALERTS_TAB;
});

const [esQuery, setEsQuery] = useState<{ bool: BoolQuery }>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
await assertAlertsPageState({
kuery: '',
// workflowStatus: 'Open',
timeRange: 'Last 2 hours',
timeRange: 'Last 24 hours',
});
});

Expand Down

0 comments on commit 9a72723

Please sign in to comment.