Profiling working on table browsing and on running sql queries.

Signed-Off-By: Piyush Vijay <piyushvijay.1997@gmail.com>
This commit is contained in:
Piyush Vijay 2018-05-14 23:48:40 +05:30
parent fc72f0d739
commit 5b7079e9ff
10 changed files with 27 additions and 66 deletions

View File

@ -4258,49 +4258,6 @@ $(window).on('popstate', function (event, data) {
return true;
});
/**
* Unbind all event handlers before tearing down a page
*/
AJAX.registerTeardown('functions.js', function () {
$(document).off('click', 'a.themeselect');
$(document).off('change', '.autosubmit');
$('a.take_theme').off('click');
});
AJAX.registerOnload('functions.js', function () {
/**
* Theme selector.
*/
$(document).on('click', 'a.themeselect', function (e) {
window.open(
e.target,
'themes',
'left=10,top=20,width=510,height=350,scrollbars=yes,status=yes,resizable=yes'
);
return false;
});
/**
* Automatic form submission on change.
*/
$(document).on('change', '.autosubmit', function (e) {
$(this).closest('form').submit();
});
/**
* Theme changer.
*/
$('a.take_theme').on('click', function (e) {
var what = this.name;
if (window.opener && window.opener.document.forms.setTheme.elements.set_theme) {
window.opener.document.forms.setTheme.elements.set_theme.value = what;
window.opener.document.forms.setTheme.submit();
window.close();
return false;
}
return true;
});
});
/**
* Produce print preview

View File

@ -25,7 +25,8 @@ const files = {
db_search: ['db_search', 'sql'],
server_sql: ['multi_column_sort', 'sql'],
tbl_sql: ['sql'],
db_sql: ['sql']
db_sql: ['sql'],
sql: ['sql']
};
export default files;

View File

@ -98,11 +98,7 @@ export function onload1 () {
* Automatic form submission on change.
*/
$(document).on('change', '.autosubmit', function (e) {
e.preventDefault();
debugger;
console.log($(this).closest('form').submit());
$(this).closest('form').submit();
debugger;
});
/**

View File

@ -1,4 +1,6 @@
import { createProfilingChart } from '../chart';
import { $ } from '../../utils/extend_jquery';
import '../../plugins/jquery/jquery.tablesorter';
/*
* Profiling Chart

View File

@ -7,6 +7,7 @@ import './variables/import_variables';
import { $ } from './utils/JqueryExtended';
import { AJAX } from './ajax';
import './variables/get_config';
import './variables/InlineScripting';
import files from './consts/files';
import Console from './console';
import { PMA_sprintf } from './utils/sprintf';
@ -14,6 +15,7 @@ import { PMA_Messages as PMA_messages } from './variables/export_variables';
import { escapeHtml } from './utils/Sanitise';
import { PMA_ajaxShowMessage } from './utils/show_ajax_messages';
import PMA_commonParams from './variables/common_params';
import PMA_MicroHistory from './classes/MicroHistory';
/**
* Page load event handler

View File

@ -38,7 +38,7 @@ var $data_a;
/**
* Unbind all event handlers before tearing down a page
*/
export function teardown1 () {
export function teardownSqlQueryExecute () {
$(document).off('click', 'a.delete_row.ajax');
$(document).off('submit', '.bookmarkQueryForm');
$('input#bkm_label').off('keyup');
@ -67,6 +67,8 @@ export function teardown1 () {
$('body').off('click', '#simulate_dml');
$('body').off('keyup', '#sqlqueryform');
$('body').off('click', 'form[name="resultsForm"].ajax button[name="submit_mult"], form[name="resultsForm"].ajax input[name="submit_mult"]');
$('#tablefields').off('dblclick');
$('#tablefieldsSubmitLinkMode,#tablefieldsSubmitNonLinkMode').off('click');
}
/**
@ -85,7 +87,7 @@ export function teardown1 () {
* @name document.ready
* @memberOf jQuery
*/
export function onload1 () {
export function onloadSqlQueryExecute () {
if (sqlQueryOptions.codemirror_editor || document.sqlform) {
setShowThisQuery();
}
@ -826,7 +828,7 @@ function browseForeignDialog ($this_a) {
});
}
export function onload2 () {
export function onloadSqlBrowsing () {
$('body').on('click', 'a.browse_foreign', function (e) {
e.preventDefault();
browseForeignDialog($(this));
@ -862,7 +864,7 @@ export function onload2 () {
}
}
export function onload4 () {
export function onloadSqlProfiling () {
makeProfilingChart();
initProfilingTables();
}

View File

@ -5,6 +5,7 @@ import 'jquery-ui-timepicker-addon';
import 'jquery-mousewheel';
import 'jquery.event.drag';
import 'jquery-validation';
import '../plugins/jquery/jquery.uitablefilter';
import { methods } from './menu_resizer';
// TODO: To use this import for replacing variables used in this file for
// extending various strings for localization.

View File

@ -0,0 +1,12 @@
import { initProfilingTables, makeProfilingChart } from '../functions/Sql/SqlProfiling';
/**
* @function makeProfilingChartInline Function for creating profiling chart
* on clicking profiling checkbox
*
* @return void
*/
window.makeProfilingChartInline = function () {
makeProfilingChart();
initProfilingTables();
};

View File

@ -324,10 +324,7 @@ EOT;
$profiling_table .= '<div id="profilingchart" class="hide">';
$profiling_table .= '</div>';
$profiling_table .= '<script type="text/javascript">';
$profiling_table .= "AJAX.registerOnload('sql.js', function () {";
$profiling_table .= 'makeProfilingChart();';
$profiling_table .= 'initProfilingTables();';
$profiling_table .= '});';
$profiling_table .= "makeProfilingChartInline();";
$profiling_table .= '</script>';
$profiling_table .= '</fieldset>' . "\n";
} else {
@ -2115,8 +2112,7 @@ EOT;
}
if (!isset($_REQUEST['printview']) || $_REQUEST['printview'] != '1') {
$scripts->addFile('makegrid.js');
$scripts->addFile('sql.js');
$scripts->addFile('sql');
unset($GLOBALS['message']);
//we don't need to buffer the output in getMessage here.
//set a global variable and check against it in the function

View File

@ -420,14 +420,6 @@ if (! defined('PMA_MINIMUM_COMMON')) {
* pages like sql, tbl_sql, db_sql, tbl_select
*/
$response = Response::getInstance();
if (isset($_SESSION['profiling'])) {
$scripts = $response->getHeader()->getScripts();
$scripts->addFile('chart.js');
$scripts->addFile('vendor/jqplot/jquery.jqplot.js');
$scripts->addFile('vendor/jqplot/plugins/jqplot.pieRenderer.js');
$scripts->addFile('vendor/jqplot/plugins/jqplot.highlighter.js');
$scripts->addFile('vendor/jquery/jquery.tablesorter.js');
}
/*
* There is no point in even attempting to process