mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
css, various places: use Hint class
This commit is contained in:
parent
24a5411a93
commit
456832e7d1
@ -5,6 +5,7 @@ namespace Icinga\Module\Director\Controllers;
|
|||||||
use gipfl\IcingaWeb2\Link;
|
use gipfl\IcingaWeb2\Link;
|
||||||
use gipfl\IcingaWeb2\Widget\NameValueTable;
|
use gipfl\IcingaWeb2\Widget\NameValueTable;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Date\DateFormatter;
|
use Icinga\Date\DateFormatter;
|
||||||
use Icinga\Module\Director\ConfigDiff;
|
use Icinga\Module\Director\ConfigDiff;
|
||||||
use Icinga\Module\Director\Core\Json;
|
use Icinga\Module\Director\Core\Json;
|
||||||
@ -57,9 +58,7 @@ class BasketController extends ActionController
|
|||||||
$this->basketTabs()->activate('show');
|
$this->basketTabs()->activate('show');
|
||||||
$this->addTitle($basket->get('basket_name'));
|
$this->addTitle($basket->get('basket_name'));
|
||||||
if ($basket->isEmpty()) {
|
if ($basket->isEmpty()) {
|
||||||
$this->content()->add(Html::tag('p', [
|
$this->content()->add(Hint::info($this->translate('This basket is empty')));
|
||||||
'class' => 'information'
|
|
||||||
], $this->translate('This basket is empty')));
|
|
||||||
}
|
}
|
||||||
$this->content()->add(
|
$this->content()->add(
|
||||||
(new BasketForm())->setObject($basket)->handleRequest()
|
(new BasketForm())->setObject($basket)->handleRequest()
|
||||||
@ -330,9 +329,7 @@ class BasketController extends ActionController
|
|||||||
$key = $this->params->get('key');
|
$key = $this->params->get('key');
|
||||||
|
|
||||||
$this->addTitle($this->translate('Single Object Diff'));
|
$this->addTitle($this->translate('Single Object Diff'));
|
||||||
$this->content()->add(Html::tag('p', [
|
$this->content()->add(Hint::info(Html::sprintf(
|
||||||
'class' => 'information'
|
|
||||||
], Html::sprintf(
|
|
||||||
$this->translate('Comparing %s "%s" from Snapshot "%s" to current config'),
|
$this->translate('Comparing %s "%s" from Snapshot "%s" to current config'),
|
||||||
$type,
|
$type,
|
||||||
$key,
|
$key,
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
use Icinga\Module\Director\Forms\IcingaCommandArgumentForm;
|
use Icinga\Module\Director\Forms\IcingaCommandArgumentForm;
|
||||||
use Icinga\Module\Director\Objects\IcingaCommand;
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
||||||
@ -64,19 +65,14 @@ class CommandController extends ObjectController
|
|||||||
$command = $this->object;
|
$command = $this->object;
|
||||||
if ($command->isInUse()) {
|
if ($command->isInUse()) {
|
||||||
$usage = new CommandUsage($command);
|
$usage = new CommandUsage($command);
|
||||||
$this->content()->add(Html::tag('p', [
|
$this->content()->add(Hint::info(Html::sprintf(
|
||||||
'class' => 'information',
|
|
||||||
'data-base-target' => '_next'
|
|
||||||
], Html::sprintf(
|
|
||||||
$this->translate('This Command is currently being used by %s'),
|
$this->translate('This Command is currently being used by %s'),
|
||||||
Html::tag('span', null, $usage->getLinks())->setSeparator(', ')
|
Html::tag('span', null, $usage->getLinks())->setSeparator(', ')
|
||||||
)));
|
))->addAttributes([
|
||||||
|
'data-base-target' => '_next'
|
||||||
|
]));
|
||||||
} else {
|
} else {
|
||||||
$this->content()->add(Html::tag(
|
$this->content()->add(Hint::warning($this->translate('This Command is currently not in use')));
|
||||||
'p',
|
|
||||||
['class' => 'warning'],
|
|
||||||
$this->translate('This Command is currently not in use')
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\NotFoundError;
|
use Icinga\Exception\NotFoundError;
|
||||||
@ -56,9 +57,7 @@ class ConfigController extends ActionController
|
|||||||
$this->setAutorefreshInterval(20);
|
$this->setAutorefreshInterval(20);
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->content()->prepend(
|
$this->content()->prepend(Hint::warning($e->getMessage()));
|
||||||
Html::tag('p', ['class' => 'warning'], $e->getMessage())
|
|
||||||
);
|
|
||||||
// No problem, Icinga might be reloading
|
// No problem, Icinga might be reloading
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
use gipfl\IcingaWeb2\Link;
|
use gipfl\IcingaWeb2\Link;
|
||||||
use gipfl\IcingaWeb2\Url;
|
use gipfl\IcingaWeb2\Url;
|
||||||
@ -116,12 +117,10 @@ class HostController extends ObjectController
|
|||||||
*/
|
*/
|
||||||
public function invalidserviceAction()
|
public function invalidserviceAction()
|
||||||
{
|
{
|
||||||
$this->content()->add(
|
$this->content()->add(Hint::error(sprintf(
|
||||||
Html::tag('p', ['class' => 'error'], sprintf(
|
$this->translate('No such service: %s'),
|
||||||
$this->translate('No such service: %s'),
|
$this->params->get('service')
|
||||||
$this->params->get('service')
|
)));
|
||||||
))
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->servicesAction();
|
$this->servicesAction();
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Module\Director\Db\Migrations;
|
use Icinga\Module\Director\Db\Migrations;
|
||||||
use Icinga\Module\Director\Forms\ApplyMigrationsForm;
|
use Icinga\Module\Director\Forms\ApplyMigrationsForm;
|
||||||
use Icinga\Module\Director\Forms\KickstartForm;
|
use Icinga\Module\Director\Forms\KickstartForm;
|
||||||
@ -30,7 +31,7 @@ class IndexController extends DashboardController
|
|||||||
->handleRequest()
|
->handleRequest()
|
||||||
);
|
);
|
||||||
} elseif ($migrations->hasBeenDowngraded()) {
|
} elseif ($migrations->hasBeenDowngraded()) {
|
||||||
$this->content()->add(Html::tag('p', ['class' => 'state-hint warning'], sprintf($this->translate(
|
$this->content()->add(Hint::warning(sprintf($this->translate(
|
||||||
'Your DB schema (migration #%d) is newer than your code base.'
|
'Your DB schema (migration #%d) is newer than your code base.'
|
||||||
. ' Downgrading Icinga Director is not supported and might'
|
. ' Downgrading Icinga Director is not supported and might'
|
||||||
. ' lead to unexpected problems.'
|
. ' lead to unexpected problems.'
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Controllers;
|
namespace Icinga\Module\Director\Controllers;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Module\Director\Web\Widget\UnorderedList;
|
use Icinga\Module\Director\Web\Widget\UnorderedList;
|
||||||
use Icinga\Module\Director\ConfigDiff;
|
use Icinga\Module\Director\ConfigDiff;
|
||||||
use Icinga\Module\Director\Db\Cache\PrefetchCache;
|
use Icinga\Module\Director\Db\Cache\PrefetchCache;
|
||||||
@ -58,7 +59,7 @@ class SyncruleController extends ActionController
|
|||||||
}
|
}
|
||||||
$this->addMainActions();
|
$this->addMainActions();
|
||||||
if (! $run) {
|
if (! $run) {
|
||||||
$this->warning($this->translate('This Sync Rule has never been run before.'));
|
$c->add(Hint::warning($this->translate('This Sync Rule has never been run before.')));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ($rule->get('sync_state')) {
|
switch ($rule->get('sync_state')) {
|
||||||
@ -80,19 +81,19 @@ class SyncruleController extends ActionController
|
|||||||
*/
|
*/
|
||||||
break;
|
break;
|
||||||
case 'pending-changes':
|
case 'pending-changes':
|
||||||
$this->warning($this->translate(
|
$c->add(Hint::warning($this->translate(
|
||||||
'There are pending changes for this Sync Rule. You should trigger a new'
|
'There are pending changes for this Sync Rule. You should trigger a new'
|
||||||
. ' Sync Run.'
|
. ' Sync Run.'
|
||||||
));
|
)));
|
||||||
break;
|
break;
|
||||||
case 'failing':
|
case 'failing':
|
||||||
$this->error(sprintf(
|
$c->add(Hint::error(sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'This Sync Rule failed when last checked at %s: %s'
|
'This Sync Rule failed when last checked at %s: %s'
|
||||||
),
|
),
|
||||||
$rule->get('last_attempt'),
|
$rule->get('last_attempt'),
|
||||||
$rule->get('last_error_message')
|
$rule->get('last_error_message')
|
||||||
));
|
)));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,30 +117,14 @@ class SyncruleController extends ActionController
|
|||||||
*/
|
*/
|
||||||
protected function addPropertyHint(SyncRule $rule)
|
protected function addPropertyHint(SyncRule $rule)
|
||||||
{
|
{
|
||||||
$this->warning(Html::sprintf(
|
$this->content()->add(Hint::warning(Html::sprintf(
|
||||||
$this->translate('You must define some %s before you can run this Sync Rule'),
|
$this->translate('You must define some %s before you can run this Sync Rule'),
|
||||||
new Link(
|
new Link(
|
||||||
$this->translate('Sync Properties'),
|
$this->translate('Sync Properties'),
|
||||||
'director/syncrule/property',
|
'director/syncrule/property',
|
||||||
['rule_id' => $rule->get('id')]
|
['rule_id' => $rule->get('id')]
|
||||||
)
|
)
|
||||||
));
|
)));
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $msg
|
|
||||||
*/
|
|
||||||
protected function warning($msg)
|
|
||||||
{
|
|
||||||
$this->content()->add(Html::tag('p', ['class' => 'state-hint warning'], $msg));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $msg
|
|
||||||
*/
|
|
||||||
protected function error($msg)
|
|
||||||
{
|
|
||||||
$this->content()->add(Html::tag('p', ['class' => 'state-hint error'], $msg));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -164,19 +149,15 @@ class SyncruleController extends ActionController
|
|||||||
try {
|
try {
|
||||||
$modifications = $sync->getExpectedModifications();
|
$modifications = $sync->getExpectedModifications();
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->content()->add(
|
$this->content()->add(Hint::error($e->getMessage()));
|
||||||
Html::tag('p', [
|
|
||||||
'class' => 'state-hint error'
|
|
||||||
], $e->getMessage())
|
|
||||||
);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($modifications)) {
|
if (empty($modifications)) {
|
||||||
$this->content()->add(Html::tag('p', [
|
$this->content()->add(Hint::ok($this->translate(
|
||||||
'class' => 'state-hint ok'
|
'This Sync Rule is in sync and would currently not apply any changes'
|
||||||
], $this->translate('This Sync Rule is in sync and would currently not apply any changes')));
|
)));
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
use ipl\Html\HtmlDocument;
|
use ipl\Html\HtmlDocument;
|
||||||
use gipfl\IcingaWeb2\Link;
|
use gipfl\IcingaWeb2\Link;
|
||||||
@ -112,9 +113,7 @@ class AddToBasketForm extends DirectorForm
|
|||||||
), $basketName));
|
), $basketName));
|
||||||
return parent::onSuccess();
|
return parent::onSuccess();
|
||||||
} else {
|
} else {
|
||||||
$this->addHtmlHint(Html::tag('p', [
|
$this->addHtmlHint(Hint::error(Html::sprintf($this->translate(
|
||||||
'class' => 'error'
|
|
||||||
], Html::sprintf($this->translate(
|
|
||||||
'Please check your Basket configuration, %s does not support'
|
'Please check your Basket configuration, %s does not support'
|
||||||
. ' single "%s" configuration objects'
|
. ' single "%s" configuration objects'
|
||||||
), Link::create(
|
), Link::create(
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Module\Director\Core\CoreApi;
|
use Icinga\Module\Director\Core\CoreApi;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
|
|
||||||
@ -89,7 +90,7 @@ trait DeployFormsBug7530
|
|||||||
$this->db->settings()->set('ignore_bug7530', 'y');
|
$this->db->settings()->set('ignore_bug7530', 'y');
|
||||||
}
|
}
|
||||||
if ($this->shouldWarnAboutBug7530()) {
|
if ($this->shouldWarnAboutBug7530()) {
|
||||||
$this->addHtml(Html::tag('p', ['class' => 'state-hint warning'], Html::sprintf($this->translate(
|
$this->addHtml(Hint::warning(Html::sprintf($this->translate(
|
||||||
"Warning: you're running Icinga v2.11.0 and our configuration looks"
|
"Warning: you're running Icinga v2.11.0 and our configuration looks"
|
||||||
. " like you could face issue %s. We're already working on a solution."
|
. " like you could face issue %s. We're already working on a solution."
|
||||||
. " The GitHub Issue and our %s contain related details."
|
. " The GitHub Issue and our %s contain related details."
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Forms;
|
namespace Icinga\Module\Director\Forms;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Data\Filter\Filter;
|
use Icinga\Data\Filter\Filter;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
@ -129,11 +130,7 @@ class IcingaServiceForm extends DirectorObjectForm
|
|||||||
|
|
||||||
if ($this->hasBeenBlacklisted()) {
|
if ($this->hasBeenBlacklisted()) {
|
||||||
$this->addHtml(
|
$this->addHtml(
|
||||||
Html::tag(
|
Hint::warning($this->translate('This Service has been deactivated on this host')),
|
||||||
'p',
|
|
||||||
['class' => 'warning'],
|
|
||||||
$this->translate('This Service has been deactivated on this host')
|
|
||||||
),
|
|
||||||
['name' => 'HINT_blacklisted']
|
['name' => 'HINT_blacklisted']
|
||||||
);
|
);
|
||||||
$group = null;
|
$group = null;
|
||||||
|
@ -9,7 +9,7 @@ use Icinga\Application\Modules\Manager;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p class="state-hint error"><?= $this->escape($this->message) ?></p>
|
<p class="legacy-error"><?= $this->escape($this->message) ?></p>
|
||||||
<table class="common-table table-row-selectable">
|
<table class="common-table table-row-selectable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -4,5 +4,5 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<p class="state-hint error"><?= $this->escape($this->message) ?></p>
|
<p class="legacy-error"><?= $this->escape($this->message) ?></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Import;
|
namespace Icinga\Module\Director\Import;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Data\Db\DbConnection;
|
use Icinga\Data\Db\DbConnection;
|
||||||
use Icinga\Module\Director\Forms\ImportSourceForm;
|
use Icinga\Module\Director\Forms\ImportSourceForm;
|
||||||
use Icinga\Module\Director\Hook\ImportSourceHook;
|
use Icinga\Module\Director\Hook\ImportSourceHook;
|
||||||
@ -50,13 +51,9 @@ class ImportSourceSql extends ImportSourceHook
|
|||||||
if ($columns = $current->getSetting('column_cache')) {
|
if ($columns = $current->getSetting('column_cache')) {
|
||||||
$form->addHtmlHint('Columns: ' . $columns);
|
$form->addHtmlHint('Columns: ' . $columns);
|
||||||
} else {
|
} else {
|
||||||
$form->addHtmlHint(Html::tag(
|
$form->addHtmlHint(Hint::warning($form->translate(
|
||||||
'p',
|
'Please click "Store" once again to determine query columns'
|
||||||
['class' => 'warning'],
|
)));
|
||||||
$form->translate(
|
|
||||||
'Please click "Store" once again to determine query columns'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $form;
|
return $form;
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Controller;
|
namespace Icinga\Module\Director\Web\Controller;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\Html;
|
use ipl\Html\Html;
|
||||||
use Icinga\Exception\IcingaException;
|
use Icinga\Exception\IcingaException;
|
||||||
use Icinga\Exception\InvalidPropertyException;
|
use Icinga\Exception\InvalidPropertyException;
|
||||||
@ -194,7 +195,7 @@ abstract class ObjectController extends ActionController
|
|||||||
try {
|
try {
|
||||||
$this->addFieldsFormAndTable($object, $type);
|
$this->addFieldsFormAndTable($object, $type);
|
||||||
} catch (NestingError $e) {
|
} catch (NestingError $e) {
|
||||||
$this->content()->add(Html::tag('p', ['class' => 'error'], $e->getMessage()));
|
$this->content()->add(Hint::error($e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Controller;
|
namespace Icinga\Module\Director\Web\Controller;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Module\Director\DirectorObject\Automation\ExportInterface;
|
use Icinga\Module\Director\DirectorObject\Automation\ExportInterface;
|
||||||
use Icinga\Module\Director\Exception\NestingError;
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
use Icinga\Module\Director\Objects\IcingaCommand;
|
use Icinga\Module\Director\Objects\IcingaCommand;
|
||||||
@ -190,7 +191,7 @@ abstract class TemplateController extends CompatController
|
|||||||
TemplateUsageTable::forTemplate($template)
|
TemplateUsageTable::forTemplate($template)
|
||||||
);
|
);
|
||||||
} catch (NestingError $e) {
|
} catch (NestingError $e) {
|
||||||
$this->content()->add(Html::tag('p', ['class' => 'error'], $e->getMessage()));
|
$this->content()->add(Hint::error($e->getMessage()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web;
|
namespace Icinga\Module\Director\Web;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\Text;
|
use ipl\Html\Text;
|
||||||
use Icinga\Module\Director\Exception\NestingError;
|
use Icinga\Module\Director\Exception\NestingError;
|
||||||
use Icinga\Module\Director\Objects\IcingaObject;
|
use Icinga\Module\Director\Objects\IcingaObject;
|
||||||
@ -70,9 +71,7 @@ class ObjectPreview
|
|||||||
|
|
||||||
$content = $cc->content();
|
$content = $cc->content();
|
||||||
if ($object->isDisabled()) {
|
if ($object->isDisabled()) {
|
||||||
$content->add(Html::tag(
|
$content->add(Hint::error(
|
||||||
'p',
|
|
||||||
['class' => 'error'],
|
|
||||||
$this->translate('This object will not be deployed as it has been disabled')
|
$this->translate('This object will not be deployed as it has been disabled')
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace Icinga\Module\Director\Web;
|
namespace Icinga\Module\Director\Web;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Exception\ProgrammingError;
|
use Icinga\Exception\ProgrammingError;
|
||||||
use Icinga\Module\Director\Core\CoreApi;
|
use Icinga\Module\Director\Core\CoreApi;
|
||||||
use Icinga\Module\Director\Forms\IcingaForgetApiKeyForm;
|
use Icinga\Module\Director\Forms\IcingaForgetApiKeyForm;
|
||||||
@ -64,7 +65,7 @@ class SelfService
|
|||||||
. ' secret key, you might want to dismiss the current key. This'
|
. ' secret key, you might want to dismiss the current key. This'
|
||||||
. ' would allow you to register the same host again.'
|
. ' would allow you to register the same host again.'
|
||||||
)),
|
)),
|
||||||
Html::tag('p', ['class' => 'warning'], $this->translate(
|
Hint::warning($this->translate(
|
||||||
'It is not a good idea to do so as long as your Agent still has'
|
'It is not a good idea to do so as long as your Agent still has'
|
||||||
. ' a valid Self Service API key!'
|
. ' a valid Self Service API key!'
|
||||||
)),
|
)),
|
||||||
@ -119,7 +120,7 @@ class SelfService
|
|||||||
$wizard->renderTokenBasedWindowsInstaller($key)
|
$wizard->renderTokenBasedWindowsInstaller($key)
|
||||||
),
|
),
|
||||||
Html::tag('h2', null, $this->translate('Generate a new key')),
|
Html::tag('h2', null, $this->translate('Generate a new key')),
|
||||||
Html::tag('p', ['class' => 'warning'], $this->translate(
|
Hint::warning($this->translate(
|
||||||
'This will invalidate the former key'
|
'This will invalidate the former key'
|
||||||
)),
|
)),
|
||||||
]);
|
]);
|
||||||
@ -206,7 +207,7 @@ class SelfService
|
|||||||
$wizard = new AgentWizard($host);
|
$wizard = new AgentWizard($host);
|
||||||
$wizard->setTicketSalt($this->api->getTicketSalt());
|
$wizard->setTicketSalt($this->api->getTicketSalt());
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$c->add(Html::tag('p', ['class' => 'error'], sprintf(
|
$c->add(Hint::error(sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'A ticket for this agent could not have been requested from'
|
'A ticket for this agent could not have been requested from'
|
||||||
. ' your deployment endpoint: %s'
|
. ' your deployment endpoint: %s'
|
||||||
|
@ -5,6 +5,7 @@ namespace Icinga\Module\Director\Web\Widget;
|
|||||||
use gipfl\IcingaWeb2\Icon;
|
use gipfl\IcingaWeb2\Icon;
|
||||||
use gipfl\IcingaWeb2\Widget\NameValueTable;
|
use gipfl\IcingaWeb2\Widget\NameValueTable;
|
||||||
use gipfl\Translation\TranslationHelper;
|
use gipfl\Translation\TranslationHelper;
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Date\DateFormatter;
|
use Icinga\Date\DateFormatter;
|
||||||
use Icinga\Module\Director\Daemon\RunningDaemonInfo;
|
use Icinga\Module\Director\Daemon\RunningDaemonInfo;
|
||||||
use Icinga\Util\Format;
|
use Icinga\Util\Format;
|
||||||
@ -34,9 +35,7 @@ class BackgroundDaemonDetails extends BaseHtmlElement
|
|||||||
{
|
{
|
||||||
$info = $this->info;
|
$info = $this->info;
|
||||||
if ($info->hasBeenStopped()) {
|
if ($info->hasBeenStopped()) {
|
||||||
$this->add(Html::tag('p', [
|
$this->add(Hint::error(Html::sprintf(
|
||||||
'class' => 'state-hint error'
|
|
||||||
], Html::sprintf(
|
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'Daemon has been stopped %s, was running with PID %s as %s@%s'
|
'Daemon has been stopped %s, was running with PID %s as %s@%s'
|
||||||
),
|
),
|
||||||
@ -47,9 +46,7 @@ class BackgroundDaemonDetails extends BaseHtmlElement
|
|||||||
Html::tag('strong', $info->getFqdn())
|
Html::tag('strong', $info->getFqdn())
|
||||||
)));
|
)));
|
||||||
} elseif ($info->isOutdated()) {
|
} elseif ($info->isOutdated()) {
|
||||||
$this->add(Html::tag('p', [
|
$this->add(Hint::error(Html::sprintf(
|
||||||
'class' => 'state-hint error'
|
|
||||||
], Html::sprintf(
|
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'Daemon keep-alive is outdated, was last seen running with PID %s as %s@%s %s'
|
'Daemon keep-alive is outdated, was last seen running with PID %s as %s@%s %s'
|
||||||
),
|
),
|
||||||
@ -83,9 +80,7 @@ class BackgroundDaemonDetails extends BaseHtmlElement
|
|||||||
),
|
),
|
||||||
]);
|
]);
|
||||||
$this->add($details);
|
$this->add($details);
|
||||||
$this->add(Html::tag('p', [
|
$this->add(Hint::ok(Html::sprintf(
|
||||||
'class' => 'state-hint ok'
|
|
||||||
], Html::sprintf(
|
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'Daemon is running with PID %s as %s@%s, last refresh happened %s'
|
'Daemon is running with PID %s as %s@%s, last refresh happened %s'
|
||||||
),
|
),
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Widget;
|
namespace Icinga\Module\Director\Web\Widget;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use ipl\Html\HtmlDocument;
|
use ipl\Html\HtmlDocument;
|
||||||
use Icinga\Module\Director\Forms\ImportCheckForm;
|
use Icinga\Module\Director\Forms\ImportCheckForm;
|
||||||
use Icinga\Module\Director\Forms\ImportRunForm;
|
use Icinga\Module\Director\Forms\ImportRunForm;
|
||||||
@ -30,17 +31,13 @@ class ImportSourceDetails extends HtmlDocument
|
|||||||
|
|
||||||
switch ($source->get('import_state')) {
|
switch ($source->get('import_state')) {
|
||||||
case 'unknown':
|
case 'unknown':
|
||||||
$this->add(Html::tag(
|
$this->add(Hint::warning($this->translate(
|
||||||
'p',
|
"It's currently unknown whether we are in sync with this Import Source."
|
||||||
['class' => 'state-hint warning'],
|
. ' You should either check for changes or trigger a new Import Run.'
|
||||||
$this->translate(
|
)));
|
||||||
"It's currently unknown whether we are in sync with this Import Source."
|
|
||||||
. ' You should either check for changes or trigger a new Import Run.'
|
|
||||||
)
|
|
||||||
));
|
|
||||||
break;
|
break;
|
||||||
case 'in-sync':
|
case 'in-sync':
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint ok'], sprintf(
|
$this->add(Hint::ok(sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'This Import Source was last found to be in sync at %s.'
|
'This Import Source was last found to be in sync at %s.'
|
||||||
),
|
),
|
||||||
@ -51,13 +48,13 @@ class ImportSourceDetails extends HtmlDocument
|
|||||||
// - there have been activities since then
|
// - there have been activities since then
|
||||||
break;
|
break;
|
||||||
case 'pending-changes':
|
case 'pending-changes':
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint warning'], $this->translate(
|
$this->add(Hint::warning($this->translate(
|
||||||
'There are pending changes for this Import Source. You should trigger a new'
|
'There are pending changes for this Import Source. You should trigger a new'
|
||||||
. ' Import Run.'
|
. ' Import Run.'
|
||||||
)));
|
)));
|
||||||
break;
|
break;
|
||||||
case 'failing':
|
case 'failing':
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint error'], sprintf(
|
$this->add(Hint::error(sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'This Import Source failed when last checked at %s: %s'
|
'This Import Source failed when last checked at %s: %s'
|
||||||
),
|
),
|
||||||
@ -66,7 +63,7 @@ class ImportSourceDetails extends HtmlDocument
|
|||||||
)));
|
)));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint error'], sprintf(
|
$this->add(Hint::error(sprintf(
|
||||||
$this->translate('This Import Source has an invalid state: %s'),
|
$this->translate('This Import Source has an invalid state: %s'),
|
||||||
$source->get('import_state')
|
$source->get('import_state')
|
||||||
)));
|
)));
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Icinga\Module\Director\Web\Widget;
|
namespace Icinga\Module\Director\Web\Widget;
|
||||||
|
|
||||||
|
use gipfl\Web\Widget\Hint;
|
||||||
use Icinga\Date\DateFormatter;
|
use Icinga\Date\DateFormatter;
|
||||||
use ipl\Html\HtmlDocument;
|
use ipl\Html\HtmlDocument;
|
||||||
use Icinga\Module\Director\Objects\DirectorJob;
|
use Icinga\Module\Director\Objects\DirectorJob;
|
||||||
@ -21,7 +22,7 @@ class JobDetails extends HtmlDocument
|
|||||||
{
|
{
|
||||||
$runInterval = $job->get('run_interval');
|
$runInterval = $job->get('run_interval');
|
||||||
if ($job->hasBeenDisabled()) {
|
if ($job->hasBeenDisabled()) {
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint error'], sprintf(
|
$this->add(Hint::error(sprintf(
|
||||||
$this->translate(
|
$this->translate(
|
||||||
'This job would run every %ds. It has been disabled and will'
|
'This job would run every %ds. It has been disabled and will'
|
||||||
. ' therefore not be executed as scheduled'
|
. ' therefore not be executed as scheduled'
|
||||||
@ -50,21 +51,19 @@ class JobDetails extends HtmlDocument
|
|||||||
], DateFormatter::timeAgo($ts));
|
], DateFormatter::timeAgo($ts));
|
||||||
if ($tsLastAttempt) {
|
if ($tsLastAttempt) {
|
||||||
if ($job->get('last_attempt_succeeded') === 'y') {
|
if ($job->get('last_attempt_succeeded') === 'y') {
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint ok'], Html::sprintf(
|
$this->add(Hint::ok(Html::sprintf(
|
||||||
$this->translate('The last attempt succeeded %s'),
|
$this->translate('The last attempt succeeded %s'),
|
||||||
$timeAgo
|
$timeAgo
|
||||||
)));
|
)));
|
||||||
} else {
|
} else {
|
||||||
$this->add(Html::tag('p', ['class' => 'state-hint error'], Html::sprintf(
|
$this->add(Hint::error(Html::sprintf(
|
||||||
$this->translate('The last attempt failed %s: %s'),
|
$this->translate('The last attempt failed %s: %s'),
|
||||||
$timeAgo,
|
$timeAgo,
|
||||||
$job->get('last_error_message')
|
$job->get('last_error_message')
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$this->add(Html::tag('p', [
|
$this->add(Hint::warning($this->translate('This job has not been executed yet')));
|
||||||
'class' => 'state-hint warning'
|
|
||||||
], $this->translate('This job has not been executed yet')));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1105,79 +1105,11 @@ span.error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
p.error:not(.state-hint) {
|
p.legacy-error {
|
||||||
color: white;
|
color: white;
|
||||||
padding: 1em 2em;
|
padding: 1em 2em;
|
||||||
background-color: @colorCritical;
|
background-color: @colorCritical;
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.warning:not(.state-hint) {
|
|
||||||
color: white;
|
|
||||||
padding: 1em 2em;
|
|
||||||
background-color: @colorWarning;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.information:not(.state-hint) {
|
|
||||||
color: white;
|
|
||||||
padding: 1em 2em;
|
|
||||||
background-color: @colorOk;
|
|
||||||
font-weight: bold;
|
|
||||||
|
|
||||||
a {
|
|
||||||
color: inherit;
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
p.state-hint {
|
|
||||||
border: 1px solid @text-color;
|
|
||||||
padding: 0.5em;
|
|
||||||
line-height: 2em;
|
|
||||||
max-width: 60em;
|
|
||||||
border-left-width: 3em;
|
|
||||||
&:before {
|
|
||||||
position: relative;
|
|
||||||
margin-left: -1.5em;
|
|
||||||
margin-right: 0.5em;
|
|
||||||
height: 100%;
|
|
||||||
vertical-align: middle;
|
|
||||||
font-family: 'ifont';
|
|
||||||
color: white;
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
&.ok {
|
|
||||||
border-color: @color-ok;
|
|
||||||
}
|
|
||||||
&.warning {
|
|
||||||
border-color: @color-warning;
|
|
||||||
}
|
|
||||||
&.error {
|
|
||||||
border-color: @color-critical;
|
|
||||||
}
|
|
||||||
&.critical:before, &.error:before {
|
|
||||||
content: '\e885';
|
|
||||||
}
|
|
||||||
&.warning:before {
|
|
||||||
content: '\e885';
|
|
||||||
}
|
|
||||||
&.ok:before {
|
|
||||||
content: '\e803';
|
|
||||||
}
|
|
||||||
a {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
table th.actions, table td.actions {
|
table th.actions, table td.actions {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user