linting

I'm a tab person but now it should look better

John Rallis committed Mar 30, 2023 at 15:10 UTC 1fcb9124b6c615bcfb5e72ad26c6c52e1c204308
1 file changed +39 -39
meshctrl.js
+39 -39
@@ -1704,37 +1704,37 @@ function serverConnect() {
1704 break;
1705 }
1706 case 'report': {
1707 - var reporttype = 1;
1708 - switch(args.type) {
1709 - case 'traffic':
1710 - reporttype = 2;
1711 - break;
1712 - case 'logins':
1713 - reporttype = 3;
1714 - break;
1715 - case 'db':
1716 - reporttype = 4;
1717 - break;
1718 - }
1719 -
1720 - var reportgroupby = 1;
1721 - if(args.groupby){
1722 - reportgroupby = args.groupby === 'device' ? 2 : args.groupby === 'day' ? 3: 1;
1723 - }
1724 -
1725 - var start = null, end = null;
1726 - if (args.start) {
1727 - start = Math.floor(Date.parse(args.start) / 1000);
1728 - } else {
1729 - start = reportgroupby === 3 ? Math.round(new Date().getTime() / 1000) - (168 * 3600) : Math.round(new Date().getTime() / 1000) - (24 * 3600);
1730 - }
1731 - if (args.end) {
1732 - end = Math.floor(Date.parse(args.end) / 1000);
1733 - } else {
1734 - end = Math.round(new Date().getTime() / 1000);
1735 - }
1736 - if (end <= start) { console.log("End time must be ahead of start time."); process.exit(1); return; }
1737 -
1707 + var reporttype = 1;
1708 + switch(args.type) {
1709 + case 'traffic':
1710 + reporttype = 2;
1711 + break;
1712 + case 'logins':
1713 + reporttype = 3;
1714 + break;
1715 + case 'db':
1716 + reporttype = 4;
1717 + break;
1718 + }
1719 +
1720 + var reportgroupby = 1;
1721 + if(args.groupby){
1722 + reportgroupby = args.groupby === 'device' ? 2 : args.groupby === 'day' ? 3: 1;
1723 + }
1724 +
1725 + var start = null, end = null;
1726 + if (args.start) {
1727 + start = Math.floor(Date.parse(args.start) / 1000);
1728 + } else {
1729 + start = reportgroupby === 3 ? Math.round(new Date().getTime() / 1000) - (168 * 3600) : Math.round(new Date().getTime() / 1000) - (24 * 3600);
1730 + }
1731 + if (args.end) {
1732 + end = Math.floor(Date.parse(args.end) / 1000);
1733 + } else {
1734 + end = Math.round(new Date().getTime() / 1000);
1735 + }
1736 + if (end <= start) { console.log("End time must be ahead of start time."); process.exit(1); return; }
1737 +
1738 ws.send(JSON.stringify({ action: 'report', type: reporttype, groupBy: reportgroupby, devGroup: args.devicegroup || null, start, end, tz: Intl.DateTimeFormat().resolvedOptions().timeZone, tf: new Date().getTimezoneOffset(), showTraffic: args.hasOwnProperty('showtraffic'), l: 'en', responseid: 'meshctrl' }));
1739 break;
1740 }
@@ -2304,15 +2304,15 @@ function serverConnect() {
2304 console.log(data.data);
2305 process.exit();
2306 }
2307 - case 'report': {
2308 - console.log('group,' + data.data.columns.flatMap(c => c.id).join(','));
2309 - Object.keys(data.data.groups).forEach(gk => {
2310 - data.data.groups[gk].entries.forEach(e => {
2311 - console.log(gk + ',' + Object.values(e).join(','));
2312 - });
2313 - });
2307 + case 'report': {
2308 + console.log('group,' + data.data.columns.flatMap(c => c.id).join(','));
2309 + Object.keys(data.data.groups).forEach(gk => {
2310 + data.data.groups[gk].entries.forEach(e => {
2311 + console.log(gk + ',' + Object.values(e).join(','));
2312 + });
2313 + });
2314 process.exit();
2315 - }
2315 + }
2316 default: { break; }
2317 }
2318 //console.log('Data', data);