QuickActions: Add action to reschedule checks

This commit is contained in:
Johannes Meyer 2019-12-10 14:48:54 +01:00
parent d577153eed
commit bc351a5122
3 changed files with 27 additions and 0 deletions

View file

@ -22,6 +22,11 @@ abstract class HostLinks
return Url::fromPath('icingadb/host/check-now', ['name' => $host->name]);
}
public static function scheduleCheck(Host $host)
{
return Url::fromPath('icingadb/host/schedule-check', ['name' => $host->name]);
}
public static function cancelDowntime(Host $host)
{
return Url::fromPath('icingadb/host/delete-downtime', ['name' => $host->name]);

View file

@ -29,6 +29,13 @@ abstract class ServiceLinks
);
}
public static function scheduleCheck(Service $service, Host $host)
{
return Url::fromPath(
'icingadb/service/schedule-check', ['name' => $service->name, 'host.name' => $host->name]
);
}
public static function cancelDowntime(Service $service, Host $host)
{
return Url::fromPath(

View file

@ -90,6 +90,21 @@ class QuickActions extends BaseHtmlElement
'Schedule a downtime to suppress all problem notifications within a specific period of time'
);
}
if (
$this->getAuth()->hasPermission('monitoring/command/schedule-check')
|| (
$this->object->active_checks_enabled
&& $this->getAuth()->hasPermission('monitoring/command/schedule-check/active-only')
)
) {
$this->assembleAction(
'scheduleCheck',
'Reschedule',
'icon-calendar-empty',
'Schedule the next active check at a different time than the current one'
);
}
}
protected function assembleAction($action, $label, $icon, $title)