392 lines
26 KiB
HTML
392 lines
26 KiB
HTML
{{define "content"}}
|
|
<div class="card mb-5">
|
|
<div class="card-header text-center text-white bg-dark ">
|
|
<div class="h2">{{ .Group.URL.Watch.Name }} - {{ .Group.Name }}</div>
|
|
<div class="h6">{{ .Group.URL.URL }}</div>
|
|
</div>
|
|
<div class="card-header text-white bg-secondary">
|
|
<div class="row">
|
|
<div class="col-2">
|
|
{{ .Group.Type }}
|
|
</div>
|
|
<div class="col-1">
|
|
<button type="button" class="btn btn-primary btn-sm" data-bs-toggle="modal" data-bs-target="#updateGroupModal">
|
|
Update
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<div class="card mb-2">
|
|
<table class="table table-hover caption-top">
|
|
<tbody>
|
|
{{ range .Group.Filters }}
|
|
<tr>
|
|
<td>{{ .Name }}</td>
|
|
<td>{{ .Type }}</td>
|
|
<td>{{ .From }}</td>
|
|
<td>{{ .To }}</td>
|
|
<td>
|
|
<button type="button" class="btn btn-primary btn-block" data-bs-toggle="modal" data-bs-target="#editFilterModal_{{ .ID }}">
|
|
Edit
|
|
</button>
|
|
</td>
|
|
<td>
|
|
<form action="/filter/delete" method="post">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}">
|
|
<input type="hidden" name="group_id" value="{{ $.Group.ID }}" >
|
|
<input type="submit" class="btn btn-sm btn-danger" value="X">
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
{{ end }}
|
|
<tr>
|
|
<td colspan="5">
|
|
<div class="row text-center">
|
|
<div class="col"></div>
|
|
<div class="col">
|
|
<button type="button" class="btn btn-primary btn-block" data-bs-toggle="modal" data-bs-target="#newFilterModal">
|
|
Add Filter
|
|
</button>
|
|
</div>
|
|
<div class="col"></div>
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{{ range .currentResult }}
|
|
<div class="card">
|
|
<div class="card-header text-center text-white bg-dark ">
|
|
<div class="h6">Result</div>
|
|
</div>
|
|
<div class="card-body">
|
|
<code>
|
|
{{ . }}
|
|
</code>
|
|
</div>
|
|
</div>
|
|
{{ end }}
|
|
|
|
|
|
<div class="modal fade" id="updateGroupModal" tabindex="-1" aria-labelledby="updateGroupModal" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="updateGroupModal">Update Group</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form action="/group/update" method="post">
|
|
<input type="hidden" name="group_id" value="{{ .Group.ID }}" >
|
|
<div class="col">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="text" name="group_name" value="{{ .Group.Name }}" class="form-control">
|
|
</div>
|
|
<div class="mb-3 m-3 row">
|
|
<select name="group_type" class="form-control" >
|
|
<option value="diff" {{ if eq .Group.Type "diff" }} selected="true" {{ end }}>Diff</option>
|
|
<option value="enum" {{ if eq .Group.Type "enum" }} selected="true" {{ end }}>Enum</option>
|
|
<option value="number" {{ if eq .Group.Type "number" }} selected="true" {{ end }}>Number</option>
|
|
<option value="bool" {{ if eq .Group.Type "bool" }} selected="true" {{ end }}>Boolean</option>
|
|
</select>
|
|
</div>
|
|
<button class="btn btn-primary">Update</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!--
|
|
----------------
|
|
New Filter Modal
|
|
----------------
|
|
-->
|
|
|
|
<div class="modal fade" id="newFilterModal" tabindex="-1" aria-labelledby="newFilterModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="newFilterModalLabel">Add Filter</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
|
|
<ul class="nav nav-tabs" id="newFilterTabs" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link active" id="xpath-tab" data-bs-toggle="tab" data-bs-target="#xpath-tab-pane" aria-controls="xpath-tab-pane" type="button" role="tab" aria-selected="true">XPath</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="css-tab" data-bs-toggle="tab" data-bs-target="#css-tab-pane" aria-controls="css-tab-pane" type="button" role="tab" aria-selected="false">CSS</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="replace-tab" data-bs-toggle="tab" data-bs-target="#replace-tab-pane" aria-controls="replace-tab-pane" type="button" role="tab" aria-selected="false">Replace</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="regex-tab" data-bs-toggle="tab" data-bs-target="#regex-tab-pane" aria-controls="regex-tab-pane" type="button" role="tab" aria-selected="false">Regex</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link" id="substring-tab" data-bs-toggle="tab" data-bs-target="#substring-tab-pane" aria-controls="substring-tab-pane" type="button" role="tab" aria-selected="false">Substring</button>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content" id="newFilterTabsContent">
|
|
<div class="tab-pane fade show active" id="xpath-tab-pane" role="tabpanel" aria-labelledby="xpath-tab" tabindex="0">
|
|
<form action="/filter/create" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_group_id" value="{{ .Group.ID }}" >
|
|
<input type="hidden" name="filter_type" value="xpath" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="filter_name" id="nameInput" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">XPath:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" placeholder="//a[@class='price']">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Add Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade" id="css-tab-pane" role="tabpanel" aria-labelledby="css-tab" tabindex="0">
|
|
<form action="/filter/create" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_group_id" value="{{ .Group.ID }}" >
|
|
<input type="hidden" name="filter_type" value="css" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="filter_name" id="nameInput" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">Selector:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" placeholder=".price">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Add Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade" id="replace-tab-pane" role="tabpanel" aria-labelledby="replace-tab" tabindex="0">
|
|
|
|
<form action="/filter/create" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_group_id" value="{{ .Group.ID }}" >
|
|
<input type="hidden" name="filter_type" value="replace" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="filter_name" id="nameInput" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" placeholder="Something">
|
|
</div>
|
|
<label for="toInput" class="col-sm-2 col-form-label">To:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="to" id="toInput" placeholder="Else">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Add Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade" id="regex-tab-pane" role="tabpanel" aria-labelledby="regex-tab" tabindex="0">
|
|
<form action="/filter/create" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_group_id" value="{{ .Group.ID }}" >
|
|
<input type="hidden" name="filter_type" value="regex" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="filter_name" id="nameInput" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" placeholder="So[mM]e(thing|where)">
|
|
</div>
|
|
<label for="toInput" class="col-sm-2 col-form-label">To:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="to" id="toInput" placeholder="Else">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Add Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade" id="substring-tab-pane" role="tabpanel" aria-labelledby="substring-tab" tabindex="0">
|
|
<form action="/filter/create" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_group_id" value="{{ .Group.ID }}" >
|
|
<input type="hidden" name="filter_type" value="substring" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="filter_name" id="nameInput" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" placeholder=":20,25-40,45,47,49,-20:">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Add Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!--
|
|
----------------
|
|
Edit Filter Modals
|
|
----------------
|
|
-->
|
|
{{ range .Group.Filters }}
|
|
<div class="modal fade" id="editFilterModal_{{ .ID }}" tabindex="-1" aria-labelledby="editFilterModalLabel_{{ .ID }}" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="editFilterModalLabel_{{ .ID }}">Edit Filter: {{ .Name }}</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<ul class="nav nav-tabs" id="editFilterTabs" role="tablist">
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link {{ if eq .Type "xpath" }} active {{ end }}" id="xpath-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#xpath-tab-pane-{{ .ID }}" aria-controls="xpath-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "xpath" }} true {{ else }} false {{ end }}">XPath</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link {{ if eq .Type "css" }} active {{ end }}" id="css-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#css-tab-pane-{{ .ID }}" aria-controls="css-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "css" }} true {{ else }} false {{ end }}">CSS</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link{{ if eq .Type "replace" }} active {{ end }}" id="replace-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#replace-tab-pane-{{ .ID }}" aria-controls="replace-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "replace" }} true {{ else }} false {{ end }}">Replace</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link {{ if eq .Type "regex" }} active {{ end }}" id="regex-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#regex-tab-pane-{{ .ID }}" aria-controls="regex-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "regex" }} true {{ else }} false {{ end }}">Regex</button>
|
|
</li>
|
|
<li class="nav-item" role="presentation">
|
|
<button class="nav-link {{ if eq .Type "substring" }} active {{ end }}" id="substring-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#substring-tab-pane-{{ .ID }}" aria-controls="substring-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "substring" }} true {{ else }} false {{ end }}">Substring</button>
|
|
</li>
|
|
</ul>
|
|
<div class="tab-content" id="editFilterTabsContent">
|
|
<div class="tab-pane fade {{ if eq .Type "xpath" }} show active {{ end }}" id="xpath-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="xpath-tab-{{ .ID }}" tabindex="0">
|
|
<form action="/filter/edit" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}" >
|
|
<input type="hidden" name="filter_group_id" value="{{ .FilterGroupID }}" >
|
|
<input type="hidden" name="filter_type" value="xpath" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="name" id="nameInput" value="{{ .Name }}" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">XPath:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "xpath" }}{{ .From }}{{ end }}" placeholder="//a[@class='price']">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Edit Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade {{ if eq .Type "css" }} show active {{ end }}" id="css-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="css-tab-{{ .ID }}" tabindex="0">
|
|
<form action="/filter/edit" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}" >
|
|
<input type="hidden" name="filter_group_id" value="{{ .FilterGroupID }}" >
|
|
<input type="hidden" name="filter_type" value="css" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="name" id="nameInput" value="{{ .Name }}" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">Selector:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "css" }}{{ .From }}{{ end }}" placeholder=".price">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Edit Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade {{ if eq .Type "replace" }} show active {{ end }}" id="replace-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="replace-tab-{{ .ID }}" tabindex="0">
|
|
<form action="/filter/edit" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}" >
|
|
<input type="hidden" name="filter_group_id" value="{{ .FilterGroupID }}" >
|
|
<input type="hidden" name="filter_type" value="replace" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="name" id="nameInput" value="{{ .Name }}" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "replace" }}{{ .From }}{{ end }}" placeholder="Something">
|
|
</div>
|
|
<label for="toInput" class="col-sm-2 col-form-label">To:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="to" id="toInput" value="{{ if eq .Type "replace" }}{{ .To }}{{ end }}" placeholder="Else">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Edit Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade {{ if eq .Type "regex" }} show active {{ end }}" id="regex-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="regex-tab-{{ .ID }}" tabindex="0">
|
|
<form action="/filter/edit" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}" >
|
|
<input type="hidden" name="filter_group_id" value="{{ .FilterGroupID }}" >
|
|
<input type="hidden" name="filter_type" value="regex" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="name" id="nameInput" value="{{ .Name }}" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "regex" }}{{ .From }}{{ end }}" placeholder="So[mM]e(thing|where)">
|
|
</div>
|
|
<label for="toInput" class="col-sm-2 col-form-label">To:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="to" id="toInput" value="{{ if eq .Type "regex" }}{{ .To }}{{ end }}" placeholder="Else">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Edit Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="tab-pane fade {{ if eq .Type "substring" }} show active {{ end }}" id="substring-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="substring-tab-{{ .ID }}" tabindex="0">
|
|
<form action="/filter/edit" method="post">
|
|
<div class="mb-3 m-3 row">
|
|
<input type="hidden" name="filter_id" value="{{ .ID }}" >
|
|
<input type="hidden" name="filter_group_id" value="{{ .FilterGroupID }}" >
|
|
<input type="hidden" name="filter_type" value="substring" >
|
|
<input type="hidden" name="to" value="-" >
|
|
|
|
<label for="nameInput" class="col-sm-2 col-form-label">Name:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="name" id="nameInput" value="{{ .Name }}" placeholder="Name">
|
|
</div>
|
|
<label for="fromInput" class="col-sm-2 col-form-label">From:</label>
|
|
<div class="col-sm-10 p-2">
|
|
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "substring" }}{{ .From }}{{ end }}" placeholder=":20,25-40,45,47,49,-20:">
|
|
</div>
|
|
<button class="btn btn-primary mt-4">Edit Filter</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|