ok
This commit is contained in:
parent
6f42dafcb9
commit
76576053e2
@ -71,7 +71,6 @@ func startServer() {
|
|||||||
m := macaron.Classic()
|
m := macaron.Classic()
|
||||||
m.Use(pongo2.Pongoer())
|
m.Use(pongo2.Pongoer())
|
||||||
m.Use(macaron.Static("static"))
|
m.Use(macaron.Static("static"))
|
||||||
// m.Get("/", myHandler)
|
|
||||||
|
|
||||||
m.Get("/", statusPage)
|
m.Get("/", statusPage)
|
||||||
m.Get("/outlets", outletsPage)
|
m.Get("/outlets", outletsPage)
|
||||||
@ -87,12 +86,6 @@ func startServer() {
|
|||||||
m.Get("/json/status", jsonStatus)
|
m.Get("/json/status", jsonStatus)
|
||||||
m.Post("/json/outlet/:id/toggle", jsonOutletToggle)
|
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")
|
logInfo("Web interface ready")
|
||||||
http.ListenAndServe("0.0.0.0:"+viper.GetString("system.listeningport"), m)
|
http.ListenAndServe("0.0.0.0:"+viper.GetString("system.listeningport"), m)
|
||||||
}
|
}
|
||||||
|
@ -72,17 +72,7 @@
|
|||||||
$(function () {
|
$(function () {
|
||||||
var btnhtml = `<div class="btn-group">
|
var btnhtml = `<div class="btn-group">
|
||||||
<button type="button" class="btn btn-info" script="toggle">Toggle</button>
|
<button type="button" class="btn btn-info" script="toggle">Toggle</button>
|
||||||
<button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown">
|
</div>`;
|
||||||
<span class="caret"></span>
|
|
||||||
<span class="sr-only">Toggle Dropdown</span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu" role="menu">
|
|
||||||
<li><a href="#">On</a></li>
|
|
||||||
<li><a href="#">Off</a></li>
|
|
||||||
<li class="divider"></li>
|
|
||||||
<li><a href="#">Edit</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>`;
|
|
||||||
|
|
||||||
|
|
||||||
var table = $('#example2').DataTable({
|
var table = $('#example2').DataTable({
|
||||||
@ -98,10 +88,20 @@
|
|||||||
'lengthChange': true,
|
'lengthChange': true,
|
||||||
'searching' : true,
|
'searching' : true,
|
||||||
'ordering' : true,
|
'ordering' : true,
|
||||||
'info' : true
|
'info' : true,
|
||||||
|
'rowCallback': function( row, data ) {
|
||||||
|
if ( data[2] == "true" ) {
|
||||||
|
$('td:eq(2)', row).html( '<i class="fa fa-toggle-on"></i>' );
|
||||||
|
} else {
|
||||||
|
$('td:eq(2)', row).html( '<i class="fa fa-toggle-off"></i>' );
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// fa-toggle-off
|
// autoreload every 3 seconds
|
||||||
|
setInterval( function () {
|
||||||
|
table.ajax.reload();
|
||||||
|
}, 3000 );
|
||||||
|
|
||||||
$('#example2 tbody').on( 'click', '[script="toggle"]', function (e) {
|
$('#example2 tbody').on( 'click', '[script="toggle"]', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
Loading…
Reference in New Issue
Block a user