1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

chore: rename toggle to flag #7 (#7125)

This commit is contained in:
Jaanus Sellin 2024-05-23 13:19:49 +03:00 committed by GitHub
parent d9e631c326
commit b3dd460d2f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 101 additions and 104 deletions

View File

@ -75,7 +75,7 @@ test('should load the table', async () => {
await screen.findByText('someFeature');
});
test('should show confirm dialog when reviving toggle', async () => {
test('should show confirm dialog when reviving flag', async () => {
setupApi();
render(
<>
@ -100,7 +100,7 @@ test('should show confirm dialog when reviving toggle', async () => {
await screen.findByText("And we're back!");
});
test('should show confirm dialog when batch reviving toggle', async () => {
test('should show confirm dialog when batch reviving flag', async () => {
setupApi();
render(
<>

View File

@ -308,14 +308,13 @@ export const ArchiveTable = ({
condition={searchValue?.length > 0}
show={
<TablePlaceholder>
No feature toggles found matching &ldquo;
No feature flags found matching &ldquo;
{searchValue}&rdquo;
</TablePlaceholder>
}
elseShow={
<TablePlaceholder>
None of the feature toggles were archived
yet.
None of the feature flags were archived yet.
</TablePlaceholder>
}
/>

View File

@ -37,7 +37,7 @@ export const ArchivedFeatureDeleteConfirm = ({
const { setToastData, setToastApiError } = useToast();
const { deleteFeatures } = useProjectApi();
const singularOrPluralToggles =
const singularOrPluralFlags =
deletedFeatures.length > 1 ? 'toggles' : 'toggle';
const onDeleteFeatureToggle = async () => {
@ -50,8 +50,8 @@ export const ArchivedFeatureDeleteConfirm = ({
await refetch();
setToastData({
type: 'success',
title: `Feature ${singularOrPluralToggles} deleted`,
text: `You have successfully deleted the following feature ${singularOrPluralToggles}: ${deletedFeatures.join(
title: `Feature ${singularOrPluralFlags} deleted`,
text: `You have successfully deleted the following feature ${singularOrPluralFlags}: ${deletedFeatures.join(
', ',
)}.`,
});
@ -71,9 +71,9 @@ export const ArchivedFeatureDeleteConfirm = ({
return (
<Dialogue
title={`Delete feature ${singularOrPluralToggles}?`}
title={`Delete feature ${singularOrPluralFlags}?`}
open={open}
primaryButtonText={`Delete feature ${singularOrPluralToggles}`}
primaryButtonText={`Delete feature ${singularOrPluralFlags}`}
secondaryButtonText='Cancel'
onClick={onDeleteFeatureToggle}
onClose={clearModal}
@ -81,22 +81,22 @@ export const ArchivedFeatureDeleteConfirm = ({
formId={formId}
>
<Alert severity='warning'>
<b>Warning!</b> Before you delete a feature toggle, make sure
all in-code references to that feature toggle have been removed.
Otherwise, a new feature toggle with the same name could
activate the old code paths.
<b>Warning!</b> Before you delete a feature flag, make sure all
in-code references to that feature flag have been removed.
Otherwise, a new feature flag with the same name could activate
the old code paths.
</Alert>
<StyledDeleteParagraph>
You are about to delete the following feature{' '}
{singularOrPluralToggles}:{' '}
{singularOrPluralFlags}:{' '}
<strong>{deletedFeatures.join(', ')}</strong>.
</StyledDeleteParagraph>
<StyledDeleteParagraph
sx={(theme) => ({ marginTop: theme.spacing(2) })}
>
In order to delete the feature {singularOrPluralToggles}, please
In order to delete the feature {singularOrPluralFlags}, please
enter the following confirmation text in the text field below:{' '}
<strong>I want to delete</strong>
</StyledDeleteParagraph>

View File

@ -78,7 +78,7 @@ export const ArchivedFeatureReviveConfirm = ({
show={
<>
<StyledParagraph>
You are about to revive feature toggles:
You are about to revive feature flags:
</StyledParagraph>
<ul>
{revivedFeatures.map((name) => (
@ -89,7 +89,7 @@ export const ArchivedFeatureReviveConfirm = ({
}
elseShow={
<StyledParagraph>
You are about to revive feature toggle:{' '}
You are about to revive feature flag:{' '}
{revivedFeatures[0]}
</StyledParagraph>
}

View File

@ -293,5 +293,5 @@ test('add flag change to pending change request', async () => {
await changeFlag('production');
await verifyChangeRequestDialog('Enable feature toggle test in production');
await verifyChangeRequestDialog('Enable feature flag test in production');
}, 10000);

View File

@ -49,7 +49,7 @@ export const ChangeRequest: VFC<IChangeRequestProps> = ({
condition={changeRequest.features.length > 0}
show={
<Typography variant='body2' color='text.secondary'>
You request changes for these feature toggles:
You request changes for these feature flags:
</Typography>
}
/>

View File

@ -49,7 +49,7 @@ export const FeatureToggleChanges: FC<IFeatureToggleChanges> = ({
px: 3,
}}
>
<Typography>Feature toggle name: </Typography>
<Typography>Feature flag name: </Typography>
<Link
component={RouterLink}

View File

@ -12,7 +12,7 @@ export const UpdateEnabledMessage = ({
environment,
}: UpdateEnabledMsg) => (
<Typography data-testid='update-enabled-message'>
<strong>{enabled ? 'Enable' : 'Disable'}</strong> feature toggle{' '}
<strong>{enabled ? 'Enable' : 'Disable'}</strong> feature flag{' '}
<strong>{featureName}</strong> in <strong>{environment}</strong>
</Typography>
);

View File

@ -52,7 +52,7 @@ export const EnvironmentDeleteDialog = ({
caution.
</strong>{' '}
Deleting this environment will result in removing all strategies
that are active in this environment across all feature toggles.
that are active in this environment across all feature flags.
</Alert>
<EnvironmentTableSingle

View File

@ -92,8 +92,8 @@ export const EnvironmentTable = () => {
<PageContent header={header}>
<StyledAlert severity='info'>
This is the order of environments that you have today in each
feature toggle. Rearranging them here will change also the order
inside each feature toggle.
feature flag. Rearranging them here will change also the order
inside each feature flag.
</StyledAlert>
<SearchHighlightProvider value={globalFilter}>
<Table {...getTableProps()} rowHeight='compact'>

View File

@ -70,7 +70,7 @@ export const CopyFeatureToggle = () => {
const [replaceGroupId, setReplaceGroupId] = useState(true);
const [apiError, setApiError] = useState('');
const [nameError, setNameError] = useState<string | undefined>();
const [newToggleName, setNewToggleName] = useState<string>();
const [newToggleName, setnewToggleName] = useState<string>();
const { cloneFeatureToggle, validateFeatureToggleName } = useFeatureApi();
const featureId = useRequiredPathParam('featureId');
const projectId = useRequiredPathParam('projectId');
@ -85,7 +85,7 @@ export const CopyFeatureToggle = () => {
const setValue: ChangeEventHandler<HTMLInputElement> = (event) => {
const value = trim(event.target.value);
setNewToggleName(value);
setnewToggleName(value);
};
const toggleReplaceGroupId = () => {
@ -148,12 +148,12 @@ export const CopyFeatureToggle = () => {
/>
<StyledSection>
<StyledDescription>
You are about to create a new feature toggle by cloning the
configuration of feature toggle&nbsp;
You are about to create a new feature flag by cloning the
configuration of feature flag&nbsp;
<Link to={getTogglePath(projectId, featureId)}>
{featureId}
</Link>
. You must give the new feature toggle a unique name before
. You must give the new feature flag a unique name before
you can proceed.
</StyledDescription>

View File

@ -165,13 +165,13 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
onBlur={validateToggleName}
/>
<StyledInputDescription>
What kind of feature toggle do you want?
What kind of feature flag do you want?
</StyledInputDescription>
<FeatureTypeSelect
sx={styledSelectInput}
value={type}
onChange={setType}
label={'Toggle type'}
label={'Flag type'}
id='feature-type-select'
editable
data-testid={CF_TYPE_ID}
@ -184,7 +184,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
condition={editable}
show={
<StyledInputDescription>
In which project do you want to save the toggle?
In which project do you want to save the flag?
</StyledInputDescription>
}
/>
@ -206,7 +206,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
/>
<StyledInputDescription>
How would you describe your feature toggle?
How would you describe your feature flag?
</StyledInputDescription>
<StyledInput
multiline

View File

@ -92,7 +92,7 @@ export const FeatureStrategyConstraintAccordionList = forwardRef<
<Typography variant='body2'>
Constraints are advanced
targeting rules that you can use
to enable a feature toggle for a
to enable a feature flag for a
subset of your users. Read more
about constraints{' '}
<a

View File

@ -21,9 +21,7 @@ export const FeatureStrategyEnabled: FC<IFeatureStrategyEnabledProps> = ({
const featurePagePath = formatFeaturePath(projectId, featureId);
const { feature } = useFeature(projectId, featureId);
const featurePageLink = (
<Link to={featurePagePath}>feature toggle page</Link>
);
const featurePageLink = <Link to={featurePagePath}>feature flag page</Link>;
return (
<ConditionallyRender
@ -31,9 +29,9 @@ export const FeatureStrategyEnabled: FC<IFeatureStrategyEnabledProps> = ({
show={children}
elseShow={
<Alert severity='warning'>
This feature toggle is currently disabled in the{' '}
This feature flag is currently disabled in the{' '}
<strong>{environmentId}</strong> environment. Any changes
made here will not take effect until the toggle has been
made here will not take effect until the flag has been
enabled on the {featurePageLink}.
</Alert>
}

View File

@ -398,7 +398,7 @@ export const FeatureStrategyForm = ({
condition={Boolean(isChangeRequest)}
show={
<Alert severity='success'>
This feature toggle is currently enabled in the{' '}
This feature flag is currently enabled in the{' '}
<strong>{environmentId}</strong> environment.
Any changes made here will be available to users
as soon as these changes are approved and
@ -407,7 +407,7 @@ export const FeatureStrategyForm = ({
}
elseShow={
<Alert severity='success'>
This feature toggle is currently enabled in the{' '}
This feature flag is currently enabled in the{' '}
<strong>{environmentId}</strong> environment.
Any changes made here will be available to users
as soon as you hit <strong>save</strong>.

View File

@ -21,8 +21,8 @@ export const FeatureMetricsContent = ({
return (
<Box mt={6}>
<Typography variant='body1' paragraph>
We have yet to receive any metrics for this feature toggle
in the selected time period.
We have yet to receive any metrics for this feature flag in
the selected time period.
</Typography>
<Typography variant='body1' paragraph>
Please note that, since the SDKs send metrics on an

View File

@ -72,12 +72,12 @@ export const MarkCompletedDialogue = ({
mb: 4,
}}
>
Marking the feature toggle as complete does not affect any
configuration, but it moves the feature toggle into its
next life cycle stage and is an indication that you have
learned what you needed in order to progress with the
feature. It serves as a reminder to start cleaning up the
feature toggle and removing it from the code.
Marking the feature flag as complete does not affect any
configuration, but it moves the feature flag into its next
life cycle stage and is an indication that you have learned
what you needed in order to progress with the feature. It
serves as a reminder to start cleaning up the feature flag
and removing it from the code.
</Box>
<Typography

View File

@ -15,7 +15,7 @@ export const EnvironmentFooter = ({
return (
<>
<SectionSeparator>Feature toggle exposure</SectionSeparator>
<SectionSeparator>Feature flag exposure</SectionSeparator>
<div>
<FeatureMetricsStats

View File

@ -79,7 +79,7 @@ export const FeatureOverviewSidePanel = ({
<FeatureOverviewSidePanelTags
header={
<StyledHeader data-loading>
Tags for this feature toggle
Tags for this feature flag
</StyledHeader>
}
feature={feature}

View File

@ -80,12 +80,12 @@ const FeatureSettingsProjectConfirm = ({
>
<StyledContainer>
<StyledAlert severity='success'>
This feature toggle is compatible with the new
This feature flag is compatible with the new
project.
</StyledAlert>
<p>
Are you sure you want to change the project for this
toggle?
flag?
</p>
</StyledContainer>
</Dialogue>
@ -107,7 +107,7 @@ const FeatureSettingsProjectConfirm = ({
show={
<p>
<span>
The feature toggle must not have any
The feature flag must not have any
dependencies.
</span>{' '}
<br />
@ -122,9 +122,9 @@ const FeatureSettingsProjectConfirm = ({
condition={!hasSameEnvironments}
show={
<p>
In order to move a feature toggle between
two projects, both projects must have the
exact same environments enabled.
In order to move a feature flag between two
projects, both projects must have the exact
same environments enabled.
</p>
}
/>
@ -133,9 +133,9 @@ const FeatureSettingsProjectConfirm = ({
show={
<>
<p>
The feature toggle must not have any
The feature flag must not have any
pending change requests. This feature
toggle is currently referenced in the
flag is currently referenced in the
following change requests:
</p>
<StyledList>

View File

@ -135,7 +135,7 @@ const RolloutSlider = ({
<Typography variant='body2'>
The groupId is used as a seed for the hash
function, ensuring consistent feature exposure
across different feature toggles for a uniform
across different feature flags for a uniform
user experience.
</Typography>
</Box>

View File

@ -159,7 +159,7 @@ export const EdgeIntegration = () => {
and the one you should default to in most cases. It
connects to an upstream node, such as your Unleash
instance, and uses that as the source of truth for
feature toggles.
feature flags.
</Typography>
<StyledFigure>
<img src={formatAssetPath(edgeMode)} alt='test' />

View File

@ -30,7 +30,7 @@ export const PlaygroundResultFeatureStrategyList = ({
condition={feature?.strategies?.data?.length === 0}
show={
<Alert severity='warning' sx={{ mt: 2 }}>
There are no strategies added to this feature toggle in
There are no strategies added to this feature flag in
selected environment.
</Alert>
}

View File

@ -88,7 +88,7 @@ export const ImportTimeline: FC<{
Import file
</TimelineItemTitle>
<TimelineItemDescription>
Import previously exported toggle configuration from
Import previously exported flag configuration from
another Unleash instance as a JSON file
</TimelineItemDescription>
</StyledTimelineContent>
@ -126,8 +126,8 @@ export const ImportTimeline: FC<{
Finish import
</TimelineItemTitle>
<TimelineItemDescription>
Feature toggle configuration will be imported to your
new Unleash instance
Feature flag configuration will be imported to your new
Unleash instance
</TimelineItemDescription>
</StyledTimelineContent>
</TimelineItem>

View File

@ -23,18 +23,18 @@ export const ImportExplanation: FC = () => (
What is being imported?
</ImportExplanationHeader>
<ImportExplanationDescription>
Feature toggles will be imported with full configuration:
Feature flags will be imported with full configuration:
<ul>
<li>strategies</li>
<li>context fields</li>
<li>variants</li>
<li>tags</li>
<li>feature toggle status</li>
<li>feature flag status</li>
</ul>
</ImportExplanationDescription>
<ImportExplanationHeader>Exceptions?</ImportExplanationHeader>
<ImportExplanationDescription>
If the feature toggle already exists in the new instance, it will be
If the feature flag already exists in the new instance, it will be
overwritten
</ImportExplanationDescription>
<ImportExplanationHeader>What is not imported?</ImportExplanationHeader>

View File

@ -15,7 +15,7 @@ export const TableEmptyState: FC<ITablePlaceholderProps> = ({ query }) => {
})}
>
<TablePlaceholder>
No feature toggles found matching &ldquo;
No feature flags found matching &ldquo;
{query}
&rdquo;
</TablePlaceholder>
@ -29,7 +29,7 @@ export const TableEmptyState: FC<ITablePlaceholderProps> = ({ query }) => {
padding: theme.spacing(3),
})}
>
<TablePlaceholder>No feature toggles available.</TablePlaceholder>
<TablePlaceholder>No feature flags available.</TablePlaceholder>
</Box>
);
};

View File

@ -34,7 +34,7 @@ export const CollaborationModeTooltip: FC = () => {
<StyledTitle>private: </StyledTitle>
<StyledDescription>
Only admins, editors and project members can see and
access the project and associated feature toggles
access the project and associated feature flags
</StyledDescription>
</Box>
</>

View File

@ -7,9 +7,9 @@ export const FeatureTogglesLimitTooltip: FC = () => (
htmlTooltip
tooltip={
<Box>
Enforce an upper limit of the number of feature toggles that may
Enforce an upper limit of the number of feature flags that may
be created for this project. You can create unlimited feature
toggle if there is no limit set.
flag if there is no limit set.
</Box>
}
/>

View File

@ -83,14 +83,14 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
const renderActiveToggles = () => (
<StyledBoxActive>
<CheckIcon />
<span>{healthReport.activeCount} active toggles</span>
<span>{healthReport.activeCount} active flags</span>
</StyledBoxActive>
);
const renderStaleToggles = () => (
<StyledBoxStale>
<ReportProblemOutlinedIcon />
<span>{healthReport.staleCount} stale toggles</span>
<span>{healthReport.staleCount} stale flags</span>
</StyledBoxStale>
);
@ -98,7 +98,7 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
<StyledBoxStale>
<ReportProblemOutlinedIcon />
<span>
{healthReport.potentiallyStaleCount} potentially stale toggles
{healthReport.potentiallyStaleCount} potentially stale flags
</span>
</StyledBoxStale>
);
@ -107,8 +107,8 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
<HtmlTooltip
title={
<>
If your toggle exceeds the expected lifetime of its toggle
type it will be marked as potentially stale.
If your flag exceeds the expected lifetime of its flag type
it will be marked as potentially stale.
<Box sx={{ mt: 2 }}>
<a
href='https://docs.getunleash.io/reference/technical-debt#stale-and-potentially-stale-toggles'
@ -152,7 +152,7 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
/>
</Box>
<Box>
<StyledHeader>Toggle report</StyledHeader>
<StyledHeader>Flag report</StyledHeader>
<StyledList>
<li>
<ConditionallyRender
@ -164,7 +164,7 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
condition={Boolean(healthReport.activeCount)}
show={
<StyledAlignedItem>
Also includes potentially stale toggles.
Also includes potentially stale flags.
</StyledAlignedItem>
}
/>
@ -199,8 +199,8 @@ export const ReportCard = ({ healthReport }: IReportCardProps) => {
show={
<>
<StyledAlignedItem>
Review your feature toggles and delete unused
toggles.
Review your feature flags and delete unused
flags.
</StyledAlignedItem>
<Box sx={{ mt: 2 }}>
<Link

View File

@ -226,7 +226,7 @@ export const ReportTable = ({ projectId, features }: IReportTableProps) => {
elseShow={
<TablePlaceholder>
No feature flags available. Get started by
adding a new feature toggle.
adding a new feature flag.
</TablePlaceholder>
}
/>

View File

@ -89,10 +89,10 @@ export const ProjectInsightsStats = ({ stats }: IProjectStatsProps) => {
percentage
>
<HelpPopper id='avg-time-to-prod'>
How long did it take on average from a feature toggle was
How long did it take on average from a feature flag was
created until it was enabled in an environment of type
production. This is calculated only from feature toggles
with the type of "release".
production. This is calculated only from feature flags with
the type of "release".
</HelpPopper>
</StatusBox>
<StatusBox

View File

@ -41,9 +41,9 @@ export const DeleteProject = ({
<StyledContainer>
<p>
Before you can delete a project, you must first archive all the
feature toggles associated with it. Keep in mind that deleting a
project will permanently remove all the archived feature
toggles, and they cannot be recovered once deleted.
feature flags associated with it. Keep in mind that deleting a
project will permanently remove all the archived feature flags,
and they cannot be recovered once deleted.
</p>
<ConditionallyRender
condition={isEnterprise() && automatedActionsEnabled}
@ -57,7 +57,7 @@ export const DeleteProject = ({
/>
<p>
Currently there are{' '}
<strong>{featureCount} feature toggles active</strong>
<strong>{featureCount} feature flags active</strong>
</p>
<ConditionallyRender
condition={isEnterprise() && automatedActionsEnabled}

View File

@ -95,10 +95,10 @@ export const ProjectStats = ({ stats }: IProjectStatsProps) => {
percentage
>
<HelpPopper id='avg-time-to-prod'>
How long did it take on average from a feature toggle
was created until it was enabled in an environment of
type production. This is calculated only from feature
toggles with the type of "release".
How long did it take on average from a feature flag was
created until it was enabled in an environment of type
production. This is calculated only from feature flags
with the type of "release".
</HelpPopper>
</StatusBox>
</StyledWidget>

View File

@ -58,7 +58,7 @@ export const SegmentDeleteUsedSegment = ({
onClick={onClose}
>
<p>
The following feature toggles are using the{' '}
The following feature flags are using the{' '}
<strong>{segment.name}</strong> segment for their strategies:
</p>
<StyledUl>

View File

@ -242,7 +242,7 @@ const theme = {
},
/**
* For 'Seen' column on feature toggles list and other
* For 'Seen' column on feature flags list and other
*/
seen: {
unknown: '#2B2A3C',

View File

@ -227,7 +227,7 @@ export const theme = {
},
/**
* For 'Seen' column on feature toggles list and other
* For 'Seen' column on feature flags list and other
*/
seen: {
unknown: colors.grey[100],

View File

@ -69,7 +69,7 @@ declare module '@mui/material/styles' {
};
/**
* For 'Seen' column on feature toggles list and other
* For 'Seen' column on feature flags list and other
*/
seen: {
unknown: string;

View File

@ -173,7 +173,7 @@ class FeatureTagStore implements IFeatureTagStore {
}
/**
* Only gets tags for active feature toggles.
* Only gets tags for active feature flags.
*/
async getAllFeatureTags(): Promise<IFeatureTag[]> {
const rows = await this.db(TABLE)

View File

@ -1102,10 +1102,10 @@ class FeatureToggleService {
/**
* @deprecated Legacy!
*
* Used to retrieve metadata of all feature toggles defined in Unleash.
* Used to retrieve metadata of all feature flags defined in Unleash.
* @param query - Allow you to limit search based on criteria such as project, tags, namePrefix. See @IFeatureToggleQuery
* @param userId - Used to find / mark features as favorite based on users preferences
* @param archived - Return archived or active toggles
* @param archived - Return archived or active flags
* @returns
*/
async getFeatureToggles(

View File

@ -78,7 +78,7 @@ const rbacMiddleware = (
findParam('environment', req) ||
findParam('environmentId', req);
// Temporary workaround to figure out projectId for feature toggle updates.
// Temporary workaround to figure out projectId for feature flag updates.
// will be removed in Unleash v5.0
if (
!projectId &&

View File

@ -107,7 +107,7 @@ test('should trigger simple-addon eventHandler', async () => {
await addonService.createAddon(config, TEST_AUDIT_USER);
// Feature toggle was created
// Feature flag was created
await eventService.storeEvent({
type: FEATURE_CREATED,
createdBy: SYSTEM_USER.username!,