Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (59 sloc) 1.84 KB
<% local.pieces.header(); %>
<h1>Pool Edit</h1>
<div class="container">
<%
core.content.forms();
var mypool = null;
if ( request._id ) mypool = db.pools.findOne( ObjectId( request._id ) );
if ( ! mypool ) mypool = {};
Forms.fillInObject( "" , mypool );
if ( mypool.machines && isString( mypool.machines ) ){
mypool.machines = request.getParameters( "machines" ).join( "," );
mypool.machines = mypool.machines.split( /[ ,]+/ ).filter( function(z){
z = z.trim();
return z.length > 0;
} );
}
if ( request.action == "save" ){
mypool.assignable = request.assignable ? true : false;
if ( request._id )
(new ConfigChange( db.pools.findOne( ObjectId( request._id )) , mypool ) ).save();
db.pools.save( mypool );
return response.sendRedirectTemporary( "/pools" );
}
print.setFormObject( mypool );
%>
<form>
<input type="hidden" name="_id">
<table>
<tr>
<th>Name</th>
<td><input name="name"></td>
</tr>
<tr>
<th>Assignable</th>
<td><input type="checkbox" name="assignable" value="true" <%= mypool.assignable ? "checked" : "" %>></td>
</tr>
<tr>
<th>Type</th>
<td>
<%= envTypeSelect( "type" , mypool.type ) %>
</td>
</tr>
<tr>
<th>Machines</th>
<td><% local.pieces.nodePicker( "machines" , true , ( mypool || {} ).machines ) %></td>
</tr>
</table>
<input name="action" type="submit" value="save">
</form>
<hr>
<h4>Sites Using this</h4>
<ul ? mypool.name >
<forarray other ( db.sites.find( { "environments.pool" : mypool.name } ) ).toArray() >
<li><a href="/site_edit?_id=<%= other._id %>"><%= other.name %></a></li>
</forarray>
</ul>
<% local.pieces.changes( mypool ); %>
<div>
<% local.pieces.footer(); %>