2022-05-02 15:52:41 +02:00
|
|
|
import { Alert } from '@mui/material';
|
2022-06-02 10:58:55 +02:00
|
|
|
import { useSegmentLimits } from 'hooks/api/getters/useSegmentLimits/useSegmentLimits';
|
2022-04-07 14:47:24 +02:00
|
|
|
|
2023-03-02 15:13:27 +01:00
|
|
|
export const SegmentDocsValuesInfo = () => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { segmentValuesLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof segmentValuesLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
2023-10-02 14:25:46 +02:00
|
|
|
<Alert severity='info'>
|
2023-03-02 15:13:27 +01:00
|
|
|
A segment can have{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/segments#segment-limits'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-03-02 15:13:27 +01:00
|
|
|
>
|
|
|
|
at most {segmentValuesLimit} across all of its contraints
|
|
|
|
</a>
|
|
|
|
. <SegmentLimitsLink />
|
2022-04-07 14:47:24 +02:00
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SegmentDocsValuesError = (props: { values: number }) => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { segmentValuesLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof segmentValuesLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
2023-10-02 14:25:46 +02:00
|
|
|
<Alert severity='error'>
|
2023-03-02 15:13:27 +01:00
|
|
|
A segment can have{' '}
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://docs.getunleash.io/reference/segments#segment-limits'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2023-03-02 15:13:27 +01:00
|
|
|
>
|
|
|
|
at most {segmentValuesLimit} across all of its contraints
|
|
|
|
</a>
|
|
|
|
. This segment has {props.values}{' '}
|
2022-04-07 14:47:24 +02:00
|
|
|
{props.values === 1 ? 'value' : 'values'}.
|
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SegmentDocsStrategyWarning = () => {
|
2022-06-02 10:58:55 +02:00
|
|
|
const { strategySegmentsLimit } = useSegmentLimits();
|
|
|
|
|
|
|
|
if (typeof strategySegmentsLimit === 'undefined') {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2022-04-07 14:47:24 +02:00
|
|
|
return (
|
2023-10-02 14:25:46 +02:00
|
|
|
<Alert severity='warning'>
|
2023-03-02 15:13:27 +01:00
|
|
|
You can't apply more than {strategySegmentsLimit} segments to a
|
|
|
|
strategy. <SegmentLimitsLink />
|
2022-04-07 14:47:24 +02:00
|
|
|
</Alert>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const SegmentLimitsLink = () => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<a
|
2023-10-02 14:25:46 +02:00
|
|
|
href='https://slack.unleash.run'
|
|
|
|
target='_blank'
|
|
|
|
rel='noreferrer'
|
2022-04-07 14:47:24 +02:00
|
|
|
>
|
2023-03-02 15:13:27 +01:00
|
|
|
Get in touch
|
2022-04-07 14:47:24 +02:00
|
|
|
</a>{' '}
|
2023-03-02 15:13:27 +01:00
|
|
|
if you'd like to increase this limit.
|
2022-04-07 14:47:24 +02:00
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export const segmentsDocsLink = 'https://docs.getunleash.io/reference/segments';
|