1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-25 00:07:47 +01:00

fix: Hide project selection option in CreateFeatureDialog when OSS (#7669)

This change wraps the project selection option in the
CreateFeatureDialog in a conditional that hides it when Unleash is
OSS.

OSS doesn't have access to the project creation API, so there's no
point in showing this.
This commit is contained in:
Thomas Heartman 2024-07-25 17:59:47 +02:00 committed by GitHub
parent c22196cb77
commit 464568dace
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -67,7 +67,7 @@ export const CreateFeatureDialog = ({
}: ICreateFeatureDialogProps) => {
const { setToastData, setToastApiError } = useToast();
const { setShowFeedback } = useContext(UIContext);
const { uiConfig } = useUiConfig();
const { uiConfig, isOss } = useUiConfig();
const navigate = useNavigate();
const {
@ -215,33 +215,41 @@ export const CreateFeatureDialog = ({
setName={setName}
configButtons={
<>
<SingleSelectConfigButton
tooltip={{
header: 'Select a project for the flag',
}}
description={configButtonData.project.text}
options={projects.map((project) => ({
label: project.name,
value: project.id,
}))}
onChange={(value: any) => {
setProject(value);
}}
button={{
label: project,
icon: configButtonData.project.icon,
labelWidth: '12ch',
}}
search={{
label: 'Filter projects',
placeholder: 'Select project',
}}
onOpen={() =>
setDocumentation(configButtonData.project)
<ConditionallyRender
condition={!isOss()}
show={
<SingleSelectConfigButton
tooltip={{
header: 'Select a project for the flag',
}}
description={
configButtonData.project.text
}
options={projects.map((project) => ({
label: project.name,
value: project.id,
}))}
onChange={(value: any) => {
setProject(value);
}}
button={{
label: project,
icon: configButtonData.project.icon,
labelWidth: '12ch',
}}
search={{
label: 'Filter projects',
placeholder: 'Select project',
}}
onOpen={() =>
setDocumentation(
configButtonData.project,
)
}
onClose={clearDocumentationOverride}
/>
}
onClose={clearDocumentationOverride}
/>
<SingleSelectConfigButton
tooltip={{
header: 'Select a flag type',