HostsController: Don't allow to reschedule checks if no objects have active ones
refs #3665
This commit is contained in:
parent
3d4fa0bcae
commit
f45b4640b0
|
@ -85,7 +85,12 @@ class HostsController extends Controller
|
|||
public function showAction()
|
||||
{
|
||||
$this->setAutorefreshInterval(15);
|
||||
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')) {
|
||||
$activeChecksEnabled = $this->hostList->getFeatureStatus()['active_checks_enabled'] !== 0;
|
||||
if ($this->Auth()->hasPermission('monitoring/command/schedule-check')
|
||||
|| ($this->Auth()->hasPermission('monitoring/command/schedule-check/active-only')
|
||||
&& $activeChecksEnabled
|
||||
)
|
||||
) {
|
||||
$checkNowForm = new CheckNowCommandForm();
|
||||
$checkNowForm
|
||||
->setObjects($this->hostList)
|
||||
|
@ -114,8 +119,10 @@ class HostsController extends Controller
|
|||
|
||||
$hostStates = $this->hostList->getStateSummary();
|
||||
|
||||
$this->setAutorefreshInterval(15);
|
||||
if ($activeChecksEnabled) {
|
||||
$this->view->rescheduleAllLink = Url::fromRequest()->setPath('monitoring/hosts/reschedule-check');
|
||||
}
|
||||
|
||||
$this->view->downtimeAllLink = Url::fromRequest()->setPath('monitoring/hosts/schedule-downtime');
|
||||
$this->view->processCheckResultAllLink = Url::fromRequest()->setPath('monitoring/hosts/process-check-result');
|
||||
$this->view->addCommentLink = Url::fromRequest()->setPath('monitoring/hosts/add-comment');
|
||||
|
|
|
@ -181,6 +181,7 @@
|
|||
</tr>
|
||||
<?php endif ?>
|
||||
|
||||
<?php if (isset($rescheduleAllLink)): ?>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td>
|
||||
|
@ -195,6 +196,7 @@
|
|||
) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<h2><?= $this->translate('Feature Commands') ?></h2>
|
||||
|
|
Loading…
Reference in New Issue