@reltio/interactions 1.4.1584 → 1.4.1586-mui5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.ts +1 -0
- package/package.json +38 -21
- package/public/bundle.js +205 -0
- package/public/bundle.js.LICENSE.txt +79 -0
- package/public/package.json +22 -0
- package/scripts/build/index.js +20 -0
- package/src/InteractionsTableView/InteractionsTable/InteractionsTable.tsx +87 -0
- package/src/InteractionsTableView/InteractionsTable/__tests__/InteractionsTable.test.js +146 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/ActorsRenderer.js +57 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/AttributesRenderer.js +50 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/BlobRenderer.js +14 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/DefaultCellValueRenderer.js +22 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/HeadCellRenderer.js +16 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/LinkRenderer.js +22 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/RowCellRenderer.js +31 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/ActorsRenderer.test.js +87 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/AttributesRenderer.test.js +118 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/DefaultCellValueRenderer.test.js +23 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/LinkRenderer.test.js +20 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/__tests__/RowCellRenderer.test.js +53 -0
- package/src/InteractionsTableView/InteractionsTable/cell-renderers/styles.js +67 -0
- package/src/InteractionsTableView/InteractionsTable/helpers/__tests__/dataHelpers.spec.js +286 -0
- package/src/InteractionsTableView/InteractionsTable/helpers/dataHelpers.ts +120 -0
- package/src/InteractionsTableView/InteractionsTable/styles.ts +29 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/InteractionTypeSelector.tsx +26 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionTypeSelector/__tests__/InteractionTypeSelector.test.js +34 -0
- package/src/InteractionsTableView/InteractionsTableHeader/InteractionsTableHeader.js +76 -0
- package/src/InteractionsTableView/InteractionsTableHeader/__tests__/InteractionsTableHeader.test.js +106 -0
- package/src/InteractionsTableView/InteractionsTableHeader/styles.js +21 -0
- package/src/InteractionsTableView/__tests__/InteractionsTableView.test.js +570 -0
- package/src/InteractionsTableView/__tests__/stateReducer.test.js +260 -0
- package/src/InteractionsTableView/helpers/__tests__/filtersHelper.test.js +221 -0
- package/src/InteractionsTableView/helpers/__tests__/tableHelper.test.js +300 -0
- package/src/InteractionsTableView/helpers/filtersHelpers.ts +18 -0
- package/src/InteractionsTableView/helpers/tableHelpers.ts +157 -0
- package/src/InteractionsTableView/hooks/useInteractions.ts +45 -0
- package/src/InteractionsTableView/index.tsx +200 -0
- package/src/InteractionsTableView/stateReducer.ts +132 -0
- package/src/InteractionsTableView/styles.ts +18 -0
- package/src/InteractionsTableView/types/index.ts +8 -0
- package/src/index.tsx +59 -0
- package/stories/Interactions.stories.js +31 -0
- package/stories/utils/entity.js +11 -0
- package/stories/utils/interactions.js +837 -0
- package/stories/utils/interactionsViewConfig.js +6 -0
- package/stories/utils/mdmStore.js +28 -0
- package/stories/utils/metadata.js +7221 -0
- package/tsconfig.json +4 -0
- package/webpack.config.js +10 -0
- package/bundle.js +0 -2
- package/bundle.js.LICENSE.txt +0 -36
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import stateReducer, {actions} from '../stateReducer';
|
|
2
|
+
import {
|
|
3
|
+
ACTORS_COLUMN_ID,
|
|
4
|
+
ATTRIBUTES_COLUMN_ID,
|
|
5
|
+
DEFAULT_COLUMNS,
|
|
6
|
+
INTERACTION_TYPE_COLUMN_ID
|
|
7
|
+
} from '../helpers/tableHelpers';
|
|
8
|
+
import {DateRangeValue} from '@reltio/mdm-sdk';
|
|
9
|
+
|
|
10
|
+
describe('stateReducer tests', () => {
|
|
11
|
+
describe('on CHANGE_INTERACTION_TYPE action', () => {
|
|
12
|
+
it('should set current interaction type', () => {
|
|
13
|
+
const oldState = {
|
|
14
|
+
currentInteractionType: null,
|
|
15
|
+
visibleColumns: ['timestamp']
|
|
16
|
+
};
|
|
17
|
+
const newType = 'configuration/interactionTypes/1';
|
|
18
|
+
const newState = {
|
|
19
|
+
currentInteractionType: newType
|
|
20
|
+
};
|
|
21
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject(newState);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should hide interaction type and attributes columns if current type changed from undefined to defined', () => {
|
|
25
|
+
const oldState = {
|
|
26
|
+
visibleColumns: ['timestamp', INTERACTION_TYPE_COLUMN_ID, ATTRIBUTES_COLUMN_ID]
|
|
27
|
+
};
|
|
28
|
+
const newType = 'configuration/interactionTypes/1';
|
|
29
|
+
const nextVisibleColumns = ['timestamp'];
|
|
30
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject({
|
|
31
|
+
visibleColumns: nextVisibleColumns
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('should show interaction type and attributes columns and remove attribute columns if current type changed from defined to undefined', () => {
|
|
36
|
+
const oldState = {
|
|
37
|
+
visibleColumns: ['timestamp', 'attributes.someAttribute']
|
|
38
|
+
};
|
|
39
|
+
const nextVisibleColumns = ['timestamp', INTERACTION_TYPE_COLUMN_ID, ATTRIBUTES_COLUMN_ID];
|
|
40
|
+
expect(stateReducer(oldState, actions.changeInteractionType(null))).toMatchObject({
|
|
41
|
+
visibleColumns: nextVisibleColumns
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('should remove attribute columns if current type changed from defined to defined', () => {
|
|
46
|
+
const oldState = {
|
|
47
|
+
currentInteractionType: 'configuration/interactionTypes/1',
|
|
48
|
+
visibleColumns: ['timestamp', 'members', 'attributes.someAttribute1']
|
|
49
|
+
};
|
|
50
|
+
const nextVisibleColumns = ['timestamp', 'members'];
|
|
51
|
+
expect(
|
|
52
|
+
stateReducer(oldState, actions.changeInteractionType('configuration/interactionTypes/2'))
|
|
53
|
+
).toMatchObject({
|
|
54
|
+
visibleColumns: nextVisibleColumns
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should reset current page number', () => {
|
|
59
|
+
const oldState = {
|
|
60
|
+
currentInteractionType: 'configuration/interactionTypes/1',
|
|
61
|
+
page: 2,
|
|
62
|
+
visibleColumns: ['timestamp']
|
|
63
|
+
};
|
|
64
|
+
const newType = 'configuration/interactionTypes/2';
|
|
65
|
+
const newState = {
|
|
66
|
+
currentInteractionType: newType,
|
|
67
|
+
page: 0,
|
|
68
|
+
visibleColumns: ['timestamp']
|
|
69
|
+
};
|
|
70
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject(newState);
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should reset actors filter if it is defined', () => {
|
|
74
|
+
const oldState = {
|
|
75
|
+
currentInteractionType: 'configuration/interactionTypes/1',
|
|
76
|
+
visibleColumns: ['timestamp'],
|
|
77
|
+
filters: {[ACTORS_COLUMN_ID]: {filter: 'equals', value: '12345'}}
|
|
78
|
+
};
|
|
79
|
+
const newType = 'configuration/interactionTypes/2';
|
|
80
|
+
const newState = {
|
|
81
|
+
currentInteractionType: newType,
|
|
82
|
+
visibleColumns: ['timestamp'],
|
|
83
|
+
filters: {}
|
|
84
|
+
};
|
|
85
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject(newState);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('should not change filters if actors filter is undefined', () => {
|
|
89
|
+
const oldState = {
|
|
90
|
+
currentInteractionType: 'configuration/interactionTypes/1',
|
|
91
|
+
visibleColumns: ['timestamp'],
|
|
92
|
+
filters: {}
|
|
93
|
+
};
|
|
94
|
+
const newType = 'configuration/interactionTypes/2';
|
|
95
|
+
const newState = {
|
|
96
|
+
currentInteractionType: newType,
|
|
97
|
+
visibleColumns: ['timestamp'],
|
|
98
|
+
filters: oldState.filters
|
|
99
|
+
};
|
|
100
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject(newState);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should save visible columns for prev type and apply saved visible columns for next type', () => {
|
|
104
|
+
const nextVisibleColumns = ['timestamp', 'attributes.SomeAttr'];
|
|
105
|
+
const oldState = {
|
|
106
|
+
currentInteractionType: 'configuration/interactionTypes/1',
|
|
107
|
+
visibleColumns: ['timestamp'],
|
|
108
|
+
visibleColumnsForInteractionTypes: {
|
|
109
|
+
'configuration/interactionTypes/2': nextVisibleColumns
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const newType = 'configuration/interactionTypes/2';
|
|
113
|
+
const newState = {
|
|
114
|
+
currentInteractionType: newType,
|
|
115
|
+
visibleColumns: nextVisibleColumns,
|
|
116
|
+
visibleColumnsForInteractionTypes: {
|
|
117
|
+
'configuration/interactionTypes/2': nextVisibleColumns,
|
|
118
|
+
'configuration/interactionTypes/1': ['timestamp']
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
expect(stateReducer(oldState, actions.changeInteractionType(newType))).toMatchObject(newState);
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
describe('on APPLY_SAVED_STATE action', () => {
|
|
126
|
+
it('should apply saved state with old visible columns format correctly', () => {
|
|
127
|
+
const oldState = {
|
|
128
|
+
visibleColumns: DEFAULT_COLUMNS,
|
|
129
|
+
currentInteractionType: null,
|
|
130
|
+
filters: null,
|
|
131
|
+
sorting: {
|
|
132
|
+
field: 'timestamp',
|
|
133
|
+
order: 'desc'
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
const savedState = {
|
|
137
|
+
visibleColumns: ['timestamp', 'attributes.SomeAttr'],
|
|
138
|
+
currentInteractionType: 'configuration/interactionTypes/Email',
|
|
139
|
+
filters: {
|
|
140
|
+
'attributes.SomeAttr': {
|
|
141
|
+
filter: 'equals',
|
|
142
|
+
value: '123'
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
sorting: {
|
|
146
|
+
field: 'attributes.SomeAttr',
|
|
147
|
+
order: 'asc'
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const entityType = 'configuration/entityTypes/HCO';
|
|
151
|
+
expect(stateReducer(oldState, actions.applySavedState({savedState, entityType}))).toMatchObject({
|
|
152
|
+
...savedState,
|
|
153
|
+
entityTypeOfAppliedSavedState: entityType
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('should apply saved state with new visible columns format correctly', () => {
|
|
158
|
+
const oldState = {
|
|
159
|
+
visibleColumns: DEFAULT_COLUMNS,
|
|
160
|
+
currentInteractionType: null,
|
|
161
|
+
filters: null,
|
|
162
|
+
sorting: {
|
|
163
|
+
field: 'timestamp',
|
|
164
|
+
order: 'desc'
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
const savedState = {
|
|
168
|
+
visibleColumnsForInteractionTypes: {
|
|
169
|
+
'configuration/interactionTypes/Email': ['timestamp', 'attributes.SomeAttr']
|
|
170
|
+
},
|
|
171
|
+
currentInteractionType: 'configuration/interactionTypes/Email',
|
|
172
|
+
filters: {
|
|
173
|
+
'attributes.SomeAttr': {
|
|
174
|
+
filter: 'equals',
|
|
175
|
+
value: '123'
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
sorting: {
|
|
179
|
+
field: 'attributes.SomeAttr',
|
|
180
|
+
order: 'asc'
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
const entityType = 'configuration/entityTypes/HCO';
|
|
184
|
+
expect(stateReducer(oldState, actions.applySavedState({savedState, entityType}))).toMatchObject({
|
|
185
|
+
...savedState,
|
|
186
|
+
visibleColumns: ['timestamp', 'attributes.SomeAttr'],
|
|
187
|
+
entityTypeOfAppliedSavedState: entityType
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
it('should filter out not supported filter values from saved state', () => {
|
|
192
|
+
const oldState = {
|
|
193
|
+
visibleColumns: DEFAULT_COLUMNS,
|
|
194
|
+
currentInteractionType: null,
|
|
195
|
+
filters: null,
|
|
196
|
+
sorting: {
|
|
197
|
+
field: 'timestamp',
|
|
198
|
+
order: 'desc'
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
const savedState = {
|
|
202
|
+
visibleColumnsForInteractionTypes: {
|
|
203
|
+
'configuration/interactionTypes/Email': ['timestamp', 'attributes.SomeAttr']
|
|
204
|
+
},
|
|
205
|
+
currentInteractionType: 'configuration/interactionTypes/Email',
|
|
206
|
+
filters: {
|
|
207
|
+
'attributes.SomeAttr': {
|
|
208
|
+
filter: 'within',
|
|
209
|
+
value: 'not_supported_value'
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
sorting: {
|
|
213
|
+
field: 'attributes.SomeAttr',
|
|
214
|
+
order: 'asc'
|
|
215
|
+
}
|
|
216
|
+
};
|
|
217
|
+
const entityType = 'configuration/entityTypes/HCO';
|
|
218
|
+
expect(stateReducer(oldState, actions.applySavedState({savedState, entityType}))).toMatchObject({
|
|
219
|
+
...savedState,
|
|
220
|
+
filters: {},
|
|
221
|
+
visibleColumns: ['timestamp', 'attributes.SomeAttr'],
|
|
222
|
+
entityTypeOfAppliedSavedState: entityType
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
it('should apply saved state if date range filter has suported values', () => {
|
|
227
|
+
const oldState = {
|
|
228
|
+
visibleColumns: DEFAULT_COLUMNS,
|
|
229
|
+
currentInteractionType: null,
|
|
230
|
+
filters: null,
|
|
231
|
+
sorting: {
|
|
232
|
+
field: 'timestamp',
|
|
233
|
+
order: 'desc'
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const savedState = {
|
|
237
|
+
visibleColumnsForInteractionTypes: {
|
|
238
|
+
'configuration/interactionTypes/Email': ['timestamp', 'attributes.SomeAttr']
|
|
239
|
+
},
|
|
240
|
+
currentInteractionType: 'configuration/interactionTypes/Email',
|
|
241
|
+
filters: {
|
|
242
|
+
'attributes.SomeAttr': {
|
|
243
|
+
filter: 'within',
|
|
244
|
+
value: DateRangeValue.LAST_6MONTHS
|
|
245
|
+
}
|
|
246
|
+
},
|
|
247
|
+
sorting: {
|
|
248
|
+
field: 'attributes.SomeAttr',
|
|
249
|
+
order: 'asc'
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
const entityType = 'configuration/entityTypes/HCO';
|
|
253
|
+
expect(stateReducer(oldState, actions.applySavedState({savedState, entityType}))).toMatchObject({
|
|
254
|
+
...savedState,
|
|
255
|
+
visibleColumns: ['timestamp', 'attributes.SomeAttr'],
|
|
256
|
+
entityTypeOfAppliedSavedState: entityType
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
});
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import {buildInteractionsFilter} from '../filtersHelpers';
|
|
2
|
+
import {ACTORS_COLUMN_ID} from '../tableHelpers';
|
|
3
|
+
import {makeCompositeFilterOption} from '@reltio/mdm-sdk';
|
|
4
|
+
|
|
5
|
+
const getStartOfDay = (date) => {
|
|
6
|
+
date.setHours(0, 0, 0, 0);
|
|
7
|
+
return date;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const getEndOfDay = (date) => {
|
|
11
|
+
date.setHours(23, 59, 59, 999);
|
|
12
|
+
return date;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
describe('build interactions filter scenarios', () => {
|
|
16
|
+
it('should build correct filter string for timestamp filter', () => {
|
|
17
|
+
const date = new Date('2019-11-01T00:00:00+05:00');
|
|
18
|
+
const filters = {
|
|
19
|
+
timestamp: {
|
|
20
|
+
filter: 'on',
|
|
21
|
+
value: date
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const columnsData = [
|
|
25
|
+
{
|
|
26
|
+
id: 'timestamp',
|
|
27
|
+
dataTypeDefinition: {
|
|
28
|
+
type: 'Timestamp'
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
];
|
|
32
|
+
const localDateStartDay = getStartOfDay(date).getTime();
|
|
33
|
+
const localDateEndDay = getEndOfDay(date).getTime();
|
|
34
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe(
|
|
35
|
+
`range(timestamp,${localDateStartDay},${localDateEndDay})`
|
|
36
|
+
);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should build correct filter string for set of filters', () => {
|
|
40
|
+
const filters = {
|
|
41
|
+
test: {
|
|
42
|
+
filter: 'equals',
|
|
43
|
+
value: '123123123'
|
|
44
|
+
},
|
|
45
|
+
test2: {
|
|
46
|
+
filter: 'exists'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const columnsData = [
|
|
50
|
+
{
|
|
51
|
+
id: 'test',
|
|
52
|
+
dataTypeDefinition: {
|
|
53
|
+
type: 'Number'
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
id: 'test2',
|
|
58
|
+
dataTypeDefinition: {
|
|
59
|
+
type: 'Number'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
];
|
|
63
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe("equals(test,'123123123') and exists(test2)");
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('should build correct filter for current interaction type', () => {
|
|
67
|
+
expect(buildInteractionsFilter('config/interactionTypes/1')).toBe("equals(type,'config/interactionTypes/1')");
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it('should build correct filter for all cases', () => {
|
|
71
|
+
const date = new Date('2019-11-01T00:00:00+05:00');
|
|
72
|
+
const filters = {
|
|
73
|
+
test: {
|
|
74
|
+
filter: 'equals',
|
|
75
|
+
value: '123123123'
|
|
76
|
+
},
|
|
77
|
+
timestamp: {
|
|
78
|
+
filter: 'on',
|
|
79
|
+
value: date,
|
|
80
|
+
type: 'Timestamp'
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
const columnsData = [
|
|
84
|
+
{
|
|
85
|
+
id: 'test',
|
|
86
|
+
dataTypeDefinition: {
|
|
87
|
+
type: 'Number'
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
id: 'timestamp',
|
|
92
|
+
dataTypeDefinition: {
|
|
93
|
+
type: 'Timestamp'
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
];
|
|
97
|
+
const localDateStartDay = getStartOfDay(date).getTime();
|
|
98
|
+
const localDateEndDay = getEndOfDay(date).getTime();
|
|
99
|
+
expect(buildInteractionsFilter('config/interactionTypes/1', filters, columnsData)).toBe(
|
|
100
|
+
`equals(type,'config/interactionTypes/1') and equals(test,'123123123') and range(timestamp,${localDateStartDay},${localDateEndDay})`
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('actors id filters behavior', () => {
|
|
105
|
+
it('should build correct "equals" filter', () => {
|
|
106
|
+
const filters = {
|
|
107
|
+
[ACTORS_COLUMN_ID]: {
|
|
108
|
+
filter: 'equals',
|
|
109
|
+
value: '12345'
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
const columnsData = [
|
|
113
|
+
{
|
|
114
|
+
id: ACTORS_COLUMN_ID,
|
|
115
|
+
dataTypeDefinition: {
|
|
116
|
+
type: 'String'
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
];
|
|
120
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe("equals(members,'12345')");
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should build correct "hasAll" filter', () => {
|
|
124
|
+
const filters = {
|
|
125
|
+
[ACTORS_COLUMN_ID]: {
|
|
126
|
+
filter: 'hasAll',
|
|
127
|
+
value: ['123', '456']
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const columnsData = [
|
|
131
|
+
{
|
|
132
|
+
id: ACTORS_COLUMN_ID,
|
|
133
|
+
dataTypeDefinition: {
|
|
134
|
+
type: 'String'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
];
|
|
138
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe(
|
|
139
|
+
"equals(members,'123') and equals(members,'456')"
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
it('should build correct "in file" filter', () => {
|
|
144
|
+
const filters = {
|
|
145
|
+
[ACTORS_COLUMN_ID]: {
|
|
146
|
+
filter: 'in.file',
|
|
147
|
+
value: {link: 'fileLink'}
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const columnsData = [
|
|
151
|
+
{
|
|
152
|
+
id: ACTORS_COLUMN_ID,
|
|
153
|
+
dataTypeDefinition: {
|
|
154
|
+
type: 'String'
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
];
|
|
158
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe("listEquals(members,'URL:fileLink')");
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
describe('actors type filters behavior', () => {
|
|
163
|
+
it('should build correct "equals" filter', () => {
|
|
164
|
+
const filters = {
|
|
165
|
+
[ACTORS_COLUMN_ID]: {
|
|
166
|
+
filter: makeCompositeFilterOption('types', 'equals'),
|
|
167
|
+
value: 'HCP'
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const columnsData = [
|
|
171
|
+
{
|
|
172
|
+
id: ACTORS_COLUMN_ID,
|
|
173
|
+
dataTypeDefinition: {
|
|
174
|
+
type: 'String'
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
];
|
|
178
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe("equals(members.types,'HCP')");
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it('should build correct "hasAll" filter', () => {
|
|
182
|
+
const filters = {
|
|
183
|
+
[ACTORS_COLUMN_ID]: {
|
|
184
|
+
filter: makeCompositeFilterOption('types', 'hasAll'),
|
|
185
|
+
value: ['HCP', 'HCO']
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const columnsData = [
|
|
189
|
+
{
|
|
190
|
+
id: ACTORS_COLUMN_ID,
|
|
191
|
+
dataTypeDefinition: {
|
|
192
|
+
type: 'String'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
];
|
|
196
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe(
|
|
197
|
+
"equals(members.types,'HCP') and equals(members.types,'HCO')"
|
|
198
|
+
);
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
it('should build correct "in file" filter', () => {
|
|
202
|
+
const filters = {
|
|
203
|
+
[ACTORS_COLUMN_ID]: {
|
|
204
|
+
filter: makeCompositeFilterOption('types', 'in.file'),
|
|
205
|
+
value: {link: 'fileLink'}
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const columnsData = [
|
|
209
|
+
{
|
|
210
|
+
id: ACTORS_COLUMN_ID,
|
|
211
|
+
dataTypeDefinition: {
|
|
212
|
+
type: 'String'
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
];
|
|
216
|
+
expect(buildInteractionsFilter(null, filters, columnsData)).toBe(
|
|
217
|
+
"listEquals(members.types,'URL:fileLink')"
|
|
218
|
+
);
|
|
219
|
+
});
|
|
220
|
+
});
|
|
221
|
+
});
|