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

Function handleAddCondition

ui/src/pages/targeting/hooks.tsx:85–100  ·  view source on GitHub ↗
(index: number, type: string)

Source from the content-addressed store, hash-verified

83 };
84
85 const handleAddCondition = (index: number, type: string) => {
86 const condition: ICondition = {
87 id: uuidv4(),
88 type: type,
89 subject: type === SEGMENT_TYPE ? intl.formatMessage({id: 'common.user.text'}) : '',
90 predicate: '',
91 };
92
93 if (type === DATETIME_TYPE) {
94 condition.datetime = moment().format().slice(0, 19);
95 condition.timezone = moment().format().slice(-6);
96 }
97 rules[index].conditions.push(condition);
98
99 saveRules([...rules]);
100 };
101
102 const handleDeleteCondition = (ruleIndex: number, conditionIndex: number) => {
103 rules[ruleIndex].conditions.splice(conditionIndex, 1);

Callers 1

RuleContentFunction · 0.50

Calls 1

pushMethod · 0.65

Tested by

no test coverage detected