Skip to content

Commit b182941

Browse files
committed
chore: add an opt-in count to early access management
1 parent 05e5d3a commit b182941

File tree

4 files changed

+31
-2
lines changed

4 files changed

+31
-2
lines changed

frontend/src/types.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -3140,13 +3140,14 @@ export enum EarlyAccessFeatureTabs {
31403140
export interface EarlyAccessFeatureType {
31413141
/** UUID */
31423142
id: string
3143-
feature_flag: FeatureFlagBasicType
3143+
feature_flag: FeatureFlagType
31443144
name: string
31453145
description: string
31463146
stage: EarlyAccessFeatureStage
31473147
/** Documentation URL. Can be empty. */
31483148
documentation_url: string
31493149
created_at: string
3150+
opt_in_count?: number
31503151
}
31513152

31523153
export interface NewEarlyAccessFeatureType extends Omit<EarlyAccessFeatureType, 'id' | 'created_at' | 'feature_flag'> {
@@ -5069,3 +5070,5 @@ export interface ProductManifest {
50695070
redirects?: Record<string, string | ((params: Params, searchParams: Params, hashParams: Params) => string)>
50705071
urls?: Record<string, string | ((...args: any[]) => string)>
50715072
}
5073+
ng)>
5074+
}

products/early_access_features/frontend/EarlyAccessFeatures.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ export function EarlyAccessFeatures(): JSX.Element {
8787
},
8888
sorter: (a, b) => STAGES_IN_ORDER[a.stage] - STAGES_IN_ORDER[b.stage],
8989
},
90+
{
91+
title: 'Opted-in users',
92+
key: 'opt_in_count',
93+
render: (_, feature) => feature.opt_in_count ?? 0,
94+
sorter: (a, b) => (a.opt_in_count ?? 0) - (b.opt_in_count ?? 0),
95+
},
9096
]}
9197
dataSource={earlyAccessFeatures}
9298
/>

products/early_access_features/frontend/earlyAccessFeaturesLogic.ts

+20-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,26 @@ export const earlyAccessFeaturesLogic = kea<earlyAccessFeaturesLogicType>([
1414
__default: [] as EarlyAccessFeatureType[],
1515
loadEarlyAccessFeatures: async () => {
1616
const response = await api.earlyAccessFeatures.list()
17-
return response.results
17+
const featuresWithCounts = await Promise.all(
18+
response.results.map(async (feature) => {
19+
const key = `$feature_enrollment/${feature.feature_flag.key}`
20+
const optInCount = await api.persons.list({
21+
properties: [
22+
{
23+
key: key,
24+
value: ['true'],
25+
operator: 'exact',
26+
type: 'person',
27+
},
28+
],
29+
})
30+
return {
31+
...feature,
32+
opt_in_count: optInCount.count,
33+
}
34+
})
35+
)
36+
return featuresWithCounts
1837
},
1938
},
2039
}),

types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)