mirror of
https://github.com/librenms/librenms.git
synced 2024-09-21 18:38:25 +00:00
Priority filtering for syslog widget (#13134)
* Update SyslogController.php * Update SyslogController.php * Update syslog.blade.php * Update syslog.blade.php * Update web.php * Create PriorityController.php * Update SyslogController.php * Update SyslogController.php * changed priority controller to static list * Update PriorityController.php * Update PriorityController.php * Update PriorityController.php * using static list directly with standard select box without backend logic * removed not required if statement avoided array_flip by flipping foreach arguments
This commit is contained in:
parent
d6fee82e1a
commit
1de372ca1b
@ -37,6 +37,7 @@ class SyslogController extends TableController
|
||||
'priority' => 'nullable|string',
|
||||
'to' => 'nullable|date',
|
||||
'from' => 'nullable|date',
|
||||
'level' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
|
||||
@ -77,6 +78,9 @@ class SyslogController extends TableController
|
||||
})
|
||||
->when($request->to, function ($query) use ($request) {
|
||||
$query->where('timestamp', '<=', $request->to);
|
||||
})
|
||||
->when($request->level, function ($query) use ($request) {
|
||||
$query->where('level', '<=', $request->level);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,7 @@ class SyslogController extends WidgetController
|
||||
'device' => null,
|
||||
'device_group' => null,
|
||||
'hidenavigation' => 0,
|
||||
'level' => null,
|
||||
];
|
||||
|
||||
public function getSettingsView(Request $request)
|
||||
@ -43,6 +44,8 @@ class SyslogController extends WidgetController
|
||||
|
||||
$data['device'] = Device::hasAccess($request->user())->find($data['device']);
|
||||
|
||||
$data['priorities'] = app('translator')->get('syslog.severity');
|
||||
|
||||
return view('widgets.settings.syslog', $data);
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,14 @@
|
||||
<label for="hidenavigation-{{ $id }}" class="control-label">@lang('Hide Navigation')</label>
|
||||
<input type="checkbox" class="form-control" name="hidenavigation" id="hidenavigation-{{ $id }}" value="{{ $hidenavigation }}" data-size="normal" @if($hidenavigation) checked @endif>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="level-{{ $id }}" class="control-label">@lang('Priority')</label>
|
||||
<select class="form-control" name="level" id="level-{{ $id }}">
|
||||
@foreach($priorities as $val => $name)
|
||||
<option value="{{ $val }}" @if($level == $val) selected @endif>{{ $name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@section('javascript')
|
||||
|
@ -22,7 +22,8 @@
|
||||
{
|
||||
return {
|
||||
device: '{{ $device ?: '' }}',
|
||||
device_group: '{{ $device_group }}'
|
||||
device_group: '{{ $device_group }}',
|
||||
level: '{{ $level }}'
|
||||
};
|
||||
},
|
||||
url: "{{ url('/ajax/table/syslog') }}"
|
||||
|
Loading…
Reference in New Issue
Block a user