Skip to content

Commit

Permalink
Link to the config form in case of a config error
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov committed Mar 21, 2018
1 parent 759851a commit 5438bab
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion library/Graphite/Web/Widget/Graphs.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

use Icinga\Application\Config;
use Icinga\Application\Icinga;
use Icinga\Authentication\Auth;
use Icinga\Exception\ConfigurationError;
use Icinga\Module\Graphite\Forms\TimeRangePicker\TimeRangePickerTrait;
use Icinga\Module\Graphite\Graphing\GraphingTrait;
use Icinga\Module\Graphite\Graphing\Template;
Expand Down Expand Up @@ -317,7 +319,22 @@ protected function getGraphsList()

public function render()
{
$result = $this->getGraphsList();
try {
$result = $this->getGraphsList();
} catch (ConfigurationError $e) {
$view = $this->view();

return "<p>{$view->escape($e->getMessage())}</p>"
. '<p>' . vsprintf(
$view->escape($view->translate('Please %scorrect%s the configuration of the Graphite module.')),
Auth::getInstance()->hasPermission('config/modules')
? explode(
'$LINK_TEXT$',
$view->qlink('$LINK_TEXT$', 'graphite/config/backend', null, ['class' => 'action-link'])
)
: ['', '']
) . '</p>';
}

if ($result === '' && $this->getShowNoGraphsFound()) {
$view = $this->view();
Expand Down

0 comments on commit 5438bab

Please sign in to comment.