diff --git a/frontend/src/component/feature/CreateFeature/CreateFeature.tsx b/frontend/src/component/feature/CreateFeature/CreateFeature.tsx index a8d136dc2a..eceaff9c83 100644 --- a/frontend/src/component/feature/CreateFeature/CreateFeature.tsx +++ b/frontend/src/component/feature/CreateFeature/CreateFeature.tsx @@ -79,7 +79,7 @@ const CreateFeature = () => { title="Create Feature toggle" description="Feature toggles support different use cases, each with their own specific needs such as simple static routing or more complex routing. The feature toggle is disabled when created and you decide when to enable" - documentationLink="https://docs.getunleash.io/" + documentationLink="https://docs.getunleash.io/advanced/feature_toggle_types" formatApiCode={formatApiCode} > { title="Edit Feature toggle" description="Feature toggles support different use cases, each with their own specific needs such as simple static routing or more complex routing. The feature toggle is disabled when created and you decide when to enable" - documentationLink="https://docs.getunleash.io/" + documentationLink="https://docs.getunleash.io/advanced/feature_toggle_types" formatApiCode={formatApiCode} > >; setDescription: React.Dispatch>; setProject: React.Dispatch>; - validateToggleName: () => void; setImpressionData: React.Dispatch>; + validateToggleName?: () => void; handleSubmit: (e: any) => void; handleCancel: () => void; errors: { [key: string]: string }; @@ -52,6 +53,7 @@ const FeatureForm: React.FC = ({ }) => { const styles = useStyles(); const { featureTypes } = useFeatureTypes(); + const history = useHistory(); const { permissions } = useUser(); const editable = mode !== 'Edit'; @@ -75,9 +77,7 @@ const FeatureForm: React.FC = ({ onFocus={() => clearErrors()} value={name} onChange={e => setName(trim(e.target.value))} - inputProps={{ - 'data-test': CF_NAME_ID, - }} + data-test={CF_NAME_ID} onBlur={validateToggleName} />

@@ -89,9 +89,7 @@ const FeatureForm: React.FC = ({ label={'Toggle type'} id="feature-type-select" editable - inputProps={{ - 'data-test': CF_TYPE_ID, - }} + data-test={CF_TYPE_ID} IconComponent={KeyboardArrowDownOutlined} className={styles.selectInput} /> @@ -108,7 +106,12 @@ const FeatureForm: React.FC = ({ /> setProject(e.target.value)} + onChange={e => { + setProject(e.target.value); + history.replace( + `/projects/${e.target.value}/create-toggle` + ); + }} enabled={editable} filter={projectFilterGenerator( { permissions }, diff --git a/frontend/src/component/feature/hooks/useFeatureForm.ts b/frontend/src/component/feature/hooks/useFeatureForm.ts index 828ac0dcae..7389e8bb70 100644 --- a/frontend/src/component/feature/hooks/useFeatureForm.ts +++ b/frontend/src/component/feature/hooks/useFeatureForm.ts @@ -50,9 +50,8 @@ const useFeatureForm = ( return { type, name, - projectId: project, - description: description, - impressionData + description, + impressionData, }; };