LSP: fixed minor bug in limits and added refresh timer to logs

This commit is contained in:
Cat 2013-04-29 14:56:22 +02:00
parent 7dea2e82f0
commit 530ba10eb8
2 changed files with 133 additions and 72 deletions

View file

@ -1100,15 +1100,27 @@
$('#page').append($table);
//tooltip
$('.limits_type').add('.limits_name').hover(function(e){
$('.limits_type').live({
"mouseover": function(e){
removeTooltip();
showTooltip(e,undefined,$(this).children(':selected').data('desc'));
},function(){
},
"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
$('.limits_name').change(function(){
$('.limits_name').live("change", function(){
var value = $(this).parents('.limits_row').find(".limits_val").val();
$(this).parents('.limits_row').children('.limit_input_container').html('');
BuildLimitRowInput(
@ -1146,9 +1158,7 @@
entries.push(t);
}
});
if (entries.length > 0) {
newval = $(this).find('.limit_listtype').children(':selected').val() + entries.join(' ');
}
break;
case 'host':
case 'time':
@ -1163,13 +1173,13 @@
}
if (newval){
obj = {"type": $(this).find(".limits_type").val(), "name":$(this).find(".limits_name").val(), "val":newval};
}
if($(this).find('.new-limit-appliesto').val() == 'server') {
settings.settings.config.limits.push(obj);
console.log('new server limit',obj);
//console.log('new server limit',obj);
}else{
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(){
@ -1181,6 +1191,66 @@
break;
case 'logs':
$('#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()
{
settings.settings.clearstatlogs = 1;
loadSettings(function()
{
showTab('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>');
@ -1216,18 +1286,8 @@
}
$table.append($tbody);
$('#page').append($table);
$('#page').append(
$('<button>').attr('class', 'floatright').click(function()
{
settings.settings.clearstatlogs = 1;
loadSettings(function()
{
showTab('logs');
});
}).text('Purge logs')
);
return $table;
}
break;

View file

@ -295,6 +295,7 @@ thead th .theadinfo
th,
#login > button,
p,
span,
label,
button,
#page label input,