[RAM] Use alert name in flyout header (#133038)

* Use alert name

* Fix unit tests
This commit is contained in:
Chris Roberson 2022-05-26 15:04:16 -04:00 committed by GitHub
parent bff21e760c
commit 1bc354e28f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View file

@ -121,7 +121,7 @@ describe('AlertsFlyout', () => {
await nextTick();
wrapper.update();
});
expect(wrapper.find('h2').first().text()).toBe('Sample title');
expect(wrapper.find('h2').first().text()).toBe('one');
expect(wrapper.find('h5').first().text()).toBe('Body');
});
@ -142,7 +142,7 @@ describe('AlertsFlyout', () => {
await nextTick();
wrapper.update();
});
expect(wrapper.find('h2').first().text()).toBe('Sample title');
expect(wrapper.find('h2').first().text()).toBe('one');
expect(wrapper.find('h5').first().text()).toBe('Body');
expect(wrapper.find('h6').first().text()).toBe('Footer');
});

View file

@ -5,22 +5,16 @@
* 2.0.
*/
import React from 'react';
import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { ALERT_RULE_NAME } from '@kbn/rule-data-utils';
import { EuiTitle } from '@elastic/eui';
import { AlertsTableFlyoutBaseProps } from '../../../../types';
const SAMPLE_TITLE_LABEL = i18n.translate(
'xpack.triggersActionsUI.sections.alertsTable.alertsFlyout.sampleTitle',
{
defaultMessage: 'Sample title',
}
);
type Props = AlertsTableFlyoutBaseProps;
const AlertsFlyoutHeader = ({ alert }: Props) => {
return (
<EuiTitle size="m">
<h2>{SAMPLE_TITLE_LABEL}</h2>
<h2>{get(alert, ALERT_RULE_NAME)}</h2>
</EuiTitle>
);
};