mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Circuits Select2 forms
This commit is contained in:
@@ -20,32 +20,3 @@
|
||||
</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 %}
|
||||
|
Reference in New Issue
Block a user