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:
parent
8aace7f93f
commit
45e089f27f
@ -258,7 +258,6 @@ export const FeatureStrategyForm = ({
|
|||||||
<StyledHr />
|
<StyledHr />
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={
|
condition={
|
||||||
Boolean(uiConfig?.flags?.strategyVariant) &&
|
|
||||||
strategy.parameters != null &&
|
strategy.parameters != null &&
|
||||||
'stickiness' in strategy.parameters
|
'stickiness' in strategy.parameters
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ import PermissionIconButton from 'component/common/PermissionIconButton/Permissi
|
|||||||
import { Edit } from '@mui/icons-material';
|
import { Edit } from '@mui/icons-material';
|
||||||
import { VariantInfoAlert } from 'component/common/VariantInfoAlert/VariantInfoAlert';
|
import { VariantInfoAlert } from 'component/common/VariantInfoAlert/VariantInfoAlert';
|
||||||
import { StrategyVariantsPreferredAlert } from 'component/common/StrategyVariantsUpgradeAlert/StrategyVariantsUpgradeAlert';
|
import { StrategyVariantsPreferredAlert } from 'component/common/StrategyVariantsUpgradeAlert/StrategyVariantsUpgradeAlert';
|
||||||
import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig';
|
|
||||||
|
|
||||||
const StyledButtonContainer = styled('div')(({ theme }) => ({
|
const StyledButtonContainer = styled('div')(({ theme }) => ({
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -37,7 +36,6 @@ const StyledButtonContainer = styled('div')(({ theme }) => ({
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
export const FeatureEnvironmentVariants = () => {
|
export const FeatureEnvironmentVariants = () => {
|
||||||
const { uiConfig } = useUiConfig();
|
|
||||||
const { setToastData, setToastApiError } = useToast();
|
const { setToastData, setToastApiError } = useToast();
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
|
const isSmallScreen = useMediaQuery(theme.breakpoints.down('md'));
|
||||||
@ -267,11 +265,7 @@ export const FeatureEnvironmentVariants = () => {
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<VariantInfoAlert mode="feature" />
|
<VariantInfoAlert mode="feature" />
|
||||||
<ConditionallyRender
|
<StrategyVariantsPreferredAlert />
|
||||||
condition={Boolean(uiConfig?.flags?.strategyVariant)}
|
|
||||||
show={<StrategyVariantsPreferredAlert />}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{environments.map(environment => {
|
{environments.map(environment => {
|
||||||
const otherEnvsWithVariants = environments.filter(
|
const otherEnvsWithVariants = environments.filter(
|
||||||
({ name, variants }) =>
|
({ name, variants }) =>
|
||||||
|
@ -182,7 +182,6 @@ export const ProjectDefaultStrategyForm = ({
|
|||||||
/>
|
/>
|
||||||
<ConditionallyRender
|
<ConditionallyRender
|
||||||
condition={
|
condition={
|
||||||
Boolean(uiConfig?.flags?.strategyVariant) &&
|
|
||||||
strategy.parameters != null &&
|
strategy.parameters != null &&
|
||||||
'stickiness' in strategy.parameters
|
'stickiness' in strategy.parameters
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,6 @@ exports[`should create default config 1`] = `
|
|||||||
"proPlanAutoCharge": false,
|
"proPlanAutoCharge": false,
|
||||||
"responseTimeWithAppNameKillSwitch": false,
|
"responseTimeWithAppNameKillSwitch": false,
|
||||||
"slackAppAddon": false,
|
"slackAppAddon": false,
|
||||||
"strategyVariant": false,
|
|
||||||
"strictSchemaValidation": false,
|
"strictSchemaValidation": false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -132,7 +131,6 @@ exports[`should create default config 1`] = `
|
|||||||
"proPlanAutoCharge": false,
|
"proPlanAutoCharge": false,
|
||||||
"responseTimeWithAppNameKillSwitch": false,
|
"responseTimeWithAppNameKillSwitch": false,
|
||||||
"slackAppAddon": false,
|
"slackAppAddon": false,
|
||||||
"strategyVariant": false,
|
|
||||||
"strictSchemaValidation": false,
|
"strictSchemaValidation": false,
|
||||||
},
|
},
|
||||||
"externalResolver": {
|
"externalResolver": {
|
||||||
|
@ -253,9 +253,7 @@ export default class FeatureToggleClientStore
|
|||||||
parameters: mapValues(row.parameters || {}, ensureStringValue),
|
parameters: mapValues(row.parameters || {}, ensureStringValue),
|
||||||
sortOrder: row.sort_order,
|
sortOrder: row.sort_order,
|
||||||
};
|
};
|
||||||
if (this.flagResolver.isEnabled('strategyVariant')) {
|
strategy.variants = row.strategy_variants || [];
|
||||||
strategy.variants = row.strategy_variants || [];
|
|
||||||
}
|
|
||||||
return strategy;
|
return strategy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,9 +10,7 @@ let app: IUnleashTest;
|
|||||||
let db: ITestDb;
|
let db: ITestDb;
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
db = await dbInit('advanced_playground', getLogger, {
|
db = await dbInit('advanced_playground', getLogger);
|
||||||
experimental: { flags: { strategyVariant: true } },
|
|
||||||
});
|
|
||||||
app = await setupAppWithCustomConfig(
|
app = await setupAppWithCustomConfig(
|
||||||
db.stores,
|
db.stores,
|
||||||
{
|
{
|
||||||
|
@ -398,12 +398,10 @@ class FeatureToggleService {
|
|||||||
disabled: featureStrategy.disabled,
|
disabled: featureStrategy.disabled,
|
||||||
constraints: featureStrategy.constraints || [],
|
constraints: featureStrategy.constraints || [],
|
||||||
parameters: featureStrategy.parameters,
|
parameters: featureStrategy.parameters,
|
||||||
|
sortOrder: featureStrategy.sortOrder,
|
||||||
segments: segments.map((segment) => segment.id) ?? [],
|
segments: segments.map((segment) => segment.id) ?? [],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.flagResolver.isEnabled('strategyVariant')) {
|
|
||||||
result.sortOrder = featureStrategy.sortOrder;
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,39 +458,37 @@ class FeatureToggleService {
|
|||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
if (this.flagResolver.isEnabled('strategyVariant')) {
|
const newOrder = (
|
||||||
const newOrder = (
|
await this.getStrategiesForEnvironment(
|
||||||
await this.getStrategiesForEnvironment(
|
project,
|
||||||
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({
|
|
||||||
featureName,
|
featureName,
|
||||||
environment,
|
environment,
|
||||||
project,
|
)
|
||||||
createdBy,
|
)
|
||||||
preData: eventPreData,
|
.sort((strategy1, strategy2) => {
|
||||||
data: eventData,
|
if (
|
||||||
tags: tags,
|
typeof strategy1.sortOrder === 'number' &&
|
||||||
});
|
typeof strategy2.sortOrder === 'number'
|
||||||
await this.eventStore.store(event);
|
) {
|
||||||
}
|
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(
|
async createStrategy(
|
||||||
@ -1226,7 +1222,7 @@ class FeatureToggleService {
|
|||||||
segments: [],
|
segments: [],
|
||||||
title: strategy.title,
|
title: strategy.title,
|
||||||
disabled: strategy.disabled,
|
disabled: strategy.disabled,
|
||||||
// FIXME: Should we return sortOrder here, or adjust OpenAPI?
|
sortOrder: strategy.sortOrder,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (segments && segments.length > 0) {
|
if (segments && segments.length > 0) {
|
||||||
|
@ -20,7 +20,6 @@ export type IFlagKey =
|
|||||||
| 'disableBulkToggle'
|
| 'disableBulkToggle'
|
||||||
| 'disableNotifications'
|
| 'disableNotifications'
|
||||||
| 'advancedPlayground'
|
| 'advancedPlayground'
|
||||||
| 'strategyVariant'
|
|
||||||
| 'slackAppAddon'
|
| 'slackAppAddon'
|
||||||
| 'filterInvalidClientMetrics'
|
| 'filterInvalidClientMetrics'
|
||||||
| 'lastSeenByEnvironment'
|
| 'lastSeenByEnvironment'
|
||||||
@ -96,10 +95,6 @@ const flags: IFlags = {
|
|||||||
process.env.DISABLE_NOTIFICATIONS,
|
process.env.DISABLE_NOTIFICATIONS,
|
||||||
false,
|
false,
|
||||||
),
|
),
|
||||||
strategyVariant: parseEnvVarBoolean(
|
|
||||||
process.env.UNLEASH_STRATEGY_VARIANT,
|
|
||||||
false,
|
|
||||||
),
|
|
||||||
slackAppAddon: parseEnvVarBoolean(
|
slackAppAddon: parseEnvVarBoolean(
|
||||||
process.env.UNLEASH_SLACK_APP_ADDON,
|
process.env.UNLEASH_SLACK_APP_ADDON,
|
||||||
false,
|
false,
|
||||||
|
@ -37,7 +37,6 @@ process.nextTick(async () => {
|
|||||||
embedProxyFrontend: true,
|
embedProxyFrontend: true,
|
||||||
anonymiseEventLog: false,
|
anonymiseEventLog: false,
|
||||||
responseTimeWithAppNameKillSwitch: false,
|
responseTimeWithAppNameKillSwitch: false,
|
||||||
strategyVariant: true,
|
|
||||||
slackAppAddon: true,
|
slackAppAddon: true,
|
||||||
lastSeenByEnvironment: true,
|
lastSeenByEnvironment: true,
|
||||||
newApplicationList: true,
|
newApplicationList: true,
|
||||||
|
Loading…
Reference in New Issue
Block a user