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;
|
||||||
|
|
|
@ -1511,6 +1511,9 @@ function showTab(tabName,streamName) {
|
||||||
case 'server stats':
|
case 'server stats':
|
||||||
var $cont = $('<div>').addClass('input_container');
|
var $cont = $('<div>').addClass('input_container');
|
||||||
|
|
||||||
|
getData(function(d){
|
||||||
|
settings.settings.capabilities = d.capabilities;
|
||||||
|
|
||||||
$cont.append(
|
$cont.append(
|
||||||
$('<p>').text('CPU')
|
$('<p>').text('CPU')
|
||||||
);
|
);
|
||||||
|
@ -1545,7 +1548,7 @@ function showTab(tabName,streamName) {
|
||||||
|
|
||||||
if (settings.settings.capabilities.load) {
|
if (settings.settings.capabilities.load) {
|
||||||
$cont.append(
|
$cont.append(
|
||||||
$('<p>').text('CPU Load')
|
$('<p>').text('Loading average')
|
||||||
).append(
|
).append(
|
||||||
$('<label>').text('Loading averages:').append(
|
$('<label>').text('Loading averages:').append(
|
||||||
$('<table>').attr('id','stats-loading')
|
$('<table>').attr('id','stats-loading')
|
||||||
|
@ -1558,6 +1561,7 @@ function showTab(tabName,streamName) {
|
||||||
updateServerstats();
|
updateServerstats();
|
||||||
},10000);
|
},10000);
|
||||||
updateServerstats();
|
updateServerstats();
|
||||||
|
},{capabilities:{}});
|
||||||
|
|
||||||
$('#page').html($cont);
|
$('#page').html($cont);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue