Commit 8d5e4662 authored by Holger Bergunde's avatar Holger Bergunde Committed by holger.bergunde

OF-490 minor fixes. removed hard coded url

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@12954 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7ba4dbf7
...@@ -31,7 +31,7 @@ public class DatabaseManager { ...@@ -31,7 +31,7 @@ public class DatabaseManager {
// "SELECT toJID, count(logID) AS counter FROM `ofGojaraStatistics` GROUP by toJID ORDER BY counter DESC"; // "SELECT toJID, count(logID) AS counter FROM `ofGojaraStatistics` GROUP by toJID ORDER BY counter DESC";
private static final String ADD_NEW_LOG = "INSERT INTO ofGojaraStatistics(messageDate, messageType, fromJID, toJId, component) VALUES(?,?,?,?,?)"; private static final String ADD_NEW_LOG = "INSERT INTO ofGojaraStatistics(messageDate, messageType, fromJID, toJId, component) VALUES(?,?,?,?,?)";
private static final String CLEAN_OLD_DATA = "DELETE FROM ofGojaraStatistics WHERE messageDate < ?"; private static final String CLEAN_OLD_DATA = "DELETE FROM ofGojaraStatistics WHERE messageDate < ?";
private static final String GET_LOGS_DATE_LIMIT_COMPONENT = "SELECT * FROM ofGojaraStatistics WHERE messageDate > ? AND component LIKE ? ORDER BY messageDate DESC LIMIT ?"; private static final String GET_LOGS_DATE_LIMIT_COMPONENT = "SELECT * FROM ofGojaraStatistics WHERE messageDate > ? AND component = ? ORDER BY messageDate DESC LIMIT ?";
private final int _dbCleanMinutes; private final int _dbCleanMinutes;
private DatabaseManager() { private DatabaseManager() {
...@@ -97,8 +97,8 @@ public class DatabaseManager { ...@@ -97,8 +97,8 @@ public class DatabaseManager {
pstmt.setLong(1, olderThan); pstmt.setLong(1, olderThan);
pstmt.setString(2, component); pstmt.setString(2, component);
pstmt.setInt(3, limit); pstmt.setInt(3, limit);
ResultSet rs = pstmt.executeQuery(); ResultSet rs = pstmt.executeQuery();
while (rs.next()) { while (rs.next()) {
String from = rs.getString(4); String from = rs.getString(4);
String to = rs.getString(5); String to = rs.getString(5);
......
...@@ -11,8 +11,8 @@ $(document).ready(function() { ...@@ -11,8 +11,8 @@ $(document).ready(function() {
drawGraph(); drawGraph();
$('#tableLimit').val(limit); $('#tableLimit').val(limit);
window.setInterval("pollStats()", 1000); window.setInterval("pollStats()", 1000);
$('#formLimit').submit(function (e) { $('#formLimit').submit(function(e) {
e.preventDefault(); e.preventDefault();
console.log(e); console.log(e);
limit = $('#tableLimit').val(); limit = $('#tableLimit').val();
...@@ -71,6 +71,19 @@ function pollStats() { ...@@ -71,6 +71,19 @@ function pollStats() {
updateData(firstDate); updateData(firstDate);
} }
// Read a page's GET URL variables and return them as an associative array.
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(
window.location.href.indexOf('?') + 1).split('&');
for ( var i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
function updateData(lastDate) { function updateData(lastDate) {
var callback = function(data, textStatus, jqXHR) { var callback = function(data, textStatus, jqXHR) {
...@@ -121,8 +134,9 @@ function updateData(lastDate) { ...@@ -121,8 +134,9 @@ function updateData(lastDate) {
} }
drawGraph(); drawGraph();
var myDomain = getUrlVars()["component"];
$.ajax({ $.ajax({
url : 'stats?component=xmpp.dew08299&date=' + lastDate, url : 'stats?component=' + myDomain + '&date=' + lastDate,
dataType : 'json', dataType : 'json',
data : '', data : '',
success : callback success : callback
......
...@@ -97,7 +97,7 @@ $(document).ready(function() { ...@@ -97,7 +97,7 @@ $(document).ready(function() {
} }
}, },
legend : { legend : {
show : true, show : true
}, },
grid : { grid : {
hoverable : true, hoverable : true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment