protocols and selector for streams (#17, 1h)
This commit is contained in:
parent
7a13a54a26
commit
0c6e8cac8d
1 changed files with 85 additions and 47 deletions
132
server-rel.html
132
server-rel.html
|
@ -125,7 +125,10 @@ tbody td button
|
||||||
padding: 2px 7px 2px 7px;
|
padding: 2px 7px 2px 7px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tbody td.center
|
||||||
|
{
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,7 +226,8 @@ tbody td button
|
||||||
#nav,
|
#nav,
|
||||||
th,
|
th,
|
||||||
#login > input, #login > button,
|
#login > input, #login > button,
|
||||||
p
|
p,
|
||||||
|
label
|
||||||
{
|
{
|
||||||
font: normal bold 11pt Arial, sans-serif;
|
font: normal bold 11pt Arial, sans-serif;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
@ -420,15 +424,17 @@ td
|
||||||
|
|
||||||
function setHeaderState(state)
|
function setHeaderState(state)
|
||||||
{
|
{
|
||||||
var text, cname;
|
var text, cname, title;
|
||||||
|
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case 'logingin': text = 'logging in...'; cname = 'loggingin'; break;
|
case 'logingin': text = 'connecting...'; cname = 'loggingin'; title = 'connecting to ' + settings.server; break;
|
||||||
case 'disconnected': text = 'disconnected'; cname = 'disconnected'; break;
|
case 'disconnected': text = 'disconnected'; cname = 'disconnected'; title = 'disconnected'; break;
|
||||||
case 'connected': text = 'connected'; cname = 'connected'; break;
|
case 'connected': text = 'connected'; cname = 'connected'; title = 'connected to ' + settings.server; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
document.title = 'Server Manager - ' + title;
|
||||||
|
|
||||||
$('#header-connection').attr('class', cname);
|
$('#header-connection').attr('class', cname);
|
||||||
$('#header-connection').text(text);
|
$('#header-connection').text(text);
|
||||||
$('#header-host').text(settings.server.replace('http://', ''));
|
$('#header-host').text(settings.server.replace('http://', ''));
|
||||||
|
@ -498,6 +504,14 @@ td
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
case 'overview':
|
||||||
|
|
||||||
|
$('#page').append($('<p>').text('TODO overview'));
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 'protocols':
|
case 'protocols':
|
||||||
|
|
||||||
|
@ -517,7 +531,7 @@ td
|
||||||
tr.append( $('<td>').text( protocol ) );
|
tr.append( $('<td>').text( protocol ) );
|
||||||
tr.append( $('<td>').text( settings.settings.config.protocols[protocol].port ) );
|
tr.append( $('<td>').text( settings.settings.config.protocols[protocol].port ) );
|
||||||
|
|
||||||
tr.append( $('<td>').append( $('<button>').click(function()
|
tr.append( $('<td>').attr('class', 'center').append( $('<button>').click(function()
|
||||||
{
|
{
|
||||||
var id = $(this).parent().attr('id').replace('protocol-', '');
|
var id = $(this).parent().attr('id').replace('protocol-', '');
|
||||||
delete settings.settings.config.protocols[protocol];
|
delete settings.settings.config.protocols[protocol];
|
||||||
|
@ -528,50 +542,54 @@ td
|
||||||
$tbody.append(tr);
|
$tbody.append(tr);
|
||||||
}
|
}
|
||||||
|
|
||||||
$table.append($tbody);
|
|
||||||
|
|
||||||
|
// add new limit!
|
||||||
|
$nprot = $('<tr>');
|
||||||
|
// protocol select
|
||||||
|
$pname = $('<select>').attr('id', 'new-protocol-name');
|
||||||
|
$pname.append( $('<option>').attr('value', 'HTTP').text('HTTP') );
|
||||||
|
$pname.append( $('<option>').attr('value', 'RTMP').text('RTMP') );
|
||||||
|
|
||||||
|
$nprot.append( $('<td>').append($pname) );
|
||||||
|
// val
|
||||||
|
$nprot.append( $('<td>').append( $('<input>').attr('type', 'text').attr('id', 'new-protocol-val') ) );
|
||||||
|
|
||||||
|
$nprot.append(
|
||||||
|
$('<td>').attr('class', 'center').append(
|
||||||
|
$('<button>').click(function()
|
||||||
|
{
|
||||||
|
settings.settings.config.protocols[$('#new-protocol-name :selected').val()] =
|
||||||
|
{
|
||||||
|
port: $('#new-protocol-val').val()
|
||||||
|
};
|
||||||
|
|
||||||
|
loadSettings(function()
|
||||||
|
{
|
||||||
|
showTab('protocols');
|
||||||
|
});
|
||||||
|
|
||||||
|
}).text('add new')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$tbody.append($nprot);
|
||||||
|
$table.append($tbody);
|
||||||
$('#page').append($table);
|
$('#page').append($table);
|
||||||
|
|
||||||
|
|
||||||
$('#page').append( $('<p>').text('todo') );
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
var protocol, li;
|
|
||||||
|
|
||||||
$('#protocol-list').html('');
|
|
||||||
|
|
||||||
for(protocol in settings.settings.config.protocols)
|
|
||||||
{
|
|
||||||
li = $('<li>').attr('id', 'protocol-' + protocol);
|
|
||||||
|
|
||||||
li.text(protocol + ' on port ' + settings.settings.config.protocols[protocol].port);
|
|
||||||
|
|
||||||
li.append($('<button>').click(function()
|
|
||||||
{
|
|
||||||
var prot = $(this).parent().attr('id').replace('protocol-', '');
|
|
||||||
console.log(prot);
|
|
||||||
|
|
||||||
delete settings.settings.config.protocols[prot];
|
|
||||||
|
|
||||||
$(this).parent().remove();
|
|
||||||
|
|
||||||
loadSettings(fillProtocols);
|
|
||||||
}).text('remove'));
|
|
||||||
|
|
||||||
$('#protocol-list').append(li);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 'streams':
|
case 'streams':
|
||||||
|
|
||||||
$streamselector = $('<select>').attr('id', 'streams-selector');
|
$streamselector = $('<select>').attr('id', 'streams-selector');
|
||||||
|
|
||||||
|
$streamselector.append( $('<option>').attr('disabled', 'disabled').text('Select a stream...') );
|
||||||
|
|
||||||
for(stream in settings.settings.streams)
|
for(stream in settings.settings.streams)
|
||||||
{
|
{
|
||||||
$streamselector.append( $('<option>').attr('value', stream).text(settings.settings.streams[stream].name) );
|
$streamselector.append( $('<option>').attr('value', stream).text(settings.settings.streams[stream].name) );
|
||||||
|
@ -579,13 +597,27 @@ $('#page').append( $('<p>').text('todo') );
|
||||||
|
|
||||||
$streamselector.change(function()
|
$streamselector.change(function()
|
||||||
{
|
{
|
||||||
console.log('selected:', $('#streams-selector :selected').val() );
|
var sname = $('#streams-selector :selected').val();
|
||||||
|
var stream = settings.settings.streams[sname];
|
||||||
|
|
||||||
|
$('#page').append( $('<p>').text('TODO stream settings: ' + sname + ' / ' + stream) );
|
||||||
|
/* // TODO
|
||||||
|
$('#page').append( $('<label>').attr('for', 'stream-name').text('Name').append( $('<input>').attr('id', 'stream-name').attr('value', stream.name) ) );
|
||||||
|
$('#page').append( $('<label>').attr('for', 'stream-group').text('Group').append( $('<input>').attr('id', 'stream-group').attr('value', stream.group) ) );
|
||||||
|
|
||||||
|
$('#page').append(
|
||||||
|
$('<div>').text('Channel').append(
|
||||||
|
$('<label>').attr('for', 'stream-channel-url').text('URL').append( $('<input>').attr('id', 'stream-channel-url').attr('value', stream.channel.URL) )
|
||||||
|
).append(
|
||||||
|
$('<label>').attr('for', 'stream-channel-account').text('Account').append( $('<input>').attr('id', 'stream-channel-account').attr('value', stream.channel.account) )
|
||||||
|
)
|
||||||
|
);
|
||||||
|
*/
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#page').append( $streamselector );
|
$('#page').append( $streamselector );
|
||||||
|
|
||||||
$('#page').append($('<p>').text('TODO'));
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
@ -593,6 +625,10 @@ $('#page').append( $('<p>').text('todo') );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 'limits':
|
case 'limits':
|
||||||
$table = $('<table>');
|
$table = $('<table>');
|
||||||
$table.html("<thead><th>Type</th><th>Hard/soft limit</th><th>Value</th><th></th></thead>");
|
$table.html("<thead><th>Type</th><th>Hard/soft limit</th><th>Value</th><th></th></thead>");
|
||||||
|
@ -613,7 +649,7 @@ $('#page').append( $('<p>').text('todo') );
|
||||||
tr.append( $('<td>').text( limit.type ) );
|
tr.append( $('<td>').text( limit.type ) );
|
||||||
tr.append( $('<td>').text( limit.val ) );
|
tr.append( $('<td>').text( limit.val ) );
|
||||||
|
|
||||||
tr.append( $('<td>').append( $('<button>').click(function()
|
tr.append( $('<td>').attr('class', 'center').append( $('<button>').click(function()
|
||||||
{
|
{
|
||||||
var id = $(this).parent().attr('id').replace('limits-', '');
|
var id = $(this).parent().attr('id').replace('limits-', '');
|
||||||
settings.settings.config.limits.splice(id, 1);
|
settings.settings.config.limits.splice(id, 1);
|
||||||
|
@ -641,7 +677,7 @@ $('#page').append( $('<p>').text('todo') );
|
||||||
$nltr.append( $('<td>').append( $('<input>').attr('type', 'text').attr('id', 'new-limit-val') ) );
|
$nltr.append( $('<td>').append( $('<input>').attr('type', 'text').attr('id', 'new-limit-val') ) );
|
||||||
|
|
||||||
$nltr.append(
|
$nltr.append(
|
||||||
$('<td>').append(
|
$('<td>').attr('class', 'center').append(
|
||||||
$('<button>').click(function()
|
$('<button>').click(function()
|
||||||
{
|
{
|
||||||
settings.settings.config.limits.push(
|
settings.settings.config.limits.push(
|
||||||
|
@ -676,9 +712,11 @@ $('#page').append( $('<p>').text('todo') );
|
||||||
$tbody = $('<tbody>');
|
$tbody = $('<tbody>');
|
||||||
|
|
||||||
var i, cur, $tr,
|
var i, cur, $tr,
|
||||||
logs = settings.settings.log.reverse(),
|
logs = settings.settings.log,
|
||||||
len = logs.length;
|
len = logs.length;
|
||||||
|
|
||||||
|
logs.reverse();
|
||||||
|
|
||||||
$tbody.html('');
|
$tbody.html('');
|
||||||
|
|
||||||
for(i = 0; i < len; i++)
|
for(i = 0; i < len; i++)
|
||||||
|
|
Loading…
Add table
Reference in a new issue