1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-23 00:22:19 +01:00
This commit is contained in:
andreas-unleash 2022-07-29 11:37:44 +03:00
parent a0a7c83366
commit 61c8c4d66b
4 changed files with 28 additions and 15 deletions

View File

@ -67,7 +67,6 @@ export const ConstraintAccordionViewHeaderInfo = ({
<ConditionallyRender <ConditionallyRender
condition={ condition={
result !== undefined && result !== undefined &&
!Boolean(result) &&
Boolean(playgroundContext) Boolean(playgroundContext)
} }
show={ show={

View File

@ -30,30 +30,43 @@ export const FeatureResultInfoPopoverCell = ({
setOpen(!open); setOpen(!open);
}; };
const dummyPlaygroundFeatureTrue: PlaygroundFeatureSchema = {
name: feature?.name as any,
projectId: 'default',
isEnabled: true,
} as any;
const dummyPlaygroundFeatureFalse: PlaygroundFeatureSchema = {
name: feature?.name as any,
projectId: 'default',
isEnabled: false,
} as any;
const strategies: PlaygroundFeatureStrategyResult[] = [ const strategies: PlaygroundFeatureStrategyResult[] = [
{ {
name: 'default', name: 'default',
id: 'strategy-id', id: 'strategy-id',
parameters: {}, parameters: {},
result: true, result: feature?.isEnabled as any,
constraints: [ constraints: [
{ {
result: false, result: true,
contextName: 'appName', contextName: 'appName',
operator: 'IN', operator: 'IN',
caseInsensitive: true, caseInsensitive: false,
inverted: false, inverted: false,
values: [ values: [
'a', 'MyApp',
'b', 'MyOtherApp',
'sdlghigoiahr;g', 'Unleash',
'WOGIHwegoihwlwEGHLwgklWEGK;L',
], ],
}, },
], ],
segments: [ segments: [
{ {
result: true, result: false,
id: 5, id: 5,
name: 'my-segment', name: 'my-segment',
constraints: [ constraints: [
@ -63,7 +76,7 @@ export const FeatureResultInfoPopoverCell = ({
operator: 'IN', operator: 'IN',
caseInsensitive: false, caseInsensitive: false,
inverted: false, inverted: false,
values: ['a', 'b'], values: ['development'],
}, },
], ],
}, },
@ -94,7 +107,7 @@ export const FeatureResultInfoPopoverCell = ({
}} }}
classes={{ paper: styles.popoverPaper }} classes={{ paper: styles.popoverPaper }}
> >
<PlaygroundResultFeatureDetails feature={feature} /> <PlaygroundResultFeatureDetails feature={feature.isEnabled ? dummyPlaygroundFeatureTrue : dummyPlaygroundFeatureFalse} />
<ConditionallyRender <ConditionallyRender
condition={strategies.length > 0} condition={strategies.length > 0}
show={ show={

View File

@ -1,5 +1,5 @@
import { PlaygroundFeatureSchema } from '../../../../../../hooks/api/actions/usePlayground/playground.model'; import { PlaygroundFeatureSchema } from '../../../../../../hooks/api/actions/usePlayground/playground.model';
import { Typography } from '@mui/material'; import {Typography, useTheme} from '@mui/material';
import { PlaygroundResultChip } from '../../PlaygroundResultChip/PlaygroundResultChip'; import { PlaygroundResultChip } from '../../PlaygroundResultChip/PlaygroundResultChip';
import { useStyles } from './PlaygroundResultFeatureDetails.styles'; import { useStyles } from './PlaygroundResultFeatureDetails.styles';
interface PlaygroundFeatureResultDetailsProps { interface PlaygroundFeatureResultDetailsProps {
@ -9,6 +9,7 @@ export const PlaygroundResultFeatureDetails = ({
feature, feature,
}: PlaygroundFeatureResultDetailsProps) => { }: PlaygroundFeatureResultDetailsProps) => {
const { classes: styles } = useStyles(); const { classes: styles } = useStyles();
const theme = useTheme();
const description = feature.isEnabled const description = feature.isEnabled
? 'This feature toggle is True in production because ' ? 'This feature toggle is True in production because '
@ -16,7 +17,7 @@ export const PlaygroundResultFeatureDetails = ({
const reason = feature.isEnabled const reason = feature.isEnabled
? 'at least one strategy is True' ? 'at least one strategy is True'
: 'all strategies are False'; : 'all strategies are False';
const color = feature.isEnabled ? 'success' : 'error'; const color = feature.isEnabled ? theme.palette.success.main : theme.palette.error.main;
return ( return (
<> <>
@ -30,7 +31,7 @@ export const PlaygroundResultFeatureDetails = ({
</div> </div>
<div className={styles.descriptionRow}> <div className={styles.descriptionRow}>
<Typography variant={'body1'}>{description}</Typography> <Typography variant={'body1'}>{description}</Typography>
<Typography variant={'body1'} color={color}> <Typography variant={'subtitle1'} color={color}>
{reason} {reason}
</Typography> </Typography>
</div> </div>

View File

@ -20,7 +20,7 @@ export const FeatureStatusCell = ({ enabled }: IFeatureStatusCellProps) => {
return ( return (
<StyledCellBox> <StyledCellBox>
<StyledChipWrapper data-loading> <StyledChipWrapper data-loading>
<PlaygroundResultChip enabled /> <PlaygroundResultChip enabled={enabled} />
</StyledChipWrapper> </StyledChipWrapper>
</StyledCellBox> </StyledCellBox>
); );