mirror of https://github.com/calzoneman/sync.git
Improve ACP
This commit is contained in:
parent
8d9d2b6433
commit
07795feffa
22
www/acp.html
22
www/acp.html
|
@ -184,6 +184,28 @@
|
||||||
</select>
|
</select>
|
||||||
<button class="btn btn-danger" id="actionlog_clear">Clear Selected</button>
|
<button class="btn btn-danger" id="actionlog_clear">Clear Selected</button>
|
||||||
<button class="btn" id="actionlog_refresh">Refresh</button>
|
<button class="btn" id="actionlog_refresh">Refresh</button>
|
||||||
|
<br>
|
||||||
|
<form class="form-inline" action="javascript:void(0)">
|
||||||
|
<input type="text" placeholder="Search" id="actionlog_search">
|
||||||
|
<label for="actionlog_sfield">Search For</label>
|
||||||
|
<select id="actionlog_sfield">
|
||||||
|
<option value="ip">IP Address</option>
|
||||||
|
<option value="name" selected="selected">Name</option>
|
||||||
|
<option value="time">Time</option>
|
||||||
|
</select>
|
||||||
|
<label for="actionlog_sort">Sort By</label>
|
||||||
|
<select id="actionlog_sort">
|
||||||
|
<option value="ip">IP Address</option>
|
||||||
|
<option value="name">Name</option>
|
||||||
|
<option value="action">Action</option>
|
||||||
|
<option value="time" selected="selected">Time</option>
|
||||||
|
</select>
|
||||||
|
<select id="actionlog_sortorder">
|
||||||
|
<option value="true">Descending</option>
|
||||||
|
<option value="false">Ascending</option>
|
||||||
|
</select>
|
||||||
|
<button class="btn" id="actionlog_searchbtn">Go</button>
|
||||||
|
</form>
|
||||||
<table class="table table-bordered table-striped table-compact">
|
<table class="table table-bordered table-striped table-compact">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -103,6 +103,51 @@ $("#actionlog_filter").click(function() {
|
||||||
$("#actionlog table").data("entries", entries);
|
$("#actionlog table").data("entries", entries);
|
||||||
loadPage($("#actionlog table"), 0);
|
loadPage($("#actionlog table"), 0);
|
||||||
});
|
});
|
||||||
|
$("#actionlog_searchbtn").click(function() {
|
||||||
|
var tbl = $("#actionlog table");
|
||||||
|
$("#actionlog tbody").remove();
|
||||||
|
var actions = $("#actionlog_filter").val();
|
||||||
|
var sfield = $("#actionlog_sfield").val();
|
||||||
|
var sval = $("#actionlog_search").val().toLowerCase();
|
||||||
|
var sort = $("#actionlog_sort").val();
|
||||||
|
var desc = $("#actionlog_sortorder").val() === "true";
|
||||||
|
tbl.data("sort_desc", desc);
|
||||||
|
tbl.data("sortby", sort);
|
||||||
|
var entries = [];
|
||||||
|
tbl.data("allentries").forEach(function(e) {
|
||||||
|
if(actions.indexOf(e.action) == -1)
|
||||||
|
return;
|
||||||
|
entries.push(e);
|
||||||
|
});
|
||||||
|
entries = entries.filter(function (item, i, arr) {
|
||||||
|
var f = item[sfield];
|
||||||
|
if(sfield === "time")
|
||||||
|
f = new Date(f).toString().toLowerCase();
|
||||||
|
return f.indexOf(sval) > -1;
|
||||||
|
});
|
||||||
|
$("#actionlog_pagination").remove();
|
||||||
|
if(entries.length > 20) {
|
||||||
|
var pag = $("<div/>").addClass("pagination")
|
||||||
|
.attr("id", "actionlog_pagination")
|
||||||
|
.insertAfter($("#actionlog table"));
|
||||||
|
var btns = $("<ul/>").appendTo(pag);
|
||||||
|
for(var i = 0; i < entries.length / 20; i++) {
|
||||||
|
var li = $("<li/>").appendTo(btns);
|
||||||
|
(function(i) {
|
||||||
|
$("<a/>").attr("href", "javascript:void(0)")
|
||||||
|
.text(i+1)
|
||||||
|
.click(function() {
|
||||||
|
loadPage(tbl, i);
|
||||||
|
})
|
||||||
|
.appendTo(li);
|
||||||
|
})(i);
|
||||||
|
}
|
||||||
|
tbl.data("pagination", pag);
|
||||||
|
}
|
||||||
|
|
||||||
|
$("#actionlog table").data("entries", entries);
|
||||||
|
loadPage($("#actionlog table"), 0);
|
||||||
|
});
|
||||||
$("#actionlog_clear").click(function() {
|
$("#actionlog_clear").click(function() {
|
||||||
socket.emit("acp-actionlog-clear", $("#actionlog_filter").val());
|
socket.emit("acp-actionlog-clear", $("#actionlog_filter").val());
|
||||||
getActionLog();
|
getActionLog();
|
||||||
|
@ -165,6 +210,7 @@ function getActionLog() {
|
||||||
socket.emit("acp-actionlog-clear-one", e);
|
socket.emit("acp-actionlog-clear-one", e);
|
||||||
tr.hide("blind", function () {
|
tr.hide("blind", function () {
|
||||||
tr.remove();
|
tr.remove();
|
||||||
|
getActionLog();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$("<td/>").text(e.ip).appendTo(tr);
|
$("<td/>").text(e.ip).appendTo(tr);
|
||||||
|
@ -181,7 +227,7 @@ function getActionLog() {
|
||||||
actions.forEach(function(a) {
|
actions.forEach(function(a) {
|
||||||
$("<option/>").text(a).val(a).appendTo($("#actionlog_filter"));
|
$("<option/>").text(a).val(a).appendTo($("#actionlog_filter"));
|
||||||
});
|
});
|
||||||
loadPage(tbl, 0);
|
tbl.find("tbody").remove();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
function getChanlog() {
|
function getChanlog() {
|
||||||
|
|
Loading…
Reference in New Issue