Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added show on map button to service view
- Loading branch information
Nicolai Buchwitz
committed
Feb 21, 2018
1 parent
216eba4
commit 539791f
Showing
2 changed files
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace Icinga\Module\Map\ProvidedHook\Monitoring; | ||
|
||
use Icinga\Module\Monitoring\Hook\ServiceActionsHook; | ||
use Icinga\Module\Monitoring\Object\Service; | ||
use Icinga\Web\Url; | ||
|
||
class ServiceActions extends ServiceActionsHook | ||
{ | ||
public function getActionsForService(Service $service) | ||
{ | ||
$actions = []; | ||
|
||
$service->fetchCustomvars(); | ||
if (array_key_exists("geolocation", $service->customvars)) { | ||
$actions[t("Show on map")] = Url::fromPath('map/', | ||
array('showHost' => $service->host_name . "!" . $service->getName())); | ||
} | ||
|
||
return $actions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<?php | ||
|
||
$this->provideHook('monitoring/HostActions'); | ||
$this->provideHook('monitoring/ServiceActions'); | ||
$this->provideHook('cube/Actions', 'CubeLinks'); |