|
79 | 79 | parent.addClass('open');
|
80 | 80 | }
|
81 | 81 |
|
82 |
| - // if the user wanted to perform an action |
83 |
| - // and the chart is no longer showing because that particular screen is showing |
84 |
| - // e.g. create parameters |
85 |
| - // and then the user decided to click on another action |
86 |
| - // let's invoke the show chart of the previous action so that the chart shows |
87 |
| - // and the user does not get confused |
88 |
| - $('input[type="button"][data-current!="chart"].show-chart-toggle').trigger('click'); |
| 82 | + /* |
| 83 | + * if the user wants to perform an action and click that tab to change the source |
| 84 | + * and the chart is no longer showing because that particular LHS screen is showing |
| 85 | + * e.g. create parameters, import json, db query box etc. |
| 86 | + * we need to make sure we cancel the current process WITHOUT saving |
| 87 | + * and then show the chart as it was |
| 88 | + * let's close the LHS window and show the chart that is hidden |
| 89 | + */ |
| 90 | + $('body').trigger('visualizer:change:action'); |
89 | 91 | });
|
90 | 92 |
|
91 | 93 | // collapse other open subsections of this section
|
|
338 | 340 | });
|
339 | 341 |
|
340 | 342 | $( '#db-chart-button' ).on( 'click', function(){
|
| 343 | + |
| 344 | + $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){ |
| 345 | + var filter_button = $( '#db-chart-button' ); |
| 346 | + $( '#visualizer-db-query' ).css("z-index", "-1").hide(); |
| 347 | + filter_button.val( filter_button.attr( 'data-t-chart' ) ); |
| 348 | + filter_button.html( filter_button.attr( 'data-t-chart' ) ); |
| 349 | + filter_button.attr( 'data-current', 'chart' ); |
| 350 | + $( '#canvas' ).css("z-index", "1").show(); |
| 351 | + }); |
| 352 | + |
341 | 353 | $('#content').css('width', 'calc(100% - 300px)');
|
342 | 354 | if( $(this).attr( 'data-current' ) === 'chart'){
|
343 | 355 | $(this).val( $(this).attr( 'data-t-filter' ) );
|
|
390 | 402 |
|
391 | 403 | // toggle between chart and create/modify parameters
|
392 | 404 | $( '#json-chart-button' ).on( 'click', function(){
|
393 |
| - var $bttn = $(this); |
| 405 | + |
| 406 | + $('body').off('visualizer:change:action').on('visualizer:change:action', function(e){ |
| 407 | + var filter_button = $( '#json-chart-button' ); |
| 408 | + $( '#visualizer-json-screen' ).css("z-index", "-1").hide(); |
| 409 | + filter_button.val( filter_button.attr( 'data-t-chart' ) ); |
| 410 | + filter_button.html( filter_button.attr( 'data-t-chart' ) ); |
| 411 | + filter_button.attr( 'data-current', 'chart' ); |
| 412 | + $( '#canvas' ).css("z-index", "1").show(); |
| 413 | + }); |
| 414 | + |
394 | 415 | $('#content').css('width', 'calc(100% - 100px)');
|
395 | 416 | if( $(this).attr( 'data-current' ) === 'chart'){
|
396 | 417 | // toggle from chart to LHS form
|
|
0 commit comments