mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
55 lines
1.8 KiB
HTML
55 lines
1.8 KiB
HTML
{% extends '_base.html' %}
|
|
{% load helpers %}
|
|
|
|
{% block title %}Devices{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="pull-right">
|
|
{% if perms.dcim.add_device %}
|
|
<a href="{% url 'dcim:device_add' %}" class="btn btn-primary">
|
|
<span class="fa fa-plus" aria-hidden="true"></span>
|
|
Add a device
|
|
</a>
|
|
<a href="{% url 'dcim:device_import' %}" class="btn btn-info">
|
|
<span class="fa fa-download" aria-hidden="true"></span>
|
|
Import devices
|
|
</a>
|
|
{% endif %}
|
|
{% include 'inc/export_button.html' with obj_type='devices' %}
|
|
</div>
|
|
<h1>Devices</h1>
|
|
<div class="row">
|
|
<div class="col-md-9">
|
|
{% include 'dcim/inc/device_table.html' with bulk_edit_url='dcim:device_bulk_edit' bulk_delete_url='dcim:device_bulk_delete' %}
|
|
</div>
|
|
<div class="col-md-3">
|
|
{% include 'inc/search_panel.html' %}
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block javascript %}
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
var model_list = $('#id_device_type_id');
|
|
$('#id_manufacturer_id').change(function() {
|
|
model_list.empty();
|
|
var selected_manufacturers = $(this).val();
|
|
if (selected_manufacturers) {
|
|
var api_url = netbox_api_path + 'dcim/device-types/?manufacturer_id=' + selected_manufacturers.join('&manufacturer_id=');
|
|
$.ajax({
|
|
url: api_url,
|
|
dataType: 'json',
|
|
success: function (response, status) {
|
|
$.each(response, function (index, device_type) {
|
|
var option = $("<option></option>").attr("value", device_type.id).text(device_type["model"] + " (" + device_type["instance_count"] + ")");
|
|
model_list.append(option);
|
|
});
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|
|
</script>
|
|
{% endblock %}
|