Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to return disabled strategies #5059

Merged
merged 7 commits into from
Oct 17, 2023

Conversation

andreas-unleash
Copy link
Contributor

Adds the option to include disabled strategies (behind the playgroundImprovements flag

Closes # 1-1505

@vercel
Copy link

vercel bot commented Oct 16, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2023 9:10am
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 17, 2023 9:10am

Signed-off-by: andreas-unleash <[email protected]>
Signed-off-by: andreas-unleash <[email protected]>
Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should improve the architecture slightly before merging

Comment on lines +128 to +131
if (
this.isUnseenStrategyRow(feature, row) &&
(includeDisabledStrategies ? true : !row.strategy_disabled)
) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the correct place to put this. createBaseFeature should only care about what is common between the two API endpoints. Instead you should take this check and move into the respective methods: buildFeatureToggleListFromRows and buildPlaygroundFeaturesFromRows and have each method have different checks for which strategies they allow

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out that both of those functions are only used for the Admin API - for which we (everywhere) return the disabled strategies

Signed-off-by: andreas-unleash <[email protected]>
Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is only relevant to the playground API

Comment on lines 154 to 161
if (
this.isUnseenStrategyRow(feature, r) &&
includeDisabledStrategies &&
r.strategy_disabled
) {
feature.strategies?.push(this.rowToStrategy(r));
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the feature toggle list need disabled strategies?

Copy link
Contributor Author

@andreas-unleash andreas-unleash Oct 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I am misunderstanding something here. Following the calls
featureToggleRowConverter.buildFeatureToggleListFromRows is called from
featureToggleStore.getFeatureToggleList is called from
featureToggleService.getFeatureTogglesis called from
featureToggleLegacyController.getAllToggles that is initialised from the AdminApi.

I added it because of following up to the Admin api admin/features

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following to the frontend - the disabled strategies are not needed

Signed-off-by: andreas-unleash <[email protected]>
@andreas-unleash
Copy link
Contributor Author

Not only relevant to playground. To be more specific - this is needed for the admin api

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@andreas-unleash andreas-unleash merged commit cf42a82 into main Oct 17, 2023
@andreas-unleash andreas-unleash deleted the feat/return_disabled_strategies_to_playground branch October 17, 2023 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants