mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-08 14:34:29 +02:00
When the X-Icinga-Module-Enable header is send, the modulemanager automatically tries to load javascript files for that module. This is realized by adding the 'registerHeaderListener' method to the async manager, which allows to listen to specific headers and firing callbacks if a response with the specified header is retrieved. Also the tests have changed a bit, requireNow should be used when using the requiremock, so a require always loads files new. refs #4092 refs #3753
52 lines
1.2 KiB
PHP
Executable File
52 lines
1.2 KiB
PHP
Executable File
<?php
|
|
// @codingStandardsIgnoreStart
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
|
|
|
# namespace Icinga\Application\Controllers;
|
|
|
|
|
|
use Icinga\Web\ActionController;
|
|
use Icinga\Application\Icinga;
|
|
|
|
class ModulesController extends ActionController
|
|
{
|
|
protected $manager;
|
|
|
|
public function init()
|
|
{
|
|
$this->manager = Icinga::app()->moduleManager();
|
|
}
|
|
|
|
public function indexAction()
|
|
{
|
|
$this->view->modules = $this->manager->select()
|
|
->from('modules')
|
|
->order('name');
|
|
$this->render('overview');
|
|
}
|
|
|
|
public function overviewAction()
|
|
{
|
|
$this->indexAction();
|
|
|
|
}
|
|
|
|
public function enableAction()
|
|
{
|
|
$this->manager->enableModule($this->_getParam('name'));
|
|
$this->manager->loadModule($this->_getParam('name'));
|
|
$this->getResponse()->setHeader('X-Icinga-Enable-Module', $this->_getParam('name'));
|
|
$this->replaceLayout = true;
|
|
$this->indexAction();
|
|
|
|
}
|
|
|
|
public function disableAction()
|
|
{
|
|
$this->manager->disableModule($this->_getParam('name'));
|
|
$this->redirectNow('modules/overview?_render=body');
|
|
}
|
|
|
|
}
|