2022-05-02 15:52:41 +02:00
|
|
|
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';
|
2022-05-31 10:50:24 +02:00
|
|
|
import { ReactComponent as RolloutIcon } from 'assets/icons/rollout.svg';
|
2022-03-09 14:59:24 +01:00
|
|
|
import { ElementType } from 'react';
|
|
|
|
|
|
|
|
export const formatStrategyName = (strategyName: string): string => {
|
|
|
|
return formattedStrategyNames[strategyName] ?? strategyName;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const getFeatureStrategyIcon = (strategyName: string): ElementType => {
|
|
|
|
switch (strategyName) {
|
|
|
|
case 'remoteAddress':
|
|
|
|
return LanguageIcon;
|
|
|
|
case 'flexibleRollout':
|
|
|
|
return RolloutIcon;
|
|
|
|
case 'userWithId':
|
|
|
|
return PeopleIcon;
|
|
|
|
case 'applicationHostname':
|
|
|
|
return LocationOnIcon;
|
|
|
|
default:
|
|
|
|
return PowerSettingsNewIcon;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const formattedStrategyNames: Record<string, string> = {
|
|
|
|
applicationHostname: 'Hosts',
|
|
|
|
default: 'Standard',
|
|
|
|
flexibleRollout: 'Gradual rollout',
|
|
|
|
gradualRolloutRandom: 'Randomized',
|
|
|
|
gradualRolloutSessionId: 'Sessions',
|
|
|
|
gradualRolloutUserId: 'Users',
|
|
|
|
remoteAddress: 'IPs',
|
|
|
|
userWithId: 'UserIDs',
|
|
|
|
};
|