@@ -19,6 +19,9 @@ import NeoPropertySelectReport from "./report/NeoPropertySelectReport";
19
19
import NeoMapReport from "./report/NeoMapReport" ;
20
20
import NeoMapFooter from "./footer/NeoMapFooter" ;
21
21
import NeoIFrameReport from "./report/NeoIFrameReport" ;
22
+ import NeoLiveTimeChartReport from "./report/experimental/NeoLiveTimeChartReport" ;
23
+ import NeoSearchBarReport from "./report/experimental/NeoSearchBarReport" ;
24
+ import NeoBigNumberReport from "./report/experimental/NeoBigNumberReport" ;
22
25
23
26
24
27
let emptyAction = < div key = { 0 } /> ;
@@ -258,6 +261,15 @@ export class NeoCard extends React.Component {
258
261
if ( this . state . type === 'line' ) {
259
262
this . setCardTypeToLineChart ( ) ;
260
263
}
264
+ if ( this . state . type === 'bignumber' ) {
265
+ this . setCardTypeToBigNumberView ( ) ;
266
+ }
267
+ if ( this . state . type === 'searchbar' ) {
268
+ this . setCardTypeToSearchBar ( ) ;
269
+ }
270
+ if ( this . state . type === 'time' ) {
271
+ this . setCardTypeToTimeChart ( ) ;
272
+ }
261
273
if ( this . state . type === "graph" ) {
262
274
this . setCardTypeToGraph ( ) ;
263
275
}
@@ -276,7 +288,7 @@ export class NeoCard extends React.Component {
276
288
if ( this . state . type === 'map' ) {
277
289
this . setCardTypeToMap ( ) ;
278
290
}
279
- if ( this . state . success === false || this . state . query === "" || this . state . query === "\n" ) {
291
+ if ( this . state . success === false || this . state . query === "" || this . state . query === "\n" ) {
280
292
this . state . action = emptyAction ;
281
293
}
282
294
return state
@@ -298,36 +310,54 @@ export class NeoCard extends React.Component {
298
310
setCardTypeToTableView ( ) {
299
311
this . state . content =
300
312
< NeoTableReport connection = { this . props . connection }
301
- rows = { this . state . height == 4 ? NeoTableReport . normalRowCount : NeoTableReport . tallRowCount }
302
- page = { this . state . page }
303
- query = { this . state . query }
304
- stateChanged = { this . stateChanged }
305
- params = { this . state . parsedParameters }
306
- refresh = { this . state . refresh }
313
+ rows = { this . state . height == 4 ? NeoTableReport . normalRowCount : NeoTableReport . tallRowCount }
314
+ page = { this . state . page }
315
+ query = { this . state . query }
316
+ stateChanged = { this . stateChanged }
317
+ params = { this . state . parsedParameters }
318
+ refresh = { this . state . refresh }
307
319
/>
308
-
320
+ if ( this . state . parsedParameters && ! this . state . parsedParameters . hideFooter ) {
309
321
this . state . action =
310
322
< NeoTableFooter page = { this . state . page } key = { 0 } data = { this . state . data } onChange = { this . stateChanged } />
323
+ }
311
324
312
325
}
313
326
327
+ /**
328
+ * Updates the card's report to a table.
329
+ */
330
+ setCardTypeToBigNumberView ( ) {
331
+ this . state . content =
332
+ < NeoBigNumberReport connection = { this . props . connection }
333
+ page = { this . state . page }
334
+ query = { this . state . query }
335
+ stateChanged = { this . stateChanged }
336
+ onSelectionChange = { this . onSelectionChange }
337
+ params = { this . state . parsedParameters }
338
+ refresh = { this . state . refresh }
339
+ />
340
+ this . state . action = emptyAction ;
341
+ }
342
+
343
+
314
344
/**
315
345
* Updates the card's report to a bar chart.
316
346
*/
317
347
setCardTypeToBarChart ( ) {
318
348
this . state . content =
319
349
< NeoBarChartReport connection = { this . props . connection }
320
- page = { this . state . page }
321
- query = { this . state . query }
322
- clientWidth = { ( this . cardRef . current ) ? this . cardRef . current . clientWidth : 0 }
323
- id = { this . props . id }
324
- stateChanged = { this . stateChanged }
325
- propertiesSelected = { this . state . propertiesSelected }
326
- onNodeLabelUpdate = { this . updateBarPropertySelect }
327
- params = { this . state . parsedParameters }
328
- refresh = { this . state . refresh }
329
- width = { this . state . width }
330
- height = { this . state . height }
350
+ page = { this . state . page }
351
+ query = { this . state . query }
352
+ clientWidth = { ( this . cardRef . current ) ? this . cardRef . current . clientWidth : 0 }
353
+ id = { this . props . id }
354
+ stateChanged = { this . stateChanged }
355
+ propertiesSelected = { this . state . propertiesSelected }
356
+ onNodeLabelUpdate = { this . updateBarPropertySelect }
357
+ params = { this . state . parsedParameters }
358
+ refresh = { this . state . refresh }
359
+ width = { this . state . width }
360
+ height = { this . state . height }
331
361
/>
332
362
}
333
363
@@ -337,20 +367,42 @@ export class NeoCard extends React.Component {
337
367
setCardTypeToLineChart ( ) {
338
368
this . state . content =
339
369
< NeoLineChartReport connection = { this . props . connection }
340
- page = { this . state . page }
341
- query = { this . state . query }
342
- clientWidth = { ( this . cardRef . current ) ? this . cardRef . current . clientWidth : 0 }
343
- id = { this . props . id }
344
- stateChanged = { this . stateChanged }
345
- propertiesSelected = { this . state . propertiesSelected }
346
- onNodeLabelUpdate = { this . updateLinePropertySelect }
347
- params = { this . state . parsedParameters }
348
- refresh = { this . state . refresh }
349
- width = { this . state . width }
350
- height = { this . state . height }
370
+ page = { this . state . page }
371
+ query = { this . state . query }
372
+ clientWidth = { ( this . cardRef . current ) ? this . cardRef . current . clientWidth : 0 }
373
+ id = { this . props . id }
374
+ stateChanged = { this . stateChanged }
375
+ propertiesSelected = { this . state . propertiesSelected }
376
+ onNodeLabelUpdate = { this . updateLinePropertySelect }
377
+ params = { this . state . parsedParameters }
378
+ refresh = { this . state . refresh }
379
+ width = { this . state . width }
380
+ height = { this . state . height }
351
381
/>
352
382
}
353
383
384
+ /**
385
+ * Updates the card's report to a line chart.
386
+ */
387
+ setCardTypeToTimeChart ( ) {
388
+ this . state . content =
389
+ < NeoLiveTimeChartReport connection = { this . props . connection }
390
+ page = { this . state . page }
391
+ query = { this . state . query }
392
+ clientWidth = { ( this . cardRef . current ) ? this . cardRef . current . clientWidth : 0 }
393
+ id = { this . props . id }
394
+ stateChanged = { this . stateChanged }
395
+ propertiesSelected = { this . state . propertiesSelected }
396
+ onNodeLabelUpdate = { function ( ) {
397
+ } }
398
+ params = { this . state . parsedParameters }
399
+ refresh = { this . state . refresh }
400
+ width = { this . state . width }
401
+ height = { this . state . height }
402
+ />
403
+ this . state . action = emptyAction ;
404
+ }
405
+
354
406
/**
355
407
* Updates the card's report to a graph visualization.
356
408
*/
@@ -420,6 +472,20 @@ export class NeoCard extends React.Component {
420
472
this . state . action = emptyAction ;
421
473
}
422
474
475
+ /**
476
+ * Update the card's report to a search bar view.
477
+ */
478
+ setCardTypeToSearchBar ( ) {
479
+ this . state . content =
480
+ < NeoSearchBarReport
481
+ connection = { this . props . connection }
482
+ query = { 'return true' }
483
+ data = { this . state . query }
484
+ stateChanged = { this . stateChanged }
485
+ refresh = { this . state . refresh } />
486
+ this . state . action = emptyAction ;
487
+ }
488
+
423
489
/**
424
490
* Update the card's report to a Markdown view.
425
491
*/
@@ -434,7 +500,7 @@ export class NeoCard extends React.Component {
434
500
refresh = { this . state . refresh } />
435
501
this . state . action = emptyAction ;
436
502
}
437
-
503
+
438
504
/**
439
505
* Update the card's report to a property selection.
440
506
*/
@@ -483,6 +549,7 @@ RETURN DISTINCT n.\`${property}\` as value LIMIT 4`;
483
549
* For selection reports, the selected value has changed. This should be propagated to other reports.
484
550
*/
485
551
onSelectionChange ( label , property , propertyId , value ) {
552
+
486
553
this . props . onChange ( {
487
554
label : "GlobalParameterChanged" ,
488
555
value : { label : label , property : property , propertyId : propertyId , value : value }
@@ -528,9 +595,9 @@ RETURN DISTINCT n.\`${property}\` as value LIMIT 4`;
528
595
this . state . page += 1 ;
529
596
this . state . action =
530
597
< NeoBarChartFooter propertiesSelected = { this . state . propertiesSelected } page = { this . state . page } key = { 0 }
531
- data = { this . state . data }
532
- onChange = { this . stateChanged }
533
- categories = { labels } values = { labels }
598
+ data = { this . state . data }
599
+ onChange = { this . stateChanged }
600
+ categories = { labels } values = { labels }
534
601
/>
535
602
this . setState ( this . state ) ;
536
603
}
@@ -542,9 +609,9 @@ RETURN DISTINCT n.\`${property}\` as value LIMIT 4`;
542
609
this . state . page += 1 ;
543
610
this . state . action =
544
611
< NeoLineChartFooter propertiesSelected = { this . state . propertiesSelected } page = { this . state . page } key = { 0 }
545
- data = { this . state . data }
546
- onChange = { this . stateChanged }
547
- categories = { labels } values = { labels }
612
+ data = { this . state . data }
613
+ onChange = { this . stateChanged }
614
+ categories = { labels } values = { labels }
548
615
/>
549
616
550
617
this . setState ( this . state ) ;
@@ -562,10 +629,10 @@ RETURN DISTINCT n.\`${property}\` as value LIMIT 4`;
562
629
563
630
564
631
this . state . action = < NeoMapFooter key = { 0 } nodeLabels = { Object . keys ( labels ) }
565
- width = { this . props . width }
566
- params = { this . state . parsedParameters }
632
+ width = { this . props . width }
633
+ params = { this . state . parsedParameters }
567
634
568
- onChange = { this . stateChanged } /> ;
635
+ onChange = { this . stateChanged } /> ;
569
636
570
637
}
571
638
@@ -591,29 +658,33 @@ RETURN DISTINCT n.\`${property}\` as value LIMIT 4`;
591
658
592
659
593
660
this . state . action = < NeoGraphVisFooter key = { 0 } nodeLabels = { Object . keys ( labels ) }
594
- width = { this . props . width }
595
- params = { this . state . parsedParameters }
596
- properties = { Object . values ( labels ) . map ( ( labelChoices , index ) => {
597
- let options = { }
598
- labelChoices . forEach ( choice =>
599
- options [ ( index + "-" + choice ) ] = choice
600
- )
601
- return options ;
602
- } ) }
603
- onChange = { this . stateChanged } /> ;
661
+ width = { this . props . width }
662
+ params = { this . state . parsedParameters }
663
+ properties = { Object . values ( labels ) . map ( ( labelChoices , index ) => {
664
+ let options = { }
665
+ labelChoices . forEach ( choice =>
666
+ options [ ( index + "-" + choice ) ] = choice
667
+ )
668
+ return options ;
669
+ } ) }
670
+ onChange = { this . stateChanged } /> ;
604
671
605
672
}
606
673
607
674
/**
608
675
* Render the NeoCard component with the currently selected report.
609
676
*/
610
677
render ( ) {
678
+ let backgroundColor = ( this . state . parsedParameters . background ) ? this . state . parsedParameters . background + "" : "" ;
611
679
return < Col l = { this . state . width } m = { 12 } s = { 12 } >
612
680
< div ref = { this . cardRef } >
613
681
< Card
614
682
actions = { [ this . state . action ] }
615
- style = { { height : ( this . state . height * 100 + 22 * ( ( this . state . height / 4 ) - 1 ) ) + 'px' } }
616
- className = { "neo-card medium white darken-5 paginated-card" }
683
+ style = { {
684
+ backgroundColor : backgroundColor ,
685
+ height : ( this . state . height * 100 + 22 * ( ( this . state . height / 4 ) - 1 ) ) + 'px'
686
+ } }
687
+ className = { "neo-card medium darken-5 paginated-card" }
617
688
closeIcon = { this . closeIcon }
618
689
revealIcon = { ( this . props . editable ) ? < Icon > more_vert</ Icon > : < div > </ div > }
619
690
textClassName = "black-text"
0 commit comments