mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-18 15:06:17 -05:00
Correct notification messages and add missing translations (#444)
fixes #405
This commit is contained in:
parent
1c38d23d3a
commit
c43128be3e
10 changed files with 39 additions and 39 deletions
|
|
@ -165,7 +165,7 @@ class BpConfigForm extends BpConfigBaseForm
|
|||
$this->bp->clearAppliedChanges();
|
||||
$this->storage->deleteProcess($name);
|
||||
$this->setSuccessUrl('businessprocess');
|
||||
$this->redirectOnSuccess(sprintf('Process %s has been deleted', $name));
|
||||
$this->redirectOnSuccess(sprintf($this->translate('Process %s has been deleted'), $name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -197,10 +197,10 @@ class BpConfigForm extends BpConfigBaseForm
|
|||
array('config' => $name, 'unlocked' => true)
|
||||
)
|
||||
);
|
||||
$this->setSuccessMessage(sprintf('Process %s has been created', $name));
|
||||
$this->setSuccessMessage(sprintf($this->translate('Process %s has been created'), $name));
|
||||
} else {
|
||||
$config = $this->bp;
|
||||
$this->setSuccessMessage(sprintf('Process %s has been stored', $name));
|
||||
$this->setSuccessMessage(sprintf($this->translate('Process %s has been stored'), $name));
|
||||
}
|
||||
$meta = $config->getMetadata();
|
||||
foreach ($this->getValues() as $key => $value) {
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ class BpUploadForm extends BpConfigBaseForm
|
|||
}
|
||||
|
||||
$this->storage->storeProcess($config);
|
||||
Notification::success(sprintf('Process %s has been stored', $name));
|
||||
Notification::success(sprintf($this->translate('Process %s has been stored'), $name));
|
||||
|
||||
$this->getSuccessUrl()->setParam('config', $name);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,15 +45,28 @@ class CleanupNodeForm extends BpConfigBaseForm
|
|||
{
|
||||
$changes = ProcessChanges::construct($this->bp, $this->session);
|
||||
|
||||
/** @var string[] $nodesToCleanup */
|
||||
$nodesToCleanup = $this->getValue('cleanup_all') === '1'
|
||||
? array_keys($this->bp->getMissingChildren())
|
||||
: $this->getValue('nodes');
|
||||
|
||||
$nodeName = null;
|
||||
foreach ($nodesToCleanup as $nodeName) {
|
||||
$node = $this->bp->getNode($nodeName);
|
||||
$changes->deleteNode($node);
|
||||
}
|
||||
|
||||
|
||||
$count = count($nodesToCleanup);
|
||||
$this->setSuccessMessage(sprintf(
|
||||
$this->translatePlural(
|
||||
'Successfully removed missing node %s',
|
||||
'Successfully removed %d missing nodes',
|
||||
$count
|
||||
),
|
||||
$count === 1 ? $nodeName : $count
|
||||
));
|
||||
|
||||
unset($changes);
|
||||
|
||||
parent::onSuccess();
|
||||
|
|
|
|||
|
|
@ -98,9 +98,17 @@ class DeleteNodeForm extends BpConfigBaseForm
|
|||
switch ($confirm) {
|
||||
case 'yes':
|
||||
$changes->deleteNode($this->node, $this->parentNode === null ? null : $this->parentNode->getName());
|
||||
$this->setSuccessMessage(sprintf(
|
||||
$this->translate('Node %s has been deleted'),
|
||||
$this->node->getAlias()
|
||||
));
|
||||
break;
|
||||
case 'all':
|
||||
$changes->deleteNode($this->node);
|
||||
$this->setSuccessMessage(sprintf(
|
||||
$this->translate('All occurrences of node %s have been deleted'),
|
||||
$this->node->getAlias()
|
||||
));
|
||||
break;
|
||||
case 'no':
|
||||
$this->setSuccessMessage($this->translate('Well, maybe next time'));
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class MoveNodeForm extends BpConfigBaseForm
|
|||
// Trigger session destruction to make sure it get's stored.
|
||||
unset($changes);
|
||||
|
||||
$this->notifySuccess($this->getSuccessMessage($this->translate('Node order updated')));
|
||||
$this->notifySuccess($this->translate('Node order updated'));
|
||||
|
||||
$response = $this->getRequest()->getResponse()
|
||||
->setHeader('X-Icinga-Container', 'ignore')
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ class ProcessForm extends BpConfigBaseForm
|
|||
|
||||
Notification::success(
|
||||
sprintf(
|
||||
'Process %s has been modified',
|
||||
$this->translate('Process %s has been modified'),
|
||||
$this->bp->getName()
|
||||
)
|
||||
);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ class SimulationForm extends BpConfigBaseForm
|
|||
$state = $this->getValue('state');
|
||||
|
||||
if ($state !== null && ctype_digit($state)) {
|
||||
$this->notifySuccess($this->translate('Simulation has been set'));
|
||||
$this->setSuccessMessage($this->translate('Simulation has been set'));
|
||||
$this->simulation->set($nodeName, (object) array(
|
||||
'state' => $this->getValue('state'),
|
||||
'acknowledged' => $this->getValue('acknowledged'),
|
||||
|
|
@ -114,7 +114,7 @@ class SimulationForm extends BpConfigBaseForm
|
|||
));
|
||||
} else {
|
||||
if ($this->simulation->remove($nodeName)) {
|
||||
$this->notifySuccess($this->translate('Simulation has been removed'));
|
||||
$this->setSuccessMessage($this->translate('Simulation has been removed'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,13 @@ namespace Icinga\Module\Businessprocess\Web\Form;
|
|||
use Icinga\Application\Icinga;
|
||||
use Icinga\Application\Modules\Module;
|
||||
use ipl\Html\ValidHtml;
|
||||
use ipl\I18n\Translation;
|
||||
use Zend_Form;
|
||||
|
||||
abstract class QuickBaseForm extends Zend_Form implements ValidHtml
|
||||
{
|
||||
use Translation;
|
||||
|
||||
/**
|
||||
* The Icinga module this form belongs to. Usually only set if the
|
||||
* form is initialized through the FormLoader
|
||||
|
|
@ -154,13 +157,4 @@ abstract class QuickBaseForm extends Zend_Form implements ValidHtml
|
|||
|
||||
return strlen($value) === 0;
|
||||
}
|
||||
|
||||
public function translate($string)
|
||||
{
|
||||
if ($this->icingaModuleName === null) {
|
||||
return t($string);
|
||||
} else {
|
||||
return mt($this->icingaModuleName, $string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -630,11 +630,6 @@ parameters:
|
|||
count: 1
|
||||
path: application/forms/BpUploadForm.php
|
||||
|
||||
-
|
||||
message: "#^Argument of an invalid type mixed supplied for foreach, only iterables are supported\\.$#"
|
||||
count: 1
|
||||
path: application/forms/CleanupNodeForm.php
|
||||
|
||||
-
|
||||
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Forms\\\\CleanupNodeForm\\:\\:onSuccess\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -645,11 +640,6 @@ parameters:
|
|||
count: 1
|
||||
path: application/forms/CleanupNodeForm.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#1 \\$name of method Icinga\\\\Module\\\\Businessprocess\\\\BpConfig\\:\\:getNode\\(\\) expects string, mixed given\\.$#"
|
||||
count: 1
|
||||
path: application/forms/CleanupNodeForm.php
|
||||
|
||||
-
|
||||
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Forms\\\\DeleteNodeForm\\:\\:onSuccess\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
|
@ -3955,16 +3945,6 @@ parameters:
|
|||
count: 1
|
||||
path: library/Businessprocess/Web/Form/QuickBaseForm.php
|
||||
|
||||
-
|
||||
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Form\\\\QuickBaseForm\\:\\:translate\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
path: library/Businessprocess/Web/Form/QuickBaseForm.php
|
||||
|
||||
-
|
||||
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Form\\\\QuickBaseForm\\:\\:translate\\(\\) has parameter \\$string with no type specified\\.$#"
|
||||
count: 1
|
||||
path: library/Businessprocess/Web/Form/QuickBaseForm.php
|
||||
|
||||
-
|
||||
message: "#^Method Icinga\\\\Module\\\\Businessprocess\\\\Web\\\\Form\\\\QuickBaseForm\\:\\:valueIsEmpty\\(\\) has no return type specified\\.$#"
|
||||
count: 1
|
||||
|
|
|
|||
|
|
@ -122,7 +122,9 @@
|
|||
].join('&');
|
||||
|
||||
var $container = $source.closest('.container');
|
||||
icinga.loader.loadUrl(actionUrl, $container, data, 'POST');
|
||||
var icingaLoader = this.module.icinga.loader;
|
||||
icingaLoader.loadUrl(actionUrl, $container, data, 'POST')
|
||||
.done((_, __, req) => icingaLoader.processNotificationHeader(req));
|
||||
}
|
||||
},
|
||||
|
||||
|
|
@ -155,7 +157,10 @@
|
|||
].join('&');
|
||||
|
||||
var $container = $target.closest('.container');
|
||||
icinga.loader.loadUrl(actionUrl, $container, data, 'POST');
|
||||
var icingaLoader = this.module.icinga.loader;
|
||||
icingaLoader.loadUrl(actionUrl, $container, data, 'POST')
|
||||
.done((_, __, req) => icingaLoader.processNotificationHeader(req));
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue