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