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

second commit

parent 687f23db
......@@ -52,12 +52,12 @@ def get_all_vms():
try:
vms = config.Config.conn.execute(
select(
[
database.vms.c.id,
database.vms.c.token,
database.vms.c.ip,
database.vms.c.enabled,
]
[
database.vms.c.id,
database.vms.c.token,
database.vms.c.ip,
database.vms.c.enabled,
]
)
)
except:
......@@ -324,19 +324,20 @@ def admin_vm():
else:
enabled = False
if str(request.form['token']).decode('utf8') and str(request.form['ip']).decode('utf8') and str(request.form['enabled']).decode('utf8'):
try:
config.Config.conn.execute(
database.vms.update().values(
token=str(request.form['token']).decode('utf8'),
ip=str(request.form['ip']).decode('utf8'),
enabled=enabled,
).where(
database.vms.c.id == int(request.form['id'])
)
try:
config.Config.conn.execute(
database.vms.update().values(
token=str(request.form['token']).decode('utf8'),
ip=str(request.form['ip']).decode('utf8'),
enabled=enabled,
).where(
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'):
if str(request.form['id']).decode('utf8'):
try:
......
......@@ -21,14 +21,18 @@
<td style="border: none; text-align: left;">
<select class="form-control" name="user-to-link">
{% for u in users %}
<option value="{{ u.id }}">{{ u.fullname }}</option>
{% if u.enabled %}
<option value="{{ u.id }}">{{ u.fullname }}</option>
{% endif %}
{% endfor %}
</select>
</td>
<td>
<select class="form-control" name="server-to-link">
{% for vm in vms %}
<option value="{{ vm.id }}">{{ vm.token }}</option>
{% if vm.enabled %}
<option value="{{ vm.id }}">{{ vm.token }}</option>
{% endif %}
{% endfor %}
</select>
</td>
......
......@@ -27,7 +27,7 @@
</tr>
<tr>
<td style="border: none; text-align: left;">
<label for="enabled">Enabled ?</label>
<label>Enabled ?</label>
</td>
<td style="border: none; text-align: left;">
<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