2017-08-01 07:21:22 -04:00
|
|
|
{% extends "base.html" %}
|
|
|
|
|
|
|
|
{% block styles %}
|
|
|
|
{{ super() }}
|
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
2017-09-20 20:08:58 -04:00
|
|
|
{% block scripts %}
|
|
|
|
{{ super() }}
|
|
|
|
<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)
|
|
|
|
e.preventDefault();
|
|
|
|
|
|
|
|
if (window.confirm("Are you sure?")) {
|
|
|
|
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
|
|
|
|
request.open("GET", "/vmanager/" + command + "/" + vmid, true);
|
|
|
|
// and then we send it off
|
|
|
|
request.send();
|
|
|
|
alert("command " + command + " executed.");
|
|
|
|
window.location.reload();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, true);
|
|
|
|
</script>
|
|
|
|
{% endblock %}
|
|
|
|
|
2017-08-01 07:21:22 -04:00
|
|
|
{% block page_content %}
|
|
|
|
<div class="row">
|
|
|
|
{% include "admin/admin_tasks.html" %}
|
|
|
|
|
|
|
|
<div class="col-md-12">
|
|
|
|
<div class="panel panel-info" id="deployments">
|
|
|
|
<div class="panel-heading">Deployments</div>
|
|
|
|
<div class="panel-body"><p>
|
|
|
|
<table class="table table-hover table-striped table-condensed cf">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Owner</th>
|
|
|
|
<th>Cube ID</th>
|
|
|
|
<th>Alias</th>
|
|
|
|
<th>CPU</th>
|
|
|
|
<th>Mem</th>
|
|
|
|
<th>HDD</th>
|
|
|
|
<th>Last Charged</th>
|
|
|
|
<th>Days Left</th>
|
2017-09-20 20:08:58 -04:00
|
|
|
<th></th>
|
2017-08-01 07:21:22 -04:00
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{% for deploy in deployments %}
|
|
|
|
{% if deploy.enabled == False %}
|
|
|
|
<tr class="danger">
|
|
|
|
{% else %}
|
|
|
|
{% if deploy.warning == True %}
|
|
|
|
<tr class="warning">
|
|
|
|
{% else %}
|
|
|
|
<tr>
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
<td><a href="{{ url_for('admin.dashboard', user_pid=deploy.user_id) }}">{{ deploy.owner.email }}</a></td>
|
|
|
|
<td>{{ deploy.machine_id }}</td>
|
|
|
|
<td>{{ deploy.machine_alias }}</font></td>
|
|
|
|
<td>{{ deploy.machine_cpu }}</td>
|
|
|
|
<td>{{ deploy.machine_mem }} MB</td>
|
|
|
|
<td>{{ deploy.machine_hdd }} GB</td>
|
|
|
|
<td>{{ moment(deploy.date_last_charge).format('lll') }} ({{ moment(deploy.date_last_charge).fromNow() }})</td>
|
|
|
|
<td>{{ deploy.daysleft }}</td>
|
2017-09-20 20:08:58 -04:00
|
|
|
<td><button class="btn btn-default btn-danger" onclick="window.open('/vmanager/vmremove/{{ deploy.machine_id }}');"><span class="glyphicon glyphicon-remove" aria-hidden="true"></span> Delete</button></td>
|
2017-08-01 07:21:22 -04:00
|
|
|
{% endfor %}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="row">
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|