]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Use consistent object key/value spacing
authormoisseev <moiseev@mezonplus.ru>
Mon, 20 Nov 2023 10:40:08 +0000 (13:40 +0300)
committermoisseev <moiseev@mezonplus.ru>
Mon, 20 Nov 2023 10:40:08 +0000 (13:40 +0300)
.eslintrc.json
interface/js/app/graph.js
interface/js/app/history.js
interface/js/app/rspamd.js
interface/js/app/stats.js
interface/js/app/symbols.js
interface/js/app/upload.js
interface/js/main.js

index a8cc237e09458cb5c16bc459c3ad621313c0955a..3a7eb3f0b90a4b27d6bf233503bdbeb1b2581b41 100644 (file)
@@ -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"
     }
 }
index 154317fd794f104774c77110994adb6491934de0..ea330aef699b0617044718380accd1594cde8062 100644 (file)
@@ -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, <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.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}
             });
         };
 
index 66e94a989c1c031779585151e19160380c874e52..5d5b9068ef0335d2edb3747d9e1851f76122cc5a 100644 (file)
@@ -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: {
index ed732449de3eeb3eb89c474a1110a5ac71ab6f3a..ac9f1f23b21982469d0fcea00566e7140c83d7fb 100644 (file)
@@ -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(",&#8203;") + 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) {
index e6b7bc89759ed72feb2f4201f9c5e2ca03842ed3..8fa58042182cb64fa1d58c9cffd03f9f27701fb1 100644 (file)
@@ -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) {
index df3d28fad1bc13304aff749b2515626bb2b0f389..7267d0ed9a97de95280a8b964b1b536f1fbe643c 100644 (file)
@@ -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: {
index 3800ca23fc1224ea182d75d988ce2ab11d7c5dda..01031c4a0ba03d194f179c96d24aaace21d5d6b8 100644 (file)
@@ -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;
         });
 
index 4bc488895df8a1491b26e2a3be9ffb6ab07813c2..1d5ec5c3c99b62d4052f95ce3c553170a17c8152 100644 (file)
@@ -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,
 });