@@ -13,6 +13,7 @@ import NeoMarkdownChart from '../chart/markdown/MarkdownChart';
13
13
import { SELECTION_TYPES } from './CardConfig' ;
14
14
import NeoLineChart from '../chart/line/LineChart' ;
15
15
import NeoScatterPlot from '../chart/scatter/ScatterPlotChart' ;
16
+ import { objMerge , objectMap } from '../utils/ObjectManipulation' ;
16
17
17
18
// TODO: make the reportConfig a interface with not self-documented code
18
19
// Use Neo4j 4.0 subqueries to limit the number of rows returned by overriding the query.
@@ -25,19 +26,14 @@ export const RUN_QUERY_DELAY_MS = 300;
25
26
export const DEFAULT_ROW_LIMIT = 100 ;
26
27
27
28
// A dictionary of available reports (visualizations).
28
- export const REPORT_TYPES = {
29
+ const _REPORT_TYPES = {
29
30
table : {
30
31
label : 'Table' ,
31
32
helperText : 'A table will contain all returned data.' ,
32
33
component : NeoTableChart ,
33
34
useReturnValuesAsFields : true ,
34
35
maxRecords : 1000 ,
35
36
settings : {
36
- backgroundColor : {
37
- label : 'Background Color' ,
38
- type : SELECTION_TYPES . COLOR ,
39
- default : '#fafafa' ,
40
- } ,
41
37
transposed : {
42
38
label : 'Transpose Rows & Columns' ,
43
39
type : SELECTION_TYPES . LIST ,
@@ -96,11 +92,6 @@ export const REPORT_TYPES = {
96
92
type : SELECTION_TYPES . NUMBER ,
97
93
default : '0 (No refresh)' ,
98
94
} ,
99
- description : {
100
- label : 'Report Description' ,
101
- type : SELECTION_TYPES . MULTILINE_TEXT ,
102
- default : 'Enter markdown here...' ,
103
- } ,
104
95
} ,
105
96
} ,
106
97
graph : {
@@ -120,11 +111,6 @@ export const REPORT_TYPES = {
120
111
// between the different options (EX: if operator is false, then it must be the opposite of the setting it depends on)
121
112
disabledDependency : { relationshipParticleSpeed : { dependsOn : 'relationshipParticles' , operator : false } } ,
122
113
settings : {
123
- backgroundColor : {
124
- label : 'Background Color' ,
125
- type : SELECTION_TYPES . COLOR ,
126
- default : '#fafafa' ,
127
- } ,
128
114
nodeColorScheme : {
129
115
label : 'Node Color Scheme' ,
130
116
type : SELECTION_TYPES . LIST ,
@@ -316,11 +302,6 @@ export const REPORT_TYPES = {
316
302
values : [ true , false ] ,
317
303
default : false ,
318
304
} ,
319
- description : {
320
- label : 'Report Description' ,
321
- type : SELECTION_TYPES . MULTILINE_TEXT ,
322
- default : 'Enter markdown here...' ,
323
- } ,
324
305
} ,
325
306
} ,
326
307
bar : {
@@ -350,11 +331,6 @@ export const REPORT_TYPES = {
350
331
} ,
351
332
maxRecords : 250 ,
352
333
settings : {
353
- backgroundColor : {
354
- label : 'Background Color' ,
355
- type : SELECTION_TYPES . COLOR ,
356
- default : '#fafafa' ,
357
- } ,
358
334
legend : {
359
335
label : 'Show Legend' ,
360
336
type : SELECTION_TYPES . LIST ,
@@ -488,11 +464,6 @@ export const REPORT_TYPES = {
488
464
type : SELECTION_TYPES . NUMBER ,
489
465
default : '0 (No refresh)' ,
490
466
} ,
491
- description : {
492
- label : 'Report Description' ,
493
- type : SELECTION_TYPES . MULTILINE_TEXT ,
494
- default : 'Enter markdown here...' ,
495
- } ,
496
467
} ,
497
468
} ,
498
469
pie : {
@@ -522,11 +493,6 @@ export const REPORT_TYPES = {
522
493
} ,
523
494
maxRecords : 250 ,
524
495
settings : {
525
- backgroundColor : {
526
- label : 'Background Color' ,
527
- type : SELECTION_TYPES . COLOR ,
528
- default : '#fafafa' ,
529
- } ,
530
496
legend : {
531
497
label : 'Show Legend' ,
532
498
type : SELECTION_TYPES . LIST ,
@@ -652,11 +618,6 @@ export const REPORT_TYPES = {
652
618
type : SELECTION_TYPES . NUMBER ,
653
619
default : '0 (No refresh)' ,
654
620
} ,
655
- description : {
656
- label : 'Report Description' ,
657
- type : SELECTION_TYPES . MULTILINE_TEXT ,
658
- default : 'Enter markdown here...' ,
659
- } ,
660
621
} ,
661
622
} ,
662
623
line : {
@@ -683,11 +644,6 @@ export const REPORT_TYPES = {
683
644
} ,
684
645
maxRecords : 250 ,
685
646
settings : {
686
- backgroundColor : {
687
- label : 'Background Color' ,
688
- type : SELECTION_TYPES . COLOR ,
689
- default : '#fafafa' ,
690
- } ,
691
647
legend : {
692
648
label : 'Show Legend' ,
693
649
type : SELECTION_TYPES . LIST ,
@@ -839,11 +795,6 @@ export const REPORT_TYPES = {
839
795
type : SELECTION_TYPES . NUMBER ,
840
796
default : '0 (No refresh)' ,
841
797
} ,
842
- description : {
843
- label : 'Report Description' ,
844
- type : SELECTION_TYPES . MULTILINE_TEXT ,
845
- default : 'Enter markdown here...' ,
846
- } ,
847
798
} ,
848
799
} ,
849
800
// TODO - move to advanced visualization.
@@ -1039,11 +990,6 @@ export const REPORT_TYPES = {
1039
990
component : NeoMapChart ,
1040
991
maxRecords : 1000 ,
1041
992
settings : {
1042
- backgroundColor : {
1043
- label : 'Background Color' ,
1044
- type : SELECTION_TYPES . COLOR ,
1045
- default : '#fafafa' ,
1046
- } ,
1047
993
layerType : {
1048
994
label : 'Layer Type' ,
1049
995
type : SELECTION_TYPES . LIST ,
@@ -1133,11 +1079,6 @@ export const REPORT_TYPES = {
1133
1079
values : [ true , false ] ,
1134
1080
default : true ,
1135
1081
} ,
1136
- description : {
1137
- label : 'Report Description' ,
1138
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1139
- default : 'Enter markdown here...' ,
1140
- } ,
1141
1082
} ,
1142
1083
} ,
1143
1084
value : {
@@ -1146,11 +1087,6 @@ export const REPORT_TYPES = {
1146
1087
component : NeoSingleValueChart ,
1147
1088
maxRecords : 1 ,
1148
1089
settings : {
1149
- backgroundColor : {
1150
- label : 'Background Color' ,
1151
- type : SELECTION_TYPES . COLOR ,
1152
- default : '#fafafa' ,
1153
- } ,
1154
1090
fontSize : {
1155
1091
label : 'Font Size' ,
1156
1092
type : SELECTION_TYPES . NUMBER ,
@@ -1214,11 +1150,6 @@ export const REPORT_TYPES = {
1214
1150
type : SELECTION_TYPES . NUMBER ,
1215
1151
default : '0 (No refresh)' ,
1216
1152
} ,
1217
- description : {
1218
- label : 'Report Description' ,
1219
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1220
- default : 'Enter markdown here...' ,
1221
- } ,
1222
1153
} ,
1223
1154
} ,
1224
1155
json : {
@@ -1234,11 +1165,6 @@ export const REPORT_TYPES = {
1234
1165
values : [ 'json' , 'yml' ] ,
1235
1166
default : 'json' ,
1236
1167
} ,
1237
- backgroundColor : {
1238
- label : 'Background Color' ,
1239
- type : SELECTION_TYPES . COLOR ,
1240
- default : '#fafafa' ,
1241
- } ,
1242
1168
refreshButtonEnabled : {
1243
1169
label : 'Refreshable' ,
1244
1170
type : SELECTION_TYPES . LIST ,
@@ -1268,11 +1194,6 @@ export const REPORT_TYPES = {
1268
1194
type : SELECTION_TYPES . NUMBER ,
1269
1195
default : '0 (No refresh)' ,
1270
1196
} ,
1271
- description : {
1272
- label : 'Report Description' ,
1273
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1274
- default : 'Enter markdown here...' ,
1275
- } ,
1276
1197
} ,
1277
1198
} ,
1278
1199
select : {
@@ -1285,11 +1206,6 @@ export const REPORT_TYPES = {
1285
1206
textOnly : true ,
1286
1207
maxRecords : 100 ,
1287
1208
settings : {
1288
- backgroundColor : {
1289
- label : 'Background Color' ,
1290
- type : SELECTION_TYPES . COLOR ,
1291
- default : '#fafafa' ,
1292
- } ,
1293
1209
multiSelector : {
1294
1210
label : 'Multiple Selection' ,
1295
1211
type : SELECTION_TYPES . LIST ,
@@ -1369,11 +1285,6 @@ export const REPORT_TYPES = {
1369
1285
values : [ true , false ] ,
1370
1286
default : false ,
1371
1287
} ,
1372
- description : {
1373
- label : 'Report Description' ,
1374
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1375
- default : 'Enter markdown here...' ,
1376
- } ,
1377
1288
} ,
1378
1289
} ,
1379
1290
iframe : {
@@ -1387,11 +1298,6 @@ export const REPORT_TYPES = {
1387
1298
maxRecords : 1 ,
1388
1299
allowScrolling : true ,
1389
1300
settings : {
1390
- backgroundColor : {
1391
- label : 'Background Color' ,
1392
- type : SELECTION_TYPES . COLOR ,
1393
- default : '#fafafa' ,
1394
- } ,
1395
1301
replaceGlobalParameters : {
1396
1302
label : 'Replace global parameters in URL' ,
1397
1303
type : SELECTION_TYPES . LIST ,
@@ -1410,11 +1316,6 @@ export const REPORT_TYPES = {
1410
1316
values : [ true , false ] ,
1411
1317
default : false ,
1412
1318
} ,
1413
- description : {
1414
- label : 'Report Description' ,
1415
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1416
- default : 'Enter markdown here...' ,
1417
- } ,
1418
1319
} ,
1419
1320
} ,
1420
1321
text : {
@@ -1427,11 +1328,6 @@ export const REPORT_TYPES = {
1427
1328
maxRecords : 1 ,
1428
1329
allowScrolling : true ,
1429
1330
settings : {
1430
- backgroundColor : {
1431
- label : 'Background Color' ,
1432
- type : SELECTION_TYPES . COLOR ,
1433
- default : '#fafafa' ,
1434
- } ,
1435
1331
replaceGlobalParameters : {
1436
1332
label : 'Replace global parameters in Markdown' ,
1437
1333
type : SELECTION_TYPES . LIST ,
@@ -1450,11 +1346,30 @@ export const REPORT_TYPES = {
1450
1346
values : [ true , false ] ,
1451
1347
default : false ,
1452
1348
} ,
1453
- description : {
1454
- label : 'Report Description' ,
1455
- type : SELECTION_TYPES . MULTILINE_TEXT ,
1456
- default : 'Enter markdown here...' ,
1457
- } ,
1458
1349
} ,
1459
1350
} ,
1460
1351
} ;
1352
+
1353
+ export const COMMON_REPORT_SETTINGS = {
1354
+ backgroundColor : {
1355
+ label : 'Background Color' ,
1356
+ type : SELECTION_TYPES . COLOR ,
1357
+ default : '#fafafa' ,
1358
+ } ,
1359
+ description : {
1360
+ label : 'Selector Description' ,
1361
+ type : SELECTION_TYPES . MULTILINE_TEXT ,
1362
+ default : 'Enter markdown here...' ,
1363
+ } ,
1364
+ ignoreNonDefinedParams : {
1365
+ label : 'Ignore undefined parameters' ,
1366
+ type : SELECTION_TYPES . LIST ,
1367
+ values : [ true , false ] ,
1368
+ default : false ,
1369
+ refresh : true ,
1370
+ } ,
1371
+ } ;
1372
+
1373
+ export const REPORT_TYPES = objectMap ( _REPORT_TYPES , ( value : any ) => {
1374
+ return objMerge ( { settings : COMMON_REPORT_SETTINGS } , value ) ;
1375
+ } ) ;
0 commit comments