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(
|
$('<tr>').html(
|
||||||
$('<td>').text('1 minute:')
|
$('<td>').text('1 minute:')
|
||||||
).append(
|
).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(
|
).append(
|
||||||
$('<tr>').html(
|
$('<tr>').html(
|
||||||
$('<td>').text('5 minutes:')
|
$('<td>').text('5 minutes:')
|
||||||
).append(
|
).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(
|
).append(
|
||||||
$('<tr>').html(
|
$('<tr>').html(
|
||||||
$('<td>').text('15 minutes:')
|
$('<td>').text('15 minutes:')
|
||||||
).append(
|
).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) {
|
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.current').removeClass('current')
|
||||||
$('#liststreams .button').filter(function(){
|
$('#liststreams .button').filter(function(){
|
||||||
return $(this).text() == streamName;
|
return $(this).text() == streamName;
|
||||||
|
@ -1456,6 +1465,7 @@ function buildstreamembed(streamName,embedbase) {
|
||||||
}
|
}
|
||||||
document.getElementById('preview-container').appendChild( script );
|
document.getElementById('preview-container').appendChild( script );
|
||||||
|
|
||||||
|
|
||||||
// stream info
|
// stream info
|
||||||
getData(function(returnedData){
|
getData(function(returnedData){
|
||||||
settings.settings.streams = returnedData.streams;
|
settings.settings.streams = returnedData.streams;
|
||||||
|
|
86
lsp/pages.js
86
lsp/pages.js
|
@ -1511,53 +1511,57 @@ function showTab(tabName,streamName) {
|
||||||
case 'server stats':
|
case 'server stats':
|
||||||
var $cont = $('<div>').addClass('input_container');
|
var $cont = $('<div>').addClass('input_container');
|
||||||
|
|
||||||
$cont.append(
|
getData(function(d){
|
||||||
$('<p>').text('CPU')
|
settings.settings.capabilities = d.capabilities;
|
||||||
);
|
|
||||||
for (var index in settings.settings.capabilities.cpu) {
|
$cont.append(
|
||||||
if (settings.settings.capabilities.cpu.length > 1) {
|
$('<p>').text('CPU')
|
||||||
$cont.append(
|
);
|
||||||
$('<span>').text('CPU '+index+1)
|
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(
|
$cont.append(
|
||||||
$('<label>').text(property.charAt(0).toUpperCase()+property.slice(1)+':').append(
|
$('<p>').text('Memory')
|
||||||
$('<span>').text(seperateThousands(settings.settings.capabilities.cpu[index][property],' '))
|
).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) {
|
||||||
if (settings.settings.capabilities.mem) {
|
$cont.append(
|
||||||
$cont.append(
|
$('<p>').text('Loading average')
|
||||||
$('<p>').text('Memory')
|
).append(
|
||||||
).append(
|
$('<label>').text('Loading averages:').append(
|
||||||
$('<label>').text('Physical memory:').append(
|
$('<table>').attr('id','stats-loading')
|
||||||
$('<table>').attr('id','stats-physical-memory')
|
)
|
||||||
)
|
);
|
||||||
).append(
|
}
|
||||||
$('<label>').text('Swap memory:').append(
|
fillServerstatsTables(settings.settings);
|
||||||
$('<table>').attr('id','stats-swap-memory')
|
|
||||||
)
|
theInterval = setInterval(function(){
|
||||||
);
|
updateServerstats();
|
||||||
}
|
},10000);
|
||||||
|
|
||||||
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(){
|
|
||||||
updateServerstats();
|
updateServerstats();
|
||||||
},10000);
|
},{capabilities:{}});
|
||||||
updateServerstats();
|
|
||||||
|
|
||||||
$('#page').html($cont);
|
$('#page').html($cont);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue