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