2023-05-11 20:01:08 +02:00
|
|
|
import { Typography, TypographyProps, styled } from '@mui/material';
|
2023-04-19 20:40:29 +02:00
|
|
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined';
|
|
|
|
import { Badge } from 'component/common/Badge/Badge';
|
|
|
|
import { Step } from 'react-joyride';
|
2023-07-05 11:49:18 +02:00
|
|
|
import { specificUser, gradualRollout, variants } from './demo-setup';
|
2023-05-12 16:34:59 +02:00
|
|
|
import { basePath, formatAssetPath } from 'utils/formatPath';
|
2023-05-17 10:47:19 +02:00
|
|
|
import demoUserId from 'assets/img/demo-userid.png';
|
2023-04-19 20:40:29 +02:00
|
|
|
|
|
|
|
export interface ITutorialTopicStep extends Step {
|
|
|
|
href?: string;
|
|
|
|
nextButton?: boolean;
|
|
|
|
backCloseModal?: boolean;
|
|
|
|
backCollapseExpanded?: boolean;
|
|
|
|
preventDefault?: boolean;
|
|
|
|
anyClick?: boolean;
|
|
|
|
optional?: boolean;
|
2023-04-28 13:54:58 +02:00
|
|
|
focus?: boolean | string;
|
2023-05-09 09:04:39 +02:00
|
|
|
delay?: number;
|
2023-04-19 20:40:29 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface ITutorialTopic {
|
|
|
|
title: string;
|
|
|
|
setup?: () => Promise<void>;
|
|
|
|
steps: ITutorialTopicStep[];
|
|
|
|
}
|
|
|
|
|
|
|
|
const Description = (props: TypographyProps) => (
|
2023-10-02 14:25:46 +02:00
|
|
|
<Typography variant='body2' color='text.secondary' {...props} />
|
2023-04-19 20:40:29 +02:00
|
|
|
);
|
|
|
|
|
2023-05-11 20:01:08 +02:00
|
|
|
const StyledImg = styled('img')(({ theme }) => ({
|
|
|
|
borderRadius: theme.shape.borderRadius,
|
|
|
|
}));
|
|
|
|
|
2023-04-27 09:15:17 +02:00
|
|
|
const PROJECT = 'demo-app';
|
|
|
|
const ENVIRONMENT = 'dev';
|
|
|
|
|
2023-04-19 20:40:29 +02:00
|
|
|
export const TOPICS: ITutorialTopic[] = [
|
|
|
|
{
|
|
|
|
title: 'Enable/disable a feature toggle',
|
|
|
|
steps: [
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-19 20:40:29 +02:00
|
|
|
target: 'body',
|
|
|
|
placement: 'center',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/feature-toggles'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
|
|
|
Feature toggles
|
|
|
|
</a>{' '}
|
|
|
|
are the central concept of Unleash.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
Feature toggles are organized within{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/projects'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
|
|
|
projects
|
|
|
|
</a>
|
|
|
|
.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
},
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-27 09:15:17 +02:00
|
|
|
target: `div[data-testid="TOGGLE-demoApp.step1-${ENVIRONMENT}"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
2023-05-09 21:33:01 +02:00
|
|
|
Enable or disable the feature for everyone by
|
|
|
|
toggling the highlighted switch.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
<Badge sx={{ mt: 2 }} icon={<InfoOutlinedIcon />}>
|
2023-05-09 21:33:01 +02:00
|
|
|
Look at the demo page to see your changes!
|
2023-04-19 20:40:29 +02:00
|
|
|
</Badge>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Enable for a specific user',
|
2023-07-05 11:49:18 +02:00
|
|
|
setup: specificUser,
|
2023-04-19 20:40:29 +02:00
|
|
|
steps: [
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-19 20:40:29 +02:00
|
|
|
target: 'body',
|
|
|
|
placement: 'center',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
|
|
|
Activation strategies
|
|
|
|
</a>{' '}
|
|
|
|
give you more control over when a feature should be
|
|
|
|
enabled.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
Let's try enabling a feature toggle only for a
|
|
|
|
specific user.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
},
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-27 09:15:17 +02:00
|
|
|
target: `a[href="${basePath}/projects/${PROJECT}/features/demoApp.step2"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-05-09 21:30:18 +02:00
|
|
|
First, open the feature toggle configuration for{' '}
|
2023-10-02 14:25:46 +02:00
|
|
|
<Badge as='span'>demoApp.step2</Badge> by using this
|
2023-05-09 21:30:18 +02:00
|
|
|
link.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
preventDefault: true,
|
|
|
|
},
|
|
|
|
{
|
2023-04-27 09:15:17 +02:00
|
|
|
href: `/projects/${PROJECT}/features/demoApp.step2`,
|
|
|
|
target: `div[data-testid="FEATURE_ENVIRONMENT_ACCORDION_${ENVIRONMENT}"] button`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-05-09 21:30:18 +02:00
|
|
|
Add a new strategy to this environment by using this
|
2023-04-19 20:40:29 +02:00
|
|
|
button.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
2023-06-19 10:17:40 +02:00
|
|
|
target: `a[href="${basePath}/projects/${PROJECT}/features/demoApp.step2/strategies/create?environmentId=${ENVIRONMENT}&strategyName=default&defaultStrategy=false"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-10-02 14:25:46 +02:00
|
|
|
Select the <Badge as='span'>Standard</Badge> strategy
|
2023-04-19 20:40:29 +02:00
|
|
|
type.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
placement: 'right',
|
2023-06-30 12:15:25 +02:00
|
|
|
optional: true,
|
2023-04-19 20:40:29 +02:00
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
2023-04-24 14:02:06 +02:00
|
|
|
target: 'button[data-testid="ADD_CONSTRAINT_BUTTON"]',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/strategy-constraints'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-24 14:02:06 +02:00
|
|
|
>
|
|
|
|
Strategy constraints
|
|
|
|
</a>{' '}
|
|
|
|
are conditions that must be satisfied for an{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-24 14:02:06 +02:00
|
|
|
>
|
|
|
|
activation strategy
|
|
|
|
</a>{' '}
|
|
|
|
to be evaluated for a feature toggle.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
2023-05-09 21:30:18 +02:00
|
|
|
Add a constraint by using this button.
|
2023-04-24 14:02:06 +02:00
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: '#context-field-select',
|
|
|
|
content: (
|
2023-05-09 21:30:18 +02:00
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/unleash-context'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-05-09 21:30:18 +02:00
|
|
|
>
|
|
|
|
Unleash context
|
|
|
|
</a>{' '}
|
|
|
|
contains information relating to the current feature
|
|
|
|
toggle request.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
Select the context field by using this dropdown.
|
|
|
|
</Description>
|
|
|
|
</>
|
2023-04-24 14:02:06 +02:00
|
|
|
),
|
|
|
|
backCloseModal: true,
|
|
|
|
anyClick: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'li[data-testid="SELECT_ITEM_ID-userId"]',
|
|
|
|
content: (
|
|
|
|
<Description>
|
2023-10-02 14:25:46 +02:00
|
|
|
Select the <Badge as='span'>userId</Badge> context
|
2023-04-24 14:02:06 +02:00
|
|
|
field.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
placement: 'right',
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'div[data-testid="CONSTRAINT_VALUES_INPUT"]',
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
2023-10-02 14:25:46 +02:00
|
|
|
Enter your <Badge as='span'>userId</Badge>
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
2023-05-11 20:01:08 +02:00
|
|
|
<Badge
|
|
|
|
sx={{ mt: 2, mb: 1, width: '100%' }}
|
|
|
|
icon={<InfoOutlinedIcon />}
|
|
|
|
>
|
2023-04-19 20:40:29 +02:00
|
|
|
You can find your userId on the demo page.
|
|
|
|
</Badge>
|
2023-05-11 20:01:08 +02:00
|
|
|
<StyledImg
|
2023-05-17 10:47:19 +02:00
|
|
|
src={formatAssetPath(demoUserId)}
|
2023-10-02 14:25:46 +02:00
|
|
|
alt='You can find your userId on the demo page.'
|
2023-05-11 20:01:08 +02:00
|
|
|
/>
|
2023-05-09 21:30:18 +02:00
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
When you're done, use the "Next" button in the
|
|
|
|
dialog.
|
|
|
|
</Description>
|
2023-04-19 20:40:29 +02:00
|
|
|
</>
|
|
|
|
),
|
2023-05-11 20:01:08 +02:00
|
|
|
placement: 'right',
|
2023-04-19 20:40:29 +02:00
|
|
|
nextButton: true,
|
2023-04-28 13:54:58 +02:00
|
|
|
focus: 'input',
|
2023-04-24 14:02:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="CONSTRAINT_VALUES_ADD_BUTTON"]',
|
2023-05-09 21:30:18 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Add the constraint value by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-04-24 14:02:06 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="CONSTRAINT_SAVE_BUTTON"]',
|
2023-05-09 21:30:18 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Save the constraint by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="STRATEGY_FORM_SUBMIT_ID"]',
|
2023-05-09 21:30:18 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Save and apply your strategy by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-04-24 14:02:06 +02:00
|
|
|
backCloseModal: true,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="DIALOGUE_CONFIRM_ID"]',
|
2023-05-09 21:30:18 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Confirm your changes by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-05-03 20:47:35 +02:00
|
|
|
optional: true,
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
|
|
|
target: `div[data-testid="TOGGLE-demoApp.step2-${ENVIRONMENT}"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
2023-05-03 20:47:35 +02:00
|
|
|
<Description>
|
2023-05-09 21:30:18 +02:00
|
|
|
Finally, enable or disable the feature for your user
|
|
|
|
by toggling the highlighted switch.
|
2023-05-03 20:47:35 +02:00
|
|
|
</Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
<Badge sx={{ mt: 2 }} icon={<InfoOutlinedIcon />}>
|
2023-05-03 20:47:35 +02:00
|
|
|
Look at the demo page to see your changes!
|
2023-04-19 20:40:29 +02:00
|
|
|
</Badge>
|
|
|
|
</>
|
|
|
|
),
|
2023-05-03 20:47:35 +02:00
|
|
|
nextButton: true,
|
2023-05-09 09:04:39 +02:00
|
|
|
delay: 500,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Adjust gradual rollout',
|
|
|
|
setup: gradualRollout,
|
|
|
|
steps: [
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-19 20:40:29 +02:00
|
|
|
target: 'body',
|
|
|
|
placement: 'center',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies#gradual-rollout'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
|
|
|
Gradual rollout
|
|
|
|
</a>{' '}
|
|
|
|
is one of the available{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
|
|
|
activation strategies
|
|
|
|
</a>
|
|
|
|
.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
Let's try enabling a feature toggle only for a
|
|
|
|
certain percentage of users.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
},
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-27 09:15:17 +02:00
|
|
|
target: `a[href="${basePath}/projects/${PROJECT}/features/demoApp.step3"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
First, open the feature toggle configuration for{' '}
|
2023-10-02 14:25:46 +02:00
|
|
|
<Badge as='span'>demoApp.step3</Badge> by using this
|
2023-05-09 17:24:28 +02:00
|
|
|
link.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
preventDefault: true,
|
|
|
|
},
|
|
|
|
{
|
2023-04-27 09:15:17 +02:00
|
|
|
href: `/projects/${PROJECT}/features/demoApp.step3`,
|
|
|
|
target: `div[data-testid="FEATURE_ENVIRONMENT_ACCORDION_${ENVIRONMENT}"] .MuiAccordionSummary-expandIconWrapper`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Expand the environment card to see all the defined
|
2023-05-09 17:24:28 +02:00
|
|
|
strategies by using the arrow button.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
2023-04-27 09:15:17 +02:00
|
|
|
target: `div[data-testid="FEATURE_ENVIRONMENT_ACCORDION_${ENVIRONMENT}"].Mui-expanded a[data-testid="STRATEGY_EDIT-flexibleRollout"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
Edit the existing gradual rollout strategy by using the
|
|
|
|
"Edit" button.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
backCollapseExpanded: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'span[data-testid="ROLLOUT_SLIDER_ID"]',
|
|
|
|
content: (
|
2023-05-09 17:24:28 +02:00
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
Change the rollout percentage by adjusting the
|
|
|
|
percentage slider.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
When you're done, use the "Next" button in the
|
|
|
|
dialog.
|
|
|
|
</Description>
|
|
|
|
</>
|
2023-04-19 20:40:29 +02:00
|
|
|
),
|
|
|
|
backCloseModal: true,
|
2023-04-24 14:02:06 +02:00
|
|
|
nextButton: true,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="STRATEGY_FORM_SUBMIT_ID"]',
|
2023-05-09 17:24:28 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Save and apply your strategy by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="DIALOGUE_CONFIRM_ID"]',
|
2023-05-09 17:24:28 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Confirm your changes by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
2023-05-03 20:47:35 +02:00
|
|
|
optional: true,
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
|
|
|
target: `div[data-testid="TOGGLE-demoApp.step3-${ENVIRONMENT}"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
2023-05-03 20:47:35 +02:00
|
|
|
<Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
Finally, enable or disable the feature with the new
|
|
|
|
variant by toggling the highlighted switch.
|
2023-05-03 20:47:35 +02:00
|
|
|
</Description>
|
2023-05-09 17:24:28 +02:00
|
|
|
<Badge sx={{ mt: 2 }} icon={<InfoOutlinedIcon />}>
|
2023-05-03 20:47:35 +02:00
|
|
|
Look at the demo page to see your changes!
|
2023-04-19 20:40:29 +02:00
|
|
|
</Badge>
|
|
|
|
</>
|
|
|
|
),
|
2023-05-03 20:47:35 +02:00
|
|
|
nextButton: true,
|
2023-05-09 09:04:39 +02:00
|
|
|
delay: 500,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: 'Adjust variants',
|
|
|
|
setup: variants,
|
|
|
|
steps: [
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-19 20:40:29 +02:00
|
|
|
target: 'body',
|
|
|
|
placement: 'center',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/strategy-variants'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-04-19 20:40:29 +02:00
|
|
|
>
|
2023-08-11 09:43:41 +02:00
|
|
|
Strategy variants
|
2023-04-19 20:40:29 +02:00
|
|
|
</a>{' '}
|
2023-08-09 13:11:07 +02:00
|
|
|
allow you to define different values for a feature
|
|
|
|
toggle. They can be used for A/B testing or
|
2023-04-19 20:40:29 +02:00
|
|
|
segmenting your users.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
2023-08-11 09:43:41 +02:00
|
|
|
Let's try adding a variant to a strategy.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
},
|
|
|
|
{
|
2023-05-02 15:20:23 +02:00
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
2023-04-27 09:15:17 +02:00
|
|
|
target: `a[href="${basePath}/projects/${PROJECT}/features/demoApp.step4"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-05-09 12:47:55 +02:00
|
|
|
First, open the feature toggle configuration for{' '}
|
2023-10-02 14:25:46 +02:00
|
|
|
<Badge as='span'>demoApp.step4</Badge> by using this
|
2023-05-09 12:47:55 +02:00
|
|
|
link.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
preventDefault: true,
|
|
|
|
},
|
|
|
|
{
|
2023-04-27 09:15:17 +02:00
|
|
|
href: `/projects/${PROJECT}/features/demoApp.step4`,
|
2023-08-10 11:55:33 +02:00
|
|
|
target: `div[data-testid="FEATURE_ENVIRONMENT_ACCORDION_${ENVIRONMENT}"] button`,
|
2023-05-09 12:47:55 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-08-10 11:55:33 +02:00
|
|
|
Add a new strategy to this environment by using this
|
|
|
|
button.
|
2023-05-09 12:47:55 +02:00
|
|
|
</Description>
|
|
|
|
),
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
2023-08-10 11:55:33 +02:00
|
|
|
target: 'button[data-testid="ADD_CONSTRAINT_BUTTON"]',
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
2023-08-10 11:55:33 +02:00
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/strategy-constraints'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-08-10 11:55:33 +02:00
|
|
|
>
|
|
|
|
Strategy constraints
|
|
|
|
</a>{' '}
|
|
|
|
are conditions that must be satisfied for an{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-08-10 11:55:33 +02:00
|
|
|
>
|
|
|
|
activation strategy
|
|
|
|
</a>{' '}
|
|
|
|
to be evaluated for a feature toggle.
|
2023-05-09 12:47:55 +02:00
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
2023-08-10 11:55:33 +02:00
|
|
|
Add a constraint by using this button.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
2023-08-10 11:55:33 +02:00
|
|
|
target: '#context-field-select',
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
2023-05-09 12:47:55 +02:00
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/unleash-context'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-05-09 12:47:55 +02:00
|
|
|
>
|
2023-08-10 11:55:33 +02:00
|
|
|
Unleash context
|
2023-05-09 12:47:55 +02:00
|
|
|
</a>{' '}
|
2023-08-10 11:55:33 +02:00
|
|
|
contains information relating to the current feature
|
|
|
|
toggle request.
|
2023-05-09 12:47:55 +02:00
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
2023-08-10 11:55:33 +02:00
|
|
|
Select the context field by using this dropdown.
|
2023-05-09 12:47:55 +02:00
|
|
|
</Description>
|
|
|
|
</>
|
2023-04-19 20:40:29 +02:00
|
|
|
),
|
|
|
|
backCloseModal: true,
|
2023-08-10 11:55:33 +02:00
|
|
|
anyClick: true,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'li[data-testid="SELECT_ITEM_ID-userId"]',
|
|
|
|
content: (
|
|
|
|
<Description>
|
2023-10-02 14:25:46 +02:00
|
|
|
Select the <Badge as='span'>userId</Badge> context
|
2023-04-19 20:40:29 +02:00
|
|
|
field.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
placement: 'right',
|
|
|
|
backCloseModal: true,
|
|
|
|
},
|
|
|
|
{
|
2023-08-10 11:55:33 +02:00
|
|
|
target: 'div[data-testid="CONSTRAINT_VALUES_INPUT"]',
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
2023-10-02 14:25:46 +02:00
|
|
|
Enter your <Badge as='span'>userId</Badge>
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
2023-05-11 20:01:08 +02:00
|
|
|
<Badge
|
|
|
|
sx={{ mt: 2, mb: 1, width: '100%' }}
|
|
|
|
icon={<InfoOutlinedIcon />}
|
|
|
|
>
|
2023-04-19 20:40:29 +02:00
|
|
|
You can find your userId on the demo page.
|
|
|
|
</Badge>
|
2023-05-11 20:01:08 +02:00
|
|
|
<StyledImg
|
2023-05-17 10:47:19 +02:00
|
|
|
src={formatAssetPath(demoUserId)}
|
2023-10-02 14:25:46 +02:00
|
|
|
alt='You can find your userId on the demo page.'
|
2023-05-11 20:01:08 +02:00
|
|
|
/>
|
2023-05-09 12:47:55 +02:00
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
When you're done, use the "Next" button in the
|
|
|
|
dialog.
|
|
|
|
</Description>
|
2023-04-19 20:40:29 +02:00
|
|
|
</>
|
|
|
|
),
|
2023-05-11 20:01:08 +02:00
|
|
|
placement: 'right',
|
2023-04-19 20:40:29 +02:00
|
|
|
nextButton: true,
|
2023-08-10 11:55:33 +02:00
|
|
|
focus: 'input',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="CONSTRAINT_VALUES_ADD_BUTTON"]',
|
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Add the constraint value by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="CONSTRAINT_SAVE_BUTTON"]',
|
|
|
|
content: (
|
|
|
|
<Description>
|
|
|
|
Save the constraint by using this button.
|
|
|
|
</Description>
|
|
|
|
),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="ADD_STRATEGY_VARIANT_BUTTON"]',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/strategy-variants'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-08-10 11:55:33 +02:00
|
|
|
>
|
|
|
|
Strategy variants
|
|
|
|
</a>{' '}
|
|
|
|
allow to attach one or more values to your{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/activation-strategies'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-08-10 11:55:33 +02:00
|
|
|
>
|
|
|
|
activation strategy
|
|
|
|
</a>{' '}
|
|
|
|
.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
Add a strategy variant by using this button.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
2023-04-19 20:40:29 +02:00
|
|
|
backCloseModal: true,
|
2023-08-10 11:55:33 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'div[data-testid="VARIANT"]:last-of-type div[data-testid="VARIANT_NAME_INPUT"]',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
Enter a name for your variant e.g.{' '}
|
2023-10-02 14:25:46 +02:00
|
|
|
<Badge as='span'>color</Badge>
|
2023-08-10 11:55:33 +02:00
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
When you're done, use the "Next" button in the
|
|
|
|
dialog.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
2023-04-28 13:54:58 +02:00
|
|
|
focus: 'input',
|
2023-08-10 11:55:33 +02:00
|
|
|
backCloseModal: true,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
{
|
2023-08-10 11:55:33 +02:00
|
|
|
target: 'div[data-testid="VARIANT"]:last-of-type #variant-payload-value',
|
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
|
|
|
Enter a{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://developer.mozilla.org/en-US/docs/Web/CSS/named-color'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-08-10 11:55:33 +02:00
|
|
|
>
|
|
|
|
color
|
|
|
|
</a>{' '}
|
|
|
|
as the payload. It will be passed along and used in
|
|
|
|
the demo website.
|
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
It can be any color. For example, you can use one of
|
2023-10-02 14:25:46 +02:00
|
|
|
these: <Badge as='span'>teal</Badge>,{' '}
|
|
|
|
<Badge as='span'>orange</Badge> or{' '}
|
|
|
|
<Badge as='span'>purple</Badge>
|
2023-08-10 11:55:33 +02:00
|
|
|
</Description>
|
|
|
|
<Description sx={{ mt: 1 }}>
|
|
|
|
When you're done, use the "Next" button in the
|
|
|
|
dialog.
|
|
|
|
</Description>
|
|
|
|
</>
|
|
|
|
),
|
|
|
|
nextButton: true,
|
|
|
|
focus: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
target: 'button[data-testid="STRATEGY_FORM_SUBMIT_ID"]',
|
2023-05-09 12:47:55 +02:00
|
|
|
content: (
|
|
|
|
<Description>
|
2023-08-10 11:55:33 +02:00
|
|
|
Save and apply your strategy by using this button.
|
2023-05-09 12:47:55 +02:00
|
|
|
</Description>
|
|
|
|
),
|
2023-08-10 11:55:33 +02:00
|
|
|
backCloseModal: true,
|
2023-05-03 20:47:35 +02:00
|
|
|
},
|
|
|
|
{
|
|
|
|
href: `/projects/${PROJECT}?sort=name`,
|
|
|
|
target: `div[data-testid="TOGGLE-demoApp.step4-${ENVIRONMENT}"]`,
|
2023-04-19 20:40:29 +02:00
|
|
|
content: (
|
|
|
|
<>
|
|
|
|
<Description>
|
2023-05-09 12:47:55 +02:00
|
|
|
Finally, enable or disable the feature with the new
|
|
|
|
variant by toggling the highlighted switch.
|
2023-04-19 20:40:29 +02:00
|
|
|
</Description>
|
2023-05-09 12:47:55 +02:00
|
|
|
<Badge sx={{ mt: 2 }} icon={<InfoOutlinedIcon />}>
|
2023-05-03 20:47:35 +02:00
|
|
|
Look at the demo page to see your changes!
|
2023-04-19 20:40:29 +02:00
|
|
|
</Badge>
|
|
|
|
</>
|
|
|
|
),
|
2023-05-03 20:47:35 +02:00
|
|
|
nextButton: true,
|
2023-05-09 09:04:39 +02:00
|
|
|
delay: 500,
|
2023-04-19 20:40:29 +02:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|