diff --git a/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundConnectionFieldset/PlaygroundConnectionFieldset.tsx b/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundConnectionFieldset/PlaygroundConnectionFieldset.tsx index 4bfaa6e12f..5925248cd3 100644 --- a/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundConnectionFieldset/PlaygroundConnectionFieldset.tsx +++ b/frontend/src/component/playground/Playground/PlaygroundForm/PlaygroundConnectionFieldset/PlaygroundConnectionFieldset.tsx @@ -8,6 +8,7 @@ import { } from '@mui/material'; import useProjects from 'hooks/api/getters/useProjects/useProjects'; import { GuidanceIndicator } from 'component/common/GuidanceIndicator/GuidanceIndicator'; +import useUiConfig from 'hooks/api/getters/useUiConfig/useUiConfig'; interface IPlaygroundConnectionFieldsetProps { environments: string[]; @@ -34,6 +35,9 @@ export const PlaygroundConnectionFieldset: VFC< availableEnvironments, }) => { const theme = useTheme(); + const { uiConfig } = useUiConfig(); + + const isAdvancedPlayground = uiConfig.flags.advancedPlayground; const { projects: availableProjects = [] } = useProjects(); const projectsOptions = [ @@ -98,6 +102,10 @@ export const PlaygroundConnectionFieldset: VFC< const isAllProjects = projects.length === 0 || (projects.length === 1 && projects[0] === '*'); + const envValue = isAdvancedPlayground + ? environmentOptions.filter(({ id }) => environments.includes(id)) + : environmentOptions.filter(({ id }) => environments.includes(id))[0]; + return ( @@ -114,18 +122,16 @@ export const PlaygroundConnectionFieldset: VFC< ( )} size="small" - value={ - environmentOptions.filter(({ id }) => - environments.includes(id) - )[0] - } + value={envValue} onChange={onEnvironmentsChange} + data-testid={'PLAYGROUND_ENVIRONMENT_SELECT'} />