Skip to content

Commit 4af7553

Browse files
ymao1kibanamachine
andauthored
[Actions] Back Button on Add Connector Flyout (#80160) (#80878)
* Adding back button to add connector flyout * Adding tests * Adding tests Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
1 parent d25c84f commit 4af7553

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.test.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ describe('connector_add_flyout', () => {
7575
);
7676
expect(wrapper.find('ActionTypeMenu')).toHaveLength(1);
7777
expect(wrapper.find(`[data-test-subj="${actionType.id}-card"]`).exists()).toBeTruthy();
78+
expect(wrapper.find('[data-test-subj="cancelButton"]').exists()).toBeTruthy();
79+
expect(wrapper.find('[data-test-subj="backButton"]').exists()).toBeFalsy();
7880
});
7981

8082
it('renders banner with subscription links when gold features are disabled due to licensing ', () => {

x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/connector_add_flyout.tsx

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,14 +251,31 @@ export const ConnectorAddFlyout = ({
251251
<EuiFlyoutFooter>
252252
<EuiFlexGroup justifyContent="spaceBetween">
253253
<EuiFlexItem grow={false}>
254-
<EuiButtonEmpty onClick={closeFlyout}>
255-
{i18n.translate(
256-
'xpack.triggersActionsUI.sections.actionConnectorAdd.cancelButtonLabel',
257-
{
258-
defaultMessage: 'Cancel',
259-
}
260-
)}
261-
</EuiButtonEmpty>
254+
{!actionType ? (
255+
<EuiButtonEmpty data-test-subj="cancelButton" onClick={closeFlyout}>
256+
{i18n.translate(
257+
'xpack.triggersActionsUI.sections.actionConnectorAdd.cancelButtonLabel',
258+
{
259+
defaultMessage: 'Cancel',
260+
}
261+
)}
262+
</EuiButtonEmpty>
263+
) : (
264+
<EuiButtonEmpty
265+
data-test-subj="backButton"
266+
onClick={() => {
267+
setActionType(undefined);
268+
setConnector(initialConnector);
269+
}}
270+
>
271+
{i18n.translate(
272+
'xpack.triggersActionsUI.sections.actionConnectorAdd.backButtonLabel',
273+
{
274+
defaultMessage: 'Back',
275+
}
276+
)}
277+
</EuiButtonEmpty>
278+
)}
262279
</EuiFlexItem>
263280
<EuiFlexItem grow={false}>
264281
<EuiFlexGroup justifyContent="spaceBetween">

x-pack/test/functional_with_es_ssl/apps/triggers_actions_ui/connectors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => {
4040

4141
await pageObjects.triggersActionsUI.clickCreateConnectorButton();
4242

43+
await testSubjects.click('.index-card');
44+
45+
await find.clickByCssSelector('[data-test-subj="backButton"]');
46+
4347
await testSubjects.click('.slack-card');
4448

4549
await testSubjects.setValue('nameInput', connectorName);

0 commit comments

Comments
 (0)