$misc->printTabs('database','processes');
$misc->printMsg($msg);
+ if (strlen($msg) === 0) {
+ echo "<br /><a id=\"control\" href=\"\"><img src=\"".$misc->icon('Refresh')."\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>";
+ }
+
+ echo "<div id=\"data_block\">";
+ currentProcesses();
+ echo "</div>";
+ }
+
+ function currentProcesses($isAjax = false) {
+ global $data, $misc, $lang;
+
// Display prepared transactions
if($data->hasPreparedXacts()) {
echo "<h3>{$lang['strpreparedxacts']}</h3>\n";
if (!isset($processes->fields['query_start'])) unset($columns['start_time']);
$misc->printTable($processes, $columns, $actions, $lang['strnodata']);
+
+ if ($isAjax) exit;
}
function currentLocks($isAjax = false) {
echo "<br /><a id=\"control\" href=\"\"><img src=\"".$misc->icon('Refresh')."\" alt=\"{$lang['strrefresh']}\" title=\"{$lang['strrefresh']}\"/> {$lang['strrefresh']}</a>";
- echo "<div id=\"locks_block\" class=\"data_block\">";
+ echo "<div id=\"data_block\">";
currentLocks();
echo "</div>";
}
/* shortcuts: these functions exit the script */
if ($action == 'tree') doTree();
if ($action == 'refresh_locks') currentLocks(true);
+ if ($action == 'refresh_processes') currentProcesses(true);
/* normal flow */
- if ($action == 'locks') {
+ if ($action == 'locks' or $action == 'processes') {
$scripts = "<script src=\"libraries/js/jquery.js\" type=\"text/javascript\"></script>\n";
- $scripts .= "<script src=\"js/locks.js\" type=\"text/javascript\"></script>";
+ $scripts .= "<script src=\"js/database.js\" type=\"text/javascript\"></script>";
$refreshTime = $conf['ajax_refresh'] * 1000;
$scripts .= "load_icon: '". $misc->icon('Loading') ."',\n";
$scripts .= "server:'{$_REQUEST['server']}',\n";
$scripts .= "dbname:'{$_REQUEST['database']}',\n";
+ $scripts .= "action:'refresh_{$action}',\n";
$scripts .= "errmsg: '". str_replace("'", "\'", $lang['strconnectionfail']) ."',\n";
$scripts .= "};\n";
$scripts .= "</script>\n";
+++ /dev/null
-$(document).ready(function() {
-
- var timeid = query = null;
- var controlLink = $('#control');
- var errmsg = $('<p class="errmsg">'+Database.errmsg+'</p>')
- .insertBefore(controlLink)
- .hide();
- var loading = $('<img class="loading" alt="[loading]" src="'+ Database.load_icon +'" />')
- .insertAfter(controlLink)
- .hide();
-
- function refreshLocksTable() {
- if (Database.ajax_time_refresh > 0) {
- loading.show();
- query = $.ajax({
- type: 'GET',
- dataType: 'html',
- data: {server: Database.server, database: Database.dbname, action: 'refresh_locks'},
- url: 'database.php',
- cache: false,
- contentType: 'application/x-www-form-urlencoded',
- success: function(html) {
- $('#locks_block').html(html);
- timeid = window.setTimeout(refreshLocksTable, Database.ajax_time_refresh)
- },
- error: function() {
- controlLink.click();
- errmsg.show();
- },
- complete: function () {
- loading.hide();
- }
- });
- }
- }
-
- controlLink.toggle(
- function() {
- $(errmsg).hide();
- timeid = window.setTimeout(refreshLocksTable, Database.ajax_time_refresh);
- controlLink.html('<img src="'+ Database.str_stop.icon +'" alt="" /> '
- + Database.str_stop.text + ' '
- );
- },
- function() {
- $(errmsg).hide();
- $(loading).hide();
- window.clearInterval(timeid);
- query.abort();
- controlLink.html('<img src="'+ Database.str_start.icon +'" alt="" /> '
- + Database.str_start.text
- );
- }
- );
-
- /* preload images */
- $('#control img').hide()
- .attr('src', Database.str_start.icon)
- .attr('src', Database.str_stop.icon)
- .show();
-
- /* start refreshing */
- controlLink.click();
-});