From 2c8719723bb5ee33c77f50c87a1d429696e085fa Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 10 Dec 2019 14:49:34 +0100 Subject: [PATCH] QuickActions: Add action to submit passive check results --- library/Icingadb/Common/HostLinks.php | 5 +++++ library/Icingadb/Common/ServiceLinks.php | 7 +++++++ library/Icingadb/Widget/Detail/QuickActions.php | 9 +++++++++ 3 files changed, 21 insertions(+) diff --git a/library/Icingadb/Common/HostLinks.php b/library/Icingadb/Common/HostLinks.php index d390ef7b..30f0f861 100644 --- a/library/Icingadb/Common/HostLinks.php +++ b/library/Icingadb/Common/HostLinks.php @@ -67,6 +67,11 @@ abstract class HostLinks return Url::fromPath('icingadb/host/send-custom-notification', ['name' => $host->name]); } + public static function processCheckresult(Host $host) + { + return Url::fromPath('icingadb/host/process-checkresult', ['name' => $host->name]); + } + public static function services(Host $host) { return Url::fromPath('icingadb/host/services', ['name' => $host->name]); diff --git a/library/Icingadb/Common/ServiceLinks.php b/library/Icingadb/Common/ServiceLinks.php index ce2043c4..2e79d8c0 100644 --- a/library/Icingadb/Common/ServiceLinks.php +++ b/library/Icingadb/Common/ServiceLinks.php @@ -91,4 +91,11 @@ abstract class ServiceLinks 'icingadb/service/send-custom-notification', ['name' => $service->name, 'host.name' => $host->name] ); } + + public static function processCheckresult(Service $service, Host $host) + { + return Url::fromPath( + 'icingadb/service/process-checkresult', ['name' => $service->name, 'host.name' => $host->name] + ); + } } diff --git a/library/Icingadb/Widget/Detail/QuickActions.php b/library/Icingadb/Widget/Detail/QuickActions.php index a611f640..f74f8665 100644 --- a/library/Icingadb/Widget/Detail/QuickActions.php +++ b/library/Icingadb/Widget/Detail/QuickActions.php @@ -105,6 +105,15 @@ class QuickActions extends BaseHtmlElement 'Schedule the next active check at a different time than the current one' ); } + + if ($this->getAuth()->hasPermission('monitoring/command/process-check-result')) { + $this->assembleAction( + 'processCheckresult', + 'Process check result', + 'icon-edit', + sprintf('Submit a one time or so called passive result for the %s check', $this->object->checkcommand) + ); + } } protected function assembleAction($action, $label, $icon, $title)