Skip to content

Commit

Permalink
adding cancel button to change policy (#919)
Browse files Browse the repository at this point in the history
* adding cancel button to change policy

Signed-off-by: kohinoor98 <kohinoorchatterjee1998@gmail.com>

* updated ChangePolicy snapshot to incl Cancel's div

Signed-off-by: kohinoor98 <kohinoorchatterjee1998@gmail.com>

* auto fixing the ChangePolicy.test snapshot

Signed-off-by: kohinoor98 <kohinoorchatterjee1998@gmail.com>

---------

Signed-off-by: kohinoor98 <kohinoorchatterjee1998@gmail.com>
Co-authored-by: bowenlan-amzn <bowenlan23@gmail.com>
  • Loading branch information
kohinoor98 and bowenlan-amzn committed Nov 11, 2023
1 parent ce4b43c commit 1c8f0c6
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import React, { Component } from "react";
import { RouteComponentProps } from "react-router-dom";
import { EuiSpacer, EuiTitle, EuiButton, EuiFlexGroup, EuiFlexItem } from "@elastic/eui";
import { EuiSpacer, EuiTitle, EuiButton, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from "@elastic/eui";
import { IndexService, ManagedIndexService } from "../../../../services";
import ChangeManagedIndices from "../../components/ChangeManagedIndices";
import NewPolicy from "../../components/NewPolicy";
Expand Down Expand Up @@ -115,6 +115,8 @@ export default class ChangePolicy extends Component<ChangePolicyProps, ChangePol
}
};

onCancel = () => this.props.history.goBack();

onSubmit = async () => {
const { selectedPolicies, selectedManagedIndices } = this.state;

Expand Down Expand Up @@ -175,6 +177,11 @@ export default class ChangePolicy extends Component<ChangePolicyProps, ChangePol
<EuiSpacer />

<EuiFlexGroup alignItems="center" justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonEmpty onClick={this.onCancel} data-test-subj="changePolicyCancelButton">
Cancel
</EuiButtonEmpty>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButton fill onClick={this.onSubmit} data-test-subj="changePolicyChangeButton">
Change
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,25 @@ exports[`<ChangePolicy /> spec renders the component 1`] = `
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--alignItemsCenter euiFlexGroup--justifyContentFlexEnd euiFlexGroup--directionRow euiFlexGroup--responsive"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
<button
class="euiButtonEmpty euiButtonEmpty--primary"
data-test-subj="changePolicyCancelButton"
type="button"
>
<span
class="euiButtonContent euiButtonEmpty__content"
>
<span
class="euiButtonEmpty__text"
>
Cancel
</span>
</span>
</button>
</div>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
>
Expand Down

0 comments on commit 1c8f0c6

Please sign in to comment.