|
@@ -327,19 +327,7 @@
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
-
|
|
|
|
-<div class="modal fade" id="graphs_modal" tabindex="-1" role="dialog">
|
|
|
|
- <div class="modal-dialog modal-lg" role="document">
|
|
|
|
- <div class="modal-content">
|
|
|
|
- <div class="modal-header">
|
|
|
|
- <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
|
|
|
- <h4 class="modal-title" id="graphs_modal_title">Modal title</h4>
|
|
|
|
- </div>
|
|
|
|
- <div class="modal-body"></div>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
-</div>
|
|
|
|
-
|
|
|
|
|
|
+{% include 'inc/graphs_modal.html' %}
|
|
{% include 'secrets/inc/private_key_modal.html' %}
|
|
{% include 'secrets/inc/private_key_modal.html' %}
|
|
{% endblock %}
|
|
{% endblock %}
|
|
|
|
|
|
@@ -396,32 +384,7 @@ $(".powerport-toggle").click(function() {
|
|
$(".interface-toggle").click(function() {
|
|
$(".interface-toggle").click(function() {
|
|
return toggleConnection($(this), "/api/dcim/interface-connections/");
|
|
return toggleConnection($(this), "/api/dcim/interface-connections/");
|
|
});
|
|
});
|
|
-$('#graphs_modal').on('show.bs.modal', function (event) {
|
|
|
|
- var button = $(event.relatedTarget);
|
|
|
|
- var iface = button.data('interface');
|
|
|
|
- var iface_id = button.data('id');
|
|
|
|
- var modal_title = $(this).find('.modal-title');
|
|
|
|
- var modal_body = $(this).find('.modal-body');
|
|
|
|
- modal_title.text('{{ device.name }} - ' + iface);
|
|
|
|
- modal_body.empty();
|
|
|
|
- $.ajax({
|
|
|
|
- url: "/api/dcim/interfaces/" + iface_id + "/graphs/",
|
|
|
|
- dataType: 'json',
|
|
|
|
- success: function(json) {
|
|
|
|
- $.each(json, function(i, graph) {
|
|
|
|
- // Build in a 500ms delay per graph to avoid hammering the server
|
|
|
|
- setTimeout(function() {
|
|
|
|
- modal_body.append('<h4 class="text-center">' + graph.name + '</h4>');
|
|
|
|
- if (graph.link) {
|
|
|
|
- modal_body.append('<a href="' + graph.link + '"><img src="' + graph.embed_url + '" /></a>');
|
|
|
|
- } else {
|
|
|
|
- modal_body.append('<img src="' + graph.embed_url + '" />');
|
|
|
|
- }
|
|
|
|
- }, i*500);
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-});
|
|
|
|
</script>
|
|
</script>
|
|
|
|
+<script src="{% static 'js/graphs.js' %}"></script>
|
|
<script src="{% static 'js/secrets.js' %}"></script>
|
|
<script src="{% static 'js/secrets.js' %}"></script>
|
|
{% endblock %}
|
|
{% endblock %}
|