|
|
@@ -705,22 +705,7 @@ define(["jquery", "footable", "humanize"], |
|
|
|
}); |
|
|
|
}; |
|
|
|
|
|
|
|
function updateErrorsTable(tables, data) { |
|
|
|
var neighbours_data = data |
|
|
|
.filter(function (d) { |
|
|
|
return d.status; |
|
|
|
}) // filter out unavailable neighbours |
|
|
|
.map(function (d) { |
|
|
|
return d.data; |
|
|
|
}); |
|
|
|
var flattened_data = [].concat.apply([], neighbours_data); |
|
|
|
$.each(flattened_data, function (i, item) { |
|
|
|
item.ts = unix_time_format(item.ts); |
|
|
|
}); |
|
|
|
tables.errors.rows.load(flattened_data); |
|
|
|
} |
|
|
|
|
|
|
|
function initErrorsTable(tables, data) { |
|
|
|
function initErrorsTable(tables, rows) { |
|
|
|
tables.errors = FooTable.init("#errorsLog", { |
|
|
|
columns: [ |
|
|
|
{sorted: true, direction: "DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}}, |
|
|
@@ -730,6 +715,7 @@ define(["jquery", "footable", "humanize"], |
|
|
|
{name:"id", title:"Internal ID", style:{"font-size":"11px"}}, |
|
|
|
{name:"message", title:"Message", breakpoints:"xs sm", style:{"font-size":"11px"}}, |
|
|
|
], |
|
|
|
rows: rows, |
|
|
|
paging: { |
|
|
|
enabled: true, |
|
|
|
limit: 5, |
|
|
@@ -742,11 +728,6 @@ define(["jquery", "footable", "humanize"], |
|
|
|
}, |
|
|
|
sorting: { |
|
|
|
enabled: true |
|
|
|
}, |
|
|
|
on: { |
|
|
|
"ready.ft.table": function () { |
|
|
|
updateErrorsTable(tables, data); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
@@ -756,10 +737,21 @@ define(["jquery", "footable", "humanize"], |
|
|
|
|
|
|
|
rspamd.query("errors", { |
|
|
|
success: function (data) { |
|
|
|
var neighbours_data = data |
|
|
|
.filter(function (d) { |
|
|
|
return d.status; |
|
|
|
}) // filter out unavailable neighbours |
|
|
|
.map(function (d) { |
|
|
|
return d.data; |
|
|
|
}); |
|
|
|
var rows = [].concat.apply([], neighbours_data); |
|
|
|
$.each(rows, function (i, item) { |
|
|
|
item.ts = unix_time_format(item.ts); |
|
|
|
}); |
|
|
|
if (Object.prototype.hasOwnProperty.call(tables, "errors")) { |
|
|
|
updateErrorsTable(tables, data); |
|
|
|
tables.errors.rows.load(rows); |
|
|
|
} else { |
|
|
|
initErrorsTable(tables, data); |
|
|
|
initErrorsTable(tables, rows); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |