Skip to content

Commit

Permalink
fix: Hide Sensitive Data switch (#4199)
Browse files Browse the repository at this point in the history
  • Loading branch information
novakzaballa authored Jun 26, 2024
1 parent 6eb1557 commit ff29f21
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions frontend/web/components/pages/EnvironmentSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { enableFeatureVersioning } from 'common/services/useEnableFeatureVersion
import AddMetadataToEntity from 'components/metadata/AddMetadataToEntity'
import { getSupportedContentType } from 'common/services/useSupportedContentType'
import EnvironmentVersioningListener from 'components/EnvironmentVersioningListener'
import Format from 'common/utils/format'

const showDisabledFlagOptions = [
{ label: 'Inherit from Project', value: null },
Expand Down Expand Up @@ -228,15 +229,18 @@ const EnvironmentSettingsPage = class extends Component {
)
}

confirmToggle = (title, description, feature) => {
confirmToggle = (title, environmentProperty, environmentPropertyValue) => {
openModal(
title,
<ConfirmToggleEnvFeature
description={`${description} Are you sure that you want to change this value?`}
feature={feature}
featureValue={this.state[feature]}
onToggleChange={(value) => {
this.setState({ [feature]: value }, this.saveEnv)
description={'Are you sure that you want to change this value?'}
feature={Format.enumeration.get(environmentProperty)}
featureValue={environmentPropertyValue}
onToggleChange={() => {
this.setState(
{ [environmentProperty]: !environmentPropertyValue },
this.saveEnv,
)
closeModal()
}}
/>,
Expand Down Expand Up @@ -484,7 +488,7 @@ const EnvironmentSettingsPage = class extends Component {
checked={hide_sensitive_data}
onChange={(v) => {
this.confirmToggle(
'The data returned from the API will change and could break your existing code. Are you sure that you want to change this value?',
'Confirm Environment Setting',
'hide_sensitive_data',
hide_sensitive_data,
)
Expand Down

0 comments on commit ff29f21

Please sign in to comment.