-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #5425: Create separate tabs for VMs and devices under the clus…
…ter view
- Loading branch information
1 parent
8fa37d3
commit b070be1
Showing
9 changed files
with
213 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,81 @@ | ||
{% extends 'generic/object.html' %} | ||
{% load buttons %} | ||
{% load custom_links %} | ||
{% extends 'virtualization/cluster/base.html' %} | ||
{% load helpers %} | ||
{% load plugins %} | ||
|
||
{% block breadcrumbs %} | ||
<li><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></li> | ||
{% if object.group %} | ||
<li><a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a></li> | ||
{% endif %} | ||
<li>{{ object }}</li> | ||
{% endblock %} | ||
|
||
{% block content %} | ||
<div class="row"> | ||
<div class="col-md-5"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Cluster</strong> | ||
</div> | ||
<table class="table table-hover panel-body attr-table"> | ||
<tr> | ||
<td>Name</td> | ||
<td>{{ object.name }}</td> | ||
</tr> | ||
<tr> | ||
<td>Type</td> | ||
<td><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></td> | ||
</tr> | ||
<tr> | ||
<td>Group</td> | ||
<td> | ||
{% if object.group %} | ||
<a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Tenant</td> | ||
<td> | ||
{% if object.tenant %} | ||
<a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Site</td> | ||
<td> | ||
{% if object.site %} | ||
<a href="{{ object.site.get_absolute_url }}">{{ object.site }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Virtual Machines</td> | ||
<td><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ object.pk }}">{{ object.virtual_machines.count }}</a></td> | ||
</tr> | ||
</table> | ||
</div> | ||
{% include 'inc/custom_fields_panel.html' %} | ||
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:cluster_list' %} | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Comments</strong> | ||
</div> | ||
<div class="panel-body rendered-markdown"> | ||
{% if object.comments %} | ||
{{ object.comments|render_markdown }} | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% plugin_left_page object %} | ||
</div> | ||
<div class="col-md-7"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Host Devices</strong> | ||
</div> | ||
{% if perms.virtualization.change_cluster %} | ||
<form action="{% url 'virtualization:cluster_remove_devices' pk=object.pk %}" method="post"> | ||
{% csrf_token %} | ||
<div class="col-md-6"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Cluster</strong> | ||
</div> | ||
<table class="table table-hover panel-body attr-table"> | ||
<tr> | ||
<td>Name</td> | ||
<td>{{ object.name }}</td> | ||
</tr> | ||
<tr> | ||
<td>Type</td> | ||
<td><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></td> | ||
</tr> | ||
<tr> | ||
<td>Group</td> | ||
<td> | ||
{% if object.group %} | ||
<a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Tenant</td> | ||
<td> | ||
{% if object.tenant %} | ||
<a href="{{ object.tenant.get_absolute_url }}">{{ object.tenant }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
{% include 'responsive_table.html' with table=device_table %} | ||
{% if perms.virtualization.change_cluster %} | ||
<div class="panel-footer noprint"> | ||
<div class="pull-right"> | ||
<a href="{% url 'virtualization:cluster_add_devices' pk=object.pk %}?site={{ object.site.pk }}" class="btn btn-primary btn-xs"> | ||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> | ||
Add devices | ||
</a> | ||
</div> | ||
<button type="submit" name="_remove" class="btn btn-danger primary btn-xs"> | ||
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> | ||
Remove devices | ||
</button> | ||
</div> | ||
</form> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Site</td> | ||
<td> | ||
{% if object.site %} | ||
<a href="{{ object.site.get_absolute_url }}">{{ object.site }}</a> | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</div> | ||
{% plugin_right_page object %} | ||
</div> | ||
</td> | ||
</tr> | ||
<tr> | ||
<td>Virtual Machines</td> | ||
<td><a href="{% url 'virtualization:virtualmachine_list' %}?cluster_id={{ object.pk }}">{{ object.virtual_machines.count }}</a></td> | ||
</tr> | ||
</table> | ||
</div> | ||
{% include 'inc/custom_fields_panel.html' %} | ||
</div> | ||
<div class="col-md-6"> | ||
{% include 'extras/inc/tags_panel.html' with tags=object.tags.all url='virtualization:cluster_list' %} | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Comments</strong> | ||
</div> | ||
<div class="panel-body rendered-markdown"> | ||
{% if object.comments %} | ||
{{ object.comments|render_markdown }} | ||
{% else %} | ||
<span class="text-muted">None</span> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% plugin_left_page object %} | ||
</div> | ||
</div> | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
{% plugin_full_width_page object %} | ||
</div> | ||
<div class="col-md-12"> | ||
{% plugin_full_width_page object %} | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
{% extends 'generic/object.html' %} | ||
{% load buttons %} | ||
{% load helpers %} | ||
{% load custom_links %} | ||
{% load plugins %} | ||
|
||
{% block breadcrumbs %} | ||
<li><a href="{{ object.type.get_absolute_url }}">{{ object.type }}</a></li> | ||
{% if object.group %} | ||
<li><a href="{{ object.group.get_absolute_url }}">{{ object.group }}</a></li> | ||
{% endif %} | ||
<li>{{ object }}</li> | ||
{% endblock %} | ||
|
||
{% block buttons %} | ||
{% if perms.virtualization.change_cluster and perms.virtualization.add_virtualmachine %} | ||
<a href="{% url 'virtualization:virtualmachine_add' %}?cluster={{ object.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary"> | ||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Add Virtual Machine | ||
</a> | ||
{% endif %} | ||
{% if perms.virtualization.change_cluster %} | ||
<a href="{% url 'virtualization:cluster_add_devices' pk=object.pk %}?site={{ object.site.pk }}&return_url={{ object.get_absolute_url }}" class="btn btn-primary"> | ||
<span class="mdi mdi-plus-thick" aria-hidden="true"></span> Assign Device | ||
</a> | ||
{% endif %} | ||
{{ block.super }} | ||
{% endblock %} | ||
|
||
{% block tabs %} | ||
<ul class="nav nav-tabs"> | ||
<li role="presentation"{% if not active_tab %} class="active"{% endif %}> | ||
<a href="{{ object.get_absolute_url }}">Cluster</a> | ||
</li> | ||
{% with virtualmachine_count=object.virtual_machines.count %} | ||
<li role="presentation" {% if active_tab == 'virtual-machines' %} class="active"{% endif %}> | ||
<a href="{% url 'virtualization:cluster_virtualmachines' pk=object.pk %}">Virtual Machines {% badge virtualmachine_count %}</a> | ||
</li> | ||
{% endwith %} | ||
{% with device_count=object.devices.count %} | ||
<li role="presentation" {% if active_tab == 'devices' %} class="active"{% endif %}> | ||
<a href="{% url 'virtualization:cluster_devices' pk=object.pk %}">Devices {% badge device_count %}</a> | ||
</li> | ||
{% endwith %} | ||
{% if perms.extras.view_journalentry %} | ||
<li role="presentation"{% if active_tab == 'journal' %} class="active"{% endif %}> | ||
<a href="{% url 'virtualization:cluster_journal' pk=object.pk %}">Journal</a> | ||
</li> | ||
{% endif %} | ||
{% if perms.extras.view_objectchange %} | ||
<li role="presentation"{% if active_tab == 'changelog' %} class="active"{% endif %}> | ||
<a href="{% url 'virtualization:cluster_changelog' pk=object.pk %}">Change Log</a> | ||
</li> | ||
{% endif %} | ||
</ul> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{% extends 'virtualization/cluster/base.html' %} | ||
{% load helpers %} | ||
|
||
{% block content %} | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Host Devices</strong> | ||
</div> | ||
<form action="{% url 'virtualization:cluster_remove_devices' pk=object.pk %}" method="post"> | ||
{% csrf_token %} | ||
{% include 'responsive_table.html' with table=devices_table %} | ||
{% if perms.virtualization.change_cluster %} | ||
<div class="panel-footer noprint"> | ||
<button type="submit" name="_remove" class="btn btn-danger primary btn-xs"> | ||
<span class="mdi mdi-trash-can-outline" aria-hidden="true"></span> Remove devices | ||
</button> | ||
</div> | ||
{% endif %} | ||
</form> | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
15 changes: 15 additions & 0 deletions
15
netbox/templates/virtualization/cluster/virtual_machines.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'virtualization/cluster/base.html' %} | ||
{% load helpers %} | ||
|
||
{% block content %} | ||
<div class="row"> | ||
<div class="col-md-12"> | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<strong>Virtual Machines</strong> | ||
</div> | ||
{% include 'responsive_table.html' with table=virtualmachines_table %} | ||
</div> | ||
</div> | ||
</div> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters