From: moisseev Date: Mon, 20 Nov 2023 10:40:08 +0000 (+0300) Subject: [Minor] Use consistent object key/value spacing X-Git-Tag: 3.8.0~55^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=01d048664f1e5e164babd718a088c36e2bd10e7c;p=rspamd.git [Minor] Use consistent object key/value spacing --- diff --git a/.eslintrc.json b/.eslintrc.json index a8cc237e0..3a7eb3f0b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -20,9 +20,6 @@ "func-names": "off", // "func-style": ["error", "declaration"], "id-length": ["error", { "min": 1 }], - // "@stylistic/key-spacing": ["error", { - // "singleLine": { "afterColon": false } - // }], "line-comment-position": "off", "logical-assignment-operators": ["error", "never"], "max-params": ["warn", 6], @@ -77,7 +74,6 @@ "sort-vars": "off", "@stylistic/function-paren-newline": "off", - "@stylistic/key-spacing": "off", "@stylistic/one-var-declaration-per-line": "off" } } diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js index 154317fd7..ea330aef6 100644 --- a/interface/js/app/graph.js +++ b/interface/js/app/graph.js @@ -132,12 +132,12 @@ define(["jquery", "app/rspamd", "d3evolution", "d3pie", "d3", "footable"], enabled: true }, columns: [ - {name:"label", title:"Action"}, - {name:"value", title:"Messages", defaultContent:""}, - {name:"min", title:"Minimum, " + unit + "", defaultContent:""}, - {name:"avg", title:"Average, " + unit + "", defaultContent:""}, - {name:"max", title:"Maximum, " + unit + "", defaultContent:""}, - {name:"last", title:"Last, " + unit}, + {name: "label", title: "Action"}, + {name: "value", title: "Messages", defaultContent: ""}, + {name: "min", title: "Minimum, " + unit + "", defaultContent: ""}, + {name: "avg", title: "Average, " + unit + "", defaultContent: ""}, + {name: "max", title: "Maximum, " + unit + "", defaultContent: ""}, + {name: "last", title: "Last, " + unit}, ], rows: rows.map(function (curr, i) { return { @@ -163,7 +163,7 @@ define(["jquery", "app/rspamd", "d3evolution", "d3pie", "d3", "footable"], } function updateWidgets(data) { - let rrd_summary = {rows:[]}; + let rrd_summary = {rows: []}; let unit = "msg/s"; if (data) { @@ -241,7 +241,7 @@ define(["jquery", "app/rspamd", "d3evolution", "d3pie", "d3", "footable"], complete: function () { $("#refresh").removeAttr("disabled").removeClass("disabled"); }, errorMessage: "Cannot receive throughput data", errorOnceId: "alerted_graph_", - data: {type:type} + data: {type: type} }); }; diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 66e94a989..5d5b9068e 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -59,7 +59,7 @@ define(["jquery", "app/rspamd", "d3", "footable"], items.push(item); }); - return {items:items}; + return {items: items}; } function columns_v2() { @@ -382,22 +382,23 @@ define(["jquery", "app/rspamd", "d3", "footable"], function initErrorsTable(rows) { rspamd.tables.errors = FooTable.init("#errorsLog", { columns: [ - { - sorted: true, + {sorted: true, direction: "DESC", name: "ts", title: "Time", style: {"font-size": "11px", "width": 300, "maxWidth": 300}, - sortValue: function (val) { return Number(val.options.sortValue); } - }, - {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"}}, - {name:"id", title:"Internal ID", style:{"font-size":"11px"}}, - {name:"message", title:"Message", breakpoints:"xs sm", style:{"font-size":"11px"}}, + sortValue: function (val) { return Number(val.options.sortValue); }}, + {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"}}, + {name: "id", title: "Internal ID", style: {"font-size": "11px"}}, + {name: "message", title: "Message", breakpoints: "xs sm", style: {"font-size": "11px"}}, ], rows: rows, paging: { diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index ed732449d..ac9f1f23b 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -339,7 +339,7 @@ function ($, NProgress) { $("#preloader").addClass("d-none"); $("#navBar, #mainUI").removeClass("d-none"); - $(".nav-tabs-sticky").stickyTabs({initialTab:"#status_nav"}); + $(".nav-tabs-sticky").stickyTabs({initialTab: "#status_nav"}); }, errorMessage: "Cannot get server status", server: "All SERVERS" @@ -366,7 +366,7 @@ function ($, NProgress) { const 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 () { const xhr = $.ajaxSettings.xhr(); @@ -853,7 +853,7 @@ function ($, NProgress) { 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}; } function get_symbol_class(name, score) { @@ -920,7 +920,7 @@ function ($, NProgress) { items.push(item); }); - return {items:items, symbols:unsorted_symbols}; + return {items: items, symbols: unsorted_symbols}; }; ui.waitForRowsDisplayed = function (table, rows_total, callback, iteration) { diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js index e6b7bc897..8fa580421 100644 --- a/interface/js/app/stats.js +++ b/interface/js/app/stats.js @@ -315,7 +315,7 @@ define(["jquery", "app/rspamd", "d3pie", "d3"], const alerted = "alerted_stats_legacy_" + neighbours_status[e].name; promises.push($.ajax({ url: neighbours_status[e].url + "auth", - headers: {Password:rspamd.getPassword()}, + headers: {Password: rspamd.getPassword()}, success: function (data) { sessionStorage.removeItem(alerted); ["config_id", "version", "uptime"].forEach(function (p) { diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index df3d28fad..7267d0ed9 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -197,17 +197,17 @@ define(["jquery", "app/rspamd", "footable"], rspamd.tables.symbols = FooTable.init("#symbolsTable", { columns: [ - {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:"time", title:"Avg. time", breakpoints:"xs sm", style:{"font-size":"11px"}}, - {name:"save", title:"Save", 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: "time", title: "Avg. time", breakpoints: "xs sm", style: {"font-size": "11px"}}, + {name: "save", title: "Save", style: {"font-size": "11px"}}, ], rows: items[0], paging: { diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js index 3800ca23f..01031c4a0 100644 --- a/interface/js/app/upload.js +++ b/interface/js/app/upload.js @@ -171,7 +171,7 @@ define(["jquery", "app/rspamd"], rspamd.alertMessage("alert-success", "Data successfully scanned"); const rows_total = $("#historyTable_scan > tbody > tr:not(.footable-detail-row)").length + 1; - const o = rspamd.process_history_v2({rows:[json]}, "scan"); + const o = rspamd.process_history_v2({rows: [json]}, "scan"); const items = o.items; rspamd.symbols.scan.push(o.symbols[0]); @@ -269,7 +269,7 @@ define(["jquery", "app/rspamd"], $("#scanForm")[0].reset(); $("#scanResult").hide(); $("#scanOutput tbody").remove(); - $("html, body").animate({scrollTop:0}, 1000); + $("html, body").animate({scrollTop: 0}, 1000); return false; }); diff --git a/interface/js/main.js b/interface/js/main.js index 4bc488895..1d5ec5c3c 100644 --- a/interface/js/main.js +++ b/interface/js/main.js @@ -20,17 +20,17 @@ requirejs.config({ stickytabs: "jquery.stickytabs.min" }, shim: { - app: {deps:["jquery"]}, - codejar: {exports: "CodeJar", deps:["linenumbers"]}, - bootstrap: {exports:"bootstrap", deps:["jquery"]}, // Popovers require jQuery - d3: {exports:"d3"}, - d3evolution: {exports:"D3Evolution", deps:["d3.global", "jquery"]}, - d3pie: {exports:"D3Pie", deps:["d3.global", "jquery"]}, - fontawesome: {exports: "FontAwesome", deps:["fontawesome_solid"]}, - footable: {deps:["bootstrap", "jquery"]}, - linenumbers: {exports: "withLineNumbers", deps:["prism"]}, + app: {deps: ["jquery"]}, + codejar: {exports: "CodeJar", deps: ["linenumbers"]}, + bootstrap: {exports: "bootstrap", deps: ["jquery"]}, // Popovers require jQuery + d3: {exports: "d3"}, + d3evolution: {exports: "D3Evolution", deps: ["d3.global", "jquery"]}, + d3pie: {exports: "D3Pie", deps: ["d3.global", "jquery"]}, + fontawesome: {exports: "FontAwesome", deps: ["fontawesome_solid"]}, + footable: {deps: ["bootstrap", "jquery"]}, + linenumbers: {exports: "withLineNumbers", deps: ["prism"]}, prism: {exports: "Prism"}, - stickytabs: {deps:["jquery"]} + stickytabs: {deps: ["jquery"]} }, waitSeconds: 30, });