|
77 | 77 | parent.addClass('open');
|
78 | 78 | }
|
79 | 79 |
|
80 |
| - // if the user wanted to perform an action |
81 |
| - // and the chart is no longer showing because that particular screen is showing |
82 |
| - // e.g. create parameters |
83 |
| - // and then the user decided to click on another action |
84 |
| - // let's invoke the show chart of the previous action so that the chart shows |
85 |
| - // and the user does not get confused |
86 |
| - $('input[type="button"][data-current!="chart"].show-chart-toggle').trigger('click'); |
| 80 | + /* |
| 81 | + * if the user wants to perform an action and click that tab to change the source |
| 82 | + * and the chart is no longer showing because that particular LHS screen is showing |
| 83 | + * e.g. create parameters, import json, db query box etc. |
| 84 | + * we need to make sure we cancel the current process WITHOUT saving |
| 85 | + * and then show the chart as it was |
| 86 | + * let's close the LHS window and show the chart that is hidden |
| 87 | + */ |
| 88 | + $('body').trigger('visualizer:change:action'); |
87 | 89 | });
|
88 | 90 |
|
89 | 91 | // collapse other open subsections of this section
|
|
307 | 309 | });
|
308 | 310 |
|
309 | 311 | $( '#db-chart-button' ).on( 'click', function(){
|
| 312 | + |
| 313 | + $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){ |
| 314 | + var filter_button = $( '#db-chart-button' ); |
| 315 | + $( '#visualizer-db-query' ).css("z-index", "-1").hide(); |
| 316 | + filter_button.val( filter_button.attr( 'data-t-chart' ) ); |
| 317 | + filter_button.html( filter_button.attr( 'data-t-chart' ) ); |
| 318 | + filter_button.attr( 'data-current', 'chart' ); |
| 319 | + $( '#canvas' ).css("z-index", "1").show(); |
| 320 | + }); |
| 321 | + |
310 | 322 | $('#content').css('width', 'calc(100% - 300px)');
|
311 | 323 | if( $(this).attr( 'data-current' ) === 'chart'){
|
312 | 324 | $(this).val( $(this).attr( 'data-t-filter' ) );
|
|
359 | 371 |
|
360 | 372 | // toggle between chart and create/modify parameters
|
361 | 373 | $( '#json-chart-button' ).on( 'click', function(){
|
362 |
| - var $bttn = $(this); |
| 374 | + |
| 375 | + $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){ |
| 376 | + var filter_button = $( '#json-chart-button' ); |
| 377 | + $( '#visualizer-json-screen' ).css("z-index", "-1").hide(); |
| 378 | + filter_button.val( filter_button.attr( 'data-t-chart' ) ); |
| 379 | + filter_button.html( filter_button.attr( 'data-t-chart' ) ); |
| 380 | + filter_button.attr( 'data-current', 'chart' ); |
| 381 | + $( '#canvas' ).css("z-index", "1").show(); |
| 382 | + }); |
| 383 | + |
363 | 384 | $('#content').css('width', 'calc(100% - 100px)');
|
364 | 385 | if( $(this).attr( 'data-current' ) === 'chart'){
|
365 | 386 | // toggle from chart to LHS form
|
|
0 commit comments