MCPcopy Create free account
hub / github.com/FeatureProbe/FeatureProbe / getAttrOptions

Function getAttrOptions

ui/src/components/Rule/constants.tsx:21–65  ·  view source on GitHub ↗
(intl: IntlShape, type?:string)

Source from the content-addressed store, hash-verified

19];
20
21export const getAttrOptions = (intl: IntlShape, type?:string) => {
22 if (type === 'string') {
23 return [
24 { key: '1', text: intl.formatMessage({id: 'targeting.rule.condition.isoneof'}), value: 'is one of' },
25 { key: '2', text: intl.formatMessage({id: 'targeting.rule.condition.notanyof'}), value: 'is not any of' },
26 { key: '3', text: intl.formatMessage({id: 'targeting.rule.condition.startswith'}), value: 'starts with' },
27 { key: '4', text: intl.formatMessage({id: 'targeting.rule.condition.notstartwith'}), value: 'does not start with' },
28 { key: '5', text: intl.formatMessage({id: 'targeting.rule.condition.endswidth'}), value: 'ends with' },
29 { key: '6', text: intl.formatMessage({id: 'targeting.rule.condition.notendwith'}), value: 'does not end with' },
30 { key: '7', text: intl.formatMessage({id: 'targeting.rule.condition.contains'}), value: 'contains' },
31 { key: '8', text: intl.formatMessage({id: 'targeting.rule.condition.notcontain'}), value: 'does not contain' },
32 { key: '9', text: intl.formatMessage({id: 'targeting.rule.condition.matches'}), value: 'matches regex' },
33 { key: '10', text: intl.formatMessage({id: 'targeting.rule.condition.notmatch'}), value: 'does not match regex' },
34 ];
35 } else if (type === 'segment') {
36 return [
37 { key: '1', text: intl.formatMessage({id: 'targeting.rule.subject.segment.in'}), value: 'is in' },
38 { key: '2', text: intl.formatMessage({id: 'targeting.rule.subject.segment.notin'}), value: 'is not in' },
39 ];
40 } else if (type === 'number') {
41 return [
42 { key: '1', text: '=', value: '=' },
43 { key: '2', text: '!=', value: '!=' },
44 { key: '3', text: '<', value: '<' },
45 { key: '4', text: '<=', value: '<=' },
46 { key: '5', text: '>', value: '>' },
47 { key: '6', text: '>=', value: '>=' },
48 { key: '7', text: intl.formatMessage({id: 'targeting.rule.condition.between'}), value: 'between' },
49 ];
50 } else if (type === 'semver') {
51 return [
52 { key: '1', text: '=', value: '=' },
53 { key: '2', text: '!=', value: '!=' },
54 { key: '3', text: '<', value: '<' },
55 { key: '4', text: '<=', value: '<=' },
56 { key: '5', text: '>', value: '>' },
57 { key: '6', text: '>=', value: '>=' },
58 ];
59 } else if (type === 'datetime') {
60 return [
61 { key: '1', text: intl.formatMessage({id: 'targeting.rule.subject.datetime.before'}), value: 'before' },
62 { key: '2', text: intl.formatMessage({id: 'targeting.rule.subject.datetime.after'}), value: 'after' },
63 ];
64 }
65};
66
67export const timezoneOptions = () => {
68 return [

Callers 1

RuleContentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected