dashboard update

This commit is contained in:
deflax 2017-09-15 03:28:26 +03:00
parent 2146b8dd8b
commit 75dbce93c0
8 changed files with 52 additions and 39 deletions

View file

@ -156,26 +156,26 @@ def dashboard(user_pid=0):
inv_deploycubeids = [] inv_deploycubeids = []
inv_deployments_list = [] inv_deployments_list = []
for invcls in inv_deployments: for invcls in inv_deployments:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_deploycubeids.extend([invcls.machine_id]) inv_deploycubeids.extend([invcls.machine_id])
inv_deployments_list.extend([invcls.machine_alias]) inv_deployments_list.extend([invcls.machine_alias])
inv_services = cuser.inv_services.filter_by(cancelled=False).order_by(Service.date_last_charge.asc()).all() inv_services = cuser.inv_services.filter_by(cancelled=False).order_by(Service.date_last_charge.asc()).all()
inv_services_list = [] inv_services_list = []
for invcls in inv_services: for invcls in inv_services:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_services_list.extend([invcls.description]) inv_services_list.extend([invcls.description])
inv_domains = cuser.inv_domains.filter_by(cancelled=False).order_by(Domain.date_created.desc()).all() inv_domains = cuser.inv_domains.filter_by(cancelled=False).order_by(Domain.date_created.desc()).all()
inv_domains_list = [] inv_domains_list = []
for invcls in inv_domains: for invcls in inv_domains:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_domains_list.extend([invcls.fqdn]) inv_domains_list.extend([invcls.fqdn])
inv_addresses = cuser.inv_addresses.order_by(Address.ip.asc()).all() inv_addresses = cuser.inv_addresses.order_by(Address.ip.asc()).all()
inv_addresses_list = [] inv_addresses_list = []
for invcls in inv_addresses: for invcls in inv_addresses:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_addresses_list.extend([invcls.ip]) inv_addresses_list.extend([invcls.ip])
sys_regions = Region.query.all() sys_regions = Region.query.all()

View file

@ -43,26 +43,26 @@ def dashboard():
inv_deploycubeids = [] inv_deploycubeids = []
inv_deployments_list = [] inv_deployments_list = []
for invcls in inv_deployments: for invcls in inv_deployments:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_deploycubeids.extend([invcls.machine_id]) inv_deploycubeids.extend([invcls.machine_id])
inv_deployments_list.extend([invcls.machine_alias]) inv_deployments_list.extend([invcls.machine_alias])
inv_services = cuser.inv_services.filter_by(cancelled=False).order_by(Service.date_last_charge.asc()).all() inv_services = cuser.inv_services.filter_by(cancelled=False).order_by(Service.date_last_charge.asc()).all()
inv_services_list = [] inv_services_list = []
for invcls in inv_services: for invcls in inv_services:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_services_list.extend([invcls.description]) inv_services_list.extend([invcls.description])
inv_domains = cuser.inv_domains.filter_by(cancelled=False).order_by(Domain.date_created.desc()).all() inv_domains = cuser.inv_domains.filter_by(cancelled=False).order_by(Domain.date_created.desc()).all()
inv_domains_list = [] inv_domains_list = []
for invcls in inv_domains: for invcls in inv_domains:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_domains_list.extend([invcls.fqdn]) inv_domains_list.extend([invcls.fqdn])
inv_addresses = cuser.inv_addresses.order_by(Address.ip.asc()).all() inv_addresses = cuser.inv_addresses.order_by(Address.ip.asc()).all()
inv_addresses_list = [] inv_addresses_list = []
for invcls in inv_addresses: for invcls in inv_addresses:
if invcls.user_id == cuser.pid and invcls.enabled == True: if invcls.user_id == cuser.pid:
inv_addresses_list.extend([invcls.ip]) inv_addresses_list.extend([invcls.ip])
sys_regions = Region.query.all() sys_regions = Region.query.all()
@ -73,6 +73,7 @@ def dashboard():
#extract rrd and status from the deployments #extract rrd and status from the deployments
rrd = {} rrd = {}
statuses = {} statuses = {}
current_app.logger.warning(str(inv_deploycubeids))
for cubeid in inv_deploycubeids: for cubeid in inv_deploycubeids:
rrd[cubeid] = {} rrd[cubeid] = {}
try: try:
@ -82,6 +83,8 @@ def dashboard():
flash('Deploy #{} unreachable. Support is notified'.format(str(cubeid))) flash('Deploy #{} unreachable. Support is notified'.format(str(cubeid)))
send_email(current_app.config['MAIL_USERNAME'], 'Cube {} is unreachable'.format(cubeid), send_email(current_app.config['MAIL_USERNAME'], 'Cube {} is unreachable'.format(cubeid),
'vmanager/email/adm_unreachable', user=current_user, cubeid=cubeid) 'vmanager/email/adm_unreachable', user=current_user, cubeid=cubeid)
#current_app.logger.info('debug query:')
#current_app.logger.info(query)
graphs_list = ['net', 'cpu', 'mem', 'hdd'] graphs_list = ['net', 'cpu', 'mem', 'hdd']
try: try:

