Skip to content

Commit 9115f16

Browse files
authored
feat: frontend context values in segment (#5766)
1 parent 1e4c2e1 commit 9115f16

9 files changed

Lines changed: 589 additions & 287 deletions

File tree

frontend/common/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,8 @@ const Constants = {
695695
'See which identities have specific overridden values for this feature.<br/>Identity overrides take priority over segment overrides and environment values.',
696696
ORGANISATION_DESCRIPTION:
697697
'This is used to create a default organisation for team members to create and manage projects.',
698+
PERCENTAGE_SPLIT_DEFAULT_TO_IDENTITY_KEY:
699+
'If no value is provided, the identity key will be used as the default value for split operator.',
698700
REMOTE_CONFIG_DESCRIPTION:
699701
'Features can have values as well as being simply on or off, e.g. a font size for a banner or an environment variable for a server.',
700702
REMOTE_CONFIG_DESCRIPTION_VARIATION:

frontend/common/types/responses.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export type SegmentCondition = {
5050
description?: string
5151
operator: string
5252
property: string
53-
value: string | number | null
53+
value: string | number | boolean | null
5454
}
5555

5656
export type SegmentConditionsError = {
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export enum RuleContextLabels {
2+
IDENTIFIER = 'Identifier',
3+
ENVIRONMENT_NAME = 'Environment Name',
4+
IDENTITY_KEY = 'Identity Key',
5+
}
6+
7+
export enum RuleContextValues {
8+
IDENTIFIER = '$.identity.identifier',
9+
IDENTITY_KEY = '$.identity.key',
10+
ENVIRONMENT_NAME = '$.environment.name',
11+
}

frontend/web/components/modals/CreateSegment.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import AssociatedSegmentOverrides from './AssociatedSegmentOverrides'
3333
import Button from 'components/base/forms/Button'
3434
import InfoMessage from 'components/InfoMessage'
3535
import InputGroup from 'components/base/forms/InputGroup'
36-
import Rule from './Rule'
36+
import Rule from 'components/segments/Rule/Rule'
3737
import TabItem from 'components/base/forms/TabItem'
3838
import Tabs from 'components/base/forms/Tabs'
3939
import ConfigProvider from 'common/providers/ConfigProvider'
@@ -267,6 +267,7 @@ const CreateSegment: FC<CreateSegmentType> = ({
267267
}
268268
})
269269
}, [valueChanged, isEdit])
270+
270271
useEffect(() => {
271272
setInterceptClose(onClosing)
272273
return () => setInterceptClose(null)
@@ -366,6 +367,7 @@ const CreateSegment: FC<CreateSegmentType> = ({
366367
readOnly={readOnly}
367368
data-test={`rule-${displayIndex}`}
368369
rule={rule}
370+
index={i}
369371
operators={operators!}
370372
onChange={(v: SegmentRule) => {
371373
setValueChanged(true)

frontend/web/components/modals/Rule.tsx

Lines changed: 0 additions & 279 deletions
This file was deleted.

0 commit comments

Comments
 (0)