proxadmin/app/templates/main/dashboard.html

312 lines
12 KiB
HTML
Raw Normal View History

2017-03-08 13:53:09 -05:00
{% extends "base.html" %}
2017-06-01 18:27:17 -04:00
{% block styles %}
{{ super() }}
<style type="text/css">
.tg {border-collapse:collapse;border-spacing:0;}
.tg td{font-family:Arial, sans-serif;font-size:14px;padding:1px 1px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg th{font-family:Arial, sans-serif;font-size:14px;padding:1px 1px;font-weight:normal;padding:border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
.tg .tg-yw4l{vertical-align:top}
2017-06-08 10:42:09 -04:00
@media only screen and (max-width: 768px) {
/* Force table to not be like tables anymore */
#no-more-tables table,
#no-more-tables thead,
#no-more-tables tbody,
#no-more-tables th,
#no-more-tables td,
#no-more-tables tr {
display: block;
}
/* Hide table headers (but not display: none;, for accessibility) */
#no-more-tables thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
#no-more-tables tr { border: 1px solid #ccc; }
#no-more-tables td {
/* Behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50%;
white-space: normal;
text-align:left;
}
#no-more-tables td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 6px;
left: 6px;
width: 45%;
padding-right: 10px;
white-space: nowrap;
text-align:left;
font-weight: bold;
}
/*
Label the data
*/
#no-more-tables td:before { content: attr(data-title); }
}
2017-06-01 18:27:17 -04:00
</style>
{% endblock %}
2017-05-25 01:54:33 -04:00
{% block scripts %}
{{ super() }}
<script type="text/javascript">
2017-06-01 18:27:17 -04:00
$('a[data-toggle="tooltip"]').tooltip({
animated: 'fade',
placement: 'bottom',
html: true
});
2017-05-25 01:54:33 -04:00
</script>
2017-06-07 11:04:27 -04:00
2017-03-08 13:53:09 -05:00
<script>
// Only run what comes next *after* the page has loaded
addEventListener("DOMContentLoaded", function() {
// Grab all of the elements with a class of command
// (which all of the buttons we just created have)
var commandButtons = document.querySelectorAll(".command");
for (var i=0, l=commandButtons.length; i<l; i++) {
var button = commandButtons[i];
// For each button, listen for the "click" event
button.addEventListener("click", function(e) {
// When a click happens, stop the button
// from submitting our form (if we have one)
2017-05-25 01:54:33 -04:00
e.preventDefault();
2017-03-08 13:53:09 -05:00
2017-05-25 01:54:33 -04:00
if (window.confirm("Are you sure?")) {
2017-03-08 13:53:09 -05:00
var clickedButton = e.target;
var command = clickedButton.value;
var vmid = clickedButton.getAttribute('vmid');
// Now we need to send the data to our server
// without reloading the page - this is the domain of
// AJAX (Asynchronous JavaScript And XML)
// We will create a new request object
// and set up a handler for the response
var request = new XMLHttpRequest();
request.onload = function() {
// We could do more interesting things with the response
// or, we could ignore it entirely
//alert(request.responseText);
};
// We point the request at the appropriate command
2017-05-24 10:37:52 -04:00
request.open("GET", "/vmanager/" + command + "/" + vmid, true);
2017-03-08 13:53:09 -05:00
// and then we send it off
request.send();
2017-06-06 09:49:32 -04:00
alert("command " + command + " executed.");
2017-06-04 10:10:38 -04:00
window.location.reload();
2017-05-25 01:54:33 -04:00
}
});
}
2017-03-08 13:53:09 -05:00
}, true);
</script>
2017-06-01 18:27:17 -04:00
{% endblock %}
2017-03-08 13:53:09 -05:00
2017-06-01 18:27:17 -04:00
{% block page_content %}
2017-06-13 19:24:39 -04:00
{% if current_user.fresh_user == True %}
<div class="row">
<center>
<img class="img-responsive img-rounded" src="{{ url_for('static', filename='images/createvm.gif') }}" alt="ping">
</center><br/>
</div>
{% endif %}
2017-03-08 13:53:09 -05:00
<div class="row">
2017-06-28 10:42:21 -04:00
{% if inv_deployments != [] %}
2017-06-01 18:27:17 -04:00
<div class="col-md-12">
2017-06-04 10:10:38 -04:00
<div class="panel panel-info" id="deployments">
2017-06-01 18:27:17 -04:00
<div class="panel-heading">Deployments</div>
2017-03-08 13:53:09 -05:00
<div class="panel-body"><p>
2017-06-08 10:42:09 -04:00
<div id="no-more-tables">
2017-06-01 18:27:17 -04:00
<table class="table table-hover table-striped table-condensed cf">
2017-06-28 10:42:21 -04:00
<thead>
<tr>
<th>Name</th>
<th>CPU</th>
<th>Mem</th>
<th>HDD</th>
<th>Network</th>
2017-06-28 10:42:21 -04:00
<th>Control</th>
<th>Time Left</th>
2017-06-28 10:42:21 -04:00
</tr>
</thead>
2017-06-01 18:27:17 -04:00
<tbody>
{% for deploy in inv_deployments %}
2017-06-28 10:42:21 -04:00
{% if deploy.enabled == False %}
<tr class="danger">
<td data-title="Name"><b>{% if status[deploy.machine_id] == 'running' %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></td>
<td data-title="CPU">{{ deploy.machine_cpu }} Cores</td>
<td data-title="Memory">{{ deploy.machine_mem }} MB</td>
<td data-title="Disk">{{ deploy.machine_hdd }} GB</td>
<td data-title="Network">{% for addr in deploy.machine_addresses %} {{ addr.ip }}<br /> {% endfor %}</td>
<td data-title="Control"> </td>
<td data-title="Time Left"><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</td>
2017-06-28 10:42:21 -04:00
{% else %}
{% if deploy.warning == True %}
<tr class="bg-warning">
{% else %}
2017-06-01 18:27:17 -04:00
<tr>
{% endif %}
2017-06-11 22:12:27 -04:00
<td data-title="Name"><a class="rrd" data-toggle="tooltip" title="ID# {{ deploy.machine_id }}<br />Deployment state: {{ status[deploy.machine_id] }}"><b>{% if status[deploy.machine_id] == 'running' %}<font color="green">{% else %}<font color="red">{% endif %}{{ deploy.machine_alias }}</font></b></a></td>
<td data-title="CPU"><a class="rrd" data-toggle="tooltip" title="<img src='data:image/png;base64,{{ rrd[deploy.machine_id]['cpu'] }}' />">{{ deploy.machine_cpu }} Cores</a></td>
<td data-title="Memory"><a class="rrd" data-toggle="tooltip" title="<img src='data:image/png;base64,{{ rrd[deploy.machine_id]['mem'] }}' />">{{ deploy.machine_mem }} MB</a></td>
<td data-title="Disk"><a class="rrd" data-toggle="tooltip" title="<img src='data:image/png;base64,{{ rrd[deploy.machine_id]['hdd'] }}' />">{{ deploy.machine_hdd }} GB</a></td>
<td data-title="Network">{% for addr in deploy.machine_addresses %}<a class="rrd" data-toggle="tooltip" title="<img src='data:image/png;base64,{{ rrd[deploy.machine_id]['net'] }}' />">{{ addr.ip }}</a><br />{% endfor %}</td>
2017-06-08 10:42:09 -04:00
<td data-title="Control">{% if status[deploy.machine_id] == 'running' %}
2017-06-01 18:27:17 -04:00
<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>
{% else %}
<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 %}</td>
2017-06-08 10:42:09 -04:00
<td data-title="Remote">{% if status[deploy.machine_id] == 'running' %}
2017-06-01 18:27:17 -04:00
<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>
{% if deploy.warning == True %}
<td data-title="Time Left"><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</button></td>
{% else %}
<td data-title="Time Left">{{ deploy.daysleft }} day(s)</td>
{% endif %}
2017-06-01 18:27:17 -04:00
{% endif %}</td>
</tr>
2017-06-28 10:42:21 -04:00
{% endif %}
2017-03-08 13:53:09 -05:00
{% endfor %}
2017-06-01 18:27:17 -04:00
</tbody>
</table>
2017-06-08 10:42:09 -04:00
</div>
<button class="btn btn-default" onclick="window.open('{{ url_for('main.dashboard') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Create</button>
2017-03-08 13:53:09 -05:00
</div>
</div>
</div>
2017-06-28 10:42:21 -04:00
{% endif %}
2017-03-08 13:53:09 -05:00
2017-06-28 10:42:21 -04:00
{% if inv_services != [] %}
2017-06-10 23:26:10 -04:00
<div class="col-md-12">
<div class="panel panel-info" id="services">
<div class="panel-heading">Services</div>
<div class="panel-body"><p>
<div id="no-more-tables">
<table class="table table-hover table-striped table-condensed cf">
<thead>
<tr>
<th>Category</th>
<th>Description</th>
<th>Last Charged</th>
<th>Time Left</th>
2017-06-10 23:26:10 -04:00
</tr>
<tbody>
{% for service in inv_services %}
{% if service.enabled == False %}
<tr class="danger">
{% else %}
<tr>
{% endif %}
2017-06-10 23:26:10 -04:00
<td data-title="Category">{{ service.category }}</td>
<td data-title="Description" >{{ service.description }}</td>
2017-06-11 22:12:27 -04:00
<td data-title="Last Charged">{{ moment(service.date_last_charge).format('lll') }} ({{ moment(service.date_last_charge).fromNow() }})</td>
2017-07-11 12:28:32 -04:00
{% if service.warning == True % or service.enabled == True}
<td data-title="Time Left"><button class="btn btn-default btn-success" onclick="window.open('/smanager/activate/{{ service.pid }}');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate</button></td>
{% else %}
<td data-title="Time Left">{{ service.daysleft }} day(s)</td>
{% endif %}
</tr >
2017-06-10 23:26:10 -04:00
{% endfor %}
</tbody>
</table>
</div>
<button class="btn btn-default" onclick="window.open('{{ url_for('main.dashboard') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Order</button>
2017-06-10 23:26:10 -04:00
</div>
</div>
</div>
2017-06-28 10:42:21 -04:00
{% endif %}
2017-06-10 23:26:10 -04:00
2017-06-28 10:42:21 -04:00
{% if inv_domains != [] %}
<div class="col-md-12">
2017-06-04 10:10:38 -04:00
<div class="panel panel-info" id="domains">
2017-03-08 13:53:09 -05:00
<div class="panel-heading">Domains</div>
<div class="panel-body"><p>
2017-06-08 10:42:09 -04:00
<div id="no-more-tables">
2017-06-04 10:10:38 -04:00
<table class="table table-hover table-striped table-condensed cf">
<thead>
<tr>
<th>Name</th>
<th>Expiry Date</th>
<th>Time Left</th>
2017-06-04 10:10:38 -04:00
</tr>
<tbody>
2017-03-08 13:53:09 -05:00
{% for domain in inv_domains %}
2017-06-04 10:10:38 -04:00
<tr>
2017-06-08 10:42:09 -04:00
<td data-title="Domain"><b><a href="http://{{ domain.fqdn }}">{{ domain.fqdn }}</a></b></td>
<td data-title="Expiry Date">{{ domain.date_expire }}</td>
2017-07-11 12:28:32 -04:00
{% if domain.enabled == True %}
{% if domain.warning == True %}
<td data-title="Time Left"><button class="btn btn-default btn-success" onclick="window.open('/dmanager/activate/{{ domain.pid }}');"><span class="glyphicon glyphicon-bell" aria-hidden="true"></span> Activate</button></td>
{% else %}
<td data-title="Time Left">{{ domain.daysleft }} day(s)</td>
{% endif %}
{% else %}
2017-07-11 12:28:32 -04:00
<td data-title="Time Left">EXPIRED</td>
{% endif %}
2017-06-04 10:10:38 -04:00
</tr>
2017-03-08 13:53:09 -05:00
{% endfor %}
2017-06-04 10:10:38 -04:00
</tbody>
</table>
2017-06-08 10:42:09 -04:00
</div>
<button class="btn btn-default" onclick="window.open('{{ url_for('main.dashboard') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Order</button>
2017-03-08 13:53:09 -05:00
</div>
</div>
</div>
2017-06-28 10:42:21 -04:00
{% endif %}
2017-03-08 13:53:09 -05:00
2017-06-28 10:42:21 -04:00
{% if inv_addresses != [] %}
<div class="col-md-12">
2017-06-04 10:10:38 -04:00
<div class="panel panel-info" id="addresses">
<div class="panel-heading">Addresses</div>
<div class="panel-body"><p>
2017-06-08 10:42:09 -04:00
<div id="no-more-tables">
2017-06-04 10:10:38 -04:00
<table class="table table-hover table-striped table-condensed cf">
<thead>
<tr>
<th>IP</th>
2017-06-28 10:42:21 -04:00
<th>Region</th>
2017-06-04 10:10:38 -04:00
<th>MAC Addr.</th>
2017-06-07 11:04:27 -04:00
<th>Reverse DNS</th>
2017-06-04 10:10:38 -04:00
</tr>
<tbody>
{% for address in inv_addresses %}
<tr>
2017-06-08 10:42:09 -04:00
<td data-title="IP">{{ address.ip }}</td>
2017-06-28 10:42:21 -04:00
<td data-title="Region">{{ region[address.region_id] }}</td>
2017-06-09 10:11:03 -04:00
<td data-title="MAC">{{ address.mac }}</td>
2017-06-08 10:42:09 -04:00
<td data-title="RDNS">{{ address.rdns }}</td>
2017-06-04 10:10:38 -04:00
{% endfor %}
</tr>
</tbody>
</table>
2017-06-08 10:42:09 -04:00
</div>
<!--<button class="btn btn-default" onclick="window.open('{{ url_for('main.dashboard') }}')"><span class="glyphicon glyphicon-plus" aria-hiddent="true"></span> Assign</button> -->
2017-06-04 10:10:38 -04:00
</div>
</div>
</div>
2017-06-28 10:42:21 -04:00
{% endif %}
2017-03-08 13:53:09 -05:00
</div>
2017-06-10 23:26:10 -04:00
<div class="row">
</div>
2017-03-08 13:53:09 -05:00
{% endblock %}