ui: conditional rec fixes
This commit is contained in:
parent
4b21194ec5
commit
d031210365
4 changed files with 27 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Icon, Input } from 'UI';
|
import { Icon, Input } from 'UI';
|
||||||
import cn from 'classnames';
|
import cn from 'classnames';
|
||||||
import { FilterList } from 'Shared/Filters/FilterList';
|
import { FilterList, EventsList } from 'Shared/Filters/FilterList';
|
||||||
import { observer } from 'mobx-react-lite';
|
import { observer } from 'mobx-react-lite';
|
||||||
import { Typography } from 'antd';
|
import { Typography } from 'antd';
|
||||||
import { BranchesOutlined } from '@ant-design/icons';
|
import { BranchesOutlined } from '@ant-design/icons';
|
||||||
|
|
@ -77,6 +77,18 @@ function ConditionSetComponent({
|
||||||
</div>
|
</div>
|
||||||
<div className={'p-2'}>
|
<div className={'p-2'}>
|
||||||
<div className={conditions.filter.filters.length > 0 ? 'p-2 mb-2' : ''}>
|
<div className={conditions.filter.filters.length > 0 ? 'p-2 mb-2' : ''}>
|
||||||
|
<EventsList
|
||||||
|
filter={conditions.filter}
|
||||||
|
onUpdateFilter={onUpdateFilter}
|
||||||
|
onRemoveFilter={onRemoveFilter}
|
||||||
|
onChangeEventsOrder={onChangeEventsOrder}
|
||||||
|
hideEventsOrder
|
||||||
|
onAddFilter={onAddFilter}
|
||||||
|
excludeFilterKeys={excludeFilterKeys}
|
||||||
|
readonly={readonly}
|
||||||
|
isConditional={isConditional}
|
||||||
|
borderless
|
||||||
|
/>
|
||||||
<FilterList
|
<FilterList
|
||||||
filter={conditions.filter}
|
filter={conditions.filter}
|
||||||
onUpdateFilter={onUpdateFilter}
|
onUpdateFilter={onUpdateFilter}
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,8 @@ export const EventsList = observer((props: Props) => {
|
||||||
actions = [],
|
actions = [],
|
||||||
onAddFilter,
|
onAddFilter,
|
||||||
cannotAdd,
|
cannotAdd,
|
||||||
excludeCategory
|
excludeCategory,
|
||||||
|
borderless
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const filters = filter.filters;
|
const filters = filter.filters;
|
||||||
|
|
@ -199,8 +200,10 @@ export const EventsList = observer((props: Props) => {
|
||||||
const eventsNum = filters.filter((i: any) => i.isEvent).length;
|
const eventsNum = filters.filter((i: any) => i.isEvent).length;
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={
|
className={cn(
|
||||||
'border-b border-b-gray-lighter pt-2 px-4 rounded-xl bg-white border border-gray-lighter'
|
'bg-white',
|
||||||
|
borderless ? '' : 'pb-2 px-4 rounded-xl border border-gray-lighter'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
style={{
|
style={{
|
||||||
borderBottomLeftRadius: props.mergeDown ? 0 : undefined,
|
borderBottomLeftRadius: props.mergeDown ? 0 : undefined,
|
||||||
|
|
@ -217,6 +220,7 @@ export const EventsList = observer((props: Props) => {
|
||||||
mode={'events'}
|
mode={'events'}
|
||||||
filter={undefined}
|
filter={undefined}
|
||||||
onFilterClick={onAddFilter}
|
onFilterClick={onAddFilter}
|
||||||
|
excludeFilterKeys={excludeFilterKeys}
|
||||||
excludeCategory={excludeCategory}
|
excludeCategory={excludeCategory}
|
||||||
>
|
>
|
||||||
<Button
|
<Button
|
||||||
|
|
|
||||||
|
|
@ -201,7 +201,8 @@ export default class API {
|
||||||
Timing(app, options)
|
Timing(app, options)
|
||||||
Focus(app)
|
Focus(app)
|
||||||
Fonts(app)
|
Fonts(app)
|
||||||
if (!options.network.disabled) {
|
const skipNetwork = options.network?.disabled
|
||||||
|
if (!skipNetwork) {
|
||||||
Network(app, options.network)
|
Network(app, options.network)
|
||||||
}
|
}
|
||||||
Selection(app)
|
Selection(app)
|
||||||
|
|
|
||||||
|
|
@ -87,13 +87,10 @@ export default class ConditionsManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
createConditionFromFilter = (filter: Filter) => {
|
createConditionFromFilter = (filter: Filter) => {
|
||||||
if (filter.value.length) {
|
const resultCondition = mapCondition(filter)
|
||||||
const resultCondition = mapCondition(filter)
|
if (resultCondition.type) {
|
||||||
if (resultCondition.type) {
|
return resultCondition
|
||||||
return resultCondition
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return undefined
|
|
||||||
}
|
}
|
||||||
|
|
||||||
trigger(conditionName: string) {
|
trigger(conditionName: string) {
|
||||||
|
|
@ -390,8 +387,9 @@ const mapCondition = (condition: Filter): Condition => {
|
||||||
con = {
|
con = {
|
||||||
type: 'session_duration',
|
type: 'session_duration',
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
value: condition.value[0],
|
value: condition.value,
|
||||||
key: '',
|
key: '',
|
||||||
|
operator: 'is',
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case 'fetchUrl':
|
case 'fetchUrl':
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue