cleanup
This commit is contained in:
parent
81d8a01a65
commit
913693d9d8
7 changed files with 19 additions and 485 deletions
18
main.go
18
main.go
|
@ -43,7 +43,6 @@ func (web Web) watchCreate(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (web Web) watchCreatePost(c *gin.Context) {
|
||||
log.Println("TEST")
|
||||
var watch Watch
|
||||
errMap, err := bindAndValidateWatch(&watch, c)
|
||||
if err != nil {
|
||||
|
@ -77,14 +76,14 @@ func (web Web) watchView(c *gin.Context) {
|
|||
var connections []FilterConnection
|
||||
web.db.Model(&FilterConnection{}).Where("watch_id = ?", watch.ID).Find(&connections)
|
||||
|
||||
c.HTML(http.StatusOK, "watch", gin.H{
|
||||
c.HTML(http.StatusOK, "watchView", gin.H{
|
||||
"Watch": watch,
|
||||
"Filters": filters,
|
||||
"Connections": connections,
|
||||
})
|
||||
}
|
||||
|
||||
func (web Web) watchSave(c *gin.Context) {
|
||||
func (web Web) watchUpdate(c *gin.Context) {
|
||||
var watch Watch
|
||||
bindAndValidateWatch(&watch, c)
|
||||
|
||||
|
@ -289,22 +288,19 @@ func main() {
|
|||
|
||||
templates := multitemplate.NewRenderer()
|
||||
templates.AddFromFiles("index", "templates/base.html", "templates/index.html")
|
||||
templates.AddFromFiles("watchCreate", "templates/base.html", "templates/watchCreate.html")
|
||||
templates.AddFromFiles("viewWatch", "templates/base.html", "templates/viewWatch.html")
|
||||
templates.AddFromFiles("editGroup", "templates/base.html", "templates/editGroup.html")
|
||||
|
||||
templates.AddFromFiles("watch", "templates/base.html", "templates/diagrams.html")
|
||||
templates.AddFromFiles("watchCreate", "templates/base.html", "templates/watch/create.html")
|
||||
templates.AddFromFiles("watchView", "templates/base.html", "templates/watch/view.html")
|
||||
|
||||
templates.AddFromFiles("500", "templates/base.html", "templates/500.html")
|
||||
router.HTMLRender = templates
|
||||
|
||||
router.GET("/", web.index)
|
||||
router.GET("/watch/new", web.watchCreate)
|
||||
router.POST("/watch/create", web.watchCreatePost)
|
||||
router.POST("/watch/delete", web.deleteWatch)
|
||||
|
||||
router.GET("/watch/:id", web.watchView)
|
||||
router.POST("/watch/save", web.watchSave)
|
||||
router.GET("/watch/new", web.watchCreate)
|
||||
router.POST("/watch/create", web.watchCreatePost)
|
||||
router.POST("/watch/update", web.watchUpdate)
|
||||
|
||||
router.Run("0.0.0.0:8080")
|
||||
}
|
||||
|
|
|
@ -239,7 +239,9 @@ function pageInit() {
|
|||
select.onchange = onTypeChange;
|
||||
var addFilterButton = document.getElementById("filterButton");
|
||||
addFilterButton.onclick = addFilterButtonClicked;
|
||||
var saveButton = document.getElementById("saveButton");
|
||||
saveButton.onclick = saveWatch;
|
||||
var saveButtonModal = document.getElementById("saveButtonModal");
|
||||
saveButtonModal.onclick = saveWatch;
|
||||
var saveButtonMain = document.getElementById("saveButtonMain");
|
||||
saveButtonMain.onclick = saveWatch;
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', pageInit, false);
|
||||
|
|
|
@ -222,8 +222,11 @@ function pageInit(){
|
|||
let addFilterButton = document.getElementById("filterButton") as HTMLButtonElement;
|
||||
addFilterButton.onclick = addFilterButtonClicked
|
||||
|
||||
let saveButton = document.getElementById("saveButton") as HTMLButtonElement;
|
||||
saveButton.onclick = saveWatch;
|
||||
let saveButtonModal = document.getElementById("saveButtonModal") as HTMLButtonElement;
|
||||
saveButtonModal.onclick = saveWatch;
|
||||
|
||||
let saveButtonMain = document.getElementById("saveButtonMain") as HTMLButtonElement;
|
||||
saveButtonMain.onclick = saveWatch;
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', pageInit, false);
|
|
@ -1,430 +0,0 @@
|
|||
{{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="#updateFilterModal_{{ .ID }}">
|
||||
Update
|
||||
</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 modal-lg">
|
||||
<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="json-tab" data-bs-toggle="tab" data-bs-target="#json-tab-pane" aria-controls="json-tab-pane" type="button" role="tab" aria-selected="false">JSON</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="match-tab" data-bs-toggle="tab" data-bs-target="#match-tab-pane" aria-controls="match-tab-pane" type="button" role="tab" aria-selected="false">Match</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 show" id="json-tab-pane" role="tabpanel" aria-labelledby="json-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="json" >
|
||||
<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">JSON:</label>
|
||||
<div class="col-sm-10 p-2">
|
||||
<input type="text" class="form-control" name="from" id="fromInput" placeholder="products.#.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="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 $1">
|
||||
</div>
|
||||
<button class="btn btn-primary mt-4">Add Filter</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade" id="match-tab-pane" role="tabpanel" aria-labelledby="match-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="match" >
|
||||
<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="So[mM]e(thing|where)">
|
||||
</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>
|
||||
|
||||
<!--
|
||||
----------------
|
||||
Update Filter Modals
|
||||
----------------
|
||||
-->
|
||||
{{ range .Group.Filters }}
|
||||
<div class="modal fade" id="updateFilterModal_{{ .ID }}" tabindex="-1" aria-labelledby="updateFilterModalLabel_{{ .ID }}" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="updateFilterModalLabel_{{ .ID }}">Update 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="updateFilterTabs" 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 "json" }} active {{ end }}" id="json-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#json-tab-pane-{{ .ID }}" aria-controls="json-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "json" }} true {{ else }} false {{ end }}">JSON</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 "match" }} active {{ end }}" id="match-tab-{{ .ID }}" data-bs-toggle="tab" data-bs-target="#match-tab-pane-{{ .ID }}" aria-controls="match-tab-pane-{{ .ID }}" type="button" role="tab" aria-selected="{{ if eq .Type "match" }} true {{ else }} false {{ end }}">Match</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="updateFilterTabsContent">
|
||||
<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/update" 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">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade {{ if eq .Type "json" }} show active {{ end }}" id="json-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="json-tab-{{ .ID }}" tabindex="0">
|
||||
<form action="/filter/update" 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="json" >
|
||||
<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">JSON:</label>
|
||||
<div class="col-sm-10 p-2">
|
||||
<input type="text" class="form-control" name="from" id="fromInput" value="{{ if eq .Type "json" }}{{ .From }}{{ end }}" placeholder="products.#.price']">
|
||||
</div>
|
||||
<button class="btn btn-primary mt-4">Update</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/update" 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">Update</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/update" 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="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 "replace" }}{{ .To }}{{ end }}" placeholder="Else $1">
|
||||
</div>
|
||||
<button class="btn btn-primary mt-4">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="tab-pane fade {{ if eq .Type "match" }} show active {{ end }}" id="match-tab-pane-{{ .ID }}" role="tabpanel" aria-labelledby="match-tab-{{ .ID }}" tabindex="0">
|
||||
<form action="/filter/update" 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="match" >
|
||||
<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 "match" }}{{ .From }}{{ end }}" placeholder="So[mM]e(thing|where)">
|
||||
</div>
|
||||
<button class="btn btn-primary mt-4">Update</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/update" 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">Update</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ end }}
|
||||
|
||||
{{ end }}
|
|
@ -1,37 +0,0 @@
|
|||
{{define "content"}}
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col h1">
|
||||
{{ .Watch.Name }}
|
||||
</div>
|
||||
<div class="col h1">
|
||||
{{ .Watch.Interval }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="{{ .MaxDepth }}">ID</th>
|
||||
<th>ID</th>
|
||||
<th>ParentID</th>
|
||||
<th>Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{{ range .Filters }}
|
||||
<tr>
|
||||
{{ range .Depth }}
|
||||
<td></td>
|
||||
{{ end }}
|
||||
<td>{{ .Filter.ID }}</td>
|
||||
<td>{{ .Filter.ParentID }}</td>
|
||||
<td>{{ .Filter.Name }}</td>
|
||||
{{ range .RevDepth }}
|
||||
<td></td>
|
||||
{{ end }}
|
||||
</tr>
|
||||
{{ end }}
|
||||
</table>
|
||||
|
||||
{{ end }}
|
|
@ -73,7 +73,7 @@
|
|||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" id="filterButton" class="btn btn-primary btn-block btn-sm" data-bs-toggle="modal" data-bs-target="#WatchModal">
|
||||
<button type="button" id="saveButtonMain" class="btn btn-primary btn-block btn-sm">
|
||||
Save
|
||||
</button>
|
||||
</div>
|
||||
|
@ -87,7 +87,7 @@
|
|||
</div>
|
||||
<div class="modal-body">
|
||||
<div>
|
||||
<form action="/watch/save" id="saveWatchForm" method="post">
|
||||
<form action="/watch/update" id="saveWatchForm" method="post">
|
||||
<div class="mb-3 m-3 row">
|
||||
<input type="hidden" id="watch_id" name="watch_id" value="{{ .Watch.ID }}">
|
||||
<label for="watchNameInput" class="col-sm-2 col-form-label">Name:</label>
|
||||
|
@ -111,7 +111,7 @@
|
|||
<input type="hidden" id="connectionsInput" name="connections" value="">
|
||||
</div>
|
||||
</form>
|
||||
<button class="btn btn-primary mt-4" id="saveButton" data-bs-dismiss="modal" id="submitWatchButton">Save</button>
|
||||
<button class="btn btn-primary mt-4" id="saveButtonModal" data-bs-dismiss="modal" id="submitWatchButton">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Loading…
Add table
Reference in a new issue