1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-03-23 00:16:25 +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) => { }: ICreateFeatureDialogProps) => {
const { setToastData, setToastApiError } = useToast(); const { setToastData, setToastApiError } = useToast();
const { setShowFeedback } = useContext(UIContext); const { setShowFeedback } = useContext(UIContext);
const { uiConfig } = useUiConfig(); const { uiConfig, isOss } = useUiConfig();
const navigate = useNavigate(); const navigate = useNavigate();
const { const {
@ -215,11 +215,16 @@ export const CreateFeatureDialog = ({
setName={setName} setName={setName}
configButtons={ configButtons={
<> <>
<ConditionallyRender
condition={!isOss()}
show={
<SingleSelectConfigButton <SingleSelectConfigButton
tooltip={{ tooltip={{
header: 'Select a project for the flag', header: 'Select a project for the flag',
}} }}
description={configButtonData.project.text} description={
configButtonData.project.text
}
options={projects.map((project) => ({ options={projects.map((project) => ({
label: project.name, label: project.name,
value: project.id, value: project.id,
@ -237,11 +242,14 @@ export const CreateFeatureDialog = ({
placeholder: 'Select project', placeholder: 'Select project',
}} }}
onOpen={() => onOpen={() =>
setDocumentation(configButtonData.project) setDocumentation(
configButtonData.project,
)
} }
onClose={clearDocumentationOverride} onClose={clearDocumentationOverride}
/> />
}
/>
<SingleSelectConfigButton <SingleSelectConfigButton
tooltip={{ tooltip={{
header: 'Select a flag type', header: 'Select a flag type',