mirror of
https://github.com/Unleash/unleash.git
synced 2025-06-09 01:17:06 +02:00
bug fix
This commit is contained in:
parent
6e190834ff
commit
b32ab004c8
@ -8,7 +8,7 @@ import { useStyles } from './PlaygroundResultFeatureDetails.styles';
|
|||||||
import { CloseOutlined } from '@mui/icons-material';
|
import { CloseOutlined } from '@mui/icons-material';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender';
|
import { ConditionallyRender } from '../../../../../common/ConditionallyRender/ConditionallyRender';
|
||||||
import { checkForEmptyValues } from './helpers';
|
import { checkForEmptyValues, hasCustomStrategies } from './helpers';
|
||||||
|
|
||||||
interface PlaygroundFeatureResultDetailsProps {
|
interface PlaygroundFeatureResultDetailsProps {
|
||||||
feature: PlaygroundFeatureSchema;
|
feature: PlaygroundFeatureSchema;
|
||||||
@ -41,6 +41,10 @@ export const PlaygroundResultFeatureDetails = ({
|
|||||||
? 'You did not provide a value for your context field in step 2 of the configuration'
|
? 'You did not provide a value for your context field in step 2 of the configuration'
|
||||||
: undefined;
|
: undefined;
|
||||||
|
|
||||||
|
const customStrategiesTxt = hasCustomStrategies(feature)
|
||||||
|
? `You have custom strategies. Custom strategies can't be evaluated and they will be set as Unevaluated`
|
||||||
|
: undefined;
|
||||||
|
|
||||||
const onCloseClick =
|
const onCloseClick =
|
||||||
onClose &&
|
onClose &&
|
||||||
((event: React.SyntheticEvent) => {
|
((event: React.SyntheticEvent) => {
|
||||||
@ -82,6 +86,14 @@ export const PlaygroundResultFeatureDetails = ({
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
<ConditionallyRender
|
||||||
|
condition={Boolean(customStrategiesTxt)}
|
||||||
|
show={
|
||||||
|
<div className={styles.alertRow}>
|
||||||
|
<Alert color={'info'}>{customStrategiesTxt}</Alert>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
/>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import { PlaygroundFeatureSchema } from '../../../../../../hooks/api/actions/usePlayground/playground.model';
|
||||||
|
|
||||||
|
export const DEFAULT_STRATEGIES = [
|
||||||
|
'default',
|
||||||
|
'applicationHostname',
|
||||||
|
'flexibleRollout',
|
||||||
|
'gradualRolloutRandom',
|
||||||
|
'gradualRolloutSessionId',
|
||||||
|
'gradualRolloutUserId',
|
||||||
|
'remoteAddress',
|
||||||
|
'userWithId',
|
||||||
|
];
|
||||||
|
|
||||||
export function checkForEmptyValues(object?: Object): boolean {
|
export function checkForEmptyValues(object?: Object): boolean {
|
||||||
if (object === undefined) {
|
if (object === undefined) {
|
||||||
return true;
|
return true;
|
||||||
@ -6,3 +19,9 @@ export function checkForEmptyValues(object?: Object): boolean {
|
|||||||
v && typeof v === 'object' ? checkForEmptyValues(v) : v === null
|
v && typeof v === 'object' ? checkForEmptyValues(v) : v === null
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const hasCustomStrategies = (feature: PlaygroundFeatureSchema) => {
|
||||||
|
return feature.strategies?.data?.find(strategy =>
|
||||||
|
DEFAULT_STRATEGIES.includes(strategy.name)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
@ -25,7 +25,7 @@ const StyledItemWrapper = styled('div')(({ theme }) => ({
|
|||||||
display: 'flex',
|
display: 'flex',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
margin: theme.spacing(0.5),
|
margin: theme.spacing(0.5, 0),
|
||||||
gap: theme.spacing(1),
|
gap: theme.spacing(1),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ export const PlaygroundResultFeatureStrategyItem = ({
|
|||||||
const Icon = getFeatureStrategyIcon(strategy.name);
|
const Icon = getFeatureStrategyIcon(strategy.name);
|
||||||
const label =
|
const label =
|
||||||
result.evaluationStatus === 'incomplete'
|
result.evaluationStatus === 'incomplete'
|
||||||
? 'Unknown'
|
? 'Unevaluated'
|
||||||
: result.enabled
|
: result.enabled
|
||||||
? 'True'
|
? 'True'
|
||||||
: 'False';
|
: 'False';
|
||||||
@ -87,7 +87,7 @@ export const PlaygroundResultFeatureStrategyItem = ({
|
|||||||
label={label}
|
label={label}
|
||||||
size={
|
size={
|
||||||
result.evaluationStatus === 'incomplete'
|
result.evaluationStatus === 'incomplete'
|
||||||
? 'medium'
|
? 'large'
|
||||||
: 'default'
|
: 'default'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
@ -20,7 +20,7 @@ interface PlaygroundResultStrategyExecutionProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const StyledStrategyExecutionWrapper = styled('div')(({ theme }) => ({
|
const StyledStrategyExecutionWrapper = styled('div')(({ theme }) => ({
|
||||||
padding: theme.spacing(1),
|
padding: theme.spacing(0),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const StyledParamWrapper = styled('div')(({ theme }) => ({
|
const StyledParamWrapper = styled('div')(({ theme }) => ({
|
||||||
|
Loading…
Reference in New Issue
Block a user