From 02e680f7d3461a14884608cd5c7195237b6aa5c2 Mon Sep 17 00:00:00 2001 From: Yuliia Naumenko Date: Mon, 20 Apr 2020 18:27:41 -0700 Subject: [PATCH] Fixed bug with no possibility to edit the index name after adding --- .../builtin_action_types/es_index.tsx | 2 +- .../apps/triggers_actions_ui/connectors.ts | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index.tsx b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index.tsx index 15f68e6a9f441..55a219ca94aea 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/es_index.tsx @@ -151,7 +151,7 @@ const IndexActionConnectorFields: React.FunctionComponent { - editActionConfig('index', selected[0].value); + editActionConfig('index', selected.length > 0 ? selected[0].value : ''); const indices = selected.map(s => s.value as string); // reset time field and expression fields if indices are deleted diff --git a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors.ts b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors.ts index 562f64656319e..db16aaefc95b5 100644 --- a/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors.ts +++ b/x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors.ts @@ -209,5 +209,23 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { expect(await testSubjects.exists('preconfiguredBadge')).to.be(true); expect(await testSubjects.exists('saveEditedActionButton')).to.be(false); }); + + it('should not be able to clear selected index on index connector form', async () => { + await pageObjects.triggersActionsUI.clickCreateConnectorButton(); + + await testSubjects.click('.index-card'); + + const indexComboBox = await testSubjects.find('connectorIndexesComboBox'); + await indexComboBox.click(); + await indexComboBox.type('k'); + const filterSelectItem = await find.byCssSelector(`.euiFilterSelectItem`); + await filterSelectItem.click(); + + expect(await indexComboBox.getVisibleText()).to.be('.kibana'); + + await testSubjects.click('comboBoxClearButton'); + + expect(await indexComboBox.getVisibleText()).to.be(''); + }); }); };