Show Alert Count on Widget (#12503)

* Show Alert Count on Widget

* update query
This commit is contained in:
SourceDoctor
2021-02-12 02:28:59 +01:00
committed by GitHub
parent e876299f09
commit 4efb71e679

View File

@@ -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());
}