forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.0][RAC] 117686 replace alert workflow status in alerts view (elast…
…ic#118723) (elastic#120198) * Add AlertStatus types * Add alert status filter component * Remove Filter in action from the t grid table * Update group buttons to applied Alert status filter instead of Workflow status * Keep the Alert status button in sync when typing and first page load * Fix data test object name and translation keys label * Add possibility to hide the bulk actions * Update how hide the bulk actions * Fix showCheckboxes hardcoded "true". Instead use the leadingControlColumns props * Hide the leading checkboxes in the T Grid with the bulk actions * Update showCheckboxes to false * Fix test as the leading checkboxes are hidden * Update tests * Get back disabledCellActions as it's required by T Grid * Update tests to skip test related to Workflow action buttons * Skip workflow tests * Revert fix showCheckboxes * Remove unused imports * Revert the o11y tests as the checkBoxes fix is reverted * Reactive the tests effected by checkBoxes * Skip alert workflow status * [Code review] use predefined types * Remove unused prop * Use the alert-data index name in the RegEx * Detect * in KQL as "show al"l alert filter Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
- Loading branch information
1 parent
563d793
commit 7b9763f
Showing
7 changed files
with
202 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
x-pack/plugins/observability/public/pages/alerts/alerts_status_filter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { EuiButtonGroup, EuiButtonGroupOptionProps } from '@elastic/eui'; | ||
import { i18n } from '@kbn/i18n'; | ||
import React from 'react'; | ||
import { | ||
ALERT_STATUS_ACTIVE, | ||
ALERT_STATUS_RECOVERED, | ||
} from '@kbn/rule-data-utils/alerts_as_data_status'; | ||
import { ALERT_STATUS } from '@kbn/rule-data-utils/technical_field_names'; | ||
import { AlertStatusFilterButton } from '../../../common/typings'; | ||
import { AlertStatusFilter } from '../../../common/typings'; | ||
|
||
export interface AlertStatusFilterProps { | ||
status: AlertStatusFilterButton; | ||
onChange: (id: string, value: string) => void; | ||
} | ||
|
||
export const allAlerts: AlertStatusFilter = { | ||
status: '', | ||
query: '', | ||
label: i18n.translate('xpack.observability.alerts.alertStatusFilter.showAll', { | ||
defaultMessage: 'Show all', | ||
}), | ||
}; | ||
|
||
export const activeAlerts: AlertStatusFilter = { | ||
status: ALERT_STATUS_ACTIVE, | ||
query: `${ALERT_STATUS}: "${ALERT_STATUS_ACTIVE}"`, | ||
label: i18n.translate('xpack.observability.alerts.alertStatusFilter.active', { | ||
defaultMessage: 'Active', | ||
}), | ||
}; | ||
|
||
export const recoveredAlerts: AlertStatusFilter = { | ||
status: ALERT_STATUS_RECOVERED, | ||
query: `${ALERT_STATUS}: "${ALERT_STATUS_RECOVERED}"`, | ||
label: i18n.translate('xpack.observability.alerts.alertStatusFilter.recovered', { | ||
defaultMessage: 'Recovered', | ||
}), | ||
}; | ||
|
||
const options: EuiButtonGroupOptionProps[] = [ | ||
{ | ||
id: allAlerts.status, | ||
label: allAlerts.label, | ||
value: allAlerts.query, | ||
'data-test-subj': 'alert-status-filter-show-all-button', | ||
}, | ||
{ | ||
id: activeAlerts.status, | ||
label: activeAlerts.label, | ||
value: activeAlerts.query, | ||
'data-test-subj': 'alert-status-filter-active-button', | ||
}, | ||
{ | ||
id: recoveredAlerts.status, | ||
label: recoveredAlerts.label, | ||
value: recoveredAlerts.query, | ||
'data-test-subj': 'alert-status-filter-recovered-button', | ||
}, | ||
]; | ||
|
||
export function AlertsStatusFilter({ status, onChange }: AlertStatusFilterProps) { | ||
return ( | ||
<EuiButtonGroup | ||
legend="Filter by" | ||
color="primary" | ||
options={options} | ||
idSelected={status} | ||
onChange={onChange} | ||
/> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.