Commit ee2fff1f authored by Jeff MrBE4R's avatar Jeff MrBE4R
Browse files

second commit

parent 687f23db
...@@ -52,12 +52,12 @@ def get_all_vms(): ...@@ -52,12 +52,12 @@ def get_all_vms():
try: try:
vms = config.Config.conn.execute( vms = config.Config.conn.execute(
select( select(
[ [
database.vms.c.id, database.vms.c.id,
database.vms.c.token, database.vms.c.token,
database.vms.c.ip, database.vms.c.ip,
database.vms.c.enabled, database.vms.c.enabled,
] ]
) )
) )
except: except:
...@@ -324,19 +324,20 @@ def admin_vm(): ...@@ -324,19 +324,20 @@ def admin_vm():
else: else:
enabled = False enabled = False
if str(request.form['token']).decode('utf8') and str(request.form['ip']).decode('utf8') and str(request.form['enabled']).decode('utf8'): try:
try: config.Config.conn.execute(
config.Config.conn.execute( database.vms.update().values(
database.vms.update().values( token=str(request.form['token']).decode('utf8'),
token=str(request.form['token']).decode('utf8'), ip=str(request.form['ip']).decode('utf8'),
ip=str(request.form['ip']).decode('utf8'), enabled=enabled,
enabled=enabled, ).where(
).where( database.vms.c.id == int(request.form['id'])
database.vms.c.id == int(request.form['id'])
)
) )
except: )
pass except:
import sys
print sys.exc_info()
pass
elif request.form['action'] == str('Delete').decode('utf8'): elif request.form['action'] == str('Delete').decode('utf8'):
if str(request.form['id']).decode('utf8'): if str(request.form['id']).decode('utf8'):
try: try:
......
...@@ -21,14 +21,18 @@ ...@@ -21,14 +21,18 @@
<td style="border: none; text-align: left;"> <td style="border: none; text-align: left;">
<select class="form-control" name="user-to-link"> <select class="form-control" name="user-to-link">
{% for u in users %} {% for u in users %}
<option value="{{ u.id }}">{{ u.fullname }}</option> {% if u.enabled %}
<option value="{{ u.id }}">{{ u.fullname }}</option>
{% endif %}
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
<td> <td>
<select class="form-control" name="server-to-link"> <select class="form-control" name="server-to-link">
{% for vm in vms %} {% for vm in vms %}
<option value="{{ vm.id }}">{{ vm.token }}</option> {% if vm.enabled %}
<option value="{{ vm.id }}">{{ vm.token }}</option>
{% endif %}
{% endfor %} {% endfor %}
</select> </select>
</td> </td>
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
</tr> </tr>
<tr> <tr>
<td style="border: none; text-align: left;"> <td style="border: none; text-align: left;">
<label for="enabled">Enabled ?</label> <label>Enabled ?</label>
</td> </td>
<td style="border: none; text-align: left;"> <td style="border: none; text-align: left;">
<input type="checkbox" data-toggle="toggle" id="enabled" name="enabled" {% if vm.enabled %} checked {% endif %}> <input type="checkbox" data-toggle="toggle" id="enabled" name="enabled" {% if vm.enabled %} checked {% endif %}>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment