diff --git a/frontend/web/components/modals/AssociatedSegmentOverrides.js b/frontend/web/components/modals/AssociatedSegmentOverrides.js
index c59f42d7d1df..57bbbc2bbb52 100644
--- a/frontend/web/components/modals/AssociatedSegmentOverrides.js
+++ b/frontend/web/components/modals/AssociatedSegmentOverrides.js
@@ -14,6 +14,7 @@ import { getStore } from 'common/store'
import { getEnvironment } from 'common/services/useEnvironment'
import { saveFeatureWithValidation } from 'components/saveFeatureWithValidation'
import Utils from 'common/utils/utils'
+import Permission from 'common/providers/Permission'
class TheComponent extends Component {
state = {
@@ -107,115 +108,132 @@ class TheComponent extends Component {
const selectedResults = selectedNewResults.concat(
(results && results[this.state.selectedEnv]) || [],
)
- const addOverride = (
-
- v.feature.id)
- }
- id={this.props.id}
- projectId={this.props.projectId}
- environmentId={this.state.selectedEnv}
- readOnly={this.props.readOnly}
- />
-
- )
return (
-
-
- This shows the list of segment overrides associated with this segment.
-
- Segment overrides will only apply when you identify via the SDK.{' '}
-
- Check the Docs for more details
-
- .
-
-
-
-
- this.setState(
- {
- selectedEnv,
- },
- this.fetch,
- )
+
+ {({ permission: manageSegmentOverrides }) => {
+ const readOnly = !manageSegmentOverrides
+ const addOverride = (
+
+
v.feature.id)
}
+ id={this.props.id}
+ projectId={this.props.projectId}
+ environmentId={this.state.selectedEnv}
+ readOnly={readOnly}
/>
- }
- title='Environment'
- />
-
- {this.state.isLoading ? (
-
-
- ) : (
- this.setState({ search })}
- filterRow={(row, search) =>
- row.feature.name.toLowerCase().includes(search.toLowerCase())
- }
- className='no-pad panel-override'
- title='Associated Features'
- items={selectedResults}
- renderNoResults={
-
- {addOverride}
-
- There are no segment overrides in this environment
-
-
- }
- renderRow={(v) => (
-
-
+ )
-
{
- if (v.newSegmentOverrides) {
- newItems[this.state.selectedEnv] = newItems[
- this.state.selectedEnv
- ].filter((x) => x !== v)
- this.setState({
- newItems,
- })
- }
- }}
- id={this.props.id}
+ return (
+
+
+ This shows the list of segment overrides associated with this
+ segment.
+
+ Segment overrides will only apply when you identify via the SDK.{' '}
+
+ Check the Docs for more details
+
+ .
+
+
+
+
+ this.setState(
+ {
+ selectedEnv,
+ },
+ this.fetch,
+ )
+ }
/>
+ }
+ title='Environment'
+ />
+
+ {this.state.isLoading ? (
+
+
-
- )}
- />
- )}
-
-
+ ) : (
+
this.setState({ search })}
+ filterRow={(row, search) =>
+ row.feature.name
+ .toLowerCase()
+ .includes(search.toLowerCase())
+ }
+ className='no-pad panel-override'
+ title='Associated Features'
+ items={selectedResults}
+ renderNoResults={
+
+ {addOverride}
+
+ There are no segment overrides in this environment
+
+
+ }
+ renderRow={(v) => (
+
+
+ {
+ if (v.newSegmentOverrides) {
+ newItems[this.state.selectedEnv] = newItems[
+ this.state.selectedEnv
+ ].filter((x) => x !== v)
+ this.setState({
+ newItems,
+ })
+ }
+ }}
+ id={this.props.id}
+ projectId={this.props.projectId}
+ environmentId={v.env.api_key}
+ readOnly={readOnly}
+ />
+
+
+ )}
+ />
+ )}
+
+
+ )
+ }}
+
)
}
}
diff --git a/frontend/web/components/modals/CreateSegment.tsx b/frontend/web/components/modals/CreateSegment.tsx
index 27d9e266671d..55085c7bf7bb 100644
--- a/frontend/web/components/modals/CreateSegment.tsx
+++ b/frontend/web/components/modals/CreateSegment.tsx
@@ -46,7 +46,6 @@ import { cloneDeep } from 'lodash'
import ErrorMessage from 'components/ErrorMessage'
import ProjectStore from 'common/stores/project-store'
import Icon from 'components/Icon'
-import Permission from 'common/providers/Permission'
import classNames from 'classnames'
import AddMetadataToEntity, {
CustomMetadataField,
@@ -587,27 +586,15 @@ const CreateSegment: FC = ({
-
- {({ permission: manageSegmentOverrides }) => {
- const isReadOnly = !manageSegmentOverrides
- return (
- {
- setValueChanged(true)
- }}
- feature={segment.feature}
- projectId={projectId}
- id={segment.id}
- readOnly={isReadOnly}
- environmentId={environmentId}
- />
- )
+ {
+ setValueChanged(true)
}}
-
+ feature={segment.feature}
+ projectId={projectId}
+ id={segment.id}
+ environmentId={environmentId}
+ />