Skip to content

Commit

Permalink
chore: rename toggle to flag #4 (#7114)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed May 22, 2024
1 parent eb19982 commit 29e7c40
Show file tree
Hide file tree
Showing 19 changed files with 267 additions and 267 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ test('should show the count of projects and features used in', async () => {

render(<ContextList />);

await screen.findByText('2 feature toggles');
await screen.findByText('2 feature flags');
await screen.findByText('3 projects');
});
4 changes: 2 additions & 2 deletions frontend/src/component/context/ContextList/UsedInCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface IUsedInCellProps {

export const UsedInCell: VFC<IUsedInCellProps> = ({ original }) => {
const projectText = original.usedInProjects === 1 ? 'project' : 'projects';
const togglesText = original.usedInFeatures === 1 ? 'toggle' : 'toggles';
const flagsText = original.usedInFeatures === 1 ? 'flag' : 'flags';
return (
<TextCell
sx={{
Expand All @@ -25,7 +25,7 @@ export const UsedInCell: VFC<IUsedInCellProps> = ({ original }) => {
{original.usedInProjects} {projectText}
</Box>
<Box>
{original.usedInFeatures} feature {togglesText}
{original.usedInFeatures} feature {flagsText}
</Box>
</TextCell>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const CreateEnvironment = () => {
feature flags are accessible in all your
environments, but they can take different
configurations per environment. This means
that you can enable a feature toggle in a
that you can enable a feature flag in a
development or test environment without
enabling the feature flag in the
production environment.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const testCases = [
hasUnsatisfiedDependency: true,
} as PlaygroundFeatureSchema,
expectedText:
'If environment was enabled and parent dependencies were satisfied, then this feature toggle would be TRUE with strategies evaluated like so:',
'If environment was enabled and parent dependencies were satisfied, then this feature flag would be TRUE with strategies evaluated like so:',
},
{
name: 'Environment enabled and parent dependency not satisfied',
Expand All @@ -41,7 +41,7 @@ const testCases = [
hasUnsatisfiedDependency: true,
} as PlaygroundFeatureSchema,
expectedText:
'If parent dependencies were satisfied, then this feature toggle would be TRUE with strategies evaluated like so:',
'If parent dependencies were satisfied, then this feature flag would be TRUE with strategies evaluated like so:',
},
{
name: 'Environment not enabled and parent dependency satisfied',
Expand All @@ -60,7 +60,7 @@ const testCases = [
hasUnsatisfiedDependency: false,
} as PlaygroundFeatureSchema,
expectedText:
'If environment was enabled, then this feature toggle would be TRUE with strategies evaluated like so:',
'If environment was enabled, then this feature flag would be TRUE with strategies evaluated like so:',
},
{
name: 'Has disabled strategies and is enabled in environment',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export const WrappedPlaygroundResultStrategyList = ({
return (
<StyledAlertWrapper sx={{ pb: 1, mt: 2 }}>
<StyledAlert severity={'info'} color={'warning'}>
{resolveHintText(feature)}, then this feature toggle would be{' '}
{resolveHintText(feature)}, then this feature flag would be{' '}
{feature.strategies?.result ? 'TRUE' : 'FALSE'} with strategies
evaluated like so:{' '}
</StyledAlert>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const MoreActions: VFC<IMoreActionsProps> = ({
onChange?.();
setToastData({
title: 'State updated',
text: 'Feature toggles marked as stale',
text: 'Feature flags marked as stale',
type: 'success',
});
trackEvent('batch_operations', {
Expand All @@ -79,7 +79,7 @@ export const MoreActions: VFC<IMoreActionsProps> = ({
onChange?.();
setToastData({
title: 'State updated',
text: 'Feature toggles unmarked as stale',
text: 'Feature flags unmarked as stale',
type: 'success',
});
trackEvent('batch_operations', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ test('should show the count of projects and features used in', async () => {

render(<SegmentTable />);

await screen.findByText('2 feature toggles');
await screen.findByText('2 feature flags');
await screen.findByText('3 projects');
});
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class ExportImportController extends Controller {
...getStandardResponses(404),
},
summary: 'Validate feature import data',
description: `Validates a feature toggle data set. Checks whether the data can be imported into the specified project and environment. The returned value is an object that contains errors, warnings, and permissions required to perform the import, as described in the [import documentation](https://docs.getunleash.io/reference/deploy/environment-import-export#import).`,
description: `Validates a feature flag data set. Checks whether the data can be imported into the specified project and environment. The returned value is an object that contains errors, warnings, and permissions required to perform the import, as described in the [import documentation](https://docs.getunleash.io/reference/deploy/environment-import-export#import).`,
}),
],
});
Expand All @@ -105,8 +105,8 @@ class ExportImportController extends Controller {
200: emptyResponse,
...getStandardResponses(404),
},
summary: 'Import feature toggles',
description: `[Import feature toggles](https://docs.getunleash.io/reference/deploy/environment-import-export#import) into a specific project and environment.`,
summary: 'Import feature flags',
description: `[Import feature flags](https://docs.getunleash.io/reference/deploy/environment-import-export#import) into a specific project and environment.`,
}),
],
});
Expand Down
34 changes: 17 additions & 17 deletions src/lib/features/export-import-toggles/export-import.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ const defaultContext: ContextFieldSchema = {

const defaultFeatureName = 'first_feature';

const createToggle = async (
toggle: FeatureToggleDTO,
const createFlag = async (
flag: FeatureToggleDTO,
strategy: Omit<IStrategyConfig, 'id'> = defaultStrategy,
tags: string[] = [],
projectId: string = 'default',
Expand All @@ -66,15 +66,15 @@ const createToggle = async (
) => {
await app.services.featureToggleServiceV2.createFeatureToggle(
projectId,
toggle,
flag,
TEST_AUDIT_USER,
);
if (strategy) {
await app.services.featureToggleServiceV2.createStrategy(
strategy,
{
projectId,
featureName: toggle.name,
featureName: flag.name,
environment: DEFAULT_ENV,
},
TEST_AUDIT_USER,
Expand All @@ -83,7 +83,7 @@ const createToggle = async (
await Promise.all(
tags.map(async (tag) => {
return app.services.featureTagService.addTag(
toggle.name,
flag.name,
{
type: 'simple',
value: tag,
Expand Down Expand Up @@ -211,7 +211,7 @@ describe('import-export for project-specific segments', () => {
],
segments: [segment.id],
};
await createToggle(
await createFlag(
{
name: defaultFeatureName,
description: 'the #1 feature',
Expand Down Expand Up @@ -276,14 +276,14 @@ test('exports features', async () => {
],
segments: [segment.id],
};
await createToggle(
await createFlag(
{
name: defaultFeatureName,
description: 'the #1 feature',
},
strategy,
);
await createToggle(
await createFlag(
{
name: 'second_feature',
description: 'the #1 feature',
Expand Down Expand Up @@ -352,15 +352,15 @@ test('exports features by tag', async () => {
},
],
};
await createToggle(
await createFlag(
{
name: defaultFeatureName,
description: 'the #1 feature',
},
strategy,
['mytag'],
);
await createToggle(
await createFlag(
{
name: 'second_feature',
description: 'the #1 feature',
Expand Down Expand Up @@ -428,7 +428,7 @@ test('should export custom context fields from strategies and variants', async (
},
],
};
await createToggle(
await createFlag(
{
name: defaultFeatureName,
description: 'the #1 feature',
Expand Down Expand Up @@ -502,7 +502,7 @@ test('should export custom context fields from strategies and variants', async (
test('should export tags', async () => {
const featureName = defaultFeatureName;
await createProjects();
await createToggle(
await createFlag(
{
name: featureName,
description: 'the #1 feature',
Expand Down Expand Up @@ -546,11 +546,11 @@ test('should export tags', async () => {

test('returns all features, when no explicit feature was requested', async () => {
await createProjects();
await createToggle({
await createFlag({
name: defaultFeatureName,
description: 'the #1 feature',
});
await createToggle({
await createFlag({
name: 'second_feature',
description: 'the #1 feature',
});
Expand All @@ -568,11 +568,11 @@ test('returns all features, when no explicit feature was requested', async () =>

test('returns all project features', async () => {
await createProjects();
await createToggle({
await createFlag({
name: defaultFeatureName,
description: 'the #1 feature',
});
await createToggle({
await createFlag({
name: 'second_feature',
description: 'the #1 feature',
});
Expand Down Expand Up @@ -1008,7 +1008,7 @@ test('reject import with duplicate features', async () => {
);

expect(body.details[0].description).toBe(
'A toggle with that name already exists',
'A flag with that name already exists',
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default class ArchiveController extends Controller {
tags: ['Archive'],
summary: 'Get archived features',
description:
'Retrieve a list of all [archived feature toggles](https://docs.getunleash.io/reference/archived-toggles).',
'Retrieve a list of all [archived feature flags](https://docs.getunleash.io/reference/archived-toggles).',
operationId: 'getArchivedFeatures',
responses: {
200: createResponseSchema('featuresSchema'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default class FakeFeatureToggleStore implements IFeatureToggleStore {
return feature;
}
throw new NotFoundError(
`Could not find feature toggle with name ${featureName}`,
`Could not find feature flag with name ${featureName}`,
);
}

Expand Down

0 comments on commit 29e7c40

Please sign in to comment.