@@ -19,6 +19,9 @@ | |||
"id-length": ["error", { "min": 1 }], | |||
"indent": ["error", 4, { "SwitchCase": 1 }], | |||
// "max-len": ["error", { "code": 120 }], | |||
"key-spacing": ["error", { | |||
"singleLine": { "afterColon": false } | |||
}], | |||
"max-params": ["warn", 6], | |||
"max-statements": ["warn", 28], | |||
"max-statements-per-line": ["error", { "max": 2 }], | |||
@@ -58,7 +61,6 @@ | |||
"func-style": "off", | |||
"function-paren-newline": "off", | |||
"guard-for-in": "off", | |||
"key-spacing": "off", | |||
"line-comment-position": "off", | |||
"max-len": "off", | |||
"max-lines": "off", |
@@ -193,7 +193,7 @@ define(["jquery"], | |||
$("#modalTitle").html(item.uri); | |||
$("#" + item.map).first().show(); | |||
$("#modalDialog .progress").hide(); | |||
$("#modalDialog").modal({backdrop: true, keyboard: "show", show: true}); | |||
$("#modalDialog").modal({backdrop:true, keyboard:"show", show:true}); | |||
if (item.editable === false) { | |||
$("#modalSave").hide(); | |||
$("#modalSaveAll").hide(); | |||
@@ -227,7 +227,7 @@ define(["jquery"], | |||
headers: { | |||
Map: id, | |||
}, | |||
params:{ | |||
params: { | |||
data: data, | |||
dataType: "text", | |||
}, |
@@ -94,10 +94,10 @@ define(["jquery", "d3evolution", "footable"], | |||
function initGraph() { | |||
var graph = new D3Evolution("graph", $.extend({}, graph_options, { | |||
yScale: getSelector("selYScale"), | |||
type: getSelector("selType"), | |||
yScale: getSelector("selYScale"), | |||
type: getSelector("selType"), | |||
interpolate: getSelector("selInterpolate"), | |||
convert: getSelector("selConvert"), | |||
convert: getSelector("selConvert"), | |||
})); | |||
$("#selYScale").change(function () { | |||
graph.yScale(this.value); | |||
@@ -144,12 +144,12 @@ define(["jquery", "d3evolution", "footable"], | |||
enabled: true | |||
}, | |||
columns: [ | |||
{name: "label", title: "Action"}, | |||
{name: "value", title: "Messages", defaultContent: ""}, | |||
{name: "min", title: "Minimum, <span class=\"unit\">" + unit + "</span>", defaultContent: ""}, | |||
{name: "avg", title: "Average, <span class=\"unit\">" + unit + "</span>", defaultContent: ""}, | |||
{name: "max", title: "Maximum, <span class=\"unit\">" + unit + "</span>", defaultContent: ""}, | |||
{name: "last", title: "Last, " + unit}, | |||
{name:"label", title:"Action"}, | |||
{name:"value", title:"Messages", defaultContent:""}, | |||
{name:"min", title:"Minimum, <span class=\"unit\">" + unit + "</span>", defaultContent:""}, | |||
{name:"avg", title:"Average, <span class=\"unit\">" + unit + "</span>", defaultContent:""}, | |||
{name:"max", title:"Maximum, <span class=\"unit\">" + unit + "</span>", defaultContent:""}, | |||
{name:"last", title:"Last, " + unit}, | |||
], | |||
rows: rows | |||
}); | |||
@@ -257,7 +257,7 @@ define(["jquery", "d3evolution", "footable"], | |||
}, | |||
errorMessage: "Cannot receive throughput data", | |||
errorOnceId: "alerted_graph_", | |||
data: {type: type} | |||
data: {type:type} | |||
}); | |||
}; | |||
@@ -151,7 +151,7 @@ define(["jquery", "footable", "humanize"], | |||
full += item.rcpt_mime.join(", "); | |||
shrt += item.rcpt_mime.slice(0, rcpt_lim).join(",​") + more("rcpt_mime"); | |||
} | |||
return {full: full, shrt: shrt}; | |||
return {full:full, shrt:shrt}; | |||
} | |||
preprocess_item(item); | |||
@@ -511,36 +511,36 @@ define(["jquery", "footable", "humanize"], | |||
function initHistoryTable(rspamd, tables, data, items) { | |||
FooTable.actionFilter = FooTable.Filtering.extend({ | |||
construct : function (instance) { | |||
construct: function (instance) { | |||
this._super(instance); | |||
this.actions = ["reject", "add header", "greylist", | |||
"no action", "soft reject", "rewrite subject"]; | |||
this.def = "Any action"; | |||
this.$action = null; | |||
}, | |||
$create : function () { | |||
$create: function () { | |||
this._super(); | |||
var self = this, $form_grp = $("<div/>", { | |||
class : "form-group" | |||
class: "form-group" | |||
}).append($("<label/>", { | |||
class : "sr-only", | |||
text : "Action" | |||
class: "sr-only", | |||
text: "Action" | |||
})).prependTo(self.$form); | |||
self.$action = $("<select/>", { | |||
class : "form-control" | |||
class: "form-control" | |||
}).on("change", { | |||
self : self | |||
self: self | |||
}, self._onStatusDropdownChanged).append( | |||
$("<option/>", { | |||
text : self.def | |||
text: self.def | |||
})).appendTo($form_grp); | |||
$.each(self.actions, function (i, action) { | |||
self.$action.append($("<option/>").text(action)); | |||
}); | |||
}, | |||
_onStatusDropdownChanged : function (e) { | |||
_onStatusDropdownChanged: function (e) { | |||
var self = e.data.self, selected = $(this).val(); | |||
if (selected !== self.def) { | |||
if (selected === "reject") { | |||
@@ -553,7 +553,7 @@ define(["jquery", "footable", "humanize"], | |||
} | |||
self.filter(); | |||
}, | |||
draw : function () { | |||
draw: function () { | |||
this._super(); | |||
var action = this.find("action"); | |||
if (action instanceof FooTable.Filter) { | |||
@@ -705,7 +705,7 @@ define(["jquery", "footable", "humanize"], | |||
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}}, | |||
{sorted:true, direction:"DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}}, | |||
{name:"type", title:"Worker type", breakpoints:"xs sm", style:{"font-size":"11px", "width":150, "maxWidth":150}}, | |||
{name:"pid", title:"PID", breakpoints:"xs sm", style:{"font-size":"11px", "width":110, "maxWidth":110}}, | |||
{name:"module", title:"Module", style:{"font-size":"11px"}}, |
@@ -182,7 +182,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config, | |||
var req_params = { | |||
jsonp: false, | |||
data: o.data, | |||
headers: $.extend({Password: getPassword()}, o.headers), | |||
headers: $.extend({Password:getPassword()}, o.headers), | |||
url: neighbours_status[ind].url + req_url, | |||
xhr: function () { | |||
var xhr = $.ajaxSettings.xhr(); | |||
@@ -483,7 +483,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config, | |||
var data = json[0].data; | |||
if (jQuery.isEmptyObject(data)) { | |||
neighbours = { | |||
local: { | |||
local: { | |||
host: window.location.host, | |||
url: window.location.href | |||
} | |||
@@ -509,7 +509,7 @@ function ($, D3pie, visibility, NProgress, tab_stat, tab_graph, tab_config, | |||
if (o.server !== "local") { | |||
neighbours_status = [{ | |||
name: o.server, | |||
host: neighbours[o.server].host, | |||
host: neighbours[o.server].host, | |||
url: neighbours[o.server].url, | |||
}]; | |||
} |
@@ -139,30 +139,30 @@ define(["jquery", "d3pie", "humanize"], | |||
if (creds && creds[checked_server]) { | |||
var data = creds[checked_server].data; | |||
var new_data = [{ | |||
color : "#66CC00", | |||
label : "Clean", | |||
data : data.clean, | |||
value : data.clean | |||
color: "#66CC00", | |||
label: "Clean", | |||
data: data.clean, | |||
value: data.clean | |||
}, { | |||
color : "#BF8040", | |||
label : "Temporarily rejected", | |||
data : data.soft_reject, | |||
value : data.soft_reject | |||
color: "#BF8040", | |||
label: "Temporarily rejected", | |||
data: data.soft_reject, | |||
value: data.soft_reject | |||
}, { | |||
color : "#FFAD00", | |||
label : "Probable spam", | |||
data : data.probable, | |||
value : data.probable | |||
color: "#FFAD00", | |||
label: "Probable spam", | |||
data: data.probable, | |||
value: data.probable | |||
}, { | |||
color : "#436EEE", | |||
label : "Greylisted", | |||
data : data.greylist, | |||
value : data.greylist | |||
color: "#436EEE", | |||
label: "Greylisted", | |||
data: data.greylist, | |||
value: data.greylist | |||
}, { | |||
color : "#FF0000", | |||
label : "Rejected", | |||
data : data.reject, | |||
value : data.reject | |||
color: "#FF0000", | |||
label: "Rejected", | |||
data: data.reject, | |||
value: data.reject | |||
}]; | |||
return rspamd.drawPie(pie, "chart", new_data); |
@@ -149,35 +149,35 @@ define(["jquery", "footable"], | |||
var data = json[0].data; | |||
var items = process_symbols_data(data); | |||
FooTable.groupFilter = FooTable.Filtering.extend({ | |||
construct : function (instance) { | |||
construct: function (instance) { | |||
this._super(instance); | |||
this.groups = items[1]; | |||
this.def = "Any group"; | |||
this.$group = null; | |||
}, | |||
$create : function () { | |||
$create: function () { | |||
this._super(); | |||
var self = this, $form_grp = $("<div/>", { | |||
class : "form-group" | |||
class: "form-group" | |||
}).append($("<label/>", { | |||
class : "sr-only", | |||
text : "Group" | |||
class: "sr-only", | |||
text: "Group" | |||
})).prependTo(self.$form); | |||
self.$group = $("<select/>", { | |||
class : "form-control" | |||
class: "form-control" | |||
}).on("change", { | |||
self : self | |||
self: self | |||
}, self._onStatusDropdownChanged).append( | |||
$("<option/>", { | |||
text : self.def | |||
text: self.def | |||
})).appendTo($form_grp); | |||
$.each(self.groups, function (i, group) { | |||
self.$group.append($("<option/>").text(group)); | |||
}); | |||
}, | |||
_onStatusDropdownChanged : function (e) { | |||
_onStatusDropdownChanged: function (e) { | |||
var self = e.data.self, selected = $(this).val(); | |||
if (selected !== self.def) { | |||
self.addFilter("group", selected, ["group"]); | |||
@@ -186,7 +186,7 @@ define(["jquery", "footable"], | |||
} | |||
self.filter(); | |||
}, | |||
draw : function () { | |||
draw: function () { | |||
this._super(); | |||
var group = this.find("group"); | |||
if (group instanceof FooTable.Filter) { | |||
@@ -198,11 +198,11 @@ define(["jquery", "footable"], | |||
}); | |||
tables.symbols = FooTable.init("#symbolsTable", { | |||
columns: [ | |||
{sorted: true, direction: "ASC", name:"group", title:"Group", style:{"font-size":"11px"}}, | |||
{sorted:true, direction:"ASC", name:"group", title:"Group", style:{"font-size":"11px"}}, | |||
{name:"symbol", title:"Symbol", style:{"font-size":"11px"}}, | |||
{name:"description", title:"Description", breakpoints:"xs sm", style:{"font-size":"11px"}}, | |||
{name:"weight", title:"Score", style:{"font-size":"11px"}}, | |||
{name:"frequency", title:"Frequency", breakpoints:"xs sm", style:{"font-size":"11px"}, sortValue: function (value) { return Number(value).toFixed(2); }}, | |||
{name:"frequency", title:"Frequency", breakpoints:"xs sm", style:{"font-size":"11px"}, sortValue:function (value) { return Number(value).toFixed(2); }}, | |||
{name:"time", title:"Avg. time", breakpoints:"xs sm", style:{"font-size":"11px"}}, | |||
{name:"save", title:"Save", style:{"font-size":"11px"}}, | |||
], |
@@ -161,7 +161,7 @@ define(["jquery"], | |||
$("#scanTextSource").val(""); | |||
$("#scanResult").hide(); | |||
$("#scanOutput tbody").remove(); | |||
$("html, body").animate({scrollTop: 0}, 1000); | |||
$("html, body").animate({scrollTop:0}, 1000); | |||
return false; | |||
}); | |||
// @init upload |
@@ -15,10 +15,10 @@ requirejs.config({ | |||
nprogress: "nprogress.min", | |||
}, | |||
shim: { | |||
bootstrap: {exports: "bootstrap", deps: ["jquery"]}, | |||
d3pie: {exports: "d3pie", deps: ["d3.global", "jquery"]}, | |||
d3evolution: {exports: "D3Evolution", deps: ["d3", "jquery"]}, | |||
footable: {deps: ["bootstrap", "jquery"]} | |||
bootstrap: {exports:"bootstrap", deps:["jquery"]}, | |||
d3pie: {exports:"d3pie", deps:["d3.global", "jquery"]}, | |||
d3evolution: {exports:"D3Evolution", deps:["d3", "jquery"]}, | |||
footable: {deps:["bootstrap", "jquery"]} | |||
} | |||
}); | |||