Skip to content

Commit

Permalink
#1737 Field-picker - Disable Reset button until changes are made (#1738)
Browse files Browse the repository at this point in the history
Signed-off-by: Veena S <[email protected]>
  • Loading branch information
veenas1 authored Mar 5, 2024
1 parent 0e89281 commit 7a67d64
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,13 @@ export default class FieldPicker extends React.Component {
_genResetButton() {
const resetLabel = PropertyUtils.formatMessage(this.props.controller.getReactIntl(),
MESSAGE_KEYS.FIELDPICKER_RESETBUTTON_LABEL);
const defaultSelections = this.props.currentFields;
const selectedFields = this.state.selectedFields;
const isSelectionEqual = defaultSelections.length === selectedFields.length && defaultSelections.every((field) => selectedFields.indexOf(field) > -1);
return (
<Button
className="properties-fp-reset-button-container"
disabled={isSelectionEqual}
onClick={this.handleReset}
renderIcon={Reset24}
iconDescription={resetLabel}
Expand Down

0 comments on commit 7a67d64

Please sign in to comment.