mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-04-21 14:17:50 -04:00
parent
cc45c503ba
commit
cb142007c3
7 changed files with 34 additions and 17 deletions
|
|
@ -204,7 +204,7 @@ abstract class ObjectInspectionDetail extends BaseHtmlElement
|
|||
private function formatTimestamp($ts)
|
||||
{
|
||||
if (empty($ts)) {
|
||||
return '-';
|
||||
return new EmptyState(t('n. a.'));
|
||||
}
|
||||
|
||||
if (is_float($ts)) {
|
||||
|
|
@ -250,7 +250,7 @@ abstract class ObjectInspectionDetail extends BaseHtmlElement
|
|||
$table->addAttributes(['class' => 'name-value-table']);
|
||||
foreach ($data as $name => $value) {
|
||||
if (empty($value) && ($value === null || is_string($value) || is_array($value))) {
|
||||
$value = '-';
|
||||
$value = new EmptyState(t('n. a.'));
|
||||
} elseif (isset($formatters[$name])) {
|
||||
$value = call_user_func($formatters[$name], $value);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
namespace Icinga\Module\Icingadb\Widget\Detail;
|
||||
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use ipl\Html\BaseHtmlElement;
|
||||
use ipl\Html\Html;
|
||||
|
||||
|
|
@ -80,6 +81,10 @@ class CustomVarTable extends BaseHtmlElement
|
|||
|
||||
protected function renderScalar($name, $value)
|
||||
{
|
||||
if ($value === '') {
|
||||
$value = new EmptyState(t('empty string'));
|
||||
}
|
||||
|
||||
$this->addRow($name, $value);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ use Icinga\Module\Icingadb\Common\Auth;
|
|||
use Icinga\Module\Icingadb\Common\Database;
|
||||
use Icinga\Module\Icingadb\Common\HostLink;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use Icinga\Module\Icingadb\Widget\MarkdownText;
|
||||
use Icinga\Module\Icingadb\Common\ServiceLink;
|
||||
use Icinga\Module\Icingadb\Forms\Command\Object\DeleteDowntimeForm;
|
||||
|
|
@ -138,11 +139,15 @@ class DowntimeDetail extends BaseHtmlElement
|
|||
));
|
||||
$this->add(new HorizontalKeyValue(
|
||||
t('Start time'),
|
||||
$this->downtime->start_time ? WebDateFormatter::formatDateTime($this->downtime->start_time) : '-'
|
||||
$this->downtime->start_time
|
||||
? WebDateFormatter::formatDateTime($this->downtime->start_time)
|
||||
: new EmptyState(t('Not started yet'))
|
||||
));
|
||||
$this->add(new HorizontalKeyValue(
|
||||
t('End time'),
|
||||
$this->downtime->end_time ? WebDateFormatter::formatDateTime($this->downtime->end_time) : '-'
|
||||
$this->downtime->end_time
|
||||
? WebDateFormatter::formatDateTime($this->downtime->end_time)
|
||||
: new EmptyState(t('Not started yet'))
|
||||
));
|
||||
$this->add(new HorizontalKeyValue(
|
||||
t('Scheduled Start'),
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ class EventDetail extends BaseHtmlElement
|
|||
new HorizontalKeyValue(t('Author'), [new Icon('user'), $comment->author]),
|
||||
new HorizontalKeyValue(t('Expires On'), $comment->expire_time
|
||||
? DateFormatter::formatDateTime($comment->expire_time)
|
||||
: '-')
|
||||
: new EmptyState(t('Never')))
|
||||
);
|
||||
|
||||
if ($comment->entry_type === 'ack') {
|
||||
|
|
@ -440,7 +440,7 @@ class EventDetail extends BaseHtmlElement
|
|||
$this->addHtml(
|
||||
new HorizontalKeyValue(t('Expires On'), $acknowledgement->expire_time
|
||||
? DateFormatter::formatDateTime($acknowledgement->expire_time)
|
||||
: '-'),
|
||||
: new EmptyState(t('Never'))),
|
||||
new HorizontalKeyValue(t('Sticky'), $acknowledgement->is_sticky ? t('Yes') : t('No')),
|
||||
new HorizontalKeyValue(t('Persistent'), $acknowledgement->is_persistent ? t('Yes') : t('No'))
|
||||
);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Icinga\Module\Icingadb\Widget\Detail;
|
|||
|
||||
use Icinga\Date\DateFormatter;
|
||||
use Icinga\Module\Icingadb\Model\Host;
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use ipl\Web\Widget\HorizontalKeyValue;
|
||||
use ipl\Web\Widget\VerticalKeyValue;
|
||||
use ipl\Html\Attributes;
|
||||
|
|
@ -35,8 +36,14 @@ class HostMetaInfo extends BaseHtmlElement
|
|||
new HtmlElement(
|
||||
'div',
|
||||
null,
|
||||
new HorizontalKeyValue('host.address', $this->host->address ?: '-'),
|
||||
new HorizontalKeyValue('host.address6', $this->host->address6 ?: '-')
|
||||
new HorizontalKeyValue(
|
||||
'host.address',
|
||||
$this->host->address ?: new EmptyState(t('None', 'address'))
|
||||
),
|
||||
new HorizontalKeyValue(
|
||||
'host.address6',
|
||||
$this->host->address6 ?: new EmptyState(t('None', 'address'))
|
||||
)
|
||||
),
|
||||
new VerticalKeyValue(
|
||||
'last_state_change',
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ namespace Icinga\Module\Icingadb\Widget\Detail;
|
|||
|
||||
use Icinga\Module\Icingadb\Util\PerfData;
|
||||
use Icinga\Module\Icingadb\Util\PerfDataSet;
|
||||
use Icinga\Module\Icingadb\Widget\EmptyState;
|
||||
use ipl\Html\Attributes;
|
||||
use ipl\Html\HtmlElement;
|
||||
use ipl\Html\HtmlString;
|
||||
|
|
@ -121,15 +122,14 @@ class PerfDataTable extends Table
|
|||
}
|
||||
|
||||
foreach ($perfdata->toArray() as $column => $value) {
|
||||
$text = htmlspecialchars(empty($value) ? '-' : $value);
|
||||
$text = htmlspecialchars($value);
|
||||
$cols[] = Table::td(
|
||||
new HtmlElement(
|
||||
'span',
|
||||
Attributes::create([
|
||||
'title' => ($text == '-' ? t('no value given') : $text),
|
||||
'class' => ($text != '-' ?: 'no-value')
|
||||
'class' => ($text ? '' : 'no-value')
|
||||
]),
|
||||
Text::create($text)
|
||||
$text ? Text::create($text) : new EmptyState(t('None', 'value'))
|
||||
),
|
||||
[ 'class' => ($column == 'label' ? 'title' : null) ]
|
||||
);
|
||||
|
|
|
|||
|
|
@ -61,11 +61,11 @@ class UserDetail extends BaseHtmlElement
|
|||
|
||||
return [
|
||||
new HtmlElement('h2', null, Text::create(t('Details'))),
|
||||
new HorizontalKeyValue(t('E-Mail'), $this->user->email ?: '-'),
|
||||
new HorizontalKeyValue(t('Pager'), $this->user->pager ?: '-'),
|
||||
new HorizontalKeyValue(t('Host States'), $hostStates ?: '-'),
|
||||
new HorizontalKeyValue(t('Service States'), $serviceStates ?: '-'),
|
||||
new HorizontalKeyValue(t('Types'), $types ?: '-')
|
||||
new HorizontalKeyValue(t('E-Mail'), $this->user->email ?: new EmptyState(t('None', 'address'))),
|
||||
new HorizontalKeyValue(t('Pager'), $this->user->pager ?: new EmptyState(t('None', 'phone-number'))),
|
||||
new HorizontalKeyValue(t('Host States'), $hostStates ?: t('All')),
|
||||
new HorizontalKeyValue(t('Service States'), $serviceStates ?: t('All')),
|
||||
new HorizontalKeyValue(t('Types'), $types ?: t('All'))
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue