watchyourlan/internal/web/templates/index.html
Adam Davidson 564ac35aa3 Adjusted HTML files to make them responsive (issue #51)
HTML adjusted to make them responsive and better sized when viewed on a mobile device. There should be no change when viewing these on tablets large screens.

Changes include:
- Making containers 100% wide on screens below the Bootstrap "lg" breakpoint. This removes the left and right outer margins, making the most of available space on small screens.
- Making the navigation menu collapse on small screens, to be replaced by a "hamburger" icon that then expands to show the menu when clicked.
- Making all tables responsive so that they can be horizontally scrolled on small screens.
- Table items now centrally align vertically on the table rows (using the "align-middle" class").
2024-01-03 17:22:28 +00:00

78 lines
3 KiB
HTML

{{ define "index"}}
<!--Auto refresh (seconds)-->
<meta http-equiv="refresh" content="{{ .Config.Timeout }}">
</head>
<body>
<div class="container-lg mt-3">
<div class="row">
<div class="col">
<h2>Online</h2>
<p>Scanning interfaces: {{ .Config.Iface }}</p>
<div class="table-responsive">
<table class="table table-striped">
<tr>
<th>Name</th>
<th>IP</th>
<th>Mac</th>
<th>Hardware</th>
<th>Known</th>
</tr>
{{ range .Hosts }}
{{ if eq .Now 1 }}
<tr>
<td class="align-middle">{{ .Name }}</td>
<td class="align-middle"><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
<td class="align-middle"><a href="/host?id={{ .ID }}">{{ .Mac }}</a></td>
<td class="align-middle">{{ .Hw }}</td>
<td class="align-middle">
{{ if eq .Known 1 }}
<button type="button" class="btn btn-success" disabled>Yes</button>
{{ else }}
<button type="button" class="btn btn-warning" disabled>No</button>
{{ end }}
</td>
</tr>
{{ end }}
{{ end }}
</table>
</div>
<h2>Log</h2>
<div class="table-responsive">
<table class="table table-striped">
<tr>
<th>Name</th>
<th>IP</th>
<th>Mac</th>
<th>Hardware</th>
<th>Last seen</th>
<th>Known</th>
</tr>
{{ range .Hosts }}
<form action="/update_host/" method="post">
<input name="id" type="hidden" class="form-control" value="{{ .ID }}">
<tr>
<td class="align-middle">
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
</td>
<td class="align-middle"><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
<td class="align-middle"><a href="/host?id={{ .ID }}">{{ .Mac }}</a></td>
<td class="align-middle">{{ .Hw }}</td>
<td class="align-middle">{{ .Date }}</td>
<td class="align-middle">
{{ if eq .Known 1 }}
<button value="off" name="known" type="submit" class="btn btn-success">Yes</button>
{{ else }}
<button value="on" name="known" type="submit" class="btn btn-warning">No</button>
{{ end }}
</td>
</tr>
</form>
{{ end }}
</table>
</div>
</div>
</div>
</div>
{{ template "footer" }}
{{ end }}