{% extends "base_okconfig.html" %}
{% block title %}Scan Network{% endblock %}
{% block smallheader %}scan{% endblock %}
{% block largeheader %}Network{% endblock %}
{% block nav2 %}<a href="{% url adagios.okconfig_.views.scan_network %}">Scan Network</a>{% endblock %}


{% block head %}
    <script type="text/javascript" src="/static/js/jquery.dataTables.min.js"></script>
{% endblock %}

{% block content %}

    <form action="#" method="post" class="form-horizontal">{% csrf_token %}
        {% include "bootstrap_fields.html" with fields=form %}
        <div class="form-actions">
            <button class="pull-right btn btn-success" type="submit">Scan Network</button>
        </div>
    </form>





<!-- display scan results -->

{% if scan_results %}

<h2>Scan results:</h2>
<table class="table" id="scan_results">
  <thead>
	<tr>
	 <th>Add</th>
	 <th>IP Address</th>
	 <th>Host Name</th>
	 <th>Is monitored</th>
	 <th>Operating System</th>
	 <th>Agent</th>
	 <th>Webserver</th>
	</tr>
  </thead>
  <tbody>
  {% for host in scan_results %}
	<tr>
	 {% if not host.ismonitored %}
	 <td><a href="{% url okconfig_.views.addhost %}?host_name={{ host.hostname }}&address={{ host.ipaddress }}">Add</a></td>
	 {% else %}
	 <td></td>
	 {% endif %}
	 <td>{{ host.ipaddress }}</td>
	 <td>{{ host.hostname }} </td>
	 <td>{{ host.ismonitored }}</td>
	 <td>{{ host.platform }}</td>
	 <td>{{ host.nrpe }}</td>
	 <td>{{ host.port80 }} </td>
	</tr>
  {% endfor %}
  </tbody>
</table>

{% endif %}
<script>
$('#scan_results').dataTable({
		"bSearch": false,
		"sScrollY": "200px",
		"bScrollCollapse": true,
		"bPaginate": false,
		"bJQueryUI": true
});
</script>



{% endblock %}
