Merge branch 'master' into feature/validate-pgsql-version-9460
This commit is contained in:
commit
9282e1bce2
|
@ -5,7 +5,7 @@ use Icinga\Web\Notification;
|
|||
use Icinga\Authentication\Auth;
|
||||
|
||||
$moduleName = $this->layout()->moduleName;
|
||||
if ($moduleName) {
|
||||
if ($moduleName !== 'default') {
|
||||
$moduleClass = ' icinga-module module-' . $moduleName;
|
||||
} else {
|
||||
$moduleClass = '';
|
||||
|
|
|
@ -4,7 +4,7 @@ use Icinga\Web\StyleSheet;
|
|||
|
||||
|
||||
$moduleName = $this->layout()->moduleName;
|
||||
if ($moduleName) {
|
||||
if ($moduleName !== 'default') {
|
||||
$moduleClass = ' icinga-module module-' . $moduleName;
|
||||
} else {
|
||||
$moduleClass = '';
|
||||
|
|
|
@ -62,14 +62,14 @@ with Icinga Web 2 (e.g. an alias) no matter what the primary user id might actua
|
|||
|
||||
Directive | Description
|
||||
------------------------|------------
|
||||
**backend** | `ad`
|
||||
**backend** | `msldap`
|
||||
**resource** | The name of the LDAP resource defined in [resources.ini](resources.md#resources).
|
||||
|
||||
**Example:**
|
||||
|
||||
```
|
||||
[auth_ad]
|
||||
backend = ad
|
||||
backend = msldap
|
||||
resource = my_ad
|
||||
```
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
namespace Icinga\Util;
|
||||
|
||||
/**
|
||||
* Common string helper
|
||||
* Common string functions
|
||||
*/
|
||||
class String
|
||||
{
|
||||
|
@ -103,8 +103,8 @@ class String
|
|||
/**
|
||||
* Check if a string ends with a different string
|
||||
*
|
||||
* @param $haystack The string to search for matches
|
||||
* @param $needle The string to match at the start of the haystack
|
||||
* @param $haystack string The string to search for matches
|
||||
* @param $needle string The string to match at the start of the haystack
|
||||
*
|
||||
* @return bool Whether or not needle is at the beginning of haystack
|
||||
*/
|
||||
|
|
|
@ -38,6 +38,13 @@ class ActionController extends Zend_Controller_Action
|
|||
*/
|
||||
protected $requiresAuthentication = true;
|
||||
|
||||
/**
|
||||
* The current module's name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $moduleName;
|
||||
|
||||
private $autorefreshInterval;
|
||||
|
||||
private $reloadCss = false;
|
||||
|
@ -90,11 +97,11 @@ class ActionController extends Zend_Controller_Action
|
|||
$this->_helper = new ActionHelperBroker($this);
|
||||
|
||||
$this->handlerBrowserWindows();
|
||||
$this->view->tabs = new Tabs();
|
||||
$this->view->translationDomain = 'icinga';
|
||||
$moduleName = $this->getModuleName();
|
||||
$this->view->translationDomain = $moduleName !== 'default' ? $moduleName : 'icinga';
|
||||
$this->_helper->layout()->isIframe = $request->getUrl()->shift('isIframe');
|
||||
$this->_helper->layout()->showFullscreen = $request->getUrl()->shift('showFullscreen');
|
||||
$this->_helper->layout()->moduleName = false;
|
||||
$this->_helper->layout()->moduleName = $moduleName;
|
||||
|
||||
$this->view->compact = $request->getParam('view') === 'compact';
|
||||
if ($request->getUrl()->shift('showCompact')) {
|
||||
|
@ -107,12 +114,12 @@ class ActionController extends Zend_Controller_Action
|
|||
$this->_helper->layout()->disableLayout();
|
||||
}
|
||||
|
||||
$this->prepareInit();
|
||||
|
||||
if ($this->requiresLogin()) {
|
||||
$this->redirectToLogin(Url::fromRequest());
|
||||
}
|
||||
|
||||
$this->view->tabs = new Tabs();
|
||||
$this->prepareInit();
|
||||
$this->init();
|
||||
}
|
||||
|
||||
|
@ -167,6 +174,20 @@ class ActionController extends Zend_Controller_Action
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current module's name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleName()
|
||||
{
|
||||
if ($this->moduleName === null) {
|
||||
$this->moduleName = $this->getRequest()->getModuleName();
|
||||
}
|
||||
|
||||
return $this->moduleName;
|
||||
}
|
||||
|
||||
public function Config($file = null)
|
||||
{
|
||||
if ($file === null) {
|
||||
|
|
|
@ -6,6 +6,7 @@ namespace Icinga\Web\Controller;
|
|||
use Icinga\Application\Config;
|
||||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Modules\Manager;
|
||||
use Icinga\Application\Modules\Module;
|
||||
|
||||
/**
|
||||
* Base class for module action controllers
|
||||
|
@ -18,25 +19,15 @@ class ModuleActionController extends ActionController
|
|||
|
||||
private $module;
|
||||
|
||||
/**
|
||||
* Module name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleName;
|
||||
|
||||
/**
|
||||
* (non-PHPDoc)
|
||||
* @see \Icinga\Web\Controller\ActionController For the method documentation.
|
||||
*/
|
||||
protected function prepareInit()
|
||||
{
|
||||
$this->moduleName = $this->_request->getModuleName();
|
||||
$this->_helper->layout()->moduleName = $this->moduleName;
|
||||
$this->view->translationDomain = $this->moduleName;
|
||||
$this->moduleInit();
|
||||
if ($this->getFrontController()->getDefaultModule() !== $this->moduleName) {
|
||||
$this->assertPermission(Manager::MODULE_PERMISSION_NS . $this->moduleName);
|
||||
if ($this->getFrontController()->getDefaultModule() !== $this->getModuleName()) {
|
||||
$this->assertPermission(Manager::MODULE_PERMISSION_NS . $this->getModuleName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -51,22 +42,28 @@ class ModuleActionController extends ActionController
|
|||
{
|
||||
if ($file === null) {
|
||||
if ($this->config === null) {
|
||||
$this->config = Config::module($this->moduleName);
|
||||
$this->config = Config::module($this->getModuleName());
|
||||
}
|
||||
return $this->config;
|
||||
} else {
|
||||
if (! array_key_exists($file, $this->configs)) {
|
||||
$this->configs[$file] = Config::module($this->moduleName, $file);
|
||||
$this->configs[$file] = Config::module($this->getModuleName(), $file);
|
||||
}
|
||||
return $this->configs[$file];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return this controller's module
|
||||
*
|
||||
* @return Module
|
||||
*/
|
||||
public function Module()
|
||||
{
|
||||
if ($this->module === null) {
|
||||
$this->module = Icinga::app()->getModuleManager()->getModule($this->moduleName);
|
||||
$this->module = Icinga::app()->getModuleManager()->getModule($this->getModuleName());
|
||||
}
|
||||
|
||||
return $this->module;
|
||||
}
|
||||
|
||||
|
@ -77,6 +74,6 @@ class ModuleActionController extends ActionController
|
|||
public function postDispatchXhr()
|
||||
{
|
||||
parent::postDispatchXhr();
|
||||
$this->getResponse()->setHeader('X-Icinga-Module', $this->moduleName, true);
|
||||
$this->getResponse()->setHeader('X-Icinga-Module', $this->getModuleName(), true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,8 @@ if (! $this->compact): ?>
|
|||
$notification->service_description,
|
||||
$notification->service_display_name,
|
||||
$notification->host_name,
|
||||
$notification->host_display_name
|
||||
$notification->host_display_name,
|
||||
'rowaction'
|
||||
) ?>
|
||||
<?php else: ?>
|
||||
<?= $this->icon('host', $this->translate('Host')); ?>
|
||||
|
|
|
@ -9,7 +9,7 @@ use Icinga\Data\Filter\Filter;
|
|||
/**
|
||||
* Query for event history records
|
||||
*/
|
||||
class EventHistoryQuery extends IdoQuery
|
||||
class EventhistoryQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -8,7 +8,7 @@ use Zend_Db_Select;
|
|||
/**
|
||||
* Query for host and service group summaries
|
||||
*/
|
||||
class GroupSummaryQuery extends IdoQuery
|
||||
class GroupsummaryQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -10,7 +10,7 @@ use Icinga\Data\Filter\Filter;
|
|||
/**
|
||||
* Query for host and service status summary
|
||||
*/
|
||||
class StatusSummaryQuery extends IdoQuery
|
||||
class StatussummaryQuery extends IdoQuery
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
|
|
|
@ -29,8 +29,6 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
*/
|
||||
protected $query;
|
||||
|
||||
protected $filter;
|
||||
|
||||
protected $connection;
|
||||
|
||||
protected $isSorted = false;
|
||||
|
@ -52,7 +50,6 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
{
|
||||
$this->connection = $connection;
|
||||
$this->query = $connection->query($this->getQueryName(), $columns);
|
||||
$this->filter = Filter::matchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,7 +88,6 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
|
||||
public function where($condition, $value = null)
|
||||
{
|
||||
$this->filter->addFilter(Filter::where($condition, $value));
|
||||
$this->query->where($condition, $value);
|
||||
return $this;
|
||||
}
|
||||
|
@ -268,9 +264,14 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
return $columns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current filter
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
public function getFilter()
|
||||
{
|
||||
return $this->filter;
|
||||
return $this->query->getFilter();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -471,8 +472,7 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
*/
|
||||
public function addFilter(Filter $filter)
|
||||
{
|
||||
$this->query->addFilter(clone($filter));
|
||||
$this->filter = $filter; // TODO: Hmmmm.... and?
|
||||
$this->query->addFilter($filter);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
@ -496,7 +496,8 @@ abstract class DataView implements QueryInterface, SortRules, FilterColumns, Ite
|
|||
*/
|
||||
public function peekAhead($state = true)
|
||||
{
|
||||
return $this->query->peekAhead($state);
|
||||
$this->query->peekAhead($state);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -450,21 +450,29 @@ abstract class MonitoredObject implements Filterable
|
|||
*/
|
||||
public function fetchEventhistory()
|
||||
{
|
||||
$eventHistory = $this->backend->select()->from('eventhistory', array(
|
||||
'object_type',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'timestamp',
|
||||
'state',
|
||||
'output',
|
||||
'type'
|
||||
))
|
||||
$eventHistory = $this->backend
|
||||
->select()
|
||||
->from(
|
||||
'eventhistory',
|
||||
array(
|
||||
'object_type',
|
||||
'host_name',
|
||||
'host_display_name',
|
||||
'service_description',
|
||||
'service_display_name',
|
||||
'timestamp',
|
||||
'state',
|
||||
'output',
|
||||
'type'
|
||||
)
|
||||
)
|
||||
->where('object_type', $this->type)
|
||||
->where('host_name', $this->host_name);
|
||||
|
||||
if ($this->type === self::TYPE_SERVICE) {
|
||||
$eventHistory->where('service_description', $this->service_description);
|
||||
}
|
||||
|
||||
$this->eventhistory = $eventHistory->applyFilter($this->getFilter());
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -424,7 +424,9 @@
|
|||
this.icinga.ui.reloadCss();
|
||||
}
|
||||
|
||||
if (req.getResponseHeader('X-Icinga-Redirect')) return;
|
||||
if (req.getResponseHeader('X-Icinga-Redirect')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// div helps getting an XML tree
|
||||
var $resp = $('<div>' + req.responseText + '</div>');
|
||||
|
@ -515,8 +517,6 @@
|
|||
var $el = $(el);
|
||||
if ($el.hasClass('dashboard')) {
|
||||
return;
|
||||
} else {
|
||||
|
||||
}
|
||||
var url = $el.data('icingaUrl');
|
||||
targets[i].data('icingaUrl', url);
|
||||
|
@ -533,28 +533,9 @@
|
|||
|
||||
this.icinga.ui.initializeTriStates($resp);
|
||||
|
||||
/* Should we try to fiddle with responses containing full HTML? */
|
||||
/*
|
||||
if ($('body', $resp).length) {
|
||||
req.responseText = $('script', $('body', $resp).html()).remove();
|
||||
if (rendered) {
|
||||
return;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
|
||||
var containers = [];
|
||||
|
||||
$('.dashboard .container').each(function(idx, el) {
|
||||
urls.push($(el).data('icingaUrl'));
|
||||
});
|
||||
console.log(urls);
|
||||
$('.container[data-icinga-refresh]').each(function(idx, el) {
|
||||
var $el = $(el);
|
||||
self.loadUrl($el.data('icingaUrl'), $el).autorefresh = true;
|
||||
el = null;
|
||||
});
|
||||
*/
|
||||
|
||||
if (rendered) return;
|
||||
|
||||
// .html() removes outer div we added above
|
||||
this.renderContentToContainer($resp.html(), req.$target, req.action, req.autorefresh);
|
||||
|
@ -652,8 +633,7 @@
|
|||
/*
|
||||
* Test if a manual actions comes in and autorefresh is active: Stop refreshing
|
||||
*/
|
||||
if (req.addToHistory && ! req.autorefresh && req.$target.data('icingaRefresh') > 0
|
||||
&& req.$target.data('icingaUrl') !== url) {
|
||||
if (req.addToHistory && ! req.autorefresh && req.$target.data('icingaRefresh') > 0) {
|
||||
req.$target.data('icingaRefresh', 0);
|
||||
req.$target.data('icingaUrl', url);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue