@@ -20,7 +20,11 @@ export default class DevToolsView extends esp.model.DisposableBase {
2020 this . _timelineData = new vis . DataSet ( ) ;
2121 this . _timeline = null ;
2222 this . _autoscrollCheckbox = null ;
23+ this . _captureEventsCheckbox = null ;
24+ this . _logEventsConsoleCheckbox = null ;
25+ this . _resetChartButton = null ;
2326 this . _eventDetailsDescriptionP = null ;
27+ this . _footer = null ;
2428 }
2529
2630 start ( ) {
@@ -42,21 +46,26 @@ export default class DevToolsView extends esp.model.DisposableBase {
4246 group : model . lastEvent . modelId ,
4347 title : model . lastEvent . eventType ,
4448 start : model . lastEvent . publishedTime ,
49+ className : 'eventDot'
4550 } ) ;
51+ } else if ( model . updateType === UpdateType . reset ) {
52+ this . _timelineGroups . clear ( ) ;
53+ this . _timelineData . clear ( ) ;
4654 }
4755
48- if ( this . _timeline && this . _autoscrollCheckbox ) {
56+ if ( this . _timeline ) {
4957 this . _timeline . setOptions ( { max : moment ( ) . add ( 2 , 'm' ) } )
5058 if ( model . shouldAutoScroll ) {
5159 this . _setTimelineWindow ( ) ;
5260 }
53- if ( this . _autoscrollCheckbox . prop ( 'checked' ) !== model . shouldAutoScroll ) {
61+ if ( this . _autoscrollCheckbox . prop ( 'checked' ) !== model . shouldAutoScroll ) {
5462 this . _autoscrollCheckbox . prop ( 'checked' , model . shouldAutoScroll ) ;
5563 }
5664
57- if ( this . _eventDetailsDescriptionP && model . selectedEvent ) {
65+ if ( this . _eventDetailsDescriptionP && model . selectedEvent ) {
5866 this . _eventDetailsDescriptionP . html ( JSON . stringify ( model . selectedEvent ) ) ;
5967 }
68+ this . _footer . html ( `Total events: ${ model . totalEventCount } ` ) ;
6069 }
6170 } )
6271 ) ;
@@ -66,18 +75,27 @@ export default class DevToolsView extends esp.model.DisposableBase {
6675 let _this = this ;
6776 $ ( ( ) => {
6877 let container = $ ( template ) ;
78+ // note use of function so 'this' is the checkbox
6979 this . _autoscrollCheckbox = container . find ( '#autoscrollCheckbox' ) ;
70- this . _autoscrollCheckbox . change ( function ( ) { // note use of function so 'this' is the checkbox
80+ this . _autoscrollCheckbox . change ( function ( ) {
7181 _this . _router . publishEvent ( 'autoscrollToggled' , { shouldAutoScroll : this . checked } ) ;
7282 } ) ;
83+ this . _captureEventsCheckbox = container . find ( '#captureEvents' ) ;
84+ this . _captureEventsCheckbox . change ( function ( ) {
85+ _this . _router . publishEvent ( 'captureEventsToggled' , { shouldCaptureEvents : this . checked } ) ;
86+ } ) ;
87+ this . _logEventsConsoleCheckbox = container . find ( '#logEventsConsole' ) ;
88+ this . _logEventsConsoleCheckbox . change ( function ( ) {
89+ _this . _router . publishEvent ( 'logEventsConsoleToggled' , { shouldLogToConsole : this . checked } ) ;
90+ } ) ;
91+ this . _resetChartButton = container . find ( '#resetChart' ) ;
92+ this . _resetChartButton . click ( function ( ) {
93+ _this . _router . publishEvent ( 'resetChart' , { } ) ;
94+ } ) ;
7395 this . _eventDetailsDescriptionP = container . find ( '#eventDetailsDescription' ) ;
96+ this . _footer = container . find ( '#footer' ) ;
7497
75- let inner = $ ( "<div class='inner'></div>" ) ;
76- container . append ( inner ) ;
77- container . draggable ( {
78- cursor : 'move' ,
79- handle : '#header'
80- } ) ;
98+ let chartContainer = container . find ( '#chartContainer' ) ;
8199 let options = {
82100 groupOrder : 'content' ,
83101 showCurrentTime : true ,
@@ -90,13 +108,18 @@ export default class DevToolsView extends esp.model.DisposableBase {
90108 // zoomMin: 1000 * 60 * 60 * 24, // one day in milliseconds
91109 //zoomMax: 1000 * 60 * 60 * 24 // one day in milliseconds
92110 } ;
93- this . _timeline = new vis . Timeline ( inner [ 0 ] ) ;
111+ this . _timeline = new vis . Timeline ( chartContainer [ 0 ] ) ;
94112 this . _timeline . setOptions ( options ) ;
95113 this . _timeline . setGroups ( this . _timelineGroups ) ;
96114 this . _timeline . setItems ( this . _timelineData ) ;
97115 this . _wireUpTimelineEvents ( this . _timeline ) ;
98116 this . _setTimelineWindow ( ) ;
99117 $ ( 'body' ) . append ( container ) ;
118+ // need to do this after it's been appended to the dome, else it addes a relative styling
119+ container . draggable ( {
120+ cursor : 'move' ,
121+ handle : '#header'
122+ } ) ;
100123 } ) ;
101124 }
102125
@@ -113,10 +136,18 @@ export default class DevToolsView extends esp.model.DisposableBase {
113136 }
114137 ) ;
115138 } ) ;
116- timeline . on ( 'click' , properties => { this . _disableAutoScroll ( ) } ) ;
117- timeline . on ( 'doubleClick' , properties => { this . _disableAutoScroll ( ) } ) ;
118- timeline . on ( 'timechanged' , properties => { this . _disableAutoScroll ( ) } ) ;
119- timeline . on ( 'groupDragged' , properties => { this . _disableAutoScroll ( ) } ) ;
139+ timeline . on ( 'click' , properties => {
140+ this . _disableAutoScroll ( )
141+ } ) ;
142+ timeline . on ( 'doubleClick' , properties => {
143+ this . _disableAutoScroll ( )
144+ } ) ;
145+ timeline . on ( 'timechanged' , properties => {
146+ this . _disableAutoScroll ( )
147+ } ) ;
148+ timeline . on ( 'groupDragged' , properties => {
149+ this . _disableAutoScroll ( )
150+ } ) ;
120151 }
121152
122153 _disableAutoScroll ( ) {
0 commit comments