Skip to content

Commit

Permalink
chore: Remove stale flags (#3111)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-ssg authored Dec 8, 2023
1 parent 64ef4c4 commit 3794e80
Show file tree
Hide file tree
Showing 15 changed files with 362 additions and 487 deletions.
76 changes: 34 additions & 42 deletions docs/docs/deployment/overview.md

Large diffs are not rendered by default.

58 changes: 25 additions & 33 deletions frontend/common/stores/user-group-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,17 @@ const controller = {
)
}
prom.then((res) => {
if (Utils.getFlagsmithHasFeature('group_admins')) {
Promise.all(
(group.usersToAddAdmin || []).map((v) =>
createGroupAdmin(getStore(), {
group: res.id,
orgId,
user: v.id,
}),
),
).then(() => {
controller.getGroups(orgId)
})
} else {
Promise.all(
(group.usersToAddAdmin || []).map((v) =>
createGroupAdmin(getStore(), {
group: res.id,
orgId,
user: v.id,
}),
),
).then(() => {
controller.getGroups(orgId)
}
})
})
})
.catch((e) => API.ajaxHandler(store, e))
Expand Down Expand Up @@ -80,31 +76,27 @@ const controller = {
{ user_ids: toRemove.map((u) => u.id) },
),
]).then(() => {
if (Utils.getFlagsmithHasFeature('group_admins')) {
Promise.all(
(group.usersToAddAdmin || [])
.map((v) =>
createGroupAdmin(getStore(), {
Promise.all(
(group.usersToAddAdmin || [])
.map((v) =>
createGroupAdmin(getStore(), {
group: group.id,
orgId,
user: v.id,
}),
)
.concat(
(group.usersToRemoveAdmin || []).map((v) =>
deleteGroupAdmin(getStore(), {
group: group.id,
orgId,
user: v.id,
}),
)
.concat(
(group.usersToRemoveAdmin || []).map((v) =>
deleteGroupAdmin(getStore(), {
group: group.id,
orgId,
user: v.id,
}),
),
),
).then(() => {
controller.getGroups(orgId)
})
} else {
),
).then(() => {
controller.getGroups(orgId)
}
})
})
})

Expand Down
62 changes: 12 additions & 50 deletions frontend/common/utils/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
},
getFeatureStatesEndpoint(_project: ProjectType) {
const project = _project || ProjectStore.model
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return 'edge-featurestates'
}
return 'featurestates'
Expand Down Expand Up @@ -211,23 +207,15 @@ const Utils = Object.assign({}, require('./base/_utils'), {
},
getIdentitiesEndpoint(_project: ProjectType) {
const project = _project || ProjectStore.model
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return 'edge-identities'
}
return 'identities'
},
getIsEdge() {
const model = ProjectStore.model as null | ProjectType

if (
Utils.getFlagsmithHasFeature('edge_identities') &&
ProjectStore.model &&
model?.use_edge_identities
) {
if (ProjectStore.model && model?.use_edge_identities) {
return true
}
return false
Expand Down Expand Up @@ -350,47 +338,31 @@ const Utils = Object.assign({}, require('./base/_utils'), {
getSDKEndpoint(_project: ProjectType) {
const project = _project || ProjectStore.model

if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return Project.flagsmithClientEdgeAPI
}
return Project.api
},

getShouldHideIdentityOverridesTab(_project: ProjectType) {
const project = _project || ProjectStore.model
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return true
}
return false
},

getShouldSendIdentityToTraits(_project: ProjectType) {
const project = _project || ProjectStore.model
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return false
}
return true
},

getShouldUpdateTraitOnDelete(_project: ProjectType) {
const project = _project || ProjectStore.model
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
project &&
project.use_edge_identities
) {
if (project && project.use_edge_identities) {
return true
}
return false
Expand All @@ -403,20 +375,14 @@ const Utils = Object.assign({}, require('./base/_utils'), {
getTraitEndpoint(environmentId: string, userId: string) {
const model = ProjectStore.model as null | ProjectType

if (
Utils.getFlagsmithHasFeature('edge_identities') &&
model?.use_edge_identities
) {
if (model?.use_edge_identities) {
return `${Project.api}environments/${environmentId}/edge-identities/${userId}/list-traits/`
}
return `${Project.api}environments/${environmentId}/identities/${userId}/traits/`
},

getTraitEndpointMethod(id?: number) {
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
(ProjectStore.model as ProjectType | null)?.use_edge_identities
) {
if ((ProjectStore.model as ProjectType | null)?.use_edge_identities) {
return 'put'
}
return id ? 'put' : 'post'
Expand Down Expand Up @@ -456,10 +422,7 @@ const Utils = Object.assign({}, require('./base/_utils'), {
},

getUpdateTraitEndpoint(environmentId: string, userId: string, id?: string) {
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
(ProjectStore.model as ProjectType | null)?.use_edge_identities
) {
if ((ProjectStore.model as ProjectType | null)?.use_edge_identities) {
return `${Project.api}environments/${environmentId}/edge-identities/${userId}/update-traits/`
}
return `${
Expand All @@ -476,9 +439,8 @@ const Utils = Object.assign({}, require('./base/_utils'), {
isMigrating() {
const model = ProjectStore.model as null | ProjectType
if (
Utils.getFlagsmithHasFeature('edge_identities') &&
(model?.migration_status === 'MIGRATION_IN_PROGRESS' ||
model?.migration_status === 'MIGRATION_SCHEDULED')
model?.migration_status === 'MIGRATION_IN_PROGRESS' ||
model?.migration_status === 'MIGRATION_SCHEDULED'
) {
return true
}
Expand Down
5 changes: 1 addition & 4 deletions frontend/web/components/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,7 @@ const App = class extends Component {
>
{({ permission }) => (
<>
{(!!permission ||
Utils.getFlagsmithHasFeature(
'group_admins',
)) && (
{!!permission && (
<NavLink
id='org-settings-link'
activeClassName='active'
Expand Down
63 changes: 29 additions & 34 deletions frontend/web/components/Aside.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,41 +169,36 @@ const Aside = class extends Component {
project && project.name ? (
<Column className='mx-0'>
<div>{project.name}</div>
{Utils.getFlagsmithHasFeature(
'edge_identities',
) && (
<div className='mt-2'>
<span
style={{
border: 'none',
}}
className='chip chip--active bg-secondary'
<div className='mt-2'>
<span
style={{
border: 'none',
}}
className='chip chip--active bg-secondary'
>
<a
data-test={
Utils.getIsEdge()
? 'edge-project'
: 'core-project'
}
href='https://docs.flagsmith.com/advanced-use/edge-api#enabling-the-edge-api'
className='text-white font-weight-bold'
>
<a
data-test={
Utils.getIsEdge()
? 'edge-project'
: 'core-project'
}
href='https://docs.flagsmith.com/advanced-use/edge-api#enabling-the-edge-api'
className='text-white font-weight-bold'
>
{Utils.getIsEdge() ? (
'Edge'
) : Utils.isMigrating() ? (
<Tooltip title='Migrating to Edge'>
Depending on the amount of project
data, migrating can take a while.
Refresh the page to track
progress.
</Tooltip>
) : (
'Core'
)}
</a>
</span>
</div>
)}
{Utils.getIsEdge() ? (
'Edge'
) : Utils.isMigrating() ? (
<Tooltip title='Migrating to Edge'>
Depending on the amount of project
data, migrating can take a while.
Refresh the page to track progress.
</Tooltip>
) : (
'Core'
)}
</a>
</span>
</div>
</Column>
) : (
'No Project'
Expand Down
8 changes: 1 addition & 7 deletions frontend/web/components/SegmentOverrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,9 +560,6 @@ class TheComponent extends Component {
const isLimitReached =
segmentOverrideLimitAlert.percentage &&
segmentOverrideLimitAlert.percentage >= 100
const manageSegmentOverridesEnabled = Utils.getFlagsmithHasFeature(
'manage_segment_overrides_env_role',
)
return (
<div>
<Permission
Expand Down Expand Up @@ -602,10 +599,7 @@ class TheComponent extends Component {
this.props.setShowCreateSegment(true)
}}
theme='outline'
disabled={
!!isLimitReached ||
(manageSegmentOverridesEnabled && !manageSegments)
}
disabled={!!isLimitReached || !manageSegments}
>
Create Feature-Specific Segment
</Button>
Expand Down
Loading

0 comments on commit 3794e80

Please sign in to comment.