Skip to content

Commit

Permalink
[Alerting] Fixed search results are not updated when search term is r…
Browse files Browse the repository at this point in the history
…emoved on Rules and Connectors page (elastic#103663) (elastic#103849)
  • Loading branch information
YulNaumenko authored Jun 30, 2021
1 parent 876d1f5 commit fe30b1b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,12 @@ export const AlertsList: React.FunctionComponent = () => {
fullWidth
isClearable
data-test-subj="alertSearchField"
onChange={(e) => setInputText(e.target.value)}
onChange={(e) => {
setInputText(e.target.value);
if (e.target.value === '') {
setSearchText(e.target.value);
}
}}
onKeyUp={(e) => {
if (e.keyCode === ENTER_KEY) {
setSearchText(inputText);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,43 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
]);
});

it('should update alert list on the search clear button click', async () => {
await createAlert({ name: 'b' });
await createAlert({ name: 'c' });
await refreshAlertsList();
await pageObjects.triggersActionsUI.searchAlerts('b');

const searchResults = await pageObjects.triggersActionsUI.getAlertsList();
expect(searchResults).to.eql([
{
name: 'b',
tagsText: 'foo, bar',
alertType: 'Test: Noop',
interval: '1m',
},
]);
const searchClearButton = await find.byCssSelector('.euiFormControlLayoutClearButton');
await searchClearButton.click();
await find.byCssSelector(
'.euiBasicTable[data-test-subj="alertsList"]:not(.euiBasicTable-loading)'
);
const searchResultsAfterClear = await pageObjects.triggersActionsUI.getAlertsList();
expect(searchResultsAfterClear).to.eql([
{
name: 'b',
tagsText: 'foo, bar',
alertType: 'Test: Noop',
interval: '1m',
},
{
name: 'c',
tagsText: 'foo, bar',
alertType: 'Test: Noop',
interval: '1m',
},
]);
});

it('should search for tags', async () => {
const createdAlert = await createAlert();
await refreshAlertsList();
Expand Down

0 comments on commit fe30b1b

Please sign in to comment.