View file

@ -4,5 +4,5 @@ from wtforms import validators, ValidationError
from wtforms.fields.html5 import EmailField from wtforms.fields.html5 import EmailField
class ActivateForm(FlaskForm): class ActivateForm(FlaskForm):
period = SelectField('Service Period', choices=[(1, '1 Month'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int) period = SelectField('Service Period', choices=[(1, '1 Month'), (2, '2 Months'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int)
submit = SubmitField('Activate') submit = SubmitField('Activate')

View file

@ -14,11 +14,10 @@
<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></th>
<th>Description</th> <th>Description</th>
<th>Amount</th> <th>Amount</th>
<th>Date</th> <th>Date</th>
<th></th> <th>User</th>
</tr> </tr>
</thead> </thead>
@ -26,14 +25,12 @@
{% for transaction in transactions %} {% for transaction in transactions %}
{% if transaction.value > 0 %} {% if transaction.value > 0 %}
<tr class="default"> <tr class="default">
<td><span class="glyphicon glyphicon-asterisk"></span></td>
<td>{{ transaction.description }}</td> <td>{{ transaction.description }}</td>
<td>{{ transaction.value }} {{ transaction.currency }}</td> <td>{{ transaction.value }} {{ transaction.currency }}</td>
<td>{{ moment(transaction.date_created).format('lll') }}</td> <td>{{ moment(transaction.date_created).format('lll') }}</td>
<td><a href="{{ url_for('admin.transaction', user_pid=transaction.owner.pid) }}">{{ transaction.owner.email }}</a></td> <td><a href="{{ url_for('admin.transaction', user_pid=transaction.owner.pid) }}">{{ transaction.owner.email }}</a></td>
{% else %} {% else %}
<tr class="success"> <tr class="default">
<td><span class="glyphicon glyphicon-plus"></span></td>
<td>{{ transaction.description }}</td> <td>{{ transaction.description }}</td>
<td>{{ transaction.value }} {{ transaction.currency }}</td> <td>{{ transaction.value }} {{ transaction.currency }}</td>
<td>{{ moment(transaction.date_created).format('lll') }}</td> <td>{{ moment(transaction.date_created).format('lll') }}</td>

View file

@ -132,53 +132,60 @@ addEventListener("DOMContentLoaded", function() {
<div class="panel-group" id="deploycubes" role="tablist" aria-multiselectable="true"> <div class="panel-group" id="deploycubes" role="tablist" aria-multiselectable="true">
{% for deploy in inv_deployments %} {% for deploy in inv_deployments %}
{% if deploy.enabled == False %} {% if deploy.enabled == False %}
<div class="panel panel-danger"> <div class="panel panel-danger" style="margin-top: 2px">
{% endif %}
{% if deploy.warning == True %}
<div class="panel panel-warning">
{% else %} {% else %}
<div class="panel panel-success"> {% if deploy.warning == True %}
<div class="panel panel-warning" style="margin-top: 2px">
{% else %}
<div class="panel panel-success" style="margin-top: 2px">
{% endif %}
{% endif %} {% endif %}
<div class="panel-heading" data-toggle="collapse" data-parent="#deploycubes" href="#cube{{ deploy.machine_id }}" aria-expanded="false" aria-controls="cube{{ deploy.machine_id }}" role="tab" id="dpanel{{ deploy.machine_id }}"> <div class="panel-heading" data-toggle="collapse" data-parent="#deploycubes" href="#cube{{ deploy.machine_id }}" aria-expanded="false" aria-controls="cube{{ deploy.machine_id }}" role="tab" id="dpanel{{ deploy.machine_id }}">
{% if deploy.protected == True %}<img class="icon icons8-Security-Checked" width="24" height="24" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAADr0lEQVRYheXYzWrbWBQHcD1CHiGPkEfwxtaXm05baDclCels0kWbTRbuJl0EJF1JdnHo1DQQOgstSgq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793GT0p3zrZ12Lh/kMgc4xD5OqPtXRhBi8Yx/Pr7jsdJxtG1fwqOZUojLDLejmesxhPdgSe6A+MZq8Ei4+3AurWXMAKOJVVrK6laW0Nrhn9D/gYrB5WUx8IwEwAAAABJRU5ErkJggg==">{% endif %} <a class="rrd" data-toggle="tooltip" title="Protected: {{ deploy.protected }}<br />State: {{ status[deploy.machine_id] }}<br />ID: {{ deploy.machine_id }}"><b>{% if status[deploy.machine_id] == 'running' %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a> {% if deploy.protected == True %}<img class="icon icons8-Security-Checked" width="24" height="24" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAADr0lEQVRYheXYzWrbWBQHcD1CHiGPkEfwxtaXm05baDclCels0kWbTRbuJl0EJF1JdnHo1DQQOgstSgqBiJIygY4XwVdXFnUIuKA0H1BIiVrTGmxrrBDnzCJ4SNLYkmzZGWb+cFYG3x+6OkdXoqj/Q+LIHGNl8hsnE4eTiZMQC5k4MseuFUWLxk1OJhqvmN9uZT9UH2r7IOXrIOXr8FDbh1vZD1VeMb9xMtFo0bg5cFAsUxpJSHgymS6usMhw72RL7tzqIaQ3XchZrSsrvenC3Ooh3M6Waiwy3GS6uJKQ8GQsUxqJBMUIeDQh4ckbavE9LWK4/7JcTekOLBrHHVGdatE4hpTuwP2X5SotYrihFt8nJDzJCHg0NIoWjcdJxdxnZdKcXrZr8+uVnlDdsPPrFZhetmusTJq8Qj7RovE4EJYWMcxoe8359UpkIL+aX6/AjLbXpEUMgYDDgl2u/waQR6TSrTMHVelNF3jVPPAFJlVra2GjOnTgwkYVkqq1de3A5VLfwOKblO4MBPfnwSl4JwBr9s+/pXQHkmrxjS8wIeCnj15/HgjufN7tXvz90evPkBDwU18gLRVmZ7S95iBxFRd+2uoHr3Y8WirM+gIZAcfuPt/+MUxczmrB3efbPxgBx3yBsUxpJKpZGBSXswLOwHY4RL5K+XrHha0vpx0X6gUn5evBZmA7vGL+0amT7cqp74LvdluBcaE6uB1aKsxOL9u1y3+0ZvsvvFJugXcSHJezWjCx9LERF/BUYCAj4FEWkSs7udvW9YLLWS1gEWmGPhfyqnnQ6T68CrlmX8R5JwDatj8u9P3XDi0WnnWbh5eR5+OdAKyUg3X6g1c7Hi0WnoUGMgIe5RDxwnRqWFzP29sOrxQtv+fyeWRYXEp3gFeKVk84iqKouICn7gV4qrQPAWFwOasF42nrr1Dde1U4yTgKcvwK0q3na2GjCpxkHPWFC3MVw9btbKnW99Vrh5PN3Sjf8lK6A6xM7EhwFHV2wmERaUbxbrxoHLc7NxYZkKIoilPIi4mlcqNf4MRSucEp5EWkOIo6O4Zxsrnbz+vA3OohsDKxI/s2czlxZI4xyHC7HcW6dS2DDHfgn+USUuEXDhEvDFLK1wdz33VKXMBTQZFSvg4cIl5kIyUMkpeN793GT0p3zrZ12Lh/kMgc4xD5OqPtXRhBi8Yx/Pr7jsdJxtG1fwqOZUojLDLejmesxhPdgSe6A+MZq8Ei4+3AurWXMAKOJVVrK6laW0Nrhn9D/gYrB5WUx8IwEwAAAABJRU5ErkJggg==">{% endif %} <a href="#"><b>{% if status[deploy.machine_id] == 'running' %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a>
</div></div> <!-- end of heading --> </div></div> <!-- end of heading -->
<!-- START OF HIDDEN PANEL --> <!-- START OF HIDDEN PANEL -->
{% if deploy.enabled == False or deploy.warning == True %} {% if deploy.enabled == False or deploy.warning == True %}
<div id="cube{{ deploy.machine_id }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading{{ deploy.machine_id }}"> <div id="cube{{ deploy.machine_id }}" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="heading{{ deploy.machine_id }}" style="border:3px solid #faebcc; border-top: none; margin-bottom: 10px;">
{% else %} {% else %}
<div id="cube{{ deploy.machine_id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{ deploy.machine_id }}"> <div id="cube{{ deploy.machine_id }}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading{{ deploy.machine_id }}" style="border:3px solid #d6e9c6; border-top: none; margin-bottom: 10px;">
{% endif %} {% endif %}
<div class="panel-body"> <div class="panel-body">
<ul class="nav nav-tabs"> <ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#controls{{ deploy.machine_id }}">Control</a></li> <li class="active"><a data-toggle="tab" href="#controls{{ deploy.machine_id }}">Control</a></li>
<li><a data-toggle="tab" href="#graphs{{ deploy.machine_id }}">Monitoring</a></li> <li><a data-toggle="tab" href="#graphs{{ deploy.machine_id }}">Monitoring</a></li>
<li><a data-toggle="tab" href="#misc{{ deploy.machine_id }}">Misc.</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div id="controls{{ deploy.machine_id }}" class="tab-pane fade in active"> <div id="controls{{ deploy.machine_id }}" class="tab-pane fade in active">
<p><br /> <p><br />
{% if deploy.enabled == True %}
<img class="icon icons8-Device-Manager" width="32" height="32" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAACl0lEQVRYhe2X70sTcRzHfdhDH/Zn9KAHPrwnejNSwqx01hpBw+1RDyoJrfZk3i0mKerWrtApKJmtQVkSSoPIfbc1vJtzOuFiWeE6QnaJlqbeuydNlj92m/PoBx68nrz5wvfFfd984FNSUuSnYwi1Xyirv7TY+0uq20JL1x8mUoVS2xFJ6xhCFS1gcAsfk7KCQrnxaG7x/xIg71fwckZW5bW4rI3ATa8Ic98Mrg6JObF44toJcETGC1HJSaNWAreeiLjojsLUG8+JpU8jgT9ewrHEVwyGJFVGYmntOtDsm4djXMqJZh3QrIQn7oSPbp/h5baJY9sFnK8+weyJq8KMJPMXqLBP1NIs+U6zBLswli2gSQlpOxmlWTKrY4gxG9pO7tMsQaU9WKatAEv8NBvkt+c6hhhplkDHEOpABCrtwbIqR/jDuS7+c4MzmspQ7xTW6rr59ezsVy7XdfOodwqLepewkRky510C2OfJwgQoq/9IlSOcHuBXVBusxrO5DTQNixgISvkLlNvfHDd5ZhaKvTzDvUAat31i/gI6hlDm/kTqoAQ4IqPFW4BARWvgpJGLLXFEBkdkVLeFYeqJoab9LWyjC8jku2HkpmDqiaHByaPZNw+OyLCNLuDa0BySsoK4tK4uQLMBQ0175IfeFV3Vu6KrBregJGUFTUMJnO2c3Mp3o65rUknKCgZDEs50TsLgnkKDS4DFE8dw5AtolsD29F1hT3C6I4IWrwh9N686Wi/3xNHiFdHYOw3HuPTbEwyGJNAsgXWPPuwpkP2LfbPrOQX6IstbZx9Pr+3oQHj+2z9QwkOBQ4G/QuDU3Uja3J9I7QeTZ1ax9Cc2M1x6ML15wSWs5r2cUlZ/aTErNt0auLIDNmDIdz3/CZaw0mqfwL4CAAAAAElFTkSuQmCC">
{% if status[deploy.machine_id] == 'running' %}
<button class="confirm command command-vmshutdown btn btn-default btn-warning" value="vmshutdown" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-off" aria-hidden="true"></span> Shutdown</button>
<button class="confirm command command-vmstop btn btn-default btn-danger" value="vmstop" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Force Stop</button>
</p>
<p>
<img class="icon icons8-Remote-Control" width="32" height="32" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAC+0lEQVRYhcWXz04aURTGZ+HCB+jCB2Dh0kWXXbBh7sREsPuuTBc+QB+A1MBctKBLgtGYVuPChYmuak2mDWXuBGfU0mpDhWCoKMb/KK0Q7pwuxmGGQflTBr3JJMNd3N93z/edAzBMFxbiRQfC0haLCUEBMs36xWGnV+jpBqvpcvliAxyWeISJwPrF/icRwTAMw/rFfoSJwGLxzZNVw+kVejgs8Swf89p6sMsXG3B6hV79s54BhKVlxJPXVhEIk6jLFxvoGDw4Hu9zB+Wdkdlk3hOS960eI150cFiaQAGyOjge79P3Wb/Yz2JCOrJicDze5w7Jmbcf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hu9zB+Wdkdlk3hOS960eI150cFiaQAGyOjge79P3Wb/Yz2JCOrJicDze5w7Jmbcfz4/CMoWJL0XwTMlH9wUN8SKHAmTVvMdhaYzDsVe2wPWnkQgOSxOIJ6MmUQ4Ok0Xb4M1EDL2Tn1mrwGJCbIU3E2EFIkyEjuBLuxRiWRXiORXW0ipMbzYWYU1+y51wH/zHsQrWdfEXYGm3tUx0dPNothZeqhjvhRLATJNKtAcPbqR865cVs8fFsgY7LQIsfqcwvUkhnjNEfd5X6zLhDm38Ng+r/4Z/SNAqSMgYoIhCoVDS9hPHal0wR+fTJ4gXuY7gYZnCQoJWS64cGqClXQrXdwLkw1oBvvXLylBQ3mtp8j3UanPbxnv+xvBeOtA6IFcwcrD6yxAw9uni2hOSs+ZR3DY8c6H5u3WkVm9L65sAAADS5zbD338zPC+Wobq//JPC2R8DXKZa6SOKjXD92c6rUCwDxLL14Zrb1iqig9uGMwzDuIPyjjlwEYVC6kyFq9taP8MyBSGjQqF0f9L1wLmDG6mW4YgXHSOzybz5kJWkYXD2qhaktxoAwEKiQzjDaL9QPJPKwZR4Wz1oZpPCzR0oail74m4Enxahc7i+OCy9GJ5ScmYREUUbOmGZwlpahdSZCitJtToLzPC2PW9VhB6yCjXmvNVzW+DNKqH7bs2DrfBGIma3aN33fVfgjUR0/eatingU+EMiHhVuFvFyUjkYnU+fDAXlvUeF68vpFXpdga/Pu/Gn8h8Gr4IF2ejgSgAAAABJRU5ErkJggg==">
{% if status[deploy.machine_id] == 'running' %} <button class="btn btn-default btn-info" onclick="window.open('/vmanager/vmvnc/{{ deploy.machine_id }}', '_blank');"><span class="glyphicon glyphicon-console" aria-hidden="true"></span> Console</button>
<button class="confirm command command-vmshutdown btn btn-default btn-warning" value="vmshutdown" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-off" aria-hidden="true"></span> Shutdown</button> {% else %}
<button class="confirm command command-vmstop btn btn-default btn-danger" value="vmstop" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> Force Stop</button> <button class="command command-vmstart btn btn-default btn-success" value="vmstart" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Start</button>
{% else %} {% endif %}
<button class="command command-vmstart btn btn-default btn-success" value="vmstart" vmid="{{ deploy.machine_id }}"><span class="glyphicon glyphicon-play" aria-hidden="true"></span> Start</button> {% endif %}
{% endif %}
{% if status[deploy.machine_id] == 'running' %}<button class="btn btn-default btn-info" onclick="window.open('/vmanager/vmvnc/{{ deploy.machine_id }}', '_blank');"><span class="glyphicon glyphicon-console" aria-hidden="true"></span> Console</button>{% endif %}
</p> </p>
<p> <p>
<img class="icon icons8-Time" width="32" height="32" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGLklEQVRYhd2W3VNTZx7Hc+FFL3rRy73Yi170sv9Bd2ZzsaPUrQVJECnaZtVKUXTa7jK12tq0YkMtkJwEkCiEABaV5UUEDmtXG4pCMOckJ68kIQ/E8CIvSQgEDIlJzncv3DhgCS/pzF7sd+Y3c87MOb/P5zzPM2d+AsEuc1DOWgtrLbOvVnYV8zRLpn9zt/12nYIa8xRNeLxaJTfcwSyZXvj/L5AjZ8YLarh4Qa15Q71fySz9T7YgS6YXShpcs3VsEqk6f3ceWTK9JL00W3ug0jC+/4rhD79b4F3ZyF6Rkls5c9OHomaCklYvJA0uZMlGTqWDf36LrFwfWU7myBmSscT+8pHsPKXpfi7FLn3S5AqXtk1ELt6dxLlOb/R0s2v1kIoLiZSsPbuSOS2U6l5LvXewipmtH1kGTXhkJHHkmuV9MWUcL7kxNp9qlK5azRF82ekN5SrYhQ/VtvP7rzwuEKssgQ+uWpF696s7vmi2gt10tX4TscIoP6FxhFvNEdCExy3rGi7T0zjTMooijQ05VQYUa+34uMEG6V3fS0iXM44v2r1rOXI2KR+KQjEcRZ7SlPzqji+ZXcWYhFLd69vCRZTx/rn2J6u9niR6PUl82jqGkiY77tv9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RRzYAmVfmg5+tC9AOTmLIHcSRWg7q4RB6PUlIrttmj9ePntgWnsqBK4Y/H62zLna74uj1JFHeP4WcKgO4J0sbgKmJKJWlyHOIFAzO3nCizRYFTXiUtnlXD1LGsh3DUznWYDt+uIZ7mmrUyITx6U9OlN50opudBTMRQrHGAotvGf3meZTd8aBIY0PVgwXQhH8xT2idU4V15sZdw1PZe3nobbHS6Cvrm4n0uBOgCY82WxTl/3qK73omUaR14JvuJ/ienn45eNCEh2owmDhcbZ7LqTRIMoanIpTq9mQrmM9EStP8+a4ny+tB66vNFkVZ/0z0cA3nF1NGjVCqe+N3w18V2SfT/0VMme6IKJbkV3PewlrLbH415xOrjOMiyjj43o+Gv+1o6l2X/wCiI4hGh4OMCwAAAABJRU5ErkJggg=="> <img class="icon icons8-Time" width="32" height="32" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAGLklEQVRYhd2W3VNTZx7Hc+FFL3rRy73Yi170sv9Bd2ZzsaPUrQVJECnaZtVKUXTa7jK12tq0YkMtkJwEkCiEABaV5UUEDmtXG4pCMOckJ68kIQ/E8CIvSQgEDIlJzncv3DhgCS/pzF7sd+Y3c87MOb/P5zzPM2d+AsEuc1DOWgtrLbOvVnYV8zRLpn9zt/12nYIa8xRNeLxaJTfcwSyZXvj/L5AjZ8YLarh4Qa15Q71fySz9T7YgS6YXShpcs3VsEqk6f3ceWTK9JL00W3ug0jC+/4rhD79b4F3ZyF6Rkls5c9OHomaCklYvJA0uZMlGTqWDf36LrFwfWU7myBmSscT+8pHsPKXpfi7FLn3S5AqXtk1ELt6dxLlOb/R0s2v1kIoLiZSsPbuSOS2U6l5LvXewipmtH1kGTXhkJHHkmuV9MWUcL7kxNp9qlK5azRF82ekN5SrYhQ/VtvP7rzwuEKssgQ+uWpF696s7vmi2gt10tX4TscIoP6FxhFvNEdCExy3rGi7T0zjTMooijQ05VQYUa+34uMEG6V3fS0iXM44v2r1rOXI2KR+KQjEcRZ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M44uZxwH5Uxg/aiWNvtkw2/lqUyz7fYYOhzPcey6FS2PpsFOhFDRRzYAmVfmg5+tC9AOTmLIHcSRWg7q4RB6PUlIrttmj9ePntgWnsqBK4Y/H62zLna74uj1JFHeP4WcKgO4J0sbgKmJKJWlyHOIFAzO3nCizRYFTXiUtnlXD1LGsh3DUznWYDt+uIZ7mmrUyITx6U9OlN50opudBTMRQrHGAotvGf3meZTd8aBIY0PVgwXQhH8xT2idU4V15sZdw1PZe3nobbHS6Cvrm4n0uBOgCY82WxTl/3qK73omUaR14JvuJ/ienn45eNCEh2owmDhcbZ7LqTRIMoanIpTq9mQrmM9EStP8+a4ny+tB66vNFkVZ/0z0cA3nF1NGjVCqe+N3w18V2SfT/0VMme6IKJbkV3PewlrLbH415xOrjOMiyjj43o+Gv+1o6l2X/wCiI4hGh4OMCwAAAABJRU5ErkJggg==">
{% if deploy.enabled == False %} {% if deploy.enabled == False %}
<button class="btn btn-default btn-success" onclick="window.open('/vmanager/activate/{{ deploy.machine_id }}','_self');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate</td> <button class="btn btn-default btn-success" onclick="window.open('/vmanager/activate/{{ deploy.machine_id }}','_self');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate</button></td>
{% else %} {% else %}
{% if deploy.warning == True %} {% if deploy.warning == True %}
<button class="btn btn-default btn-success" onclick="window.open('/vmanager/activate/{{ deploy.machine_id }}');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate ({{ deploy.daysleft }} days left)</button></td> <button class="btn btn-default btn-success" onclick="window.open('/vmanager/activate/{{ deploy.machine_id }}');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate ({{ deploy.daysleft }} days left)</button></td>
{% else %} {% else %}
<td data-title="Time Left">{{ deploy.daysleft }} day(s)</td> <td data-title="Time Left">{{ deploy.daysleft }} day(s)</td>
{% endif %} {% endif %}
{% endif %} {% endif %}
</p> </p>
</div> </div>
@ -207,7 +214,13 @@ addEventListener("DOMContentLoaded", function() {
</p> </p>
</div> </div>
<div id="properties{{ deploy.machine_id }}" class="tab-pane fade"> <div id="misc{{ deploy.machine_id }}" class="tab-pane fade">
<br />
<p>
ID: {{ deploy.machine_id }}<br />
State: {{ status[deploy.machine_id] }}<br />
Protected: {{ deploy.protected }}<br />
</p>
</div> </div>
</div> </div>

View file

@ -76,7 +76,7 @@ var myChart = new Chart(ctx, {
<tbody> <tbody>
{% for transaction in transactions %} {% for transaction in transactions %}
{% if transaction.value < 0 %} {% if transaction.value < 0 %}
<tr class="success"> <tr class="default">
<td>{{ moment(transaction.date_created).format('lll') }}</td> <td>{{ moment(transaction.date_created).format('lll') }}</td>
<td>{{ transaction.description }}</td> <td>{{ transaction.description }}</td>
<td>{{ transaction.value|abs }} {{ transaction.currency }}</td> <td>{{ transaction.value|abs }} {{ transaction.currency }}</td>

View file

@ -17,6 +17,6 @@ class CreateForm(FlaskForm):
submit = SubmitField('Create') submit = SubmitField('Create')
class ActivateForm(FlaskForm): class ActivateForm(FlaskForm):
period = SelectField('Deploy Period', choices=[(1, '1 Month'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int) period = SelectField('Deploy Period', choices=[(1, '1 Month'), (2, '2 Months'), (3, '3 Months'), (6, '6 Months'), (12, '1 Year'), (24, '2 Years')], coerce=int)
submit = SubmitField('Activate') submit = SubmitField('Activate')

View file

@ -151,14 +151,14 @@ def command(cmd=None, vmid=0):
inventory.extend([invcls.machine_id]) inventory.extend([invcls.machine_id])
if current_user.is_administrator(): if current_user.is_administrator():
current_app.logger.warning('[ADMIN] Access override for cube id:{}'.format(vmid)) #current_app.logger.warning('[ADMIN] Access override for cube id:{}'.format(vmid))
db_result = contact_proxmaster({}, cmd, vmid) db_result = contact_proxmaster({}, cmd, vmid)
if cmd == 'vmvnc': if cmd == 'vmvnc':
return redirect(db_result['url']) return redirect(db_result['url'])
else: else:
#checks if current user owns this vmid #checks if current user owns this vmid
if not vmid in inventory: if not vmid in inventory:
current_app.logger.error('[{}] Access violation with cube id: {}'.format(current_user.email, vmid)) current_app.logger.warning('[{}] Access violation with cube id: {}'.format(current_user.email, vmid))
#TODO: log ips #TODO: log ips
else: else:
db_result = contact_proxmaster({}, cmd, vmid) db_result = contact_proxmaster({}, cmd, vmid)