Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option for showing origin in machinetracker #1541

Merged
merged 3 commits into from
Aug 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions python/nav/web/machinetracker/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ class IpTrackerForm(MachineTrackerForm):
netbios = forms.BooleanField(required=False, initial=False,
help_text="Show netbios name (if any)")

source = forms.BooleanField(required=False, initial=False,
help_text="Show which router the data is retrieved from")

def clean_ip_range(self):
"""Clean the ip_range field"""
data = self.cleaned_data['ip_range']
Expand Down
3 changes: 3 additions & 0 deletions python/nav/web/machinetracker/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,11 +208,14 @@ def find_colspan(view, form):
colspan = defaults[view]
netbios = form.data.get('netbios', False)
dns = form.data.get('dns', False)
source = form.data.get('source', False)

if netbios:
colspan += 1
if dns:
colspan += 1
if source:
colspan += 1
return colspan


Expand Down
12 changes: 10 additions & 2 deletions templates/machinetracker/ip_search.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,21 +76,29 @@
<legend>Columns</legend>
<div class="row machinetracker-filter">

<div class="small-6 column">
<div class="small-4 column">
<label for="{{ form.netbios.auto_id }}"
title="{{ form.netbios.help_text }}">
{{ form.netbios }}
{{ form.netbios.label }}
</label>
</div>

<div class="small-6 column">
<div class="small-4 column">
<label for="{{ form.dns.auto_id }}" title="{{ form.dns.help_text }}">
{{ form.dns }}
{{ form.dns.label }}
</label>
</div>

<div class="small-4 column">
<label for="{{ form.source.auto_id }}"
title="{{ form.source.help_text }}">
{{ form.source }}
{{ form.source.label }}
</label>
</div>

</div>

</fieldset>
Expand Down
6 changes: 6 additions & 0 deletions templates/machinetracker/ip_tracker.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
<th>MAC</th>
<th>Start time</th>
<th>End time</th>
{% if form_data.source %}
<th>Source</th>
{% endif %}
</tr>
</thead>

Expand Down Expand Up @@ -64,6 +67,9 @@
{{ row.end_time|date:"Y-m-d H:i:s" }}
{% endif %}
</td>
{% if form_data.source %}
<td>{{row.sysname}}</td>
{% endif %}
</tr>
{% endfor %}
{% endfor %}
Expand Down