| 1 |
function getDbmsInfo(targetElement, action, args) { |
| 2 |
jQuery.ajax({ |
| 3 |
type: "POST", |
| 4 |
url: wpda_dbms_vars.wpda_ajaxurl + "?action=" + action, |
| 5 |
data: args |
| 6 |
}).done( |
| 7 |
function(data) { |
| 8 |
targetElement.closest(".wpda-widget").find(".hostname").html(data['hostname']); |
| 9 |
targetElement.closest(".wpda-widget").find(".post").html(data['post']); |
| 10 |
targetElement.closest(".wpda-widget").find(".ssl").html(data['ssl']); |
| 11 |
targetElement.closest(".wpda-widget").find(".version").html(data['version'] + " " + data['version_comment']); |
| 12 |
targetElement.closest(".wpda-widget").find(".compiled").html(data['version_compile_os'] + " (" + data['version_compile_machine'] + ")"); |
| 13 |
targetElement.closest(".wpda-widget").find(".uptime").html(data['uptime']); |
| 14 |
|
| 15 |
targetElement.closest(".wpda-widget").find(".basedir").html(data['basedir']); |
| 16 |
targetElement.closest(".wpda-widget").find(".datadir").html(data['datadir']); |
| 17 |
targetElement.closest(".wpda-widget").find(".plugin_dir").html(data['plugin_dir']); |
| 18 |
targetElement.closest(".wpda-widget").find(".tmpdir").html(data['tmpdir']); |
| 19 |
|
| 20 |
targetElement.closest(".wpda-widget").find(".log_error").html(data['log_error']); |
| 21 |
targetElement.closest(".wpda-widget").find(".general_log").html(data['general_log_file'] + "[" + data['general_log'] + "]"); |
| 22 |
targetElement.closest(".wpda-widget").find(".slow_query").html(data['slow_query_log_file'] + "[" + data['slow_query_log'] + "]"); |
| 23 |
} |
| 24 |
); |
| 25 |
} |
| 26 |
|
| 27 |
function getDbmsVars(targetElement, action, args, force = false) { |
| 28 |
if (force || targetElement.html()==="") { |
| 29 |
// Load variables |
| 30 |
targetElement.html("Loading..."); |
| 31 |
jQuery.ajax({ |
| 32 |
type: "POST", |
| 33 |
url: wpda_dbms_vars.wpda_ajaxurl + "?action=" + action, |
| 34 |
data: args |
| 35 |
}).done( |
| 36 |
function(data) { |
| 37 |
if (data.status==="ERROR") { |
| 38 |
targetElement.html('ERROR: ' + data.msg); |
| 39 |
} else { |
| 40 |
targetElement.html(''); |
| 41 |
vars = jQuery('<table class="wpda-widget-dbms"></table>'); |
| 42 |
targetElement.append(vars); |
| 43 |
varsHead = jQuery('<thead class="ui-widget-header"><tr><th>Variable</th><th>Value</th></tr></thead>'); |
| 44 |
vars.append(varsHead); |
| 45 |
varsBody = jQuery('<tbody class="ui-widget-content"></tbody>'); |
| 46 |
vars.append(varsBody); |
| 47 |
for (var prop in data) { |
| 48 |
varsBody.append('<tr><td>' + prop + "</td><td>" + data[prop] + "</td></tr>"); |
| 49 |
} |
| 50 |
// Adjust header column width |
| 51 |
jQuery(targetElement).find("thead th:first-child").css("width", |
| 52 |
jQuery(targetElement).find("tbody td:first-child").css("width")); |
| 53 |
} |
| 54 |
} |
| 55 |
); |
| 56 |
} |
| 57 |
} |
| 58 |
|
| 59 |
function toggleIcon(elem) { |
| 60 |
if (elem.html().indexOf("fa-caret-right")>-1) { |
| 61 |
elem.html(elem.html().replace("fa-caret-right","fa-caret-down")); |
| 62 |
} else { |
| 63 |
elem.html(elem.html().replace("fa-caret-down","fa-caret-right")); |
| 64 |
} |
| 65 |
} |