diff --git a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx index 72814d19dd..caf3e68b72 100644 --- a/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx +++ b/frontend/src/component/feature/FeatureStrategy/FeatureStrategyForm/FeatureStrategyForm.tsx @@ -258,7 +258,6 @@ export const FeatureStrategyForm = ({ ({ display: 'flex', @@ -37,7 +36,6 @@ const StyledButtonContainer = styled('div')(({ theme }) => ({ })); export const FeatureEnvironmentVariants = () => { - const { uiConfig } = useUiConfig(); const { setToastData, setToastApiError } = useToast(); const theme = useTheme(); const isSmallScreen = useMediaQuery(theme.breakpoints.down('md')); @@ -267,11 +265,7 @@ export const FeatureEnvironmentVariants = () => { } > - } - /> - + {environments.map(environment => { const otherEnvsWithVariants = environments.filter( ({ name, variants }) => diff --git a/frontend/src/component/project/Project/ProjectSettings/ProjectDefaultStrategySettings/ProjectEnvironment/ProjectEnvironmentDefaultStrategy/ProjectDefaultStrategyForm.tsx b/frontend/src/component/project/Project/ProjectSettings/ProjectDefaultStrategySettings/ProjectEnvironment/ProjectEnvironmentDefaultStrategy/ProjectDefaultStrategyForm.tsx index 323da5c1da..ace7f08ffe 100644 --- a/frontend/src/component/project/Project/ProjectSettings/ProjectDefaultStrategySettings/ProjectEnvironment/ProjectEnvironmentDefaultStrategy/ProjectDefaultStrategyForm.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/ProjectDefaultStrategySettings/ProjectEnvironment/ProjectEnvironmentDefaultStrategy/ProjectDefaultStrategyForm.tsx @@ -182,7 +182,6 @@ export const ProjectDefaultStrategyForm = ({ /> { - db = await dbInit('advanced_playground', getLogger, { - experimental: { flags: { strategyVariant: true } }, - }); + db = await dbInit('advanced_playground', getLogger); app = await setupAppWithCustomConfig( db.stores, { diff --git a/src/lib/services/feature-toggle-service.ts b/src/lib/services/feature-toggle-service.ts index a2393bccf4..fe527b7f45 100644 --- a/src/lib/services/feature-toggle-service.ts +++ b/src/lib/services/feature-toggle-service.ts @@ -398,12 +398,10 @@ class FeatureToggleService { disabled: featureStrategy.disabled, constraints: featureStrategy.constraints || [], parameters: featureStrategy.parameters, + sortOrder: featureStrategy.sortOrder, segments: segments.map((segment) => segment.id) ?? [], }; - if (this.flagResolver.isEnabled('strategyVariant')) { - result.sortOrder = featureStrategy.sortOrder; - } return result; } @@ -460,39 +458,37 @@ class FeatureToggleService { ); }), ); - if (this.flagResolver.isEnabled('strategyVariant')) { - const newOrder = ( - await this.getStrategiesForEnvironment( - project, - featureName, - environment, - ) - ) - .sort((strategy1, strategy2) => { - if ( - typeof strategy1.sortOrder === 'number' && - typeof strategy2.sortOrder === 'number' - ) { - return strategy1.sortOrder - strategy2.sortOrder; - } - return 0; - }) - .map((strategy) => strategy.id); - - const eventData: StrategyIds = { strategyIds: newOrder }; - - const tags = await this.tagStore.getAllTagsForFeature(featureName); - const event = new StrategiesOrderChangedEvent({ + const newOrder = ( + await this.getStrategiesForEnvironment( + project, featureName, environment, - project, - createdBy, - preData: eventPreData, - data: eventData, - tags: tags, - }); - await this.eventStore.store(event); - } + ) + ) + .sort((strategy1, strategy2) => { + if ( + typeof strategy1.sortOrder === 'number' && + typeof strategy2.sortOrder === 'number' + ) { + return strategy1.sortOrder - strategy2.sortOrder; + } + return 0; + }) + .map((strategy) => strategy.id); + + const eventData: StrategyIds = { strategyIds: newOrder }; + + const tags = await this.tagStore.getAllTagsForFeature(featureName); + const event = new StrategiesOrderChangedEvent({ + featureName, + environment, + project, + createdBy, + preData: eventPreData, + data: eventData, + tags: tags, + }); + await this.eventStore.store(event); } async createStrategy( @@ -1226,7 +1222,7 @@ class FeatureToggleService { segments: [], title: strategy.title, disabled: strategy.disabled, - // FIXME: Should we return sortOrder here, or adjust OpenAPI? + sortOrder: strategy.sortOrder, }; if (segments && segments.length > 0) { diff --git a/src/lib/types/experimental.ts b/src/lib/types/experimental.ts index 830780b5ae..e044ad81af 100644 --- a/src/lib/types/experimental.ts +++ b/src/lib/types/experimental.ts @@ -20,7 +20,6 @@ export type IFlagKey = | 'disableBulkToggle' | 'disableNotifications' | 'advancedPlayground' - | 'strategyVariant' | 'slackAppAddon' | 'filterInvalidClientMetrics' | 'lastSeenByEnvironment' @@ -96,10 +95,6 @@ const flags: IFlags = { process.env.DISABLE_NOTIFICATIONS, false, ), - strategyVariant: parseEnvVarBoolean( - process.env.UNLEASH_STRATEGY_VARIANT, - false, - ), slackAppAddon: parseEnvVarBoolean( process.env.UNLEASH_SLACK_APP_ADDON, false, diff --git a/src/server-dev.ts b/src/server-dev.ts index 237baa38cc..0de7336306 100644 --- a/src/server-dev.ts +++ b/src/server-dev.ts @@ -37,7 +37,6 @@ process.nextTick(async () => { embedProxyFrontend: true, anonymiseEventLog: false, responseTimeWithAppNameKillSwitch: false, - strategyVariant: true, slackAppAddon: true, lastSeenByEnvironment: true, newApplicationList: true,