From 9041775830b42d52d491cdb1b5a90b810b79ed84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nuno=20G=C3=B3is?= Date: Thu, 22 Feb 2024 14:55:33 +0000 Subject: [PATCH] fix: only show visible environments for that project in actions --- .../ProjectActionsActionItem.tsx | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsActionItem.tsx b/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsActionItem.tsx index 48911c78c3a5..94bcd89ac7b5 100644 --- a/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsActionItem.tsx +++ b/frontend/src/component/project/Project/ProjectSettings/ProjectActions/ProjectActionsTable/ProjectActionsModal/ProjectActionsForm/ProjectActionsActionItem.tsx @@ -1,11 +1,11 @@ import { IconButton, Tooltip, styled } from '@mui/material'; import GeneralSelect from 'component/common/GeneralSelect/GeneralSelect'; import { Delete } from '@mui/icons-material'; -import { useProjectEnvironments } from 'hooks/api/getters/useProjectEnvironments/useProjectEnvironments'; import { useRequiredPathParam } from 'hooks/useRequiredPathParam'; import { useFeatureSearch } from 'hooks/api/getters/useFeatureSearch/useFeatureSearch'; import { ActionsActionState } from './useProjectActionsForm'; import { ProjectActionsFormItem } from './ProjectActionsFormItem'; +import useProjectOverview from 'hooks/api/getters/useProjectOverview/useProjectOverview'; const StyledItemRow = styled('div')(({ theme }) => ({ display: 'flex', @@ -31,7 +31,12 @@ export const ProjectActionsActionItem = ({ }) => { const { action: actionName } = action; const projectId = useRequiredPathParam('projectId'); - const environments = useProjectEnvironments(projectId); + const { project } = useProjectOverview(projectId); + + const environments = project.environments.map( + ({ environment }) => environment, + ); + const { features } = useFeatureSearch({ project: `IS:${projectId}` }); const header = ( @@ -78,9 +83,9 @@ export const ProjectActionsActionItem = ({ ({ - label: env.name, - key: env.name, + options={environments.map((environment) => ({ + label: environment, + key: environment, }))} value={action.executionParams.environment as string} onChange={(selected) =>