Move command note to the `getHelp()' and add the help as an icon

This commit is contained in:
Alexander Fuhr 2014-11-18 16:10:17 +01:00
parent 7eab09c2a2
commit 7a7157ebef
8 changed files with 80 additions and 49 deletions

View File

@ -44,6 +44,16 @@ abstract class CommandForm extends Form
return $this->backend;
}
/**
* Get the command help description
*
* @return string|null
*/
public function getHelp()
{
return null;
}
/**
* Get the transport used to send commands
*

View File

@ -24,22 +24,24 @@ class DisableNotificationsExpireCommandForm extends CommandForm
$this->setSubmitLabel(mt('monitoring', 'Disable Notifications'));
}
/**
* (non-PHPDoc)
* @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation.
*/
public function getHelp()
{
return mt(
'monitoring',
'This command is used to disable host and service notifications for a specific time.'
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
*/
public function createElements(array $formData = array())
{
$this->addElement(
'note',
'command-info',
array(
'value' => mt(
'monitoring',
'This command is used to disable host and service notifications for a specific time.'
)
)
);
$expireTime = new DateTime();
$expireTime->add(new DateInterval('PT1H'));
$this->addElement(

View File

@ -25,6 +25,20 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation.
*/
public function getHelp()
{
return mt(
'monitoring',
'This command is used to acknowledge host or service problems. When a problem is acknowledged,'
. ' future notifications about problems are temporarily disabled until the host or service'
. ' recovers.'
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
@ -32,18 +46,6 @@ class AcknowledgeProblemCommandForm extends ObjectsCommandForm
public function createElements(array $formData = array())
{
$this->addElements(array(
array(
'note',
'command-info',
array(
'value' => mt(
'monitoring',
'This command is used to acknowledge host or service problems. When a problem is acknowledged,'
. ' future notifications about problems are temporarily disabled until the host or service'
. ' recovers.'
)
)
),
array(
'textarea',
'comment',

View File

@ -23,6 +23,18 @@ class AddCommentCommandForm extends ObjectsCommandForm
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation.
*/
public function getHelp()
{
return mt(
'monitoring',
'This command is used to add host or service comments.'
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
@ -30,16 +42,6 @@ class AddCommentCommandForm extends ObjectsCommandForm
public function createElements(array $formData = array())
{
$this->addElements(array(
array(
'note',
'command-info',
array(
'value' => mt(
'monitoring',
'This command is used to add host or service comments.'
)
)
),
array(
'textarea',
'comment',

View File

@ -26,6 +26,19 @@ class ScheduleServiceCheckCommandForm extends ObjectsCommandForm
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation.
*/
public function getHelp()
{
return mt(
'monitoring',
'This command is used to schedule the next check of hosts or services. Icinga will re-queue the'
. ' hosts or services to be checked at the time you specify.'
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.

View File

@ -36,6 +36,22 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Module\Monitoring\Forms\Command\CommandForm::getHelp() For the method documentation.
*/
public function getHelp()
{
return mt(
'monitoring',
'This command is used to schedule host and service downtimes. During the specified downtime,'
. ' Icinga will not send notifications out about the hosts and services. When the scheduled'
. ' downtime expires, Icinga will send out notifications for the hosts and services as it'
. ' normally would. Scheduled downtimes are preserved across program shutdowns and'
. ' restarts.'
);
}
/**
* (non-PHPDoc)
* @see \Icinga\Web\Form::createElements() For the method documentation.
@ -46,20 +62,6 @@ class ScheduleServiceDowntimeCommandForm extends ObjectsCommandForm
$end = clone $start;
$end->add(new DateInterval('PT1H'));
$this->addElements(array(
array(
'note',
'command-info',
array(
'value' => mt(
'monitoring',
'This command is used to schedule host and service downtimes. During the specified downtime,'
. ' Icinga will not send notifications out about the hosts and services. When the scheduled'
. ' downtime expires, Icinga will send out notifications for the hosts and services as it'
. ' normally would. Scheduled downtimes are preserved across program shutdowns and'
. ' restarts.'
)
)
),
array(
'textarea',
'comment',

View File

@ -1,9 +1,9 @@
<div class="controls">
<?= $this->tabs->showOnlyCloseButton() ?>
</div>
<!-- /** @var \Icinga\Module\Monitoring\Forms\Command\CommandForm $form */ $form->getHelp() -->
<div class="content">
<h1><?= $title ?></h1>
<h1><?= $title ?> <?= $this->icon('help', $form->getHelp()) ?></h1>
<table class="objectlist">
<thead>
<tr>

View File

@ -2,7 +2,7 @@
<?= $this->tabs->showOnlyCloseButton() ?>
</div>
<div class="content">
<h1><?= $title ?></h1>
<h1><?= $title ?> <?= $this->icon('help', $form->getHelp()) ?></h1>
<?php if ((bool) $programStatus->notifications_enabled === false): ?>
<div>
<?= $this->translate('Host and service notifications are already disabled.') ?>