LSP: fixed minor bug in limits and added refresh timer to logs
This commit is contained in:
parent
7dea2e82f0
commit
530ba10eb8
2 changed files with 133 additions and 72 deletions
204
lsp/main.js
204
lsp/main.js
|
@ -1100,15 +1100,27 @@
|
||||||
$('#page').append($table);
|
$('#page').append($table);
|
||||||
|
|
||||||
//tooltip
|
//tooltip
|
||||||
$('.limits_type').add('.limits_name').hover(function(e){
|
$('.limits_type').live({
|
||||||
removeTooltip();
|
"mouseover": function(e){
|
||||||
showTooltip(e,undefined,$(this).children(':selected').data('desc'));
|
removeTooltip();
|
||||||
},function(){
|
showTooltip(e,undefined,$(this).children(':selected').data('desc'));
|
||||||
removeTooltip();
|
},
|
||||||
|
"mouseout": function(){
|
||||||
|
removeTooltip();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.limits_name').live({
|
||||||
|
"mouseover": function(e){
|
||||||
|
removeTooltip();
|
||||||
|
showTooltip(e,undefined,$(this).children(':selected').data('desc'));
|
||||||
|
},
|
||||||
|
"mouseout": function(){
|
||||||
|
removeTooltip();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//change limit value box on type change
|
//change limit value box on type change
|
||||||
$('.limits_name').change(function(){
|
$('.limits_name').live("change", function(){
|
||||||
var value = $(this).parents('.limits_row').find(".limits_val").val();
|
var value = $(this).parents('.limits_row').find(".limits_val").val();
|
||||||
$(this).parents('.limits_row').children('.limit_input_container').html('');
|
$(this).parents('.limits_row').children('.limit_input_container').html('');
|
||||||
BuildLimitRowInput(
|
BuildLimitRowInput(
|
||||||
|
@ -1138,38 +1150,36 @@
|
||||||
$tbody.children('tr').each(function(){
|
$tbody.children('tr').each(function(){
|
||||||
var newval = null;
|
var newval = null;
|
||||||
switch ($(this).find(".limits_name").val()) {
|
switch ($(this).find(".limits_name").val()) {
|
||||||
case 'geo':
|
case 'geo':
|
||||||
var entries = Array();
|
var entries = Array();
|
||||||
$(this).find('.limit_listentry').each(function(){
|
$(this).find('.limit_listentry').each(function(){
|
||||||
var t = $(this).children(':selected').val();
|
var t = $(this).children(':selected').val();
|
||||||
if (t != ''){
|
if (t != ''){
|
||||||
entries.push(t);
|
entries.push(t);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (entries.length > 0) {
|
|
||||||
newval = $(this).find('.limit_listtype').children(':selected').val() + entries.join(' ');
|
newval = $(this).find('.limit_listtype').children(':selected').val() + entries.join(' ');
|
||||||
}
|
break;
|
||||||
break;
|
case 'host':
|
||||||
case 'host':
|
case 'time':
|
||||||
case 'time':
|
var t = $(this).find('.limit_listentry').val();
|
||||||
var t = $(this).find('.limit_listentry').val();
|
if ((t != undefined) && (t.toString().split(' ').length > 0)) {
|
||||||
if ((t != undefined) && (t.toString().split(' ').length > 0)) {
|
newval = $(this).find('.limit_listtype').children(':selected').val() + t;
|
||||||
newval = $(this).find('.limit_listtype').children(':selected').val() + t;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
newval = $(this).find(".limits_val").val();
|
||||||
newval = $(this).find(".limits_val").val();
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (newval){
|
if (newval){
|
||||||
obj = {"type": $(this).find(".limits_type").val(), "name":$(this).find(".limits_name").val(), "val":newval};
|
obj = {"type": $(this).find(".limits_type").val(), "name":$(this).find(".limits_name").val(), "val":newval};
|
||||||
}
|
if($(this).find('.new-limit-appliesto').val() == 'server') {
|
||||||
if($(this).find('.new-limit-appliesto').val() == 'server') {
|
settings.settings.config.limits.push(obj);
|
||||||
settings.settings.config.limits.push(obj);
|
//console.log('new server limit',obj);
|
||||||
console.log('new server limit',obj);
|
}else{
|
||||||
}else{
|
settings.settings.streams[$(this).find('.new-limit-appliesto').val()].limits.push(obj);
|
||||||
settings.settings.streams[$(this).find('.new-limit-appliesto').val()].limits.push(obj);
|
//console.log('new stream limit',$(this).find('.new-limit-appliesto').val(),obj);
|
||||||
console.log('new stream limit',$(this).find('.new-limit-appliesto').val(),obj);
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
loadSettings(function(){
|
loadSettings(function(){
|
||||||
|
@ -1181,44 +1191,25 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'logs':
|
case 'logs':
|
||||||
$table = $('<table>');
|
|
||||||
$table.html("<thead><th>Date<span class='theadinfo'>(MM/DD/YYYY)</span></th><th>Type</th><th>Message</th></thead>");
|
|
||||||
$tbody = $('<tbody>');
|
|
||||||
|
|
||||||
if(!settings.settings.log)
|
|
||||||
{
|
|
||||||
return; // no logs, so just bail
|
|
||||||
}
|
|
||||||
var i, cur, $tr,
|
|
||||||
logs = settings.settings.log,
|
|
||||||
len = logs.length;
|
|
||||||
|
|
||||||
if(len >= 2 && settings.settings.log[0][0] < settings.settings.log[len - 1][0])
|
|
||||||
{
|
|
||||||
logs.reverse();
|
|
||||||
}
|
|
||||||
|
|
||||||
$tbody.html('');
|
|
||||||
|
|
||||||
for(i = 0; i < len; i++)
|
|
||||||
{
|
|
||||||
cur = settings.settings.log[i];
|
|
||||||
|
|
||||||
$tr = $('<tr>').append(
|
|
||||||
$('<td>').text(formatDate(cur[0]))
|
|
||||||
).append(
|
|
||||||
$('<td>').text(cur[1])
|
|
||||||
).append(
|
|
||||||
$('<td>').text(cur[2])
|
|
||||||
);
|
|
||||||
|
|
||||||
$tbody.append($tr);
|
|
||||||
}
|
|
||||||
|
|
||||||
$table.append($tbody);
|
|
||||||
$('#page').append($table);
|
|
||||||
|
|
||||||
$('#page').append(
|
$('#page').append(
|
||||||
|
$('<input>').attr('type','checkbox').addClass('logs_refresh')
|
||||||
|
).append(
|
||||||
|
$('<span>').text(' Refresh logs every ')
|
||||||
|
).append(
|
||||||
|
$('<select>').addClass('logs_refresh_every').append(
|
||||||
|
$('<option>').val(10000).text('10 seconds')
|
||||||
|
).append(
|
||||||
|
$('<option>').val(30000).text('30 seconds')
|
||||||
|
).append(
|
||||||
|
$('<option>').val(60000).text('minute')
|
||||||
|
).append(
|
||||||
|
$('<option>').val(300000).text('5 minutes')
|
||||||
|
).append(
|
||||||
|
$('<option>').val(600000).text('10 minutes')
|
||||||
|
).append(
|
||||||
|
$('<option>').val(1800000).text('30 minutes')
|
||||||
|
)
|
||||||
|
).append(
|
||||||
$('<button>').attr('class', 'floatright').click(function()
|
$('<button>').attr('class', 'floatright').click(function()
|
||||||
{
|
{
|
||||||
settings.settings.clearstatlogs = 1;
|
settings.settings.clearstatlogs = 1;
|
||||||
|
@ -1227,8 +1218,77 @@
|
||||||
showTab('logs');
|
showTab('logs');
|
||||||
});
|
});
|
||||||
}).text('Purge logs')
|
}).text('Purge logs')
|
||||||
|
).append(
|
||||||
|
buildLogsTable()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var logsinterval;
|
||||||
|
$('.logs_refresh').change(function(){
|
||||||
|
if ($(this).is(':checked')) {
|
||||||
|
var delay = $('.logs_refresh_every').val();
|
||||||
|
logsinterval = setInterval(function(){getLogsdata();},delay);
|
||||||
|
getLogsdata();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
clearInterval(logsinterval);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('.logs_refresh_every').change(function(){
|
||||||
|
if ($('.logs_refresh').is(':checked')) {
|
||||||
|
var delay = $(this).val();
|
||||||
|
clearInterval(logsinterval);
|
||||||
|
logsinterval = setInterval(function(){getLogsdata();},delay);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function getLogsdata(){
|
||||||
|
getData(function(data){
|
||||||
|
settings.settings.log = data.log;
|
||||||
|
|
||||||
|
$('#page table').remove();
|
||||||
|
$('#page').append(buildLogsTable());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildLogsTable(){
|
||||||
|
$table = $('<table>');
|
||||||
|
$table.html("<thead><th>Date<span class='theadinfo'>(MM/DD/YYYY)</span></th><th>Type</th><th>Message</th></thead>");
|
||||||
|
$tbody = $('<tbody>');
|
||||||
|
|
||||||
|
if(!settings.settings.log)
|
||||||
|
{
|
||||||
|
return; // no logs, so just bail
|
||||||
|
}
|
||||||
|
var i, cur, $tr,
|
||||||
|
logs = settings.settings.log,
|
||||||
|
len = logs.length;
|
||||||
|
|
||||||
|
if(len >= 2 && settings.settings.log[0][0] < settings.settings.log[len - 1][0])
|
||||||
|
{
|
||||||
|
logs.reverse();
|
||||||
|
}
|
||||||
|
|
||||||
|
$tbody.html('');
|
||||||
|
|
||||||
|
for(i = 0; i < len; i++)
|
||||||
|
{
|
||||||
|
cur = settings.settings.log[i];
|
||||||
|
|
||||||
|
$tr = $('<tr>').append(
|
||||||
|
$('<td>').text(formatDate(cur[0]))
|
||||||
|
).append(
|
||||||
|
$('<td>').text(cur[1])
|
||||||
|
).append(
|
||||||
|
$('<td>').text(cur[2])
|
||||||
|
);
|
||||||
|
|
||||||
|
$tbody.append($tr);
|
||||||
|
}
|
||||||
|
|
||||||
|
$table.append($tbody);
|
||||||
|
return $table;
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'server stats':
|
case 'server stats':
|
||||||
|
|
|
@ -295,6 +295,7 @@ thead th .theadinfo
|
||||||
th,
|
th,
|
||||||
#login > button,
|
#login > button,
|
||||||
p,
|
p,
|
||||||
|
span,
|
||||||
label,
|
label,
|
||||||
button,
|
button,
|
||||||
#page label input,
|
#page label input,
|
||||||
|
|
Loading…
Add table
Reference in a new issue