mirror of https://github.com/calzoneman/sync.git
Clear individual rows from action log
This commit is contained in:
parent
5df30cb8a9
commit
8d9d2b6433
5
acp.js
5
acp.js
|
@ -152,5 +152,10 @@ module.exports = {
|
||||||
ActionLog.clear(data);
|
ActionLog.clear(data);
|
||||||
ActionLog.record(user.ip, user.name, "acp-actionlog-clear", data);
|
ActionLog.record(user.ip, user.name, "acp-actionlog-clear", data);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
user.socket.on("acp-actionlog-clear-one", function(data) {
|
||||||
|
ActionLog.clearOne(data);
|
||||||
|
ActionLog.record(user.ip, user.name, "acp-actionlog-clear-one", data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
18
actionlog.js
18
actionlog.js
|
@ -65,6 +65,24 @@ exports.clear = function(actions) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exports.clearOne = function(e) {
|
||||||
|
var db = Database.getConnection();
|
||||||
|
if(!db)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var query = Database.createQuery(
|
||||||
|
"DELETE FROM actionlog WHERE ip=? AND time=?",
|
||||||
|
[e.ip, e.time]
|
||||||
|
);
|
||||||
|
|
||||||
|
var result = db.querySync(query);
|
||||||
|
if(!result) {
|
||||||
|
Logger.errlog.log("! Failed to clear action log");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
exports.tooManyRegistrations = function (ip) {
|
exports.tooManyRegistrations = function (ip) {
|
||||||
var db = Database.getConnection();
|
var db = Database.getConnection();
|
||||||
if(!db)
|
if(!db)
|
||||||
|
|
|
@ -187,6 +187,7 @@
|
||||||
<table class="table table-bordered table-striped table-compact">
|
<table class="table table-bordered table-striped table-compact">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th id="actionlog_rem">Remove</th>
|
||||||
<th id="actionlog_ip">IP Address</th>
|
<th id="actionlog_ip">IP Address</th>
|
||||||
<th id="actionlog_name">Name</th>
|
<th id="actionlog_name">Name</th>
|
||||||
<th id="actionlog_action">Action</th>
|
<th id="actionlog_action">Action</th>
|
||||||
|
|
|
@ -157,6 +157,16 @@ function getActionLog() {
|
||||||
tbl.data("allentries", entries);
|
tbl.data("allentries", entries);
|
||||||
tbl.data("generator", function(e) {
|
tbl.data("generator", function(e) {
|
||||||
var tr = $("<tr/>").appendTo($("#actionlog table"));
|
var tr = $("<tr/>").appendTo($("#actionlog table"));
|
||||||
|
var rem = $("<td/>").appendTo(tr);
|
||||||
|
$("<button/>").addClass("btn btn-mini btn-danger")
|
||||||
|
.html("<i class='icon-trash'></i>")
|
||||||
|
.appendTo(rem)
|
||||||
|
.click(function () {
|
||||||
|
socket.emit("acp-actionlog-clear-one", e);
|
||||||
|
tr.hide("blind", function () {
|
||||||
|
tr.remove();
|
||||||
|
});
|
||||||
|
});
|
||||||
$("<td/>").text(e.ip).appendTo(tr);
|
$("<td/>").text(e.ip).appendTo(tr);
|
||||||
$("<td/>").text(e.name).appendTo(tr);
|
$("<td/>").text(e.name).appendTo(tr);
|
||||||
$("<td/>").text(e.action).appendTo(tr);
|
$("<td/>").text(e.action).appendTo(tr);
|
||||||
|
|
Loading…
Reference in New Issue