mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-25 00:07:47 +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 (
|
||||
<StyledForm
|
||||
onSubmit={(submitEvent) => {
|
||||
@ -320,17 +329,11 @@ export const NewProjectForm: React.FC<FormProps> = ({
|
||||
updateProjectChangeRequestConfig
|
||||
}
|
||||
button={{
|
||||
label:
|
||||
Object.keys(
|
||||
projectChangeRequestConfiguration,
|
||||
).length > 0
|
||||
? `${
|
||||
Object.keys(
|
||||
projectChangeRequestConfiguration,
|
||||
).length
|
||||
} environment configured`
|
||||
: 'Configure change requests',
|
||||
label: changeRequestSelectorLabel,
|
||||
icon: <ChangeRequestIcon />,
|
||||
labelWidth: `${
|
||||
'nn environments configured'.length
|
||||
}ch`,
|
||||
}}
|
||||
search={{
|
||||
label: 'Filter environments',
|
||||
|
Loading…
Reference in New Issue
Block a user