mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Show Alert Count on Widget (#12503)
* Show Alert Count on Widget * update query
This commit is contained in:
@@ -24,7 +24,9 @@
|
||||
|
||||
namespace App\Http\Controllers\Widgets;
|
||||
|
||||
use App\Models\Alert;
|
||||
use Illuminate\Http\Request;
|
||||
use LibreNMS\Enum\AlertState;
|
||||
|
||||
class AlertsController extends WidgetController
|
||||
{
|
||||
@@ -45,6 +47,12 @@ class AlertsController extends WidgetController
|
||||
|
||||
public function getView(Request $request)
|
||||
{
|
||||
$alert_count = Alert::where('state', '!=', AlertState::RECOVERED)->count();
|
||||
|
||||
if ($alert_count) {
|
||||
$this->title .= ' (' . $alert_count . ')';
|
||||
}
|
||||
|
||||
return view('widgets.alerts', $this->getSettings());
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user