hide/show nas wake up link
This commit is contained in:
parent
02a191a6e1
commit
c7f6d46818
@ -1,4 +1,8 @@
|
||||
$(function() {
|
||||
refreshNodes();
|
||||
})
|
||||
|
||||
function refreshNodes() {
|
||||
$("#nodeTable tr[data-node]").each(function(){
|
||||
var $this = $(this);
|
||||
var node = $this.data("node");
|
||||
@ -17,7 +21,24 @@ $(function() {
|
||||
label = "label-danger";
|
||||
$this.addClass("danger");
|
||||
}
|
||||
if (data["Domain"] === "devkid-nas.vpn") {
|
||||
setNasWakeUpLink($this, data);
|
||||
}
|
||||
$this.find("span.status").addClass(label).text(data["Status"]);
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
function setNasWakeUpLink($row, data) {
|
||||
var $nasStatus = $row.find("#nasStatus");
|
||||
if ($nasStatus.length == 0){
|
||||
var ele = '<a id="nasStatus" href="http://devkid-router.vpn:8080/cgi-bin/wake-nas" class="btn btn-link btn-sm">Wake up NAS</a>'
|
||||
$row.find(".host").append(ele);
|
||||
$nasStatus = $row.find("#nasStatus")
|
||||
}
|
||||
if (data["Status"] == "DOWN") {
|
||||
$nasStatus.show();
|
||||
} else {
|
||||
$nasStatus.hide();
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,6 @@ func main() {
|
||||
http.HandleFunc("/status/", statusHandler)
|
||||
http.Handle("/assets/", http.StripPrefix("/assets", http.FileServer(http.Dir("./assets/"))))
|
||||
http.HandleFunc("/", indexHandler)
|
||||
fmt.Printf("Running on http://0.0.0.0:8080\n");
|
||||
http.ListenAndServe(":8080", nil)
|
||||
fmt.Printf("Running on 8080")
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user