Skip to content
Merged
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
8 changes: 7 additions & 1 deletion frontend/web/components/TryIt.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import Highlight from './Highlight'
import ConfigProvider from 'common/providers/ConfigProvider'
import Constants from 'common/constants'

// Running a test is a real SDK evaluation, which marks the environment as
// integrated (environment.first_evaluated) — hide it until the project looks
// genuinely in use.
export const MIN_FLAGS_TO_SHOW_TRY_IT = 3

const TryIt = class extends Component {
static displayName = 'TryIt'

Expand Down Expand Up @@ -52,7 +57,8 @@ const TryIt = class extends Component {
}

render() {
return Utils.getFlagsmithHasFeature('try_it') ? (
return Utils.getFlagsmithHasFeature('try_it') &&
(E2E || (this.props.totalFeatures || 0) >= MIN_FLAGS_TO_SHOW_TRY_IT) ? (
<div>
<Row space>
<Flex className='align-items-start'>
Expand Down
10 changes: 9 additions & 1 deletion frontend/web/components/pages/IdentityPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@
{ skip: !projectId },
)

const { getEnvironmentIdFromKey } = useProjectEnvironments(projectId!)
const { getEnvironmentIdFromKey, project } = useProjectEnvironments(
projectId!,

Check warning on line 75 in frontend/web/components/pages/IdentityPage.tsx

View workflow job for this annotation

GitHub Actions / Lint changed files

Forbidden non-null assertion
)

const apiParams = environmentId
? buildApiFilterParams(
Expand Down Expand Up @@ -423,6 +425,12 @@
title='Check to see what features and traits are coming back for this user'
environmentId={environmentId}
userId={identityName}
totalFeatures={Math.max(
// The list count is filter-aware but live; the
// project total is unfiltered but cached.
paging?.count ?? 0,
project?.total_features ?? 0,
)}
/>
</FormGroup>
<FormGroup className='mt-5'>
Expand Down
6 changes: 6 additions & 0 deletions frontend/web/components/pages/features/FeaturesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,12 @@ const FeaturesPage: FC<FeaturesPageProps> = ({ forcedTagIds, pageTitle }) => {
<FeaturesSDKIntegration
projectId={projectId}
environmentId={environmentId}
totalFeatures={Math.max(
// The list count is filter-aware but live; the project
// total is unfiltered but cached.
data?.pagination?.count ?? 0,
project?.total_features ?? 0,
)}
/>
</>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { openIntegrationModal } from 'components/integrations/openIntegrationMod
type FeaturesSDKIntegrationProps = {
projectId: number
environmentId: string
totalFeatures?: number
}

export const FeaturesSDKIntegration: FC<FeaturesSDKIntegrationProps> = ({
environmentId,
projectId,
totalFeatures,
}) => {
const hasMcp = Utils.hasIntegration('mcp')
return (
Expand Down Expand Up @@ -48,6 +50,7 @@ export const FeaturesSDKIntegration: FC<FeaturesSDKIntegrationProps> = ({
<TryIt
title='Test what values are being returned from the API on this environment'
environmentId={environmentId}
totalFeatures={totalFeatures}
/>
</FormGroup>
</>
Expand Down
Loading