mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
Re-add benchmark helper
Enable benchmark via user preferences resolves #5508
This commit is contained in:
parent
b9c86ac1f5
commit
fc1fb60b01
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
# namespace Icinga\Application\Controllers;
|
# namespace Icinga\Application\Controllers;
|
||||||
|
|
||||||
use \Icinga\Web\Controller\ActionController;
|
use Icinga\Web\Controller\ActionController;
|
||||||
use \Icinga\Application\Icinga;
|
use Icinga\Application\Benchmark;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Application wide index controller
|
* Application wide index controller
|
||||||
|
@ -214,6 +214,15 @@ class GeneralForm extends Form
|
|||||||
$this->addDateFormatSettings($global);
|
$this->addDateFormatSettings($global);
|
||||||
|
|
||||||
$this->setSubmitLabel('{{SAVE_ICON}} Save Changes');
|
$this->setSubmitLabel('{{SAVE_ICON}} Save Changes');
|
||||||
|
|
||||||
|
$this->addElement(
|
||||||
|
'checkbox',
|
||||||
|
'showBenchmark',
|
||||||
|
array(
|
||||||
|
'label' => 'Use benchmark',
|
||||||
|
'value' => $this->getUserPreferences()->get('app.showBenchmark')
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -227,7 +236,8 @@ class GeneralForm extends Form
|
|||||||
return array(
|
return array(
|
||||||
'app.timezone' => $values['timezone'],
|
'app.timezone' => $values['timezone'],
|
||||||
'app.dateFormat' => $values['date_format'],
|
'app.dateFormat' => $values['date_format'],
|
||||||
'app.timeFormat' => $values['time_format']
|
'app.timeFormat' => $values['time_format'],
|
||||||
|
'app.showBenchmark' => $values['showBenchmark'] === '1' ? true : false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,6 @@
|
|||||||
<?= $this->render('body.phtml') ?>
|
<?= $this->render('body.phtml') ?>
|
||||||
<script data-main="<?php echo $this->baseUrl('js/main.js')?>"
|
<script data-main="<?php echo $this->baseUrl('js/main.js')?>"
|
||||||
src="<?php echo $this->baseUrl('js/vendor/require.js') ?>"></script>
|
src="<?php echo $this->baseUrl('js/vendor/require.js') ?>"></script>
|
||||||
|
<?= $this->layout()->benchmark ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -229,6 +229,21 @@ class ActionController extends Zend_Controller_Action
|
|||||||
}
|
}
|
||||||
$this->_helper->layout()->setLayout($target);
|
$this->_helper->layout()->setLayout($target);
|
||||||
}
|
}
|
||||||
|
$userPreferences = $this->getRequest()->getUser()->getPreferences();
|
||||||
|
if ($userPreferences->get('app.showBenchmark') === true) {
|
||||||
|
Benchmark::measure('Response ready');
|
||||||
|
$this->_helper->layout()->benchmark = $this->renderBenchmark();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Render the benchmark
|
||||||
|
*
|
||||||
|
* @return string Benchmark HTML
|
||||||
|
*/
|
||||||
|
protected function renderBenchmark()
|
||||||
|
{
|
||||||
|
return Benchmark::renderToHtml();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user