1
0
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:
Jaanus Sellin 2023-07-14 13:30:15 +03:00 committed by GitHub
parent 5e45ec25e9
commit 8de7dfc488
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 67 additions and 122 deletions

View File

@ -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: [

View File

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

View File

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

View File

@ -86,8 +86,6 @@ const ContextList: VFC = () => {
), ),
sortType: 'alphanumeric', sortType: 'alphanumeric',
}, },
...(uiConfig.flags.segmentContextFieldUsage
? [
{ {
Header: 'Used in', Header: 'Used in',
width: '60%', width: '60%',
@ -95,8 +93,6 @@ const ContextList: VFC = () => {
<UsedInCell original={original} /> <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(

View File

@ -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,
}, },
}); });
}; };

View File

@ -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,8 +198,6 @@ const getColumns = (segmentContextFieldUsage?: boolean) => [
/> />
), ),
}, },
...(segmentContextFieldUsage
? [
{ {
Header: 'Used in', Header: 'Used in',
width: '60%', width: '60%',
@ -210,9 +205,6 @@ const getColumns = (segmentContextFieldUsage?: boolean) => [
<UsedInCell original={original} /> <UsedInCell original={original} />
), ),
}, },
]
: []),
{ {
Header: 'Project', Header: 'Project',
accessor: 'project', accessor: 'project',

View File

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

View File

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

View File

@ -87,7 +87,6 @@ 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(),
@ -115,14 +114,6 @@ class ContextFieldStore implements IContextFieldStore {
) )
.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> {

View File

@ -107,7 +107,6 @@ 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(),
@ -135,14 +134,6 @@ export default class SegmentStore implements ISegmentStore {
.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[]> {

View File

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

View File

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