diff --git a/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionView.tsx b/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionView.tsx index 22db144fd0..3345e0ece9 100644 --- a/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionView.tsx +++ b/frontend/src/component/common/ConstraintAccordion/ConstraintAccordionView/ConstraintAccordionView.tsx @@ -5,6 +5,7 @@ import { AccordionDetails, SxProps, Theme, + useTheme, } from '@mui/material'; import { IConstraint } from 'interfaces/strategy'; import { ConstraintAccordionViewBody } from './ConstraintAccordionViewBody/ConstraintAccordionViewBody'; @@ -17,12 +18,12 @@ import { } from 'constants/operators'; import { useStyles } from '../ConstraintAccordion.styles'; import { - PlaygroundFeatureStrategyConstraintResult, + PlaygroundConstraintSchema, PlaygroundRequestSchema, } from '../../../../hooks/api/actions/usePlayground/playground.model'; interface IConstraintAccordionViewProps { - constraint: IConstraint | PlaygroundFeatureStrategyConstraintResult; + constraint: IConstraint | PlaygroundConstraintSchema; onDelete?: () => void; onEdit?: () => void; playgroundInput?: PlaygroundRequestSchema; @@ -41,6 +42,7 @@ export const ConstraintAccordionView = ({ const { classes: styles } = useStyles(); const [expandable, setExpandable] = useState(true); const [expanded, setExpanded] = useState(false); + const theme = useTheme(); const singleValue = oneOf( [...semVerOperators, ...numOperators, ...dateOperators], @@ -51,6 +53,11 @@ export const ConstraintAccordionView = ({ setExpanded(!expanded); } }; + const backgroundColor = Boolean(playgroundInput) + ? !Boolean((constraint as PlaygroundConstraintSchema).result) + ? theme.palette.neutral.light + : 'inherit' + : 'inherit'; return ( - + diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.styles.ts b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.styles.ts index 09bcd3dc2c..66b3e69b6f 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.styles.ts +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.styles.ts @@ -12,6 +12,10 @@ export const useStyles = makeStyles()(theme => ({ justifyContent: 'space-between', gap: theme.spacing(2), }, + disabled: { + backgroundColor: theme.palette.neutral.light, + opacity: '90%', + }, chip: { margin: '0.25rem', }, diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.tsx index a94a22e1df..d1f6d90399 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundConstraintItem/PlaygroundConstraintItem.tsx @@ -3,6 +3,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit import { useStyles } from './PlaygroundConstraintItem.styles'; import StringTruncator from 'component/common/StringTruncator/StringTruncator'; import { CancelOutlined } from '@mui/icons-material'; +import classnames from 'classnames'; interface IConstraintItemProps { value: string[]; @@ -23,10 +24,13 @@ export const PlaygroundConstraintItem = ({ const color = input === 'no value' ? 'error' : 'neutral'; const reason = `value does not match any ${text}`; - console.log(value, text, input, showReason); - return ( -
+
{input} @@ -72,6 +76,7 @@ export const PlaygroundConstraintItem = ({ } + elseShow={
} />
); diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx index ee945ed086..4b6f54fbad 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/PlaygroundResultFeatureStrategyItem/PlaygroundResultFeatureStrategyItem.tsx @@ -40,14 +40,15 @@ export const PlaygroundResultFeatureStrategyItem = ({ const theme = useTheme(); const Icon = getFeatureStrategyIcon(strategy.name); const label = - result.evaluationStatus !== 'complete' - ? 'Unevaluated' + result.evaluationStatus === 'incomplete' + ? 'Unknown' : result.enabled ? 'True' : 'False'; - const border = result.enabled - ? `1px solid ${theme.palette.success.main}` - : `1px solid ${theme.palette.divider}`; + const border = + result.enabled && result.evaluationStatus === 'complete' + ? `1px solid ${theme.palette.success.main}` + : `1px solid ${theme.palette.divider}`; return (
diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/PlaygroundResultChip/PlaygroundResultChip.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/PlaygroundResultChip/PlaygroundResultChip.tsx index d91b4ae9c6..8cbf734142 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/PlaygroundResultChip/PlaygroundResultChip.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/PlaygroundResultChip/PlaygroundResultChip.tsx @@ -6,22 +6,25 @@ import { ReactComponent as FeatureEnabledIcon } from '../../../../../assets/icon import { ReactComponent as FeatureDisabledIcon } from '../../../../../assets/icons/isenabled-false.svg'; interface IResultChipProps { - enabled: boolean | 'unevaluated'; + enabled: boolean | 'unknown'; // Result icon - defaults to true showIcon?: boolean; label?: string; + size?: 'default' | 'medium' | 'large'; } -export const StyledChip = styled(Chip)(({ theme }) => ({ - width: 60, - height: 24, - borderRadius: theme.shape.borderRadius, - fontWeight: theme.typography.fontWeightMedium, - ['& .MuiChip-label']: { - padding: 0, - paddingLeft: theme.spacing(0.5), - }, -})); +export const StyledChip = styled(Chip)<{ width?: number }>( + ({ theme, width }) => ({ + width: width ?? 60, + height: 24, + borderRadius: theme.shape.borderRadius, + fontWeight: theme.typography.fontWeightMedium, + ['& .MuiChip-label']: { + padding: 0, + paddingLeft: theme.spacing(0.5), + }, + }) +); export const StyledFalseChip = styled(StyledChip)(({ theme }) => ({ border: `1px solid ${theme.palette.error.main}`, @@ -45,15 +48,27 @@ export const StyledTrueChip = styled(StyledChip)(({ theme }) => ({ }, })); +export const StyledUnknownChip = styled(StyledChip)(({ theme }) => ({ + border: `1px solid ${theme.palette.warning.main}`, + backgroundColor: colors.orange['100'], + ['& .MuiChip-label']: { + color: theme.palette.warning.main, + }, + ['& .MuiChip-icon']: { + color: theme.palette.warning.main, + }, +})); + export const PlaygroundResultChip = ({ enabled, showIcon = true, label, + size = 'default', }: IResultChipProps) => { const theme = useTheme(); const icon = ( } elseShow={ - + } + elseShow={ + + } /> } />