From b32b751f2cf14cb62c688241a1bcfd051f5c12ae Mon Sep 17 00:00:00 2001 From: Tymoteusz Czech Date: Mon, 8 Aug 2022 11:41:35 +0200 Subject: [PATCH] update custom strategy params from feature branch --- .../CustomStrategyParams.tsx | 122 ++++++------------ 1 file changed, 41 insertions(+), 81 deletions(-) diff --git a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/StrategyItem/StrategyExecution/CustomStrategyParams/CustomStrategyParams.tsx b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/StrategyItem/StrategyExecution/CustomStrategyParams/CustomStrategyParams.tsx index f39f164725..b2cf842ad7 100644 --- a/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/StrategyItem/StrategyExecution/CustomStrategyParams/CustomStrategyParams.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundResultsTable/FeatureResultInfoPopoverCell/PlaygroundResultFeatureStrategyList/PlaygroundResultStrategyList/StrategyItem/StrategyExecution/CustomStrategyParams/CustomStrategyParams.tsx @@ -9,9 +9,7 @@ import { ConditionallyRender } from 'component/common/ConditionallyRender/Condit import { StrategySeparator } from 'component/common/StrategySeparator/StrategySeparator'; import { Chip } from '@mui/material'; import PercentageCircle from 'component/common/PercentageCircle/PercentageCircle'; -import StringTruncator from 'component/common/StringTruncator/StringTruncator'; import { PlaygroundConstraintSchema } from 'hooks/api/actions/usePlayground/playground.model'; -import { useStyles } from '../StrategyExecution.styles'; import { useStrategies } from 'hooks/api/getters/useStrategies/useStrategies'; interface ICustomStrategyProps { @@ -25,15 +23,16 @@ export const CustomStrategyParams: VFC = ({ constraints, parameters, }) => { - const { classes: styles } = useStyles(); const { strategies } = useStrategies(); - const definition = strategies.find(strategyDefinition => { return strategyDefinition.name === strategyName; }); + if (!definition?.editable) { + return null; + } + const renderCustomStrategyParameters = () => { - if (!definition?.editable) return null; return definition?.parameters.map((param: any, index: number) => { const notLastItem = index !== definition?.parameters?.length - 1; switch (param?.type) { @@ -81,93 +80,54 @@ export const CustomStrategyParams: VFC = ({ ); case 'boolean': + const bool = Boolean(parameters[param?.name]); return ( - -

- {' '} - {parameters[param.name]} -

+ + } - /> - } + condition={notLastItem} + show={} /> ); case 'string': - const value = parseParameterString(parameters[param.name]); + const value = + parseParameterString(parameters[param.name]) ?? + 'no value'; return ( - -

- - - is set to - - -

- } - /> - - } - /> + + + } + /> + ); case 'number': const number = parseParameterNumber(parameters[param.name]); return ( - -

- - - is set to - - -

- } - /> - - } - /> + + + } + /> + ); case 'default': return null;