go-watch/templates/viewWatch.html

111 lines
5 KiB
HTML

{{define "content"}}
<div class="container">
<div class="row">
<div class="col h1">
{{ .Name }}
</div>
<div class="col h1">
{{ $.Interval }}
</div>
</div>
</div>
{{ range .URLs }}
<div class="card mb-5">
<div class="card-header text-center text-white bg-dark ">
<div class="h3">{{ .Name }} URL</div>
</div>
<div class="card-header bg-secondary text-white text-center">
<div>{{ .URL }}</div>
</div>
<div class="card-body">
{{ range .Queries }}
<div class="card mb-2">
<div class="card-header">
<div class="row">
<div class="col h5 text-start">{{ .Type }}</div>
<div class="col h4 text-center" >{{ .Name }}</div>
<div class="col h5 text-end"><a class="btn btn-success btn-sm" href="/query/edit/{{ .ID }}">Edit</a></div>
</div>
<div class="text-center text-muted">
{{ .Query }}
</div>
</div>
<div class="card-body">
<input type="hidden" name="query_id" value="{{ .ID }}" >
<input type="hidden" name="w_id" value="{{ $.ID }}" >
<table class="table table-hover caption-top">
<tbody>
{{ if .Filters }}
{{ range .Filters }}
<tr>
<td>{{ .Name }}</td>
<td>{{ .Type }}</td>
<td>{{ .From }}</td>
<td>{{ .To }}</td>
<td></td>
</tr>
{{ end }}
{{ else }}
<tr>
<td class="text-center h3">No filters yet, click "Edit" to add</td>
</tr>
{{ end }}
</tbody>
</table>
</div>
<div class="card-footer">
</div>
</div>
{{ end }}
<form action="/query/create" method="post">
<input type="hidden" name="query_url_id" value="{{ .ID }}" >
<input type="hidden" name="w_id" value="{{ $.ID }}" >
<table class="table table-hover caption-top">
<tbody>
<tr>
<td>
<input type="text" class="form-control" name="query_name" placeholder="Query Name">
</td>
<td>
<select class="form-control" id="query_type" name="query_type">
<option value="css">CSS Selector</option>
<option value="xpath">XPath</option>
<option value="regex">Regex</option>
<option value="json">JSON</option>
<!-- additions/changes should also be added to Query.Type oneof validator -->
</select>
</td>
<td>
<input type="text" class="form-control" name="query" placeholder="Query">
</td>
<td>
<button class="btn btn-primary">Add Query</button>
</td>
</tr>
</tbody>
</table>
</form>
</div>
</div>
{{ end }}
<div class="card mb-5">
<div class="card-header text-center bg-light ">
<div class="h5">New URL</div>
</div>
<div class="card-body">
<form action="/url/create" method="post">
<div class="form-group mb-2">
<input type="text" class="form-control" name="url_name" id="urlName" placeholder="URL Name">
</div>
<div class="form-group mb-2">
<input type="url" class="form-control" name="url" id="url" placeholder="URL">
</div>
<input type="hidden" name="url_watch_id" value="{{ .ID }}" >
<input class="btn btn-primary" type="submit" value="Create URL">
</form>
</div>
</div>
{{ end }}