mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
56 lines
1.8 KiB
HTML
56 lines
1.8 KiB
HTML
{% extends '_base.html' %}
|
|
|
|
{% block content %}
|
|
<div class="pull-right">
|
|
{% if perms.virtualization.add_virtualmachine %}
|
|
<a href="{% url 'virtualization:virtualmachine_add' %}" class="btn btn-primary">
|
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
|
Add a virtual machine
|
|
</a>
|
|
<a href="{% url 'virtualization:virtualmachine_import' %}" class="btn btn-info">
|
|
<span class="fa fa-download" aria-hidden="true"></span>
|
|
Import virtual machines
|
|
</a>
|
|
{% endif %}
|
|
{% include 'inc/export_button.html' with obj_type='virtual machines' %}
|
|
</div>
|
|
<h1>{% block title %}Virtual Machines{% endblock %}</h1>
|
|
<div class="row">
|
|
<div class="col-md-9">
|
|
{% include 'utilities/obj_table.html' %}
|
|
</div>
|
|
<div class="col-md-3">
|
|
{% include 'inc/search_panel.html' %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block javascript %}
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
|
|
var cluster_group_list = $('#id_cluster_group');
|
|
var cluster_list = $('#id_cluster_id');
|
|
|
|
// Update cluster options based on selected group
|
|
cluster_group_list.change(function() {
|
|
var selected_groups = $(this).val();
|
|
if (selected_groups) {
|
|
cluster_list.empty();
|
|
$.ajax({
|
|
url: netbox_api_path + 'virtualization/clusters/?limit=500&group=' + selected_groups.join('&group='),
|
|
dataType: 'json',
|
|
success: function (response, status) {
|
|
$.each(response["results"], function (index, cluster) {
|
|
var option = $("<option></option>").attr("value", cluster.id).text(cluster.name);
|
|
cluster_list.append(option);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
});
|
|
</script>
|
|
{% endblock %}
|