fix address list

This commit is contained in:
deflax 2018-01-29 18:29:35 +02:00
parent d7246f30ed
commit fabc3c130d
4 changed files with 24 additions and 12 deletions

View file

@ -30,6 +30,10 @@ def chat():
#def about(): #def about():
# return render_template('main/aboutus.html') # return render_template('main/aboutus.html')
@main.route('/domaincheck', methods=['GET'])
def domaincheck():
return render_template('main/domaincheck.html')
@main.route("/terms", methods=['GET']) @main.route("/terms", methods=['GET'])
def terms(): def terms():
return render_template('main/terms.html') return render_template('main/terms.html')

View file

@ -22,6 +22,7 @@
<th>Server</th> <th>Server</th>
<th>Region</th> <th>Region</th>
<th>rDNS</th> <th>rDNS</th>
<th>Assignee</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -44,6 +45,11 @@
{% else %} {% else %}
<td></td> <td></td>
{% endif %} {% endif %}
{% if address.user_id != None %}
<td><a href="{{ url_for('admin.dashboard', user_pid=address.user_id) }}">{{ address.owner.email }}</a></td>
{% else %}
<td></td>
{% endif %}
{% endfor %} {% endfor %}
</tr> </tr>
</tbody> </tbody>

View file

@ -16,13 +16,13 @@
<table class="table table-hover table-striped table-condensed cf"> <table class="table table-hover table-striped table-condensed cf">
<thead> <thead>
<tr> <tr>
<th>Owner</th>
<th>Alias</th> <th>Alias</th>
<th>CPU</th> <th>CPU</th>
<th>Mem</th> <th>Mem</th>
<th>HDD</th> <th>HDD</th>
<th>Last Charged</th> <th>Last Charged</th>
<th>Days Left</th> <th>Days Left</th>
<th>Owner</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -36,7 +36,6 @@
<tr> <tr>
{% endif %} {% endif %}
{% endif %} {% endif %}
<td><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
<td><a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }}<br />Online: {{ deploy.connected }}<br />ID: {{ deploy.machine_id }}"><b>{% if deploy.protected == True %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a></td> <td><a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }}<br />Online: {{ deploy.connected }}<br />ID: {{ deploy.machine_id }}"><b>{% if deploy.protected == True %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a></td>
<td>{{ deploy.machine_cpu }}</td> <td>{{ deploy.machine_cpu }}</td>
<td>{{ deploy.machine_mem }} MB</td> <td>{{ deploy.machine_mem }} MB</td>
@ -47,6 +46,7 @@
<td>{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td> <td>{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td>
{% endif %} {% endif %}
<td>{{ deploy.daysleft }}</td> <td>{{ deploy.daysleft }}</td>
<td><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
{% endfor %} {% endfor %}
</tbody> </tbody>
</table> </table>

View file

@ -36,16 +36,18 @@ def slavetables():
selected_slave = Server.query.filter_by(name=str(postdata['slavename'])).first() selected_slave = Server.query.filter_by(name=str(postdata['slavename'])).first()
if selected_slave == None: if selected_slave == None:
return jsonify({'status': 'slave_not_found'}) return jsonify({'status': 'slave_not_found'})
addrlist = {}
try:
deploylist = selected_slave.inv_deployments.all() deploylist = selected_slave.inv_deployments.all()
addresslist = {}
for deploy in deploylist: for deploy in deploylist:
addresslist[str(deploy.machine_id)] = {} pubvlanlist = deploy.inv_pubvlans.all()
addresses = deploy.inv_addresses.first() for pubvlan in pubvlanlist:
deploy_address_list = [] if pubvlan.pubaddr != None:
for address in addresses: addrlist[str(pubvlan.pubaddr.ip)] = str(pubvlan.vlan_id)
deploy_address_list.append(address.ip) addrlist['status'] = 'ok'
addresslist[deploy.vlan] = deploy_address_list except:
return jsonify(addresslist) addrlist['status'] = 'tables_gen_error'
return jsonify(addrlist)
@vmanager.route('/createvm', methods=['GET', 'POST']) @vmanager.route('/createvm', methods=['GET', 'POST'])
@login_required @login_required