Skip to content

Commit

Permalink
Merge branch 'feature/drop-show-overview-47' into next
Browse files Browse the repository at this point in the history
fixes #47
  • Loading branch information
Al2Klimov committed Sep 20, 2017
2 parents 47195e1 + cdce975 commit 6490db1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 75 deletions.
74 changes: 0 additions & 74 deletions application/controllers/ShowController.php
Expand Up @@ -40,80 +40,6 @@ public function init()
$this->params->shift('r');
}

public function overviewAction()
{
$this->handleDatasourceToggles();
$this->handleGraphParams();
// TODO: $max = $query->getMaxValue();

$this->view->tabs->add('overview', array(
'label' => $this->translate('Graphite - Overview'),
'url' => $this->getRequest()->getUrl()
))->activate('overview');

$this->view->filterColumn = $this->params->get('filterColumn');
$this->view->filterValue = $this->params->get('filterValue');

$optional = array(null => '- please choose -');
$any = array('*' => 'Show any');

$this->view->templates = array_merge(
$optional,
$this->templateStore->enumTemplates()
);

if (! $template = $this->template) {
return;
}

$varnames = GraphiteUtil::extractVariableNames($template->getFilterString());
$varnames = array_combine($varnames, $varnames);

$this->view->filterColumns = $optional + $varnames;

if ($this->view->filterColumn) {
if (array_key_exists($this->view->filterColumn, $this->view->filterColumns)) {

$this->view->filterValues = $optional + $any + $this->graphiteWeb->select()
->from($template->getFilterString())
->listDistinct($this->view->filterColumn);
}
}

if (! $this->view->filterColumn || ! $this->view->filterValue) {
return;
}

$imgs = array();

$title = $template->getTitle();
if (false === strpos($title, '$')) {
$template->setTitle('$hostname');
} else {
if (false === strpos($title, '$hostname')) {
$template->setTitle('$hostname: ' . $template->getTitle());
}
}

$query = $this->graphiteWeb->select()->from(
$template->getFilterString()
)->where($this->view->filterColumn, $this->view->filterValue);

$view = $this->view;
$imgParams = array(
'template' => $view->templateName,
'start' => $view->start,
'width' => $view->width,
'height' => $view->height
);

if ($this->view->disabledDatasources) {
$imgParams['disabled'] = $this->view->disabledDatasources;
}

$view->images = $query->getWrappedImageLinks($template, $imgParams);
}

public function graphAction()
{
$template = $this->loadTemplate();
Expand Down
2 changes: 1 addition & 1 deletion configuration.php
Expand Up @@ -3,7 +3,7 @@
/** @var \Icinga\Application\Modules\Module $this */

/** @var \Icinga\Application\Modules\MenuItemContainer $section */
$section = $this->menuSection(N_('Graphite'), ['icon' => 'chart-area'])->setUrl('graphite/show/overview');
$section = $this->menuSection(N_('Graphite'), ['icon' => 'chart-area']);
$section->add(N_('Hosts'), ['url' => 'graphite/list/hosts']);
$section->add(N_('Services'), ['url' => 'graphite/list/services']);

Expand Down

0 comments on commit 6490db1

Please sign in to comment.