LSP - bugfix "preview crashes LSP if you dont have any streams yet"
This commit is contained in:
parent
c927170ea2
commit
a52fd35a57
2 changed files with 58 additions and 44 deletions
16
lsp/main.js
16
lsp/main.js
|
@ -1266,19 +1266,19 @@ function fillServerstatsTables(data) {
|
|||
$('<tr>').html(
|
||||
$('<td>').text('1 minute:')
|
||||
).append(
|
||||
$('<td>').text(settings.settings.capabilities.load.one/100+'%').css('text-align','right')
|
||||
$('<td>').text(settings.settings.capabilities.load.one/100).css('text-align','right')
|
||||
)
|
||||
).append(
|
||||
$('<tr>').html(
|
||||
$('<td>').text('5 minutes:')
|
||||
).append(
|
||||
$('<td>').text(settings.settings.capabilities.load.five/100+'%').css('text-align','right')
|
||||
$('<td>').text(settings.settings.capabilities.load.five/100).css('text-align','right')
|
||||
)
|
||||
).append(
|
||||
$('<tr>').html(
|
||||
$('<td>').text('15 minutes:')
|
||||
).append(
|
||||
$('<td>').text(settings.settings.capabilities.load.fifteen/100+'%').css('text-align','right')
|
||||
$('<td>').text(settings.settings.capabilities.load.fifteen/100).css('text-align','right')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -1292,6 +1292,15 @@ function updateServerstats() {
|
|||
}
|
||||
|
||||
function buildstreamembed(streamName,embedbase) {
|
||||
if (typeof streamName == 'undefined') {
|
||||
$('#subpage').html('You\'ll have to setup a stream before you can view it.<br>').append(
|
||||
$('<button>').text('New stream').css('float','left').click(function(){
|
||||
showTab('edit stream','_new_');
|
||||
})
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
$('#liststreams .button.current').removeClass('current')
|
||||
$('#liststreams .button').filter(function(){
|
||||
return $(this).text() == streamName;
|
||||
|
@ -1456,6 +1465,7 @@ function buildstreamembed(streamName,embedbase) {
|
|||
}
|
||||
document.getElementById('preview-container').appendChild( script );
|
||||
|
||||
|
||||
// stream info
|
||||
getData(function(returnedData){
|
||||
settings.settings.streams = returnedData.streams;
|
||||
|
|
86
lsp/pages.js
86
lsp/pages.js
|
@ -1511,53 +1511,57 @@ function showTab(tabName,streamName) {
|
|||
case 'server stats':
|
||||
var $cont = $('<div>').addClass('input_container');
|
||||
|
||||
$cont.append(
|
||||
$('<p>').text('CPU')
|
||||
);
|
||||
for (var index in settings.settings.capabilities.cpu) {
|
||||
if (settings.settings.capabilities.cpu.length > 1) {
|
||||
$cont.append(
|
||||
$('<span>').text('CPU '+index+1)
|
||||
);
|
||||
getData(function(d){
|
||||
settings.settings.capabilities = d.capabilities;
|
||||
|
||||
$cont.append(
|
||||
$('<p>').text('CPU')
|
||||
);
|
||||
for (var index in settings.settings.capabilities.cpu) {
|
||||
if (settings.settings.capabilities.cpu.length > 1) {
|
||||
$cont.append(
|
||||
$('<span>').text('CPU '+index+1)
|
||||
);
|
||||
}
|
||||
for (var property in settings.settings.capabilities.cpu[index]) {
|
||||
$cont.append(
|
||||
$('<label>').text(property.charAt(0).toUpperCase()+property.slice(1)+':').append(
|
||||
$('<span>').text(seperateThousands(settings.settings.capabilities.cpu[index][property],' '))
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
for (var property in settings.settings.capabilities.cpu[index]) {
|
||||
|
||||
if (settings.settings.capabilities.mem) {
|
||||
$cont.append(
|
||||
$('<label>').text(property.charAt(0).toUpperCase()+property.slice(1)+':').append(
|
||||
$('<span>').text(seperateThousands(settings.settings.capabilities.cpu[index][property],' '))
|
||||
$('<p>').text('Memory')
|
||||
).append(
|
||||
$('<label>').text('Physical memory:').append(
|
||||
$('<table>').attr('id','stats-physical-memory')
|
||||
)
|
||||
).append(
|
||||
$('<label>').text('Swap memory:').append(
|
||||
$('<table>').attr('id','stats-swap-memory')
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (settings.settings.capabilities.mem) {
|
||||
$cont.append(
|
||||
$('<p>').text('Memory')
|
||||
).append(
|
||||
$('<label>').text('Physical memory:').append(
|
||||
$('<table>').attr('id','stats-physical-memory')
|
||||
)
|
||||
).append(
|
||||
$('<label>').text('Swap memory:').append(
|
||||
$('<table>').attr('id','stats-swap-memory')
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (settings.settings.capabilities.load) {
|
||||
$cont.append(
|
||||
$('<p>').text('CPU Load')
|
||||
).append(
|
||||
$('<label>').text('Loading averages:').append(
|
||||
$('<table>').attr('id','stats-loading')
|
||||
)
|
||||
);
|
||||
}
|
||||
fillServerstatsTables(settings.settings);
|
||||
|
||||
theInterval = setInterval(function(){
|
||||
|
||||
if (settings.settings.capabilities.load) {
|
||||
$cont.append(
|
||||
$('<p>').text('Loading average')
|
||||
).append(
|
||||
$('<label>').text('Loading averages:').append(
|
||||
$('<table>').attr('id','stats-loading')
|
||||
)
|
||||
);
|
||||
}
|
||||
fillServerstatsTables(settings.settings);
|
||||
|
||||
theInterval = setInterval(function(){
|
||||
updateServerstats();
|
||||
},10000);
|
||||
updateServerstats();
|
||||
},10000);
|
||||
updateServerstats();
|
||||
},{capabilities:{}});
|
||||
|
||||
$('#page').html($cont);
|
||||
break;
|
||||
|
|
Loading…
Add table
Reference in a new issue