@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | { |
| 43 | 43 | return $this->datatables |
| 44 | 44 | ->eloquent($this->query()) |
| 45 | - ->editColumn('device.hostname', function ($eventlog) { |
|
| 45 | + ->editColumn('device.hostname', function($eventlog) { |
|
| 46 | 46 | $hostname = is_null($eventlog->device) ? trans('devices.text.deleted') : $eventlog->device->hostname; |
| 47 | 47 | return '<a href="'.url("devices/".$eventlog->device_id).'">'.$hostname.'</a>'; |
| 48 | 48 | }) |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | */ |
| 106 | 106 | public function getAjax() |
| 107 | 107 | { |
| 108 | - return url('eventlog?device_id=' . $this->device_id); |
|
| 108 | + return url('eventlog?device_id='.$this->device_id); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | public function forDevice($device_id) |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | { |
| 40 | 40 | return $this->datatables |
| 41 | 41 | ->eloquent($this->query()) |
| 42 | - ->editColumn('device.hostname', function ($inventory) { |
|
| 42 | + ->editColumn('device.hostname', function($inventory) { |
|
| 43 | 43 | $hostname = is_null($inventory->device) ? trans('devices.text.deleted') : $inventory->device->hostname; |
| 44 | 44 | return '<a href="'.url("devices/".$inventory->device_id).'">'.$hostname.'</a>'; |
| 45 | 45 | }) |
@@ -41,21 +41,21 @@ |
||
| 41 | 41 | { |
| 42 | 42 | return $this->datatables |
| 43 | 43 | ->eloquent($this->query()) |
| 44 | - ->editColumn('hostname', function ($data) { |
|
| 44 | + ->editColumn('hostname', function($data) { |
|
| 45 | 45 | $hostname = is_null($data->device) ? trans('devices.text.deleted') : $data->device->hostname; |
| 46 | 46 | return '<a href="'.url("devices/".$data->device_id).'">'.$hostname.'</a>'; |
| 47 | 47 | }) |
| 48 | - ->editColumn('ifName', function ($data) { |
|
| 48 | + ->editColumn('ifName', function($data) { |
|
| 49 | 49 | $ifName = is_null($data->ifName) ? trans('devices.text.deleted') : $data->ifName; |
| 50 | 50 | return '<a href="'.url("devices/".$data->device_id."/ports/".$data->port_id).'">'.$ifName.'</a>'; |
| 51 | 51 | }) |
| 52 | - ->addColumn('remote_device', function ($data) { |
|
| 52 | + ->addColumn('remote_device', function($data) { |
|
| 53 | 53 | $remote_device = IPv4::where('ipv4_addresses.ipv4_address', $data->ipv4_address)->with('port.device')->first(); |
| 54 | 54 | $remote_id = empty($remote_device->port->device->device_id) ? '' : $remote_device->port->device->device_id; |
| 55 | 55 | $remote_hostname = empty($remote_device->port->device->hostname) ? trans('devices.text.deleted') : $remote_device->port->device->hostname; |
| 56 | 56 | return '<a href="'.url("devices/".$remote_id).'">'.$remote_hostname.'</a>'; |
| 57 | 57 | }) |
| 58 | - ->addColumn('remote_interface', function ($data) { |
|
| 58 | + ->addColumn('remote_interface', function($data) { |
|
| 59 | 59 | $remote_device = IPv4::where('ipv4_addresses.ipv4_address', $data->ipv4_address)->with('port.device')->first(); |
| 60 | 60 | $remote_id = empty($remote_device->port->device->device_id) ? '' : $remote_device->port->device->device_id; |
| 61 | 61 | $remote_port_id = empty($remote_device->port->port_id) ? '' : $remote_device->port->port_id; |
@@ -39,10 +39,10 @@ |
||
| 39 | 39 | { |
| 40 | 40 | return $this->datatables |
| 41 | 41 | ->eloquent($this->query()) |
| 42 | - ->editColumn('level', function ($user) { |
|
| 42 | + ->editColumn('level', function($user) { |
|
| 43 | 43 | return trans('user.level.'.$user->level); |
| 44 | 44 | }) |
| 45 | - ->editColumn('actions', function ($user) { |
|
| 45 | + ->editColumn('actions', function($user) { |
|
| 46 | 46 | $edit = '<a type="button" class="btn btn-xs btn-primary" href="'. |
| 47 | 47 | route('users.edit', ['user_id' => $user->user_id]). |
| 48 | 48 | '"><i class="fa fa-edit fa-lg fa-fw"></i><span class="hidden-xs"> '.trans('button.edit').'</span></a> '; |
@@ -40,11 +40,11 @@ |
||
| 40 | 40 | { |
| 41 | 41 | return $this->datatables |
| 42 | 42 | ->eloquent($this->query()) |
| 43 | - ->editColumn('hostname', function ($data) { |
|
| 43 | + ->editColumn('hostname', function($data) { |
|
| 44 | 44 | $hostname = is_null($data->device) ? trans('devices.text.deleted') : $data->device->hostname; |
| 45 | 45 | return '<a href="'.url("devices/".$data->device_id).'">'.$hostname.'</a>'; |
| 46 | 46 | }) |
| 47 | - ->editColumn('ifName', function ($data) { |
|
| 47 | + ->editColumn('ifName', function($data) { |
|
| 48 | 48 | $ifName = is_null($data->ifName) ? trans('devices.text.deleted') : $data->ifName; |
| 49 | 49 | return '<a href="'.url("devices/".$data->device_id."/ports/".$data->port_id).'">'.$ifName.'</a>'; |
| 50 | 50 | }) |
@@ -39,18 +39,18 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | return $this->datatables |
| 41 | 41 | ->eloquent($this->query()) |
| 42 | - ->editColumn('device.hostname', function ($log) { |
|
| 42 | + ->editColumn('device.hostname', function($log) { |
|
| 43 | 43 | $hostname = is_null($log->device) ? trans('devices.text.deleted') : $log->device->hostname; |
| 44 | 44 | return '<a href="'.url("devices/".$log->device_id).'">'.$hostname.'</a>'; |
| 45 | 45 | }) |
| 46 | - ->editColumn('rule.name', function ($log) { |
|
| 46 | + ->editColumn('rule.name', function($log) { |
|
| 47 | 47 | if ($log->rule_id) { |
| 48 | 48 | return '<a href="'.url("alerting/rules/".$log->rule_id).'">'.$log->rule->name.'</a>'; |
| 49 | 49 | } else { |
| 50 | 50 | return trans('alerting.general.text.invalid'); |
| 51 | 51 | } |
| 52 | 52 | }) |
| 53 | - ->editColumn('state', function ($log) { |
|
| 53 | + ->editColumn('state', function($log) { |
|
| 54 | 54 | $icon = ''; |
| 55 | 55 | $colour = ''; |
| 56 | 56 | $text = ''; |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | return '<b><span class="fa fa-'.$icon.'" style="color:'.$colour.'"></span> '.$text.'</b>'; |
| 79 | 79 | }) |
| 80 | - ->editColumn('time_logged', function ($log) { |
|
| 80 | + ->editColumn('time_logged', function($log) { |
|
| 81 | 81 | return date('Y-m-d H:i:s', $log->time_logged / 1000); |
| 82 | 82 | }) |
| 83 | 83 | ->make(true); |
@@ -46,7 +46,8 @@ discard block |
||
| 46 | 46 | ->editColumn('rule.name', function ($log) { |
| 47 | 47 | if ($log->rule_id) { |
| 48 | 48 | return '<a href="'.url("alerting/rules/".$log->rule_id).'">'.$log->rule->name.'</a>'; |
| 49 | - } else { |
|
| 49 | + } |
|
| 50 | + else { |
|
| 50 | 51 | return trans('alerting.general.text.invalid'); |
| 51 | 52 | } |
| 52 | 53 | }) |
@@ -58,19 +59,23 @@ discard block |
||
| 58 | 59 | $icon = 'check'; |
| 59 | 60 | $colour = 'green'; |
| 60 | 61 | $text = trans('alerting.logs.text.ok'); |
| 61 | - } elseif ($log->state == 1) { |
|
| 62 | + } |
|
| 63 | + elseif ($log->state == 1) { |
|
| 62 | 64 | $icon = 'times'; |
| 63 | 65 | $colour = 'red'; |
| 64 | 66 | $text = trans('alerting.logs.text.fail'); |
| 65 | - } elseif ($log->state == 2) { |
|
| 67 | + } |
|
| 68 | + elseif ($log->state == 2) { |
|
| 66 | 69 | $icon = 'volume-off'; |
| 67 | 70 | $colour = 'lightgrey'; |
| 68 | 71 | $text = trans('alerting.logs.text.ack'); |
| 69 | - } elseif ($log->state == 3) { |
|
| 72 | + } |
|
| 73 | + elseif ($log->state == 3) { |
|
| 70 | 74 | $icon = 'arrow-down'; |
| 71 | 75 | $colour = 'orange'; |
| 72 | 76 | $text = trans('alerting.logs.text.worse'); |
| 73 | - } elseif ($log->state == 4) { |
|
| 77 | + } |
|
| 78 | + elseif ($log->state == 4) { |
|
| 74 | 79 | $icon = 'arrow-up'; |
| 75 | 80 | $colour = 'khaki'; |
| 76 | 81 | $text = trans('alerting.logs.text.better'); |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | @else |
| 50 | 50 | <div class="label label-default">UNKNOWN</div> |
| 51 | 51 | @endif') |
| 52 | - ->editColumn('rule.name', function ($alert) { |
|
| 52 | + ->editColumn('rule.name', function($alert) { |
|
| 53 | 53 | return '<a href="'.url("alerting/rules/".$alert->rule_id).'">'.$alert->rule->name.'</a>'; |
| 54 | 54 | }) |
| 55 | - ->editColumn('device.hostname', function ($alert) { |
|
| 55 | + ->editColumn('device.hostname', function($alert) { |
|
| 56 | 56 | $hostname = is_null($alert->device) ? trans('devices.text.deleted') : $alert->device->hostname; |
| 57 | 57 | return '<a href="'.url("devices/".$alert->device_id).'">'.$hostname.'</a>'; |
| 58 | 58 | }) |
| 59 | - ->addColumn('actions', function ($alert) { |
|
| 59 | + ->addColumn('actions', function($alert) { |
|
| 60 | 60 | if ($alert->state == 2) { |
| 61 | 61 | $btn = "btn-danger"; |
| 62 | 62 | $icon = "volume-off"; |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | return '<a id="alerts-ack" data-id="'.$alert->id.'" data-state="'.$alert->state.'" class="btn btn-xs '.$btn.'"><i class="fa fa-'.$icon.' fa-fw"></i></a>'; |
| 68 | 68 | }) |
| 69 | - ->editColumn('rule.severity', function ($alert) { |
|
| 69 | + ->editColumn('rule.severity', function($alert) { |
|
| 70 | 70 | return $alert->rule->severity; |
| 71 | 71 | }) |
| 72 | 72 | ->make(true); |
@@ -102,7 +102,8 @@ |
||
| 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 | } |
@@ -38,33 +38,33 @@ |
||
| 38 | 38 | { |
| 39 | 39 | return $this->datatables |
| 40 | 40 | ->eloquent($this->query()) |
| 41 | - ->editColumn('status_reason', function ($device) { |
|
| 41 | + ->editColumn('status_reason', function($device) { |
|
| 42 | 42 | if ($device->status == 0) { |
| 43 | 43 | return '<span data-toggle="tooltip" title="down" class="device-status label label-danger">'.$device->status_reason.'</span>'; |
| 44 | 44 | } else { |
| 45 | 45 | return '<span data-toggle="tooltip" title="up" class="device-status label label-success">up</span>'; |
| 46 | 46 | } |
| 47 | 47 | }) |
| 48 | - ->editColumn('vendor', function ($device) { |
|
| 48 | + ->editColumn('vendor', function($device) { |
|
| 49 | 49 | return '<img src="'.$device->logo().'" border="0" alt="'.$device->os.'">'; |
| 50 | 50 | }) |
| 51 | - ->editColumn('hostname', function ($device) { |
|
| 51 | + ->editColumn('hostname', function($device) { |
|
| 52 | 52 | $hostname = is_null($device) ? trans('devices.text.deleted') : $device->hostname; |
| 53 | 53 | return '<a href="'.url("devices/".$device->device_id).'">'.$hostname.'</a>'; |
| 54 | 54 | }) |
| 55 | - ->editColumn('resources', function ($device) { |
|
| 55 | + ->editColumn('resources', function($device) { |
|
| 56 | 56 | $ports = $device->ports()->count(); |
| 57 | 57 | $sensors = $device->sensors()->count(); |
| 58 | 58 | return '<span data-toggle="tooltip" title="'.$ports.' Ports" class="badge bg-light-blue"><i class="fa fa-link"></i> '.$ports.'</span><br /> |
| 59 | 59 | <span data-toggle="tooltip" title="'.$sensors.' Sensors" class="badge bg-light-blue"><i class="fa fa-dashboard"></i> '.$sensors.'</span>'; |
| 60 | 60 | }) |
| 61 | - ->editColumn('hardware', function ($device) { |
|
| 61 | + ->editColumn('hardware', function($device) { |
|
| 62 | 62 | return $device->hardware.'<br />'.$device->features; |
| 63 | 63 | }) |
| 64 | - ->editColumn('os', function ($device) { |
|
| 64 | + ->editColumn('os', function($device) { |
|
| 65 | 65 | return ucfirst($device->os).'<br />'.$device->version; |
| 66 | 66 | }) |
| 67 | - ->editColumn('location', function ($device) { |
|
| 67 | + ->editColumn('location', function($device) { |
|
| 68 | 68 | return $device->formatUptime($device->uptime).'<br />'.$device->location; |
| 69 | 69 | }) |
| 70 | 70 | ->make(true); |
@@ -102,7 +102,8 @@ |
||
| 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 | } |
@@ -38,14 +38,14 @@ |
||
| 38 | 38 | { |
| 39 | 39 | return $this->datatables |
| 40 | 40 | ->eloquent($this->query()) |
| 41 | - ->editColumn('name', function ($group) { |
|
| 41 | + ->editColumn('name', function($group) { |
|
| 42 | 42 | return '<a href="'.url('devices/group='.$group->id).'">'.$group->name.'</a>'; |
| 43 | 43 | }) |
| 44 | - ->editColumn('count', function ($group) { |
|
| 44 | + ->editColumn('count', function($group) { |
|
| 45 | 45 | return '<span data-toggle="tooltip" title="'.$group->deviceCount.' '.trans('nav.devices.devices').'" class="badge bg-aqua"> |
| 46 | 46 | <i class="fa fa-server"></i> '.$group->deviceCount.'</span>'; |
| 47 | 47 | }) |
| 48 | - ->addColumn('actions', function ($group) { |
|
| 48 | + ->addColumn('actions', function($group) { |
|
| 49 | 49 | $edit = '<button type="button" class="btn btn-xs btn-primary showModal" data-toggle="modal" data-target="#generalModal" data-href="'. |
| 50 | 50 | route('device-groups.edit', ['group_id' => $group->id]). |
| 51 | 51 | '"><i class="fa fa-edit fa-lg fa-fw"></i><span class="hidden-xs"> '.trans('button.edit').'</span></button> '; |