-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 32-import-device-export-file-from-matrix
- Loading branch information
Showing
9 changed files
with
160 additions
and
76 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
const search_form = $("#search_form") | ||
const results_div = $('#results') | ||
const endpoint = '/devices/' | ||
const delay_by_in_ms = 700 | ||
let scheduled_function = false | ||
|
||
let ajax_call = function (endpoint, request_parameters) { | ||
$.getJSON(endpoint, request_parameters) | ||
.done(response => { | ||
// replace the HTML contents | ||
results_div.html(response['html']) | ||
}) | ||
} | ||
|
||
search_form.on('input', function () { | ||
|
||
const request_parameters = { | ||
search_string: $('#id_search_string').val(), | ||
device_role_prod: $('#id_device_role_prod').val(), | ||
authorization_group: $('#id_authorization_group').val() | ||
} | ||
|
||
// if scheduled_function is NOT false, cancel the execution of the function | ||
if (scheduled_function) { | ||
clearTimeout(scheduled_function) | ||
} | ||
|
||
// setTimeout returns the ID of the function to be executed | ||
scheduled_function = setTimeout(ajax_call, delay_by_in_ms, endpoint, request_parameters); | ||
}) |
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 |
---|---|---|
|
@@ -15,7 +15,10 @@ | |
<link rel="icon" href="{% static 'icons/favicon.svg' %}" sizes="any" type="image/svg+xml"> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous"></script> | ||
|
||
|
||
<!-- JQuery --> | ||
<script src="https://code.jquery.com/jquery-3.7.1.js" integrity="sha256-eKhayi8LEQwp4NKxN+CfCh+3qOVUtJn3QNZ0TciWLP4=" crossorigin="anonymous"></script> | ||
|
||
|
||
{% block head %}{% 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{% load static %} | ||
|
||
<table class="table table-striped"> | ||
<thead> | ||
<tr> | ||
<th scope="col">Name</th> | ||
<th scope="col">Status</th> | ||
<th scope="col">FQDN</th> | ||
<th scope="col">Device Role Prod</th> | ||
<th scope="col">MAC</th> | ||
<th scope="col" width="60"></th> | ||
</tr> | ||
</thead> | ||
|
||
{% for device in device_list %} | ||
<tr> | ||
<td> | ||
<a href="{% url 'device_detail' device.pk %}">{{ device.name }}</a> | ||
</td> | ||
<td> | ||
{% if device.appl_NAC_Active %} | ||
<span class="icon-desc" desc="Active Device"><img src="{% static 'icons/check-lg.svg' %}" alt="appl_NAC_Active_True" height="25" width="25" class="icon-zoom" /></span> | ||
{% else %} | ||
<span class="icon-desc" desc="Inactive Device"><img src="{% static 'icons/x-lg.svg' %}" alt="appl_NAC_Active_False" height="25" width="25" class="icon-zoom" /></span> | ||
{% endif %} | ||
{% if device.appl_NAC_Install %} | ||
<span class="icon-desc" desc="Install"><img src="{% static 'icons/wrench.svg' %}" alt="appl_NAC_Install" height="25" width="25" class="icon-zoom"/></span> | ||
{% endif %} | ||
</td> | ||
<td> | ||
{{ device.appl_NAC_FQDN }} | ||
</td> | ||
<td> | ||
{{ device.appl_NAC_DeviceRoleProd }} | ||
</td> | ||
<td> | ||
{% for mac in device.get_appl_NAC_macAddressAIR %} | ||
<b> | ||
{% if mac != None %} | ||
<span class="icon-desc" desc="macAddressAIR"><img src="{% static 'icons/wifi.svg' %}" alt="appl_NAC_macAddressAIR" height="14" width="14" class="icon-zoom"/></span> | ||
<b> {{mac}}</b> <br /> | ||
{% endif %} | ||
</b> | ||
{% endfor %} | ||
{% for mac in device.get_appl_NAC_macAddressCAB %} | ||
<b> | ||
{% if mac != None %} | ||
<span class="icon-desc" desc="macAddressCAB"><img src="{% static 'icons/ethernet.svg' %}" alt="appl_NAC_macAddressCAB" height="14" width="14" class="icon-zoom"/></span> | ||
<b> {{mac}}</b> <br /> | ||
{% endif %} | ||
</b> | ||
{% endfor %} | ||
</td> | ||
<td> | ||
<a href="{% url 'device_edit' device.pk %}"> | ||
<span class="icon-desc" desc="edit"><img src="{% static 'icons/pencil-square.svg' %}" alt="edit" height="16" width="16" class="icon-zoom"/></span> | ||
|
||
</a> | ||
<a href="{% url 'device_delete' device.pk %}"> | ||
<span class="icon-desc" desc="delete"><img src="{% static 'icons/trash.svg' %}" alt="delete" height="16" width="16" class="icon-zoom"/></span> | ||
</a> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</table> | ||
</div> |
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