1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

chore: strategy variant flag removed (#4603)

This commit is contained in:
Mateusz Kwasniewski 2023-09-04 13:15:54 +02:00 committed by GitHub
parent 8aace7f93f
commit 45e089f27f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 34 additions and 58 deletions

View File

@ -258,7 +258,6 @@ export const FeatureStrategyForm = ({
<StyledHr />
<ConditionallyRender
condition={
Boolean(uiConfig?.flags?.strategyVariant) &&
strategy.parameters != null &&
'stickiness' in strategy.parameters
}

View File

@ -29,7 +29,6 @@ import PermissionIconButton from 'component/common/PermissionIconButton/Permissi
import { Edit } from '@mui/icons-material';
import { VariantInfoAlert } from 'component/common/VariantInfoAlert/VariantInfoAlert';
import { StrategyVariantsPreferredAlert } from 'component/common/StrategyVariantsUpgradeAlert/StrategyVariantsUpgradeAlert';
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
const StyledButtonContainer = styled('div')(({ theme }) => ({
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 = () => {
}
>
<VariantInfoAlert mode="feature" />
<ConditionallyRender
condition={Boolean(uiConfig?.flags?.strategyVariant)}
show={<StrategyVariantsPreferredAlert />}
/>
<StrategyVariantsPreferredAlert />
{environments.map(environment => {
const otherEnvsWithVariants = environments.filter(
({ name, variants }) =>

View File

@ -182,7 +182,6 @@ export const ProjectDefaultStrategyForm = ({
/>
<ConditionallyRender
condition={
Boolean(uiConfig?.flags?.strategyVariant) &&
strategy.parameters != null &&
'stickiness' in strategy.parameters
}

View File

@ -97,7 +97,6 @@ exports[`should create default config 1`] = `
"proPlanAutoCharge": false,
"responseTimeWithAppNameKillSwitch": false,
"slackAppAddon": false,
"strategyVariant": false,
"strictSchemaValidation": false,
},
},
@ -132,7 +131,6 @@ exports[`should create default config 1`] = `
"proPlanAutoCharge": false,
"responseTimeWithAppNameKillSwitch": false,
"slackAppAddon": false,
"strategyVariant": false,
"strictSchemaValidation": false,
},
"externalResolver": {

View File

@ -253,9 +253,7 @@ export default class FeatureToggleClientStore
parameters: mapValues(row.parameters || {}, ensureStringValue),
sortOrder: row.sort_order,
};
if (this.flagResolver.isEnabled('strategyVariant')) {
strategy.variants = row.strategy_variants || [];
}
strategy.variants = row.strategy_variants || [];
return strategy;
}

View File

@ -10,9 +10,7 @@ let app: IUnleashTest;
let db: ITestDb;
beforeAll(async () => {
db = await dbInit('advanced_playground', getLogger, {
experimental: { flags: { strategyVariant: true } },
});
db = await dbInit('advanced_playground', getLogger);
app = await setupAppWithCustomConfig(
db.stores,
{

View File

@ -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) {

View File

@ -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,

View File

@ -37,7 +37,6 @@ process.nextTick(async () => {
embedProxyFrontend: true,
anonymiseEventLog: false,
responseTimeWithAppNameKillSwitch: false,
strategyVariant: true,
slackAppAddon: true,
lastSeenByEnvironment: true,
newApplicationList: true,