@@ -13,6 +13,7 @@ import NeoMarkdownChart from '../chart/markdown/MarkdownChart';
1313import { SELECTION_TYPES } from './CardConfig' ;
1414import NeoLineChart from '../chart/line/LineChart' ;
1515import NeoScatterPlot from '../chart/scatter/ScatterPlotChart' ;
16+ import { objMerge , objectMap } from '../utils/ObjectManipulation' ;
1617
1718// TODO: make the reportConfig a interface with not self-documented code
1819// 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;
2526export const DEFAULT_ROW_LIMIT = 100 ;
2627
2728// A dictionary of available reports (visualizations).
28- export const REPORT_TYPES = {
29+ const _REPORT_TYPES = {
2930 table : {
3031 label : 'Table' ,
3132 helperText : 'A table will contain all returned data.' ,
3233 component : NeoTableChart ,
3334 useReturnValuesAsFields : true ,
3435 maxRecords : 1000 ,
3536 settings : {
36- backgroundColor : {
37- label : 'Background Color' ,
38- type : SELECTION_TYPES . COLOR ,
39- default : '#fafafa' ,
40- } ,
4137 transposed : {
4238 label : 'Transpose Rows & Columns' ,
4339 type : SELECTION_TYPES . LIST ,
@@ -96,11 +92,6 @@ export const REPORT_TYPES = {
9692 type : SELECTION_TYPES . NUMBER ,
9793 default : '0 (No refresh)' ,
9894 } ,
99- description : {
100- label : 'Report Description' ,
101- type : SELECTION_TYPES . MULTILINE_TEXT ,
102- default : 'Enter markdown here...' ,
103- } ,
10495 } ,
10596 } ,
10697 graph : {
@@ -120,11 +111,6 @@ export const REPORT_TYPES = {
120111 // between the different options (EX: if operator is false, then it must be the opposite of the setting it depends on)
121112 disabledDependency : { relationshipParticleSpeed : { dependsOn : 'relationshipParticles' , operator : false } } ,
122113 settings : {
123- backgroundColor : {
124- label : 'Background Color' ,
125- type : SELECTION_TYPES . COLOR ,
126- default : '#fafafa' ,
127- } ,
128114 nodeColorScheme : {
129115 label : 'Node Color Scheme' ,
130116 type : SELECTION_TYPES . LIST ,
@@ -316,11 +302,6 @@ export const REPORT_TYPES = {
316302 values : [ true , false ] ,
317303 default : false ,
318304 } ,
319- description : {
320- label : 'Report Description' ,
321- type : SELECTION_TYPES . MULTILINE_TEXT ,
322- default : 'Enter markdown here...' ,
323- } ,
324305 } ,
325306 } ,
326307 bar : {
@@ -350,11 +331,6 @@ export const REPORT_TYPES = {
350331 } ,
351332 maxRecords : 250 ,
352333 settings : {
353- backgroundColor : {
354- label : 'Background Color' ,
355- type : SELECTION_TYPES . COLOR ,
356- default : '#fafafa' ,
357- } ,
358334 legend : {
359335 label : 'Show Legend' ,
360336 type : SELECTION_TYPES . LIST ,
@@ -488,11 +464,6 @@ export const REPORT_TYPES = {
488464 type : SELECTION_TYPES . NUMBER ,
489465 default : '0 (No refresh)' ,
490466 } ,
491- description : {
492- label : 'Report Description' ,
493- type : SELECTION_TYPES . MULTILINE_TEXT ,
494- default : 'Enter markdown here...' ,
495- } ,
496467 } ,
497468 } ,
498469 pie : {
@@ -522,11 +493,6 @@ export const REPORT_TYPES = {
522493 } ,
523494 maxRecords : 250 ,
524495 settings : {
525- backgroundColor : {
526- label : 'Background Color' ,
527- type : SELECTION_TYPES . COLOR ,
528- default : '#fafafa' ,
529- } ,
530496 legend : {
531497 label : 'Show Legend' ,
532498 type : SELECTION_TYPES . LIST ,
@@ -652,11 +618,6 @@ export const REPORT_TYPES = {
652618 type : SELECTION_TYPES . NUMBER ,
653619 default : '0 (No refresh)' ,
654620 } ,
655- description : {
656- label : 'Report Description' ,
657- type : SELECTION_TYPES . MULTILINE_TEXT ,
658- default : 'Enter markdown here...' ,
659- } ,
660621 } ,
661622 } ,
662623 line : {
@@ -683,11 +644,6 @@ export const REPORT_TYPES = {
683644 } ,
684645 maxRecords : 250 ,
685646 settings : {
686- backgroundColor : {
687- label : 'Background Color' ,
688- type : SELECTION_TYPES . COLOR ,
689- default : '#fafafa' ,
690- } ,
691647 legend : {
692648 label : 'Show Legend' ,
693649 type : SELECTION_TYPES . LIST ,
@@ -839,11 +795,6 @@ export const REPORT_TYPES = {
839795 type : SELECTION_TYPES . NUMBER ,
840796 default : '0 (No refresh)' ,
841797 } ,
842- description : {
843- label : 'Report Description' ,
844- type : SELECTION_TYPES . MULTILINE_TEXT ,
845- default : 'Enter markdown here...' ,
846- } ,
847798 } ,
848799 } ,
849800 // TODO - move to advanced visualization.
@@ -1039,11 +990,6 @@ export const REPORT_TYPES = {
1039990 component : NeoMapChart ,
1040991 maxRecords : 1000 ,
1041992 settings : {
1042- backgroundColor : {
1043- label : 'Background Color' ,
1044- type : SELECTION_TYPES . COLOR ,
1045- default : '#fafafa' ,
1046- } ,
1047993 layerType : {
1048994 label : 'Layer Type' ,
1049995 type : SELECTION_TYPES . LIST ,
@@ -1133,11 +1079,6 @@ export const REPORT_TYPES = {
11331079 values : [ true , false ] ,
11341080 default : true ,
11351081 } ,
1136- description : {
1137- label : 'Report Description' ,
1138- type : SELECTION_TYPES . MULTILINE_TEXT ,
1139- default : 'Enter markdown here...' ,
1140- } ,
11411082 } ,
11421083 } ,
11431084 value : {
@@ -1146,11 +1087,6 @@ export const REPORT_TYPES = {
11461087 component : NeoSingleValueChart ,
11471088 maxRecords : 1 ,
11481089 settings : {
1149- backgroundColor : {
1150- label : 'Background Color' ,
1151- type : SELECTION_TYPES . COLOR ,
1152- default : '#fafafa' ,
1153- } ,
11541090 fontSize : {
11551091 label : 'Font Size' ,
11561092 type : SELECTION_TYPES . NUMBER ,
@@ -1214,11 +1150,6 @@ export const REPORT_TYPES = {
12141150 type : SELECTION_TYPES . NUMBER ,
12151151 default : '0 (No refresh)' ,
12161152 } ,
1217- description : {
1218- label : 'Report Description' ,
1219- type : SELECTION_TYPES . MULTILINE_TEXT ,
1220- default : 'Enter markdown here...' ,
1221- } ,
12221153 } ,
12231154 } ,
12241155 json : {
@@ -1234,11 +1165,6 @@ export const REPORT_TYPES = {
12341165 values : [ 'json' , 'yml' ] ,
12351166 default : 'json' ,
12361167 } ,
1237- backgroundColor : {
1238- label : 'Background Color' ,
1239- type : SELECTION_TYPES . COLOR ,
1240- default : '#fafafa' ,
1241- } ,
12421168 refreshButtonEnabled : {
12431169 label : 'Refreshable' ,
12441170 type : SELECTION_TYPES . LIST ,
@@ -1268,11 +1194,6 @@ export const REPORT_TYPES = {
12681194 type : SELECTION_TYPES . NUMBER ,
12691195 default : '0 (No refresh)' ,
12701196 } ,
1271- description : {
1272- label : 'Report Description' ,
1273- type : SELECTION_TYPES . MULTILINE_TEXT ,
1274- default : 'Enter markdown here...' ,
1275- } ,
12761197 } ,
12771198 } ,
12781199 select : {
@@ -1285,11 +1206,6 @@ export const REPORT_TYPES = {
12851206 textOnly : true ,
12861207 maxRecords : 100 ,
12871208 settings : {
1288- backgroundColor : {
1289- label : 'Background Color' ,
1290- type : SELECTION_TYPES . COLOR ,
1291- default : '#fafafa' ,
1292- } ,
12931209 multiSelector : {
12941210 label : 'Multiple Selection' ,
12951211 type : SELECTION_TYPES . LIST ,
@@ -1369,11 +1285,6 @@ export const REPORT_TYPES = {
13691285 values : [ true , false ] ,
13701286 default : false ,
13711287 } ,
1372- description : {
1373- label : 'Report Description' ,
1374- type : SELECTION_TYPES . MULTILINE_TEXT ,
1375- default : 'Enter markdown here...' ,
1376- } ,
13771288 } ,
13781289 } ,
13791290 iframe : {
@@ -1387,11 +1298,6 @@ export const REPORT_TYPES = {
13871298 maxRecords : 1 ,
13881299 allowScrolling : true ,
13891300 settings : {
1390- backgroundColor : {
1391- label : 'Background Color' ,
1392- type : SELECTION_TYPES . COLOR ,
1393- default : '#fafafa' ,
1394- } ,
13951301 replaceGlobalParameters : {
13961302 label : 'Replace global parameters in URL' ,
13971303 type : SELECTION_TYPES . LIST ,
@@ -1410,11 +1316,6 @@ export const REPORT_TYPES = {
14101316 values : [ true , false ] ,
14111317 default : false ,
14121318 } ,
1413- description : {
1414- label : 'Report Description' ,
1415- type : SELECTION_TYPES . MULTILINE_TEXT ,
1416- default : 'Enter markdown here...' ,
1417- } ,
14181319 } ,
14191320 } ,
14201321 text : {
@@ -1427,11 +1328,6 @@ export const REPORT_TYPES = {
14271328 maxRecords : 1 ,
14281329 allowScrolling : true ,
14291330 settings : {
1430- backgroundColor : {
1431- label : 'Background Color' ,
1432- type : SELECTION_TYPES . COLOR ,
1433- default : '#fafafa' ,
1434- } ,
14351331 replaceGlobalParameters : {
14361332 label : 'Replace global parameters in Markdown' ,
14371333 type : SELECTION_TYPES . LIST ,
@@ -1450,11 +1346,30 @@ export const REPORT_TYPES = {
14501346 values : [ true , false ] ,
14511347 default : false ,
14521348 } ,
1453- description : {
1454- label : 'Report Description' ,
1455- type : SELECTION_TYPES . MULTILINE_TEXT ,
1456- default : 'Enter markdown here...' ,
1457- } ,
14581349 } ,
14591350 } ,
14601351} ;
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