mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: remove projectId from create feature form (#658)
* fix: remove projectId from create feature form * fix: update link and fix componend header in edit mode * fix: update url on project change * fix: conflict * fix: use shorthand Co-authored-by: Fredrik Oseberg <fredrik.no@gmail.com>
This commit is contained in:
parent
ff8d983d7e
commit
36f59b2290
@ -79,7 +79,7 @@ const CreateFeature = () => {
|
|||||||
title="Create Feature toggle"
|
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.
|
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"
|
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}
|
formatApiCode={formatApiCode}
|
||||||
>
|
>
|
||||||
<FeatureForm
|
<FeatureForm
|
||||||
|
@ -83,7 +83,7 @@ const EditFeature = () => {
|
|||||||
title="Edit Feature toggle"
|
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.
|
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"
|
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}
|
formatApiCode={formatApiCode}
|
||||||
>
|
>
|
||||||
<FeatureForm
|
<FeatureForm
|
||||||
|
@ -11,6 +11,7 @@ import ConditionallyRender from '../../common/ConditionallyRender';
|
|||||||
import { trim } from '../../common/util';
|
import { trim } from '../../common/util';
|
||||||
import Input from '../../common/Input/Input';
|
import Input from '../../common/Input/Input';
|
||||||
import { CREATE_FEATURE } from '../../providers/AccessProvider/permissions';
|
import { CREATE_FEATURE } from '../../providers/AccessProvider/permissions';
|
||||||
|
import { useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
interface IFeatureToggleForm {
|
interface IFeatureToggleForm {
|
||||||
type: string;
|
type: string;
|
||||||
@ -22,8 +23,8 @@ interface IFeatureToggleForm {
|
|||||||
setName: React.Dispatch<React.SetStateAction<string>>;
|
setName: React.Dispatch<React.SetStateAction<string>>;
|
||||||
setDescription: React.Dispatch<React.SetStateAction<string>>;
|
setDescription: React.Dispatch<React.SetStateAction<string>>;
|
||||||
setProject: React.Dispatch<React.SetStateAction<string>>;
|
setProject: React.Dispatch<React.SetStateAction<string>>;
|
||||||
validateToggleName: () => void;
|
|
||||||
setImpressionData: React.Dispatch<React.SetStateAction<boolean>>;
|
setImpressionData: React.Dispatch<React.SetStateAction<boolean>>;
|
||||||
|
validateToggleName?: () => void;
|
||||||
handleSubmit: (e: any) => void;
|
handleSubmit: (e: any) => void;
|
||||||
handleCancel: () => void;
|
handleCancel: () => void;
|
||||||
errors: { [key: string]: string };
|
errors: { [key: string]: string };
|
||||||
@ -52,6 +53,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const styles = useStyles();
|
const styles = useStyles();
|
||||||
const { featureTypes } = useFeatureTypes();
|
const { featureTypes } = useFeatureTypes();
|
||||||
|
const history = useHistory();
|
||||||
const { permissions } = useUser();
|
const { permissions } = useUser();
|
||||||
const editable = mode !== 'Edit';
|
const editable = mode !== 'Edit';
|
||||||
|
|
||||||
@ -75,9 +77,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
|
|||||||
onFocus={() => clearErrors()}
|
onFocus={() => clearErrors()}
|
||||||
value={name}
|
value={name}
|
||||||
onChange={e => setName(trim(e.target.value))}
|
onChange={e => setName(trim(e.target.value))}
|
||||||
inputProps={{
|
data-test={CF_NAME_ID}
|
||||||
'data-test': CF_NAME_ID,
|
|
||||||
}}
|
|
||||||
onBlur={validateToggleName}
|
onBlur={validateToggleName}
|
||||||
/>
|
/>
|
||||||
<p className={styles.inputDescription}>
|
<p className={styles.inputDescription}>
|
||||||
@ -89,9 +89,7 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
|
|||||||
label={'Toggle type'}
|
label={'Toggle type'}
|
||||||
id="feature-type-select"
|
id="feature-type-select"
|
||||||
editable
|
editable
|
||||||
inputProps={{
|
data-test={CF_TYPE_ID}
|
||||||
'data-test': CF_TYPE_ID,
|
|
||||||
}}
|
|
||||||
IconComponent={KeyboardArrowDownOutlined}
|
IconComponent={KeyboardArrowDownOutlined}
|
||||||
className={styles.selectInput}
|
className={styles.selectInput}
|
||||||
/>
|
/>
|
||||||
@ -108,7 +106,12 @@ const FeatureForm: React.FC<IFeatureToggleForm> = ({
|
|||||||
/>
|
/>
|
||||||
<FeatureProjectSelect
|
<FeatureProjectSelect
|
||||||
value={project}
|
value={project}
|
||||||
onChange={e => setProject(e.target.value)}
|
onChange={e => {
|
||||||
|
setProject(e.target.value);
|
||||||
|
history.replace(
|
||||||
|
`/projects/${e.target.value}/create-toggle`
|
||||||
|
);
|
||||||
|
}}
|
||||||
enabled={editable}
|
enabled={editable}
|
||||||
filter={projectFilterGenerator(
|
filter={projectFilterGenerator(
|
||||||
{ permissions },
|
{ permissions },
|
||||||
|
@ -50,9 +50,8 @@ const useFeatureForm = (
|
|||||||
return {
|
return {
|
||||||
type,
|
type,
|
||||||
name,
|
name,
|
||||||
projectId: project,
|
description,
|
||||||
description: description,
|
impressionData,
|
||||||
impressionData
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user