LSP bugfixes - mostly about status displays for protocols and streams
This commit is contained in:
parent
b5bb288ac0
commit
eb57d6f4a4
4 changed files with 198 additions and 185 deletions
|
@ -187,7 +187,7 @@
|
||||||
|
|
||||||
for(var stream in data.streams)
|
for(var stream in data.streams)
|
||||||
{
|
{
|
||||||
streams[stream] = [data.streams[stream].online, 0];
|
streams[stream] = [data.streams[stream].online, 0, data.streams[stream].error];
|
||||||
cnt++;
|
cnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,7 +339,7 @@
|
||||||
delete data.statistics; // same goes for the stats
|
delete data.statistics; // same goes for the stats
|
||||||
|
|
||||||
//IE breaks if the console isn't opened, so keep commented when committing
|
//IE breaks if the console isn't opened, so keep commented when committing
|
||||||
console.log('[763] SEND', data);
|
//console.log('[763] SEND', data);
|
||||||
|
|
||||||
$.ajax(
|
$.ajax(
|
||||||
{
|
{
|
||||||
|
@ -363,7 +363,7 @@
|
||||||
$('#shield').remove(); // remove loading display
|
$('#shield').remove(); // remove loading display
|
||||||
|
|
||||||
//IE breaks if the console isn't opened, so keep commented when committing
|
//IE breaks if the console isn't opened, so keep commented when committing
|
||||||
console.log('[785] RECV', d);
|
//console.log('[785] RECV', d);
|
||||||
|
|
||||||
if(d && d['authorize'] && d['authorize']['challenge'])
|
if(d && d['authorize'] && d['authorize']['challenge'])
|
||||||
{
|
{
|
||||||
|
@ -435,12 +435,12 @@
|
||||||
{
|
{
|
||||||
return "<span>Unknown, checking...</span>";
|
return "<span>Unknown, checking...</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(status)
|
switch(status)
|
||||||
{
|
{
|
||||||
case 1: return "<span class='green'>Running</span>"; break;
|
case 1: return "<span class='green'>Running</span>"; break;
|
||||||
case 0: return "<span class='red'>Offline</span>"; break;
|
case 0: return "<span class='red'>Offline</span>"; break;
|
||||||
default: return "<span class='red'>" + status + "</span>"; break;
|
case -1: return "<span>Unknown, checking...</span>"; break;
|
||||||
|
default: return "<span class='green'>" + status + "</span>"; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
329
lsp/main.js
329
lsp/main.js
|
@ -79,8 +79,8 @@
|
||||||
// what kind of streams should be displayed? Format is [recorded, live];
|
// what kind of streams should be displayed? Format is [recorded, live];
|
||||||
var streamsdisplay = [true, true];
|
var streamsdisplay = [true, true];
|
||||||
|
|
||||||
// used on the overview page to decide then to ask the controller for an update check
|
// used on the overview page to decide then to ask the controller for an update check
|
||||||
var updatelastchecked;
|
var updatelastchecked;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a certain page. It contains a (giant) switch-statement, that builds a page depending on the tab requested
|
* Display a certain page. It contains a (giant) switch-statement, that builds a page depending on the tab requested
|
||||||
|
@ -175,116 +175,116 @@
|
||||||
case 'overview':
|
case 'overview':
|
||||||
|
|
||||||
|
|
||||||
loadSettings(function(){
|
loadSettings(function(){
|
||||||
|
|
||||||
$uptodate = null;
|
$uptodate = null;
|
||||||
if (settings.settings.LTS == 1)
|
if (settings.settings.LTS == 1)
|
||||||
{
|
{
|
||||||
if ((settings.settings.update == undefined) || (updatelastchecked == undefined) || ((new Date()).getTime() - updatelastchecked > 3600000))
|
if ((settings.settings.update == undefined) || (updatelastchecked == undefined) || ((new Date()).getTime() - updatelastchecked > 3600000))
|
||||||
{
|
{
|
||||||
settings.settings.checkupdate = true;
|
settings.settings.checkupdate = true;
|
||||||
settings.settings.update = {};
|
settings.settings.update = {};
|
||||||
updatelastchecked = (new Date()).getTime();
|
updatelastchecked = (new Date()).getTime();
|
||||||
loadSettings(function()
|
loadSettings(function()
|
||||||
{
|
{
|
||||||
showTab('overview');
|
showTab('overview');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (settings.settings.update.uptodate == 0)
|
if (settings.settings.update.uptodate == 0)
|
||||||
{
|
{
|
||||||
$uptodate = $('<label>').text('version check').css('line-height','30px');
|
$uptodate = $('<label>').text('version check').css('line-height','30px');
|
||||||
$uptodate.append(
|
$uptodate.append(
|
||||||
$('<span>').attr('class','red').text('Outdated version!').append(
|
$('<span>').attr('class','red').text('Outdated version!').append(
|
||||||
$('<button>').text('update').click(function(){
|
$('<button>').text('update').click(function(){
|
||||||
settings.settings.autoupdate = true;
|
settings.settings.autoupdate = true;
|
||||||
loadSettings();
|
loadSettings();
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$('#page').append(
|
$('#page').append(
|
||||||
$('<div>').attr('id', 'editserver').append(
|
$('<div>').attr('id', 'editserver').append(
|
||||||
$('<label>').attr('for', 'config-host').text('host').append(
|
$('<label>').attr('for', 'config-host').text('host').append(
|
||||||
$('<input>').attr('type', 'text').attr('placeholder', 'HOST').attr('id', 'config-host').attr('value', settings.settings.config.host)
|
$('<input>').attr('type', 'text').attr('placeholder', 'HOST').attr('id', 'config-host').attr('value', settings.settings.config.host)
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
$('<label>').attr('for', 'config-name').text('name').append(
|
$('<label>').attr('for', 'config-name').text('name').append(
|
||||||
$('<input>').attr('type', 'text').attr('placeholder', 'NAME').attr('id', 'config-name').attr('value', settings.settings.config.name)
|
$('<input>').attr('type', 'text').attr('placeholder', 'NAME').attr('id', 'config-name').attr('value', settings.settings.config.name)
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
$('<label>').text('version').append(
|
$('<label>').text('version').append(
|
||||||
$('<span>').text(settings.settings.config.version)
|
$('<span>').text(settings.settings.config.version)
|
||||||
).append($uptodate)
|
).append($uptodate)
|
||||||
).append(
|
).append(
|
||||||
$('<label>').text('time').append(
|
$('<label>').text('time').append(
|
||||||
$('<span>').text( formatDate(settings.settings.config.time) )
|
$('<span>').text( formatDate(settings.settings.config.time) )
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
$('<label>').text('Streams').append(
|
$('<label>').text('Streams').append(
|
||||||
$('<span>').attr('id', 'cur_streams_online').text('retrieving data...')
|
$('<span>').attr('id', 'cur_streams_online').text('retrieving data...')
|
||||||
)
|
)
|
||||||
).append(
|
).append(
|
||||||
$('<label>').text('Viewers').append(
|
$('<label>').text('Viewers').append(
|
||||||
$('<span>').attr('id', 'cur_num_viewers').text('retrieving data...')
|
$('<span>').attr('id', 'cur_num_viewers').text('retrieving data...')
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
function showStats()
|
function showStats()
|
||||||
{
|
{
|
||||||
getStatData(function(data)
|
getStatData(function(data)
|
||||||
{
|
{
|
||||||
$('#cur_streams_online').html('').text(data.streams[0] + ' of ' + data.streams[1] + ' online');
|
$('#cur_streams_online').html('').text(data.streams[0] + ' of ' + data.streams[1] + ' online');
|
||||||
$('#cur_num_viewers').html('').text(data.viewers);
|
$('#cur_num_viewers').html('').text(data.viewers);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// refresh the stream status + viewers
|
// refresh the stream status + viewers
|
||||||
sinterval = setInterval(function()
|
sinterval = setInterval(function()
|
||||||
{
|
{
|
||||||
showStats();
|
showStats();
|
||||||
}, 10000);
|
}, 10000);
|
||||||
|
|
||||||
showStats();
|
showStats();
|
||||||
|
|
||||||
$('#editserver').append(
|
$('#editserver').append(
|
||||||
$('<button>').attr('class', 'floatright').click(function()
|
$('<button>').attr('class', 'floatright').click(function()
|
||||||
{
|
{
|
||||||
var host = $('#config-host').val();
|
var host = $('#config-host').val();
|
||||||
var name = $('#config-name').val();
|
var name = $('#config-name').val();
|
||||||
|
|
||||||
settings.settings.config.host = host;
|
settings.settings.config.host = host;
|
||||||
settings.settings.config.name = name;
|
settings.settings.config.name = name;
|
||||||
|
|
||||||
loadSettings(function()
|
loadSettings(function()
|
||||||
{
|
{
|
||||||
showTab('overview');
|
showTab('overview');
|
||||||
});
|
});
|
||||||
}).text( 'save' )
|
}).text( 'save' )
|
||||||
);
|
);
|
||||||
|
|
||||||
var forcesave = $('<div>').attr('id', 'forcesave');
|
var forcesave = $('<div>').attr('id', 'forcesave');
|
||||||
|
|
||||||
forcesave.append(
|
forcesave.append(
|
||||||
$('<p>').text('Click the button below to force an immediate settings save. This differs from a regular save to memory and file save on exit by saving directly to file while operating. This may slow server processes for a short period of time.')
|
$('<p>').text('Click the button below to force an immediate settings save. This differs from a regular save to memory and file save on exit by saving directly to file while operating. This may slow server processes for a short period of time.')
|
||||||
).append(
|
).append(
|
||||||
$('<button>').click(function()
|
$('<button>').click(function()
|
||||||
{
|
{
|
||||||
if(confirmDelete('Are you sure you want to force a JSON save?') == true)
|
if(confirmDelete('Are you sure you want to force a JSON save?') == true)
|
||||||
{
|
{
|
||||||
forceJSONSave();
|
forceJSONSave();
|
||||||
}
|
}
|
||||||
}).text( 'force save to JSON file' )
|
}).text( 'force save to JSON file' )
|
||||||
);
|
);
|
||||||
|
|
||||||
$('#page').append(forcesave);
|
$('#page').append(forcesave);
|
||||||
});
|
});
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -580,6 +580,7 @@
|
||||||
$('input').each(function(){
|
$('input').each(function(){
|
||||||
newprotocol[$(this).attr('id').split('-')[2]] = $(this).val();;
|
newprotocol[$(this).attr('id').split('-')[2]] = $(this).val();;
|
||||||
});
|
});
|
||||||
|
newprotocol.online = -1;
|
||||||
if (streamname == 'new') {
|
if (streamname == 'new') {
|
||||||
settings.settings.config.protocols.push(newprotocol);
|
settings.settings.config.protocols.push(newprotocol);
|
||||||
}else{
|
}else{
|
||||||
|
@ -679,7 +680,14 @@
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
streamstatus = streams[stream][0];
|
if (streams[stream][2])
|
||||||
|
{
|
||||||
|
streamstatus = streams[stream][2];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
streamstatus = streams[stream][0];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
$(this).children(':nth-child(5)').html(formatStatus(streamstatus));
|
$(this).children(':nth-child(5)').html(formatStatus(streamstatus));
|
||||||
$(this).children(':nth-child(6)').html(streams[stream][1]);
|
$(this).children(':nth-child(6)').html(streams[stream][1]);
|
||||||
|
@ -734,10 +742,15 @@
|
||||||
showTab('embed', sname);
|
showTab('embed', sname);
|
||||||
}) ) ); // end function, end click(), end append(), end append(). Huzzah jQuery.
|
}) ) ); // end function, end click(), end append(), end append(). Huzzah jQuery.
|
||||||
|
|
||||||
if ( cstr.name == undefined ) { cstr.name = ''; }
|
if ( cstr.name == undefined ) { cstr.name = ''; }
|
||||||
|
|
||||||
$tr.append( $('<td>').text( cstr.name ) );
|
$tr.append( $('<td>').text( cstr.name ) );
|
||||||
|
|
||||||
|
if (cstr.error)
|
||||||
|
{
|
||||||
|
cstr.online = cstr.error;
|
||||||
|
}
|
||||||
|
|
||||||
$tr.append( $('<td>').html( formatStatus( cstr.online ) ) );
|
$tr.append( $('<td>').html( formatStatus( cstr.online ) ) );
|
||||||
|
|
||||||
var cviewers = 0;
|
var cviewers = 0;
|
||||||
|
@ -894,6 +907,8 @@
|
||||||
sdata.name = newname;
|
sdata.name = newname;
|
||||||
sdata.channel.URL = s.val();
|
sdata.channel.URL = s.val();
|
||||||
sdata.preset.cmd = p.val();
|
sdata.preset.cmd = p.val();
|
||||||
|
sdata.online = -1;
|
||||||
|
sdata.error = null;
|
||||||
|
|
||||||
if(streamname == 'new')
|
if(streamname == 'new')
|
||||||
{
|
{
|
||||||
|
@ -1144,64 +1159,62 @@
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'server stats':
|
case 'server stats':
|
||||||
loadSettings(function(){
|
loadSettings(function(){
|
||||||
serverstats = settings.settings.capabilities;
|
serverstats = settings.settings.capabilities;
|
||||||
|
|
||||||
console.log(serverstats); //weghalen
|
if (serverstats.cpu !== undefined)
|
||||||
|
{
|
||||||
|
$('#page').append(
|
||||||
|
$('<div>').attr('class','datacont').append(
|
||||||
|
$('<p>').text('CPU')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
//be careful, only works if this is the first div to be constructed
|
||||||
|
for (property in serverstats.cpu[0])
|
||||||
|
{
|
||||||
|
$('#page div.datacont').append(
|
||||||
|
$('<label>').text(property).append(
|
||||||
|
$('<span>').text(serverstats.cpu[0][property])
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (serverstats.mem !== undefined)
|
||||||
|
{
|
||||||
|
$('#page').append(
|
||||||
|
$('<div>').attr('class','datacont').append(
|
||||||
|
$('<p>').text('Memory')
|
||||||
|
).append(
|
||||||
|
$('<label>').text('Physical memory').append(
|
||||||
|
$('<span>').text(serverstats.mem.used+'MiB/'+serverstats.mem.total+'MiB ('+serverstats.mem.free+'MiB available)')
|
||||||
|
)
|
||||||
|
).append(
|
||||||
|
$('<label>').text('Swap memory').append(
|
||||||
|
$('<span>').text((serverstats.mem.swaptotal - serverstats.mem.swapfree)+'MiB/'+serverstats.mem.swaptotal+'MiB ('+serverstats.mem.swapfree+'MiB available)')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (serverstats.load !== undefined)
|
||||||
|
{
|
||||||
|
$('#page').append(
|
||||||
|
$('<div>').attr('class','datacont').append(
|
||||||
|
$('<p>').text('Load')
|
||||||
|
).append(
|
||||||
|
$('<label>').text('Memory used').append(
|
||||||
|
$('<span>').text(serverstats.load.memory+'%')
|
||||||
|
)
|
||||||
|
).append(
|
||||||
|
$('<label>').text('Loading averages').append(
|
||||||
|
$('<span>').text('1 min: '+serverstats.load.one+'%, 5 min: '+serverstats.load.five+'%, 15 min: '+serverstats.load.fifteen+'%')
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if (serverstats.cpu !== undefined)
|
break;
|
||||||
{
|
|
||||||
$('#page').append(
|
|
||||||
$('<div>').attr('class','datacont').append(
|
|
||||||
$('<p>').text('CPU')
|
|
||||||
)
|
|
||||||
);
|
|
||||||
//be careful, only works if this is the first div to be constructed
|
|
||||||
for (property in serverstats.cpu[0])
|
|
||||||
{
|
|
||||||
$('#page div.datacont').append(
|
|
||||||
$('<label>').text(property).append(
|
|
||||||
$('<span>').text(serverstats.cpu[0][property])
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (serverstats.mem !== undefined)
|
|
||||||
{
|
|
||||||
$('#page').append(
|
|
||||||
$('<div>').attr('class','datacont').append(
|
|
||||||
$('<p>').text('Memory')
|
|
||||||
).append(
|
|
||||||
$('<label>').text('Physical memory').append(
|
|
||||||
$('<span>').text(serverstats.mem.used+'MiB/'+serverstats.mem.total+'MiB ('+serverstats.mem.free+'MiB available)')
|
|
||||||
)
|
|
||||||
).append(
|
|
||||||
$('<label>').text('Swap memory').append(
|
|
||||||
$('<span>').text((serverstats.mem.swaptotal - serverstats.mem.swapfree)+'MiB/'+serverstats.mem.swaptotal+'MiB ('+serverstats.mem.swapfree+'MiB available)')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (serverstats.load !== undefined)
|
|
||||||
{
|
|
||||||
$('#page').append(
|
|
||||||
$('<div>').attr('class','datacont').append(
|
|
||||||
$('<p>').text('Load')
|
|
||||||
).append(
|
|
||||||
$('<label>').text('Memory used').append(
|
|
||||||
$('<span>').text(serverstats.load.memory+'%')
|
|
||||||
)
|
|
||||||
).append(
|
|
||||||
$('<label>').text('Loading averages').append(
|
|
||||||
$('<span>').text('1 min: '+serverstats.load.one+'%, 5 min: '+serverstats.load.five+'%, 15 min: '+serverstats.load.fifteen+'%')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'disconnect':
|
case 'disconnect':
|
||||||
showTab('login');
|
showTab('login');
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<li>streams</li>
|
<li>streams</li>
|
||||||
<li>limits</li>
|
<li>limits</li>
|
||||||
<li>logs</li>
|
<li>logs</li>
|
||||||
<li>server stats</li>
|
<li>server stats</li>
|
||||||
<li id='logoutbutton'>disconnect</li>
|
<li id='logoutbutton'>disconnect</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|
|
@ -412,15 +412,15 @@ td
|
||||||
|
|
||||||
.datacont label span
|
.datacont label span
|
||||||
{
|
{
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
}
|
}
|
||||||
.datacont label
|
.datacont label
|
||||||
{
|
{
|
||||||
padding-left: 25px;
|
padding-left: 25px;
|
||||||
}
|
}
|
||||||
.datacont p
|
.datacont p
|
||||||
{
|
{
|
||||||
margin-top: 25px;
|
margin-top: 25px;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue