').attr('id', 'forcesave');
-
- forcesave.append(
- $('
').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(
- $('').click(function()
- {
- if(confirmDelete('Are you sure you want to force a JSON save?') == true)
- {
- forceJSONSave();
- }
- }).text( 'force save to JSON file' )
- );
-
- $('#page').append(forcesave);
+ function showStats()
+ {
+ getStatData(function(data)
+ {
+ $('#cur_streams_online').html('').text(data.streams[0] + ' of ' + data.streams[1] + ' online');
+ $('#cur_num_viewers').html('').text(data.viewers);
+ });
+ }
+
+ // refresh the stream status + viewers
+ sinterval = setInterval(function()
+ {
+ showStats();
+ }, 10000);
+
+ showStats();
+
+ $('#editserver').append(
+ $('').attr('class', 'floatright').click(function()
+ {
+ var host = $('#config-host').val();
+ var name = $('#config-name').val();
+
+ settings.settings.config.host = host;
+ settings.settings.config.name = name;
+
+ loadSettings(function()
+ {
+ showTab('overview');
+ });
+ }).text( 'save' )
+ );
+
+ var forcesave = $('').attr('id', 'forcesave');
+
+ forcesave.append(
+ $('
').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(
+ $('').click(function()
+ {
+ if(confirmDelete('Are you sure you want to force a JSON save?') == true)
+ {
+ forceJSONSave();
+ }
+ }).text( 'force save to JSON file' )
+ );
+
+ $('#page').append(forcesave);
+ });
break;
@@ -298,7 +335,10 @@
var id = Number($(this).parent().parent().attr('id').replace('protocol-', ''));
var pid = pids.indexOf(id);
settings.settings.config.protocols.splice(pid, 1);
- showTab('protocols');
+ loadSettings(function()
+ {
+ showTab('protocols');
+ });
}
}).text('delete') ) );
@@ -338,7 +378,7 @@
}
protocolstatus = data.config.protocols[pid].online;
}
- $(this).children()[1].innerHTML = formatStatus( protocolstatus );
+ $(this).children(':nth-child(2)').html( formatStatus( protocolstatus ) );
});
});
}
@@ -641,8 +681,8 @@
{
streamstatus = streams[stream][0];
}
- $(this).children()[4].innerHTML = formatStatus(streamstatus);
- $(this).children()[5].innerHTML = streams[stream][1];
+ $(this).children(':nth-child(5)').html(formatStatus(streamstatus));
+ $(this).children(':nth-child(6)').html(streams[stream][1]);
});
});
};
@@ -694,6 +734,8 @@
showTab('embed', sname);
}) ) ); // end function, end click(), end append(), end append(). Huzzah jQuery.
+ if ( cstr.name == undefined ) { cstr.name = ''; }
+
$tr.append( $('').text( cstr.name ) );
$tr.append( $(' ').html( formatStatus( cstr.online ) ) );
@@ -1102,6 +1144,65 @@
break;
+ case 'server stats':
+ loadSettings(function(){
+ serverstats = settings.settings.capabilities;
+
+ console.log(serverstats); //weghalen
+
+ if (serverstats.cpu !== undefined)
+ {
+ $('#page').append(
+ $('').attr('class','datacont').append(
+ $('
').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(
+ $('').text(property).append(
+ $('').text(serverstats.cpu[0][property])
+ )
+ );
+ }
+ }
+ if (serverstats.mem !== undefined)
+ {
+ $('#page').append(
+ $('').attr('class','datacont').append(
+ $('
').text('Memory')
+ ).append(
+ $('').text('Physical memory').append(
+ $('').text(serverstats.mem.used+'MiB/'+serverstats.mem.total+'MiB ('+serverstats.mem.free+'MiB available)')
+ )
+ ).append(
+ $('').text('Swap memory').append(
+ $('').text((serverstats.mem.swaptotal - serverstats.mem.swapfree)+'MiB/'+serverstats.mem.swaptotal+'MiB ('+serverstats.mem.swapfree+'MiB available)')
+ )
+ )
+ );
+ }
+ if (serverstats.load !== undefined)
+ {
+ $('#page').append(
+ $('').attr('class','datacont').append(
+ $('
').text('Load')
+ ).append(
+ $('').text('Memory used').append(
+ $('').text(serverstats.load.memory+'%')
+ )
+ ).append(
+ $('').text('Loading averages').append(
+ $('').text('1 min: '+serverstats.load.one+'%, 5 min: '+serverstats.load.five+'%, 15 min: '+serverstats.load.fifteen+'%')
+ )
+ )
+ );
+ }
+ });
+
+ break;
+
case 'disconnect':
showTab('login');
setHeaderState('disconnected');
diff --git a/lsp/server.html b/lsp/server.html
index b6fe2a3c..62d825f7 100644
--- a/lsp/server.html
+++ b/lsp/server.html
@@ -40,6 +40,7 @@
streams
limits
logs
+ server stats
disconnect
diff --git a/lsp/style.css b/lsp/style.css
index 1bd05d3e..d6f3c34d 100644
--- a/lsp/style.css
+++ b/lsp/style.css
@@ -257,7 +257,7 @@ label select
width: 225px;
}
-label span
+label span, label button
{
float: right;
}
@@ -290,6 +290,7 @@ th,
#login > button,
p,
label,
+button,
#page label input,
#page label select,
#page > button,
@@ -409,4 +410,17 @@ td
padding: 50px 0 0 0;
}
-
+.datacont label span
+{
+ font-weight: normal;
+ text-transform: none;
+}
+.datacont label
+{
+ padding-left: 25px;
+}
+.datacont p
+{
+ margin-top: 25px;
+ margin-bottom: 0px;
+}
\ No newline at end of file