mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
chore: remove context/segment usage flag (#4242)
This commit is contained in:
parent
5e45ec25e9
commit
8de7dfc488
@ -24,12 +24,6 @@ const setupRoutes = () => {
|
||||
],
|
||||
}
|
||||
);
|
||||
testServerRoute(server, '/api/admin/ui-config', {
|
||||
flags: {
|
||||
segmentContextFieldUsage: true,
|
||||
},
|
||||
});
|
||||
|
||||
testServerRoute(server, '/api/admin/projects', {
|
||||
version: 1,
|
||||
projects: [
|
||||
|
@ -267,10 +267,7 @@ export const ContextForm: React.FC<IContextForm> = ({
|
||||
/>
|
||||
<Typography>{stickiness ? 'On' : 'Off'}</Typography>
|
||||
</StyledSwitchContainer>
|
||||
<ConditionallyRender
|
||||
condition={Boolean(uiConfig.flags.segmentContextFieldUsage)}
|
||||
show={<ContextFieldUsage contextName={contextName} />}
|
||||
/>
|
||||
<ContextFieldUsage contextName={contextName} />
|
||||
</StyledContainer>
|
||||
<StyledButtonContainer>
|
||||
{children}
|
||||
|
@ -20,12 +20,6 @@ const setupRoutes = () => {
|
||||
createdAt: '2023-05-24T06:23:07.797Z',
|
||||
},
|
||||
]);
|
||||
testServerRoute(server, '/api/admin/ui-config', {
|
||||
flags: {
|
||||
SE: true,
|
||||
segmentContextFieldUsage: true,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
test('should show the count of projects and features used in', async () => {
|
||||
|
@ -86,17 +86,13 @@ const ContextList: VFC = () => {
|
||||
),
|
||||
sortType: 'alphanumeric',
|
||||
},
|
||||
...(uiConfig.flags.segmentContextFieldUsage
|
||||
? [
|
||||
{
|
||||
Header: 'Used in',
|
||||
width: '60%',
|
||||
Cell: ({ row: { original } }: any) => (
|
||||
<UsedInCell original={original} />
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
Header: 'Used in',
|
||||
width: '60%',
|
||||
Cell: ({ row: { original } }: any) => (
|
||||
<UsedInCell original={original} />
|
||||
),
|
||||
},
|
||||
{
|
||||
Header: 'Actions',
|
||||
id: 'Actions',
|
||||
@ -128,7 +124,7 @@ const ContextList: VFC = () => {
|
||||
sortType: 'number',
|
||||
},
|
||||
],
|
||||
[uiConfig.flags.segmentContextFieldUsage]
|
||||
[]
|
||||
);
|
||||
|
||||
const initialState = useMemo(
|
||||
|
@ -25,7 +25,6 @@ const setupRoutes = () => {
|
||||
testServerRoute(server, '/api/admin/ui-config', {
|
||||
flags: {
|
||||
SE: true,
|
||||
segmentContextFieldUsage: true,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
@ -59,10 +59,7 @@ export const SegmentTable = () => {
|
||||
return segments;
|
||||
}, [segments, projectId]);
|
||||
|
||||
const columns = useMemo(
|
||||
() => getColumns(uiConfig.flags.segmentContextFieldUsage),
|
||||
[uiConfig.flags.segmentContextFieldUsage]
|
||||
);
|
||||
const columns = useMemo(() => getColumns(), []);
|
||||
const {
|
||||
getTableProps,
|
||||
getTableBodyProps,
|
||||
@ -177,7 +174,7 @@ export const SegmentTable = () => {
|
||||
);
|
||||
};
|
||||
|
||||
const getColumns = (segmentContextFieldUsage?: boolean) => [
|
||||
const getColumns = () => [
|
||||
{
|
||||
id: 'Icon',
|
||||
width: '1%',
|
||||
@ -201,18 +198,13 @@ const getColumns = (segmentContextFieldUsage?: boolean) => [
|
||||
/>
|
||||
),
|
||||
},
|
||||
...(segmentContextFieldUsage
|
||||
? [
|
||||
{
|
||||
Header: 'Used in',
|
||||
width: '60%',
|
||||
Cell: ({ row: { original } }: any) => (
|
||||
<UsedInCell original={original} />
|
||||
),
|
||||
},
|
||||
]
|
||||
: []),
|
||||
|
||||
{
|
||||
Header: 'Used in',
|
||||
width: '60%',
|
||||
Cell: ({ row: { original } }: any) => (
|
||||
<UsedInCell original={original} />
|
||||
),
|
||||
},
|
||||
{
|
||||
Header: 'Project',
|
||||
accessor: 'project',
|
||||
|
@ -48,7 +48,6 @@ export interface IFlags {
|
||||
demo?: boolean;
|
||||
googleAuthEnabled?: boolean;
|
||||
disableBulkToggle?: boolean;
|
||||
segmentContextFieldUsage?: boolean;
|
||||
disableNotifications?: boolean;
|
||||
advancedPlayground?: boolean;
|
||||
customRootRoles?: boolean;
|
||||
|
@ -94,7 +94,6 @@ exports[`should create default config 1`] = `
|
||||
"personalAccessTokensKillSwitch": false,
|
||||
"proPlanAutoCharge": false,
|
||||
"responseTimeWithAppNameKillSwitch": false,
|
||||
"segmentContextFieldUsage": false,
|
||||
"slackAppAddon": false,
|
||||
"strategySplittedButton": false,
|
||||
"strategyVariant": false,
|
||||
@ -130,7 +129,6 @@ exports[`should create default config 1`] = `
|
||||
"personalAccessTokensKillSwitch": false,
|
||||
"proPlanAutoCharge": false,
|
||||
"responseTimeWithAppNameKillSwitch": false,
|
||||
"segmentContextFieldUsage": false,
|
||||
"slackAppAddon": false,
|
||||
"strategySplittedButton": false,
|
||||
"strategyVariant": false,
|
||||
|
@ -87,42 +87,33 @@ class ContextFieldStore implements IContextFieldStore {
|
||||
}
|
||||
|
||||
async getAll(): Promise<IContextField[]> {
|
||||
if (this.flagResolver.isEnabled('segmentContextFieldUsage')) {
|
||||
const rows = await this.db
|
||||
.select(
|
||||
this.prefixColumns(),
|
||||
'used_in_projects',
|
||||
'used_in_features',
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.project_name AS used_in_projects`,
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.feature_name AS used_in_features`,
|
||||
)
|
||||
.from(T.contextFields)
|
||||
.joinRaw(
|
||||
`LEFT JOIN ${T.featureStrategies} ON EXISTS (
|
||||
const rows = await this.db
|
||||
.select(
|
||||
this.prefixColumns(),
|
||||
'used_in_projects',
|
||||
'used_in_features',
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.project_name AS used_in_projects`,
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.feature_name AS used_in_features`,
|
||||
)
|
||||
.from(T.contextFields)
|
||||
.joinRaw(
|
||||
`LEFT JOIN ${T.featureStrategies} ON EXISTS (
|
||||
SELECT 1
|
||||
FROM jsonb_array_elements(${T.featureStrategies}.constraints) AS elem
|
||||
WHERE elem ->> 'contextName' = ${T.contextFields}.name
|
||||
)`,
|
||||
)
|
||||
.groupBy(
|
||||
this.prefixColumns(
|
||||
COLUMNS.filter((column) => column !== 'legal_values'),
|
||||
),
|
||||
)
|
||||
.orderBy('name', 'asc');
|
||||
return rows.map(mapRow);
|
||||
} else {
|
||||
const rows = await this.db
|
||||
.select(COLUMNS)
|
||||
.from(T.contextFields)
|
||||
.orderBy('name', 'asc');
|
||||
|
||||
return rows.map(mapRow);
|
||||
}
|
||||
)
|
||||
.groupBy(
|
||||
this.prefixColumns(
|
||||
COLUMNS.filter((column) => column !== 'legal_values'),
|
||||
),
|
||||
)
|
||||
.orderBy('name', 'asc');
|
||||
return rows.map(mapRow);
|
||||
}
|
||||
|
||||
async get(key: string): Promise<IContextField> {
|
||||
|
@ -107,42 +107,33 @@ export default class SegmentStore implements ISegmentStore {
|
||||
}
|
||||
|
||||
async getAll(): Promise<ISegment[]> {
|
||||
if (this.flagResolver.isEnabled('segmentContextFieldUsage')) {
|
||||
const rows: ISegmentRow[] = await this.db
|
||||
.select(
|
||||
this.prefixColumns(),
|
||||
'used_in_projects',
|
||||
'used_in_features',
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.project_name AS used_in_projects`,
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.feature_name AS used_in_features`,
|
||||
)
|
||||
.from(T.segments)
|
||||
.leftJoin(
|
||||
T.featureStrategySegment,
|
||||
`${T.segments}.id`,
|
||||
`${T.featureStrategySegment}.segment_id`,
|
||||
)
|
||||
.leftJoin(
|
||||
T.featureStrategies,
|
||||
`${T.featureStrategies}.id`,
|
||||
`${T.featureStrategySegment}.feature_strategy_id`,
|
||||
)
|
||||
.groupBy(this.prefixColumns())
|
||||
.orderBy('name', 'asc');
|
||||
const rows: ISegmentRow[] = await this.db
|
||||
.select(
|
||||
this.prefixColumns(),
|
||||
'used_in_projects',
|
||||
'used_in_features',
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.project_name AS used_in_projects`,
|
||||
)
|
||||
.countDistinct(
|
||||
`${T.featureStrategies}.feature_name AS used_in_features`,
|
||||
)
|
||||
.from(T.segments)
|
||||
.leftJoin(
|
||||
T.featureStrategySegment,
|
||||
`${T.segments}.id`,
|
||||
`${T.featureStrategySegment}.segment_id`,
|
||||
)
|
||||
.leftJoin(
|
||||
T.featureStrategies,
|
||||
`${T.featureStrategies}.id`,
|
||||
`${T.featureStrategySegment}.feature_strategy_id`,
|
||||
)
|
||||
.groupBy(this.prefixColumns())
|
||||
.orderBy('name', 'asc');
|
||||
|
||||
return rows.map(this.mapRow);
|
||||
} else {
|
||||
const rows: ISegmentRow[] = await this.db
|
||||
.select(this.prefixColumns())
|
||||
.from(T.segments)
|
||||
.orderBy('name', 'asc');
|
||||
|
||||
return rows.map(this.mapRow);
|
||||
}
|
||||
return rows.map(this.mapRow);
|
||||
}
|
||||
|
||||
async getActive(): Promise<ISegment[]> {
|
||||
|
@ -19,7 +19,6 @@ export type IFlagKey =
|
||||
| 'demo'
|
||||
| 'googleAuthEnabled'
|
||||
| 'disableBulkToggle'
|
||||
| 'segmentContextFieldUsage'
|
||||
| 'disableNotifications'
|
||||
| 'advancedPlayground'
|
||||
| 'customRootRoles'
|
||||
@ -96,10 +95,6 @@ const flags: IFlags = {
|
||||
process.env.DISABLE_BULK_TOGGLE,
|
||||
false,
|
||||
),
|
||||
segmentContextFieldUsage: parseEnvVarBoolean(
|
||||
process.env.UNLEASH_SSEGMENT_CONTEXT_FIELD_USAGE,
|
||||
false,
|
||||
),
|
||||
disableNotifications: parseEnvVarBoolean(
|
||||
process.env.DISABLE_NOTIFICATIONS,
|
||||
false,
|
||||
|
@ -37,7 +37,6 @@ process.nextTick(async () => {
|
||||
embedProxyFrontend: true,
|
||||
anonymiseEventLog: false,
|
||||
responseTimeWithAppNameKillSwitch: false,
|
||||
segmentContextFieldUsage: true,
|
||||
advancedPlayground: true,
|
||||
strategySplittedButton: true,
|
||||
strategyVariant: true,
|
||||
|
Loading…
Reference in New Issue
Block a user