mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: change request environment selector button label (#7176)
This change makes it so that the button for change request environments reads correctly when: 1. You have no envs configured: "Configure change requests" 2. One env configured: "1 environment configured" 3. More than one env configured: "`n` environments configured"
This commit is contained in:
parent
5f3eae7035
commit
2698ddf704
@ -174,6 +174,15 @@ export const NewProjectForm: React.FC<FormProps> = ({
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const numberOfConfiguredChangeRequestEnvironments = Object.keys(
|
||||||
|
projectChangeRequestConfiguration,
|
||||||
|
).length;
|
||||||
|
const changeRequestSelectorLabel =
|
||||||
|
numberOfConfiguredChangeRequestEnvironments > 1
|
||||||
|
? `${numberOfConfiguredChangeRequestEnvironments} environments configured`
|
||||||
|
: numberOfConfiguredChangeRequestEnvironments === 1
|
||||||
|
? `1 environment configured`
|
||||||
|
: 'Configure change requests';
|
||||||
return (
|
return (
|
||||||
<StyledForm
|
<StyledForm
|
||||||
onSubmit={(submitEvent) => {
|
onSubmit={(submitEvent) => {
|
||||||
@ -320,17 +329,11 @@ export const NewProjectForm: React.FC<FormProps> = ({
|
|||||||
updateProjectChangeRequestConfig
|
updateProjectChangeRequestConfig
|
||||||
}
|
}
|
||||||
button={{
|
button={{
|
||||||
label:
|
label: changeRequestSelectorLabel,
|
||||||
Object.keys(
|
|
||||||
projectChangeRequestConfiguration,
|
|
||||||
).length > 0
|
|
||||||
? `${
|
|
||||||
Object.keys(
|
|
||||||
projectChangeRequestConfiguration,
|
|
||||||
).length
|
|
||||||
} environment configured`
|
|
||||||
: 'Configure change requests',
|
|
||||||
icon: <ChangeRequestIcon />,
|
icon: <ChangeRequestIcon />,
|
||||||
|
labelWidth: `${
|
||||||
|
'nn environments configured'.length
|
||||||
|
}ch`,
|
||||||
}}
|
}}
|
||||||
search={{
|
search={{
|
||||||
label: 'Filter environments',
|
label: 'Filter environments',
|
||||||
|
Loading…
Reference in New Issue
Block a user