HostController: details for external services...

...when clicking "Modify" in the monitoring module

fixes #1531
This commit is contained in:
Thomas Gelf 2020-10-27 01:18:18 +01:00
parent 1d384500aa
commit 213f897ffc
2 changed files with 31 additions and 4 deletions

View File

@ -117,14 +117,40 @@ class HostController extends ObjectController
*/
public function invalidserviceAction()
{
$this->content()->add(Hint::error(sprintf(
$this->translate('No such service: %s'),
$this->params->get('service')
)));
if (! $this->showInfoForNonDirectorService()) {
$this->content()->add(Hint::error(sprintf(
$this->translate('No such service: %s'),
$this->params->get('service')
)));
}
$this->servicesAction();
}
protected function showInfoForNonDirectorService()
{
try {
$api = $this->getApiIfAvailable();
if ($api) {
$name = $this->params->get('name') . '!' . $this->params->get('service');
$info = $api->getObject($name, 'Services');
if (isset($info->attrs->source_location)) {
$source = $info->attrs->source_location;
$this->content()->add(Hint::info(Html::sprintf(
'The configuration for this object has not been rendered by'
. ' Icinga Director. You can find it on line %s in %s.',
Html::tag('strong', null, $source->first_line),
Html::tag('strong', null, $source->path)
)));
}
}
return true;
} catch (Exception $e) {
return false;
}
}
/**
* @throws \Icinga\Exception\NotFoundError
*/

View File

@ -21,6 +21,7 @@ next (will be 1.8.0)
* FEATURE: Endpoints table now shows the object type (e.g. external) (#2050)
* FEATURE: make sure that form label and fields stay close together (#2136)
* FEATURE: show more content, reduce padding (expect on mobile) (#2140)
* FEATURE: location details for non-Director services on "Modify" (#1531)
### Import and Sync
* FEATURE: allow to define update-only Sync Rules (#2059)