can delete watches
This commit is contained in:
parent
63b519ec2e
commit
69a4b6e15d
3 changed files with 14 additions and 7 deletions
7
main.go
7
main.go
|
@ -49,9 +49,10 @@ func (web Web) watchCreatePost(c *gin.Context) {
|
|||
}
|
||||
|
||||
func (web Web) deleteWatch(c *gin.Context) {
|
||||
id, err := strconv.Atoi(c.PostForm("id"))
|
||||
id, err := strconv.Atoi(c.PostForm("watch_id"))
|
||||
if err != nil {
|
||||
c.Redirect(http.StatusSeeOther, "/watch/new")
|
||||
log.Println(err)
|
||||
c.Redirect(http.StatusSeeOther, "/")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -243,12 +244,12 @@ func main() {
|
|||
router.HTMLRender = templates
|
||||
|
||||
router.GET("/", web.index)
|
||||
router.POST("/watch/delete", web.deleteWatch)
|
||||
|
||||
router.GET("/watch/:id", web.watchView)
|
||||
router.GET("/watch/new", web.watchCreate)
|
||||
router.POST("/watch/create", web.watchCreatePost)
|
||||
router.POST("/watch/update", web.watchUpdate)
|
||||
router.POST("/watch/delete", web.deleteWatch)
|
||||
|
||||
router.Run("0.0.0.0:8080")
|
||||
}
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<td class="h3">{{ .Name }}</td>
|
||||
<td class="h3">{{ .Interval }}</td>
|
||||
<td>
|
||||
<form action="/query/delete" method="post">
|
||||
<input type="hidden" name="id" value="{{ .ID }}">
|
||||
<form action="/watch/delete" method="post">
|
||||
<input type="hidden" name="watch_id" value="{{ .ID }}">
|
||||
<input type="submit" class="btn btn-danger" value="Delete">
|
||||
</form>
|
||||
</td>
|
||||
|
|
|
@ -59,7 +59,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<button class="btn btn-primary mt-4" data-bs-dismiss="modal" id="submitFilterButton">Add Filter</button>
|
||||
<div>
|
||||
<button class="btn btn-primary mt-4" data-bs-dismiss="modal" id="submitFilterButton">Add Filter</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -111,7 +113,11 @@
|
|||
<input type="hidden" id="connectionsInput" name="connections" value="">
|
||||
</div>
|
||||
</form>
|
||||
<button class="btn btn-primary mt-4" id="saveButtonModal" data-bs-dismiss="modal" id="submitWatchButton">Save</button>
|
||||
<button class="btn btn-primary mt-4 float-start" id="saveButtonModal" data-bs-dismiss="modal" id="submitWatchButton">Save</button>
|
||||
<form action="/watch/delete" method="post">
|
||||
<input type="hidden" name="watch_id" value="{{ .Watch.ID }}">
|
||||
<button class="btn btn-danger mt-4 float-end" data-bs-dismiss="modal" id="deleteFilterButton">Delete Filter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue