Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (36 sloc) 1.18 KB
<% local.pieces.header(); %>
<%
if ( request.action == "add" && request.new_nodes ){
var redir = initialConfig && ! db.nodes.findOne();
for each ( var n in request.new_nodes.split( /[\r\n\s,]+/g ) ){
n = n.trim();
if ( n.length == 0 )
continue;
if ( db.nodes.findOne( { machine : n } ) )
continue;
db.nodes.save( { machine : n } );
}
if ( redir )
throw Exception.Redirect( "/nodes" );
}
if ( request.action == "delete" && request.machines ){
for each ( var n in request.getParameters( "machines" ) ){
db.nodes.remove( { machine : n } );
}
}
%>
<h1>Nodes</h1>
<div class="container">
<form action="/nodes/" >
<% local.pieces.nodePicker( "machines" , true , current ); %>
<input type="submit" name="action" value="delete">
</form>
<hr>
<h3>Add Nodes</h3>
<form method="post" action="/nodes" >
<textarea name="new_nodes" cols=60 rows=10 ></textarea>
<input type="submit" name="action" value="add">
</form>
<div class="small">space or line seperated</div>
</div>
<% local.pieces.footer(); %>
Something went wrong with that request. Please try again.