Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: only show visible environments for that project in actions #6318

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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',
Expand All @@ -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 = (
Expand Down Expand Up @@ -78,9 +83,9 @@ export const ProjectActionsActionItem = ({
<GeneralSelect
label='Environment'
name='environment'
options={environments.environments.map((env) => ({
label: env.name,
key: env.name,
options={environments.map((environment) => ({
label: environment,
key: environment,
}))}
value={action.executionParams.environment as string}
onChange={(selected) =>
Expand Down
Loading