From 76576053e26ef0499164814d5853eddb21e267a7 Mon Sep 17 00:00:00 2001 From: Paolo Asperti Date: Tue, 5 Jan 2021 09:43:50 +0100 Subject: [PATCH] ok --- src/webui.go | 7 ------- templates/status.html | 26 +++++++++++++------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/src/webui.go b/src/webui.go index c338a5b..27223f0 100644 --- a/src/webui.go +++ b/src/webui.go @@ -71,7 +71,6 @@ func startServer() { m := macaron.Classic() m.Use(pongo2.Pongoer()) m.Use(macaron.Static("static")) - // m.Get("/", myHandler) m.Get("/", statusPage) m.Get("/outlets", outletsPage) @@ -87,12 +86,6 @@ func startServer() { m.Get("/json/status", jsonStatus) m.Post("/json/outlet/:id/toggle", jsonOutletToggle) - m.Get("/boards", func(ctx *macaron.Context) { - ctx.HTML(200, "boards") // 200 is the response code. - }) - - logInfo("hostname: " + viper.GetString("system.hostname")) - logInfo("Web interface ready") http.ListenAndServe("0.0.0.0:"+viper.GetString("system.listeningport"), m) } diff --git a/templates/status.html b/templates/status.html index e65b9b5..f47ea92 100644 --- a/templates/status.html +++ b/templates/status.html @@ -72,17 +72,7 @@ $(function () { var btnhtml = `
- - -
`; + `; var table = $('#example2').DataTable({ @@ -98,10 +88,20 @@ 'lengthChange': true, 'searching' : true, 'ordering' : true, - 'info' : true + 'info' : true, + 'rowCallback': function( row, data ) { + if ( data[2] == "true" ) { + $('td:eq(2)', row).html( '' ); + } else { + $('td:eq(2)', row).html( '' ); + } + } }); - // fa-toggle-off + // autoreload every 3 seconds + setInterval( function () { + table.ajax.reload(); + }, 3000 ); $('#example2 tbody').on( 'click', '[script="toggle"]', function (e) { e.preventDefault();