Skip to content

Commit

Permalink
fix: multivariate toggle (#4594)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Sep 6, 2024
1 parent 4b43f2c commit 4e85975
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions frontend/web/components/FeatureRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,21 @@ class TheComponent extends Component {
const changeRequestsEnabled = Utils.changeRequestsEnabled(
environment && environment.minimum_change_request_approvals,
)
const onChange = ()=> {
if(disableControls) {
return;
}
if (
projectFlag?.multivariate_options?.length ||
Utils.changeRequestsEnabled(
environment.minimum_change_request_approvals,
)
) {
this.editFeature(projectFlag, environmentFlags[id])
return
}
this.confirmToggle()
}
const isCompact = getViewMode() === 'compact'
if (this.props.condensed) {
return (
Expand Down Expand Up @@ -171,14 +186,7 @@ class TheComponent extends Component {
: '-off'
}`}
checked={environmentFlags[id] && environmentFlags[id].enabled}
onChange={() => {
if (disableControls) return
if (changeRequestsEnabled) {
this.editFeature(projectFlag, environmentFlags[id])
return
}
this.confirmToggle()
}}
onChange={onChange}
/>
</Row>
</div>
Expand Down Expand Up @@ -357,17 +365,7 @@ class TheComponent extends Component {
: '-off'
}`}
checked={environmentFlags[id] && environmentFlags[id].enabled}
onChange={() => {
if (
Utils.changeRequestsEnabled(
environment.minimum_change_request_approvals,
)
) {
this.editFeature(projectFlag, environmentFlags[id])
return
}
this.confirmToggle()
}}
onChange={onChange}
/>
</div>

Expand Down

0 comments on commit 4e85975

Please sign in to comment.