Completed
Push — datatables-fix ( cee81d...f696ce )
by Tony
02:57
created
app/DataTables/Alerting/LogsDataTable.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 
26 26
 namespace App\DataTables\Alerting;
27 27
 
28
-use App\Models\Alerting\Alert;
29 28
 use App\Models\Alerting\Log;
30 29
 use Yajra\Datatables\Services\DataTable;
31 30
 
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -102,7 +102,8 @@
 block discarded – undo
102 102
             } catch(\Exception $e) {
103 103
                 if(starts_with($e->getMessage(), 'unserialize():')) {
104 104
                     return $value;
105
-                } else {
105
+                }
106
+                else {
106 107
                     throw $e;
107 108
                 }
108 109
             }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
                 return '<b><span class="fa fa-'.$icon.'" style="color:'.$colour.'"></span> '.$text.'</b>';
83 83
             })
84 84
             ->editColumn('time_logged', function($log) {
85
-                return date('Y-m-d H:i:s', $log->time_logged/1000);
85
+                return date('Y-m-d H:i:s', $log->time_logged / 1000);
86 86
             })
87 87
             ->make(true);
88 88
     }
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
      */
95 95
     public function query()
96 96
     {
97
-        $logs = Log::with('device','rule')->select('alert_log.*');
97
+        $logs = Log::with('device', 'rule')->select('alert_log.*');
98 98
         return $this->applyScopes($logs);
99 99
     }
100 100
 
Please login to merge, or discard this patch.
app/Http/Controllers/Alerting/StatsController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@
 block discarded – undo
38 38
      */
39 39
     public function index(Request $request)
40 40
     {
41
-        $data = Log::join('alert_rules', 'alert_rules.id', '=', 'alert_log.rule_id')->where('state', '!=', '0')->groupBy('time_logged')->groupBy('alert_rules.severity')->select('time_logged','alert_rules.severity',\DB::raw('COUNT(alert_log.id) as total'))->get();
41
+        $data = Log::join('alert_rules', 'alert_rules.id', '=', 'alert_log.rule_id')->where('state', '!=', '0')->groupBy('time_logged')->groupBy('alert_rules.severity')->select('time_logged', 'alert_rules.severity', \DB::raw('COUNT(alert_log.id) as total'))->get();
42 42
         $output = array();
43 43
         foreach ($data as $log) {
44 44
             $output[$log->severity]['label'] = $log->severity;
Please login to merge, or discard this patch.
app/Models/Alerting/Log.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@
 block discarded – undo
96 96
     public function getTimeLoggedAttribute($date)
97 97
     {
98 98
         if ($date) {
99
-            return strtotime($date)*1000;
99
+            return strtotime($date) * 1000;
100 100
         }
101 101
     }
102 102
 }
Please login to merge, or discard this patch.
app/Api/Controllers/General/EventlogController.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -27,7 +27,6 @@
 block discarded – undo
27 27
 
28 28
 use App\Api\Controllers\Controller;
29 29
 use App\Models\General\Eventlog;
30
-use App\Models\Alerting\Log;
31 30
 use Dingo\Api\Http;
32 31
 use Dingo\Api\Routing\Helpers;
33 32
 use Illuminate\Http\Request;
Please login to merge, or discard this patch.
app/DataTables/Alerting/AlertsDataTable.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@
 block discarded – undo
76 76
      */
77 77
     public function query()
78 78
     {
79
-        $alerts = Alert::active()->with('device','rule')->select('alerts.*');
79
+        $alerts = Alert::active()->with('device', 'rule')->select('alerts.*');
80 80
         return $this->applyScopes($alerts);
81 81
     }
82 82
 
Please login to merge, or discard this patch.