feature/21 :: Added ordered row numbers to tables
This commit is contained in:
parent
0c49949a5d
commit
a5e37cde98
3 changed files with 113 additions and 94 deletions
|
|
@ -11,6 +11,19 @@
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.9.1/font/bootstrap-icons.css">
|
||||||
<!-- JavaScript Bundle with Popper -->
|
<!-- JavaScript Bundle with Popper -->
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
|
||||||
|
<style>
|
||||||
|
table {
|
||||||
|
counter-reset: rowNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
table td.row-index::before {
|
||||||
|
display: table-cell;
|
||||||
|
counter-increment: rowNumber;
|
||||||
|
content: counter(rowNumber) ".";
|
||||||
|
padding-right: 0.3em;
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
|
<nav class="navbar navbar-expand-sm navbar-dark bg-primary">
|
||||||
|
|
|
||||||
|
|
@ -1,74 +1,79 @@
|
||||||
{{ define "index"}}
|
{{ define "index"}}
|
||||||
|
|
||||||
{{ template "header" }}
|
{{ template "header" }}
|
||||||
<!--Auto refresh (seconds)-->
|
<!--Auto refresh (seconds)-->
|
||||||
<meta http-equiv="refresh" content="{{ .Config.Timeout }}">
|
<meta http-equiv="refresh" content="{{ .Config.Timeout }}">
|
||||||
<!--Bootstrap theme-->
|
<!--Bootstrap theme-->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container mt-3">
|
<div class="container mt-3">
|
||||||
<h2>Online</h2>
|
<h2>Online</h2>
|
||||||
<p>Scanning interfaces: {{ .Config.Iface }}</p>
|
<p>Scanning interfaces: {{ .Config.Iface }}</p>
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Name</th>
|
<th>#</th>
|
||||||
<th>Ip</th>
|
<th>Name</th>
|
||||||
<th>Mac</th>
|
<th>Ip</th>
|
||||||
<th>Hardware</th>
|
<th>Mac</th>
|
||||||
<th>Known</th>
|
<th>Hardware</th>
|
||||||
</tr>
|
<th>Known</th>
|
||||||
{{ range .Hosts }}
|
</tr>
|
||||||
{{ if eq .Now 1 }}
|
{{ range .Hosts }}
|
||||||
<tr>
|
{{ if eq .Now 1 }}
|
||||||
<td>{{ .Name }}</td>
|
<tr>
|
||||||
<td><a href="http://{{ .Ip }}" target="_blank">{{ .Ip }}</a></td>
|
<td class="row-index"></td>
|
||||||
<td>{{ .Mac }}</td>
|
<td>{{ .Name }}</td>
|
||||||
<td>{{ .Hw }}</td>
|
<td><a href="http://{{ .Ip }}" target="_blank">{{ .Ip }}</a></td>
|
||||||
<td>
|
<td>{{ .Mac }}</td>
|
||||||
{{ if eq .Known 1 }}
|
<td>{{ .Hw }}</td>
|
||||||
<button type="button" class="btn btn-success" disabled>Yes</button>
|
<td>
|
||||||
{{ else }}
|
{{ if eq .Known 1 }}
|
||||||
<button type="button" class="btn btn-warning" disabled>No</button>
|
<button type="button" class="btn btn-success" disabled>Yes</button>
|
||||||
{{ end }}
|
{{ else }}
|
||||||
</td>
|
<button type="button" class="btn btn-warning" disabled>No</button>
|
||||||
</tr>
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
</td>
|
||||||
</table>
|
</tr>
|
||||||
<h2>Log</h2>
|
{{ end }}
|
||||||
<table class="table table-striped">
|
{{ end }}
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h2>Log</h2>
|
||||||
|
<table class="table table-striped">
|
||||||
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
|
<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>
|
<tr>
|
||||||
<th>Name</th>
|
<td class="row-index"></td>
|
||||||
<th>Ip</th>
|
<td>
|
||||||
<th>Mac</th>
|
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
|
||||||
<th>Hardware</th>
|
</td>
|
||||||
<th>Last seen</th>
|
<td>{{ .Ip }}</td>
|
||||||
<th>Known</th>
|
<td>{{ .Mac }}</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>
|
</tr>
|
||||||
{{ range .Hosts }}
|
</form>
|
||||||
<form action="/update_host/" method="post">
|
{{ end }}
|
||||||
<input name="id" type="hidden" class="form-control" value="{{ .Id }}">
|
</table>
|
||||||
<tr>
|
</div>
|
||||||
<td>
|
|
||||||
<input name="name" type="text" class="form-control text-dark" value="{{ .Name }}">
|
|
||||||
</td>
|
|
||||||
<td>{{ .Ip }}</td>
|
|
||||||
<td>{{ .Mac }}</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" }}
|
{{ template "footer" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
{{ define "offline"}}
|
{{ define "offline"}}
|
||||||
|
|
||||||
{{ template "header" }}
|
{{ template "header" }}
|
||||||
<!--Auto refresh (seconds)-->
|
<!--Auto refresh (seconds)-->
|
||||||
<!-- <meta http-equiv="refresh" content="{{ .Config.Timeout }}"> -->
|
<!-- <meta http-equiv="refresh" content="{{ .Config.Timeout }}"> -->
|
||||||
<!--Bootstrap theme-->
|
<!--Bootstrap theme-->
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootswatch@5.2.0/dist/{{ .Config.Theme }}/bootstrap.min.css" rel="stylesheet">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container mt-3">
|
<div class="container mt-3">
|
||||||
<table class="table table-striped">
|
<table class="table table-striped">
|
||||||
<tr>
|
<tr>
|
||||||
|
<th>#</th>
|
||||||
<form action="/sort_hosts/" method="post">
|
<form action="/sort_hosts/" method="post">
|
||||||
<th>Name<br>
|
<th>Name<br>
|
||||||
<button type="submit" name="sort_method" value="name-up" class="btn btn-primary btn-sm">
|
<button type="submit" name="sort_method" value="name-up" class="btn btn-primary btn-sm">
|
||||||
|
|
@ -46,30 +47,30 @@
|
||||||
</button>
|
</button>
|
||||||
</th>
|
</th>
|
||||||
</form>
|
</form>
|
||||||
|
</tr>
|
||||||
|
{{ range .Hosts }}
|
||||||
|
<form action="/update_host/" method="post">
|
||||||
|
<input name="id" type="hidden" class="form-control" value="{{ .Id }}">
|
||||||
|
<tr>
|
||||||
|
<td class="row-index"></td>
|
||||||
|
<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>{{ .Mac }}</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>
|
</tr>
|
||||||
{{ range .Hosts }}
|
</form>
|
||||||
<form action="/update_host/" method="post">
|
{{ end }}
|
||||||
<input name="id" type="hidden" class="form-control" value="{{ .Id }}">
|
</table>
|
||||||
<tr>
|
</div>
|
||||||
<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>{{ .Mac }}</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" }}
|
{{ template "footer" }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
Loading…
Reference in a new issue