Fix bug:3829 Enabling query profiling crashes javascript based navigation

This commit is contained in:
Atul Pratap Singh 2013-02-22 15:08:14 +05:30
parent bb7f3e1559
commit b9c61c7dc1
3 changed files with 13 additions and 7 deletions

View File

@ -94,6 +94,7 @@ underscore
- rfe #1386 Add IF NOT EXISTS clause when copying database
- No longer package .travis.yml configuration file when creating a release.
- bug #3830 Can't export custom query because it lowercases table names
- bug #3829 Enabling query profiling crashes javascript based navigation
3.5.8.0 (not yet released)
- bug #3828 MariaDB reported as MySQL

View File

@ -561,17 +561,20 @@ AJAX.registerOnload('sql.js', function() {
*/
function makeProfilingChart()
{
if ($('#profilingchart').length == 0) {
if ($('#profilingchart').length == 0
|| $('#profilingchart').html().length != 0
) {
return;
}
var data = [];
$.each(jQuery.parseJSON($('#profilingchart').html()),function(key,value) {
$.each(jQuery.parseJSON($('#profilingChartData').html()),function(key,value) {
data.push([key,parseFloat(value)]);
});
// Prevent the user from seeing the JSON code
$('div#profilingchart').html('').show();
// Remove chart and data divs contents
$('#profilingchart').html('').show();
$('#profilingChartData').html('');
PMA_createProfilingChartJqplot('profilingchart', data);
}

View File

@ -1150,7 +1150,7 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
echo '<script type="text/javascript">';
echo 'pma_token = \'' . $_SESSION[' PMA_token '] . '\';';
echo 'url_query = \'' . (isset($url_query) ? $url_query : PMA_generate_common_url($db)) . '\';';
echo '$(makeProfilingChart);';
echo 'AJAX.registerOnload(\'sql.js\',makeProfilingChart);';
echo '</script>';
echo '<fieldset><legend>' . __('Profiling') . '</legend>' . "\n";
@ -1182,9 +1182,11 @@ if ((0 == $num_rows && 0 == $unlim_num_rows) || $is_affected) {
echo '</table>' . "\n";
echo '</div>';
//require_once 'libraries/chart.lib.php';
echo '<div id="profilingchart" style="display:none;">';
echo '<div id="profilingChartData" style="display:none;">';
echo json_encode($chart_json);
echo '</div>';
echo '<div id="profilingchart" style="display:none;">';
echo '</div>';
echo '</fieldset>' . "\n";
}