mirror of
https://github.com/retspen/webvirtcloud
synced 2024-12-24 23:25:24 +00:00
Namespaced instances urls
This commit is contained in:
parent
636b5bb1bc
commit
7eee811e65
9 changed files with 18 additions and 15 deletions
|
@ -42,7 +42,7 @@
|
|||
{% for inst in user_insts %}
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td><a href="{% url 'instance' inst.instance.compute.id inst.instance.name %}">{{ inst.instance.name }}</a></td>
|
||||
<td><a href="{% url 'instances:instance' inst.instance.compute.id inst.instance.name %}">{{ inst.instance.name }}</a></td>
|
||||
<td>{{ inst.is_vnc }}</td>
|
||||
<td>{{ inst.is_change }}</td>
|
||||
<td>{{ inst.is_delete }}</td>
|
||||
|
|
|
@ -63,7 +63,7 @@
|
|||
<tbody class="searchable">
|
||||
{% for inst, vm in all_user_vms.items %}
|
||||
<tr>
|
||||
<td><a href="{% url 'instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
||||
<td><a href="{% url 'instances:instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
||||
<td>{% if vm.status == 1 %}
|
||||
<span class="text-success">{% trans "Active" %}</span>
|
||||
{% endif %}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
<tr host="{{ host.1 }}">
|
||||
<td class="text-right">{{ forloop.counter }} </td>
|
||||
<td> 
|
||||
<a class="text-secondary" href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br>
|
||||
<a class="text-secondary" href="{% url 'instances:instance' host.0 inst %}">{{ inst }}</a><br>
|
||||
<small><em>{{ vm.title }}</em></small>
|
||||
</td>
|
||||
<td class="d-none d-sm-table-cell">
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
{% for host, inst in all_host_vms.items %}
|
||||
{% for inst, vm in inst.items %}
|
||||
<tr>
|
||||
<td><a href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ info.title }}</em></small></td>
|
||||
<td><a href="{% url 'instances:instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ info.title }}</em></small></td>
|
||||
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a><br><small><em>{% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
|
||||
<td>
|
||||
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<a class="nav-link" href="{% url 'instances' compute.id %}"><i class="fa fa-desktop"></i> {% trans "Instances" %}</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="{% url 'instance' compute.id vname %}"><i class="fa fa-hdd-o"></i> {{ vname }}</a>
|
||||
<a class="nav-link" href="{% url 'instances:instance' compute.id vname %}"><i class="fa fa-hdd-o"></i> {{ vname }}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
|
@ -52,7 +52,7 @@
|
|||
{{ ipv4 }} |
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
<a class="text-secondary" href="{% url 'instance' compute.id vname %}" title="{% trans 'Refresh instance info' %}"><span class="fa fa-refresh"></span></a>
|
||||
<a class="text-secondary" href="{% url 'instances:instance' compute.id vname %}" title="{% trans 'Refresh instance info' %}"><span class="fa fa-refresh"></span></a>
|
||||
</div>
|
||||
{% if user_quota_msg %}
|
||||
<div class="alert alert-warning fade show">
|
||||
|
@ -1749,7 +1749,7 @@
|
|||
</script>
|
||||
<script>
|
||||
function random_mac(net) {
|
||||
$.getJSON('{% url 'random_mac_address' %}', function (data) {
|
||||
$.getJSON('{% url 'instances:random_mac_address' %}', function (data) {
|
||||
$('input[name="' + net + '"]').val(data['mac']);
|
||||
});
|
||||
}
|
||||
|
@ -1766,7 +1766,7 @@
|
|||
<script>
|
||||
function guess_mac_address(src_elem, net) {
|
||||
new_vname = $(src_elem).val();
|
||||
guess_mac_address_url = "{% url 'guess_mac_address' 1 %}".replace(1, new_vname);
|
||||
guess_mac_address_url = "{% url 'instances:guess_mac_address' 1 %}".replace(1, new_vname);
|
||||
$.getJSON(guess_mac_address_url, function(data) {
|
||||
$('input[name="clone-net-mac-'+net+'"]').val(data['mac']);
|
||||
});
|
||||
|
@ -1774,7 +1774,7 @@
|
|||
</script>
|
||||
<script>
|
||||
function guess_clone_name() {
|
||||
$.getJSON('{% url 'guess_clone_name' %}', function(data) {
|
||||
$.getJSON('{% url 'instances:guess_clone_name' %}', function(data) {
|
||||
guessed_name = data['name'].split(".")[0];
|
||||
$('#clone_name').val(guessed_name);
|
||||
update_clone_disk_name(guessed_name);
|
||||
|
@ -2181,7 +2181,7 @@
|
|||
{% endfor %}
|
||||
|
||||
var graph_interval = window.setInterval(function graph_usage() {
|
||||
$.getJSON('{% url 'inst_graph' compute_id vname %}', function (data) {
|
||||
$.getJSON('{% url 'instances:inst_graph' compute_id vname %}', function (data) {
|
||||
|
||||
cpuChart.data.labels.push(data.timeline);
|
||||
cpuChart.data.datasets[0].data.push(data.cpudata);
|
||||
|
@ -2234,7 +2234,7 @@
|
|||
backgroundJobRunning = false;
|
||||
var status_interval = window.setInterval(function get_status() {
|
||||
var status = {{ status|lower }};
|
||||
$.getJSON('{% url 'inst_status' compute_id vname %}', function (data) {
|
||||
$.getJSON('{% url 'instances:inst_status' compute_id vname %}', function (data) {
|
||||
if (data['status'] != status && !backgroundJobRunning) {
|
||||
window.location.reload()
|
||||
}
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
{% for host, insts in all_host_vms.items %}
|
||||
{% for inst, vm in insts.items %}
|
||||
<tr>
|
||||
<td><a class="text-secondary" href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
||||
<td><a class="text-secondary" href="{% url 'instances:instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ vm.title }}</em></small></td>
|
||||
<td class="d-none d-md-table-cell"><small><em>{% if vm.userinstances.count > 0 %}{{ vm.userinstances.first_user.user.username }}{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
|
||||
<td>
|
||||
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
app_name = 'instances'
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.allinstances, name='allinstances'),
|
||||
path('<int:compute_id>/<vname>/', views.instance, name='instance'),
|
||||
path('', views.allinstances, name='index'),
|
||||
path('<int:compute_id>/<vname>/', views.instance, name='instance'),
|
||||
path('statistics/<int:compute_id>/<vname>/', views.inst_graph, name='inst_graph'),
|
||||
path('status/<int:compute_id>/<vname>/', views.inst_status, name='inst_status'),
|
||||
path('guess_mac_address/<vname>/', views.guess_mac_address, name='guess_mac_address'),
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div id="navbar" class="navbar-collapse collapse">
|
||||
<ul class="navbar-nav mr-auto mt-2 mt-md-0">
|
||||
<li class="nav-item {% class_active request '^/instances' %}">
|
||||
<a class="nav-link" href="{% url 'allinstances' %}"><i class="fa fa-fw fa-desktop"></i> {% trans "Instances" %}</a>
|
||||
<a class="nav-link" href="{% url 'instances:index' %}"><i class="fa fa-fw fa-desktop"></i> {% trans "Instances" %}</a>
|
||||
</li>
|
||||
{% if request.user.is_superuser %}
|
||||
<li class="nav-item {% class_active request '^/computes' %}">
|
||||
|
|
Loading…
Reference in a new issue