Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ import React, { FC } from 'react'
import InfoMessage from 'components/InfoMessage'
import Button from 'components/base/forms/Button'
import ModalHR from 'components/modals/ModalHR'
import { useGetProjectQuery } from 'common/services/useProject'

type FeatureUpdateSummaryProps = {
identity?: string
projectId: number | string
onCreateFeature: () => void
isSaving: boolean
name: string
Expand All @@ -22,18 +24,24 @@ const FeatureUpdateSummary: FC<FeatureUpdateSummaryProps> = ({
isSaving,
name,
onCreateFeature,
projectId,
regexValid,
}) => {
const { data: project } = useGetProjectQuery({ id: projectId })
const preventFlagDefaults = !!project?.prevent_flag_defaults

return (
<>
<ModalHR className={`my-4 ${identity ? 'mx-3' : ''}`} />
{!identity && (
<div className='text-right mb-3'>
<InfoMessage collapseId={'create-flag'}>
This will create the feature for <strong>all environments</strong>,
you can edit this feature per environment once the feature is
created.
</InfoMessage>
{!preventFlagDefaults && (
<InfoMessage collapseId={'create-flag'}>
This will create the feature for <strong>all environments</strong>
, you can edit this feature per environment once the feature is
created.
</InfoMessage>
)}

<Button
onClick={onCreateFeature}
Expand Down
1 change: 1 addition & 0 deletions frontend/web/components/modals/create-feature/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,7 @@ const Index = class extends Component {
/>
<FeatureUpdateSummary
identity={identity}
projectId={this.props.projectId}
onCreateFeature={onCreateFeature}
isSaving={isSaving}
name={projectFlag.name}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { useHasPermission } from 'common/providers/Permission'
import Switch from 'components/Switch'
import Tooltip from 'components/Tooltip'
import Icon from 'components/Icon'
import InfoMessage from 'components/InfoMessage'
import { useGetProjectQuery } from 'common/services/useProject'
import { useCreateTagMutation, useGetTagsQuery } from 'common/services/useTag'

type CreateFeatureTabProps = {
Expand Down Expand Up @@ -55,6 +57,9 @@ const CreateFeature: FC<CreateFeatureTabProps> = ({
permission: 'ADMIN',
})

const { data: project } = useGetProjectQuery({ id: projectId })
const preventFlagDefaults = !!project?.prevent_flag_defaults && !identity

const noPermissions = !createFeature && !projectAdmin

const showExperimentToggle =
Expand Down Expand Up @@ -134,10 +139,17 @@ const CreateFeature: FC<CreateFeatureTabProps> = ({
<WarningMessage warningMessage={featureWarning} />
{!!projectFlag && (
<>
{preventFlagDefaults && (
<InfoMessage collapseId='create-flag'>
This will create the feature for <strong>all environments</strong>
, you can edit the feature's enabled state and value per
environment once the feature is created.
</InfoMessage>
)}
<FeatureValue
error={error}
createFeature={createFeature}
hideValue={false}
hideValue={preventFlagDefaults}
isEdit={!!identity}
identity={identity}
noPermissions={noPermissions}
Expand Down
Loading