mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-28 17:55:15 +02:00
* fix playground border radius consistency * improve playground alerts * fix: playground segments constraint type logic * fix: refactor segment execution * fix: comments * fix: add summary width * align playground spacing and borders * fix build - ts segment type in playground * fix status cell logic * update playground disabled env info * fix playground filter by status and sort Co-authored-by: Nuno Góis <github@nunogois.com> Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com> Co-authored-by: andreas-unleash <104830839+andreas-unleash@users.noreply.github.com> Co-authored-by: Nuno Góis <github@nunogois.com>
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
import { FC, ElementType } from 'react';
|
|
import { SvgIcon } from '@mui/material';
|
|
import LocationOnIcon from '@mui/icons-material/LocationOn';
|
|
import PeopleIcon from '@mui/icons-material/People';
|
|
import LanguageIcon from '@mui/icons-material/Language';
|
|
import PowerSettingsNewIcon from '@mui/icons-material/PowerSettingsNew';
|
|
import CodeIcon from '@mui/icons-material/Code';
|
|
import { ReactComponent as RolloutIcon } from 'assets/icons/rollout.svg';
|
|
|
|
export const formatStrategyName = (strategyName: string): string => {
|
|
return formattedStrategyNames[strategyName] ?? strategyName;
|
|
};
|
|
|
|
const RolloutSvgIcon: FC = props => (
|
|
<SvgIcon
|
|
{...props}
|
|
component={rest => <RolloutIcon {...rest} />}
|
|
inheritViewBox
|
|
/>
|
|
);
|
|
|
|
export const getFeatureStrategyIcon = (strategyName: string): ElementType => {
|
|
switch (strategyName) {
|
|
case 'default':
|
|
return PowerSettingsNewIcon;
|
|
case 'remoteAddress':
|
|
return LanguageIcon;
|
|
case 'flexibleRollout':
|
|
return RolloutSvgIcon;
|
|
case 'userWithId':
|
|
return PeopleIcon;
|
|
case 'applicationHostname':
|
|
return LocationOnIcon;
|
|
default:
|
|
return CodeIcon;
|
|
}
|
|
};
|
|
|
|
export const formattedStrategyNames: Record<string, string> = {
|
|
applicationHostname: 'Hosts',
|
|
default: 'Standard',
|
|
flexibleRollout: 'Gradual rollout',
|
|
gradualRolloutRandom: 'Randomized',
|
|
gradualRolloutSessionId: 'Sessions',
|
|
gradualRolloutUserId: 'Users',
|
|
remoteAddress: 'IPs',
|
|
userWithId: 'UserIDs',
|
|
};
|