watchyourlan/internal/web/templates/index.html
2023-01-03 18:16:59 +07:00

70 lines
No EOL
2.6 KiB
HTML

{{ define "index"}}
<!--Auto refresh (seconds)-->
<meta http-equiv="refresh" content="{{ .Config.Timeout }}">
</head>
<body>
<div class="container mt-3">
<h2>Online</h2>
<p>Scanning interfaces: {{ .Config.Iface }}</p>
<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>{{ .Name }}</td>
<td><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
<td><a href="/host?id={{ .ID }}">{{ .Mac }}</a></td>
<td>{{ .Hw }}</td>
<td>
{{ 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>
<h2>Log</h2>
<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>
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
</td>
<td><a href="http://{{ .IP }}" target="_blank">{{ .IP }}</a></td>
<td><a href="/host?id={{ .ID }}">{{ .Mac }}</a></td>
<td>{{ .Hw }}</td>
<td>{{ .Date }}</td>
<td>
{{ 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>
{{ template "footer" }}
{{ end }}