summaryrefslogtreecommitdiffstats
path: root/library/Icingadb/Widget
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--library/Icingadb/Widget/Detail/DowntimeCard.php2
-rw-r--r--library/Icingadb/Widget/Detail/EventDetail.php8
-rw-r--r--library/Icingadb/Widget/Detail/MultiselectQuickActions.php1
-rw-r--r--library/Icingadb/Widget/Detail/ObjectDetail.php5
-rw-r--r--library/Icingadb/Widget/HostSummaryDonut.php2
-rw-r--r--library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php6
-rw-r--r--library/Icingadb/Widget/ItemList/HostDetailHeader.php4
-rw-r--r--library/Icingadb/Widget/ItemList/ServiceDetailHeader.php4
-rw-r--r--library/Icingadb/Widget/ItemList/StateList.php2
-rw-r--r--library/Icingadb/Widget/ItemList/StateListItem.php2
-rw-r--r--library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/HostgroupTableRow.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php4
-rw-r--r--library/Icingadb/Widget/ItemTable/StateRowItem.php2
-rw-r--r--library/Icingadb/Widget/ServiceSummaryDonut.php2
16 files changed, 34 insertions, 22 deletions
diff --git a/library/Icingadb/Widget/Detail/DowntimeCard.php b/library/Icingadb/Widget/Detail/DowntimeCard.php
index 81f59da..8184479 100644
--- a/library/Icingadb/Widget/Detail/DowntimeCard.php
+++ b/library/Icingadb/Widget/Detail/DowntimeCard.php
@@ -35,7 +35,7 @@ class DowntimeCard extends BaseHtmlElement
$this->start = $this->downtime->scheduled_start_time->getTimestamp();
$this->end = $this->downtime->scheduled_end_time->getTimestamp();
- if ($this->downtime->end_time > $this->downtime->scheduled_end_time) {
+ if ($this->downtime->end_time && $this->downtime->end_time > $this->downtime->scheduled_end_time) {
$this->duration = $this->downtime->end_time->getTimestamp() - $this->start;
} else {
$this->duration = $this->end - $this->start;
diff --git a/library/Icingadb/Widget/Detail/EventDetail.php b/library/Icingadb/Widget/Detail/EventDetail.php
index 181c9ae..aaf7608 100644
--- a/library/Icingadb/Widget/Detail/EventDetail.php
+++ b/library/Icingadb/Widget/Detail/EventDetail.php
@@ -366,7 +366,7 @@ class EventDetail extends BaseHtmlElement
}
$cancelInfo = [];
- if ($downtime->has_been_cancelled) {
+ if ($downtime->has_been_cancelled && $downtime->cancel_time) {
$cancelInfo = [
new HtmlElement('h2', null, Text::create(t('This downtime has been cancelled'))),
new HorizontalKeyValue(
@@ -430,7 +430,7 @@ class EventDetail extends BaseHtmlElement
}
$removedInfo = [];
- if ($comment->has_been_removed) {
+ if ($comment->has_been_removed && $comment->remove_time) {
$removedInfo[] = new HtmlElement('h2', null, Text::create(t('This comment has been removed')));
if ($comment->removed_by) {
$removedInfo[] = new HorizontalKeyValue(
@@ -487,7 +487,7 @@ class EventDetail extends BaseHtmlElement
$flapping->percent_state_change_start,
$flapping->flapping_threshold_high
));
- } else {
+ } elseif ($flapping->end_time !== null) {
$eventInfo[] = new HorizontalKeyValue(
t('Ended on'),
DateFormatter::formatDateTime($flapping->end_time->getTimestamp())
@@ -567,7 +567,7 @@ class EventDetail extends BaseHtmlElement
if ($acknowledgement->cleared_by) {
$eventInfo[] = new HorizontalKeyValue(
t('Cleared by'),
- [new Icon('user', $acknowledgement->cleared_by)]
+ [new Icon('user'), $acknowledgement->cleared_by]
);
} else {
$expired = false;
diff --git a/library/Icingadb/Widget/Detail/MultiselectQuickActions.php b/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
index f398d80..b80ec9d 100644
--- a/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
+++ b/library/Icingadb/Widget/Detail/MultiselectQuickActions.php
@@ -67,6 +67,7 @@ class MultiselectQuickActions extends BaseHtmlElement
) {
$removeAckForm = (new RemoveAcknowledgementForm())
->setAction($this->getLink('removeAcknowledgement'))
+ // TODO: This is a hack as for the button label the count of objects is used. setCount? setMultiple?
->setObjects(array_fill(0, $this->summary->$acks, null));
$this->add(Html::tag('li', $removeAckForm));
diff --git a/library/Icingadb/Widget/Detail/ObjectDetail.php b/library/Icingadb/Widget/Detail/ObjectDetail.php
index a688173..4ba0e69 100644
--- a/library/Icingadb/Widget/Detail/ObjectDetail.php
+++ b/library/Icingadb/Widget/Detail/ObjectDetail.php
@@ -423,7 +423,10 @@ class ObjectDetail extends BaseHtmlElement
if (empty($this->object->state->output) && empty($this->object->state->long_output)) {
$pluginOutput = new EmptyState(t('Output unavailable.'));
} else {
- $pluginOutput = new PluginOutputContainer(PluginOutput::fromObject($this->object));
+ $pluginOutput = new PluginOutputContainer(
+ PluginOutput::fromObject($this->object)
+ ->setCharacterLimit(10000)
+ );
CopyToClipboard::attachTo($pluginOutput);
}
diff --git a/library/Icingadb/Widget/HostSummaryDonut.php b/library/Icingadb/Widget/HostSummaryDonut.php
index db5fef8..5efcf74 100644
--- a/library/Icingadb/Widget/HostSummaryDonut.php
+++ b/library/Icingadb/Widget/HostSummaryDonut.php
@@ -47,7 +47,7 @@ class HostSummaryDonut extends Card
->addSlice($this->summary->hosts_down_handled, ['class' => 'slice-state-critical-handled'])
->addSlice($this->summary->hosts_down_unhandled, ['class' => 'slice-state-critical'])
->addSlice($this->summary->hosts_pending, ['class' => 'slice-state-pending'])
- ->setLabelBig($this->summary->hosts_down_unhandled)
+ ->setLabelBig((string) $this->summary->hosts_down_unhandled)
->setLabelBigUrl(Links::hosts()->setFilter($labelBigUrlFilter)->addParams([
'sort' => 'host.state.last_state_change'
]))
diff --git a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
index 7ebc1f6..dedaa72 100644
--- a/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
+++ b/library/Icingadb/Widget/ItemList/BaseDowntimeListItem.php
@@ -56,7 +56,11 @@ abstract class BaseDowntimeListItem extends BaseListItem
protected function init(): void
{
- if ($this->item->is_flexible && $this->item->is_in_effect) {
+ if (
+ isset($this->item->start_time, $this->item->end_time)
+ && $this->item->is_flexible
+ && $this->item->is_in_effect
+ ) {
$this->startTime = $this->item->start_time->getTimestamp();
$this->endTime = $this->item->end_time->getTimestamp();
} else {
diff --git a/library/Icingadb/Widget/ItemList/HostDetailHeader.php b/library/Icingadb/Widget/ItemList/HostDetailHeader.php
index 97176da..b7afb23 100644
--- a/library/Icingadb/Widget/ItemList/HostDetailHeader.php
+++ b/library/Icingadb/Widget/ItemList/HostDetailHeader.php
@@ -50,7 +50,9 @@ class HostDetailHeader extends HostListItemMinimal
}
$stateChange->setIcon($this->state->getIcon());
- $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
+ $stateChange->setHandled(
+ $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
+ );
$visual->addHtml($stateChange);
}
diff --git a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
index 2f0dbbd..8c5094d 100644
--- a/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
+++ b/library/Icingadb/Widget/ItemList/ServiceDetailHeader.php
@@ -50,7 +50,9 @@ class ServiceDetailHeader extends ServiceListItemMinimal
}
$stateChange->setIcon($this->state->getIcon());
- $stateChange->setHandled($this->state->is_handled || ! $this->state->is_reachable);
+ $stateChange->setHandled(
+ $this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)
+ );
$visual->addHtml($stateChange);
}
diff --git a/library/Icingadb/Widget/ItemList/StateList.php b/library/Icingadb/Widget/ItemList/StateList.php
index 1e6dcb9..9671c97 100644
--- a/library/Icingadb/Widget/ItemList/StateList.php
+++ b/library/Icingadb/Widget/ItemList/StateList.php
@@ -53,7 +53,7 @@ abstract class StateList extends BaseItemList
if ($this->data instanceof VolatileStateResults && $this->data->isRedisUnavailable()) {
$this->prependWrapper((new HtmlDocument())->addHtml(new Notice(
- t('Icinga Redis is currently unavailable. The shown information might be outdated.')
+ t('Redis is currently unavailable. The shown information might be outdated.')
)));
}
}
diff --git a/library/Icingadb/Widget/ItemList/StateListItem.php b/library/Icingadb/Widget/ItemList/StateListItem.php
index d0b3363..cd8ff16 100644
--- a/library/Icingadb/Widget/ItemList/StateListItem.php
+++ b/library/Icingadb/Widget/ItemList/StateListItem.php
@@ -99,7 +99,7 @@ abstract class StateListItem extends BaseListItem
{
$stateBall = new StateBall($this->state->getStateText(), $this->getStateBallSize());
$stateBall->add($this->state->getIcon());
- if ($this->state->is_handled || ! $this->state->is_reachable) {
+ if ($this->state->is_problem && ($this->state->is_handled || ! $this->state->is_reachable)) {
$stateBall->getAttributes()->add('class', 'handled');
}
diff --git a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
index c56a1f8..b3099c8 100644
--- a/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
+++ b/library/Icingadb/Widget/ItemTable/BaseHostGroupItem.php
@@ -5,7 +5,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
use Icinga\Module\Icingadb\Common\Links;
-use Icinga\Module\Icingadb\Model\Hostgroup;
+use Icinga\Module\Icingadb\Model\Hostgroupsummary;
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
@@ -18,7 +18,7 @@ use ipl\Web\Widget\Link;
/**
* Hostgroup item of a hostgroup list. Represents one database row.
*
- * @property Hostgroup $item
+ * @property Hostgroupsummary $item
* @property HostgroupTable $table
*/
abstract class BaseHostGroupItem extends BaseTableRowItem
diff --git a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
index 7bee532..24f0bea 100644
--- a/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
+++ b/library/Icingadb/Widget/ItemTable/BaseServiceGroupItem.php
@@ -5,7 +5,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
use Icinga\Module\Icingadb\Common\Links;
-use Icinga\Module\Icingadb\Model\Servicegroup;
+use Icinga\Module\Icingadb\Model\ServicegroupSummary;
use ipl\Html\Attributes;
use ipl\Html\BaseHtmlElement;
use ipl\Html\HtmlElement;
@@ -18,7 +18,7 @@ use ipl\Web\Widget\Link;
/**
* Servicegroup item of a servicegroup list. Represents one database row.
*
- * @property Servicegroup $item
+ * @property ServicegroupSummary $item
* @property ServicegroupTable $table
*/
abstract class BaseServiceGroupItem extends BaseTableRowItem
diff --git a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
index 6aa61c2..cb3f06a 100644
--- a/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
+++ b/library/Icingadb/Widget/ItemTable/HostgroupTableRow.php
@@ -4,7 +4,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
-use Icinga\Module\Icingadb\Model\Hostgroup;
+use Icinga\Module\Icingadb\Model\Hostgroupsummary;
use Icinga\Module\Icingadb\Widget\Detail\HostStatistics;
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
use ipl\Html\BaseHtmlElement;
@@ -13,7 +13,7 @@ use ipl\Stdlib\Filter;
/**
* Hostgroup table row of a hostgroup table. Represents one database row.
*
- * @property Hostgroup $item
+ * @property Hostgroupsummary $item
* @property HostgroupTable $table
*/
class HostgroupTableRow extends BaseHostGroupItem
diff --git a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
index 3dea4c1..e34c029 100644
--- a/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
+++ b/library/Icingadb/Widget/ItemTable/ServicegroupTableRow.php
@@ -4,7 +4,7 @@
namespace Icinga\Module\Icingadb\Widget\ItemTable;
-use Icinga\Module\Icingadb\Model\Servicegroup;
+use Icinga\Module\Icingadb\Model\ServicegroupSummary;
use Icinga\Module\Icingadb\Widget\Detail\ServiceStatistics;
use ipl\Html\BaseHtmlElement;
use ipl\Stdlib\Filter;
@@ -12,7 +12,7 @@ use ipl\Stdlib\Filter;
/**
* Servicegroup item of a servicegroup list. Represents one database row.
*
- * @property Servicegroup $item
+ * @property ServicegroupSummary $item
* @property ServicegroupTable $table
*/
class ServicegroupTableRow extends BaseServiceGroupItem
diff --git a/library/Icingadb/Widget/ItemTable/StateRowItem.php b/library/Icingadb/Widget/ItemTable/StateRowItem.php
index f62286b..7ca9392 100644
--- a/library/Icingadb/Widget/ItemTable/StateRowItem.php
+++ b/library/Icingadb/Widget/ItemTable/StateRowItem.php
@@ -33,7 +33,7 @@ abstract class StateRowItem extends BaseStateRowItem
$stateBall = new StateBall($this->item->state->getStateText(), StateBall::SIZE_LARGE);
$stateBall->add($this->item->state->getIcon());
- if ($this->item->state->is_handled) {
+ if ($this->item->state->is_problem && ($this->item->state->is_handled || ! $this->item->state->is_reachable)) {
$stateBall->getAttributes()->add('class', 'handled');
}
diff --git a/library/Icingadb/Widget/ServiceSummaryDonut.php b/library/Icingadb/Widget/ServiceSummaryDonut.php
index e806fba..e6b38a1 100644
--- a/library/Icingadb/Widget/ServiceSummaryDonut.php
+++ b/library/Icingadb/Widget/ServiceSummaryDonut.php
@@ -50,7 +50,7 @@ class ServiceSummaryDonut extends Card
->addSlice($this->summary->services_unknown_handled, ['class' => 'slice-state-unknown-handled'])
->addSlice($this->summary->services_unknown_unhandled, ['class' => 'slice-state-unknown'])
->addSlice($this->summary->services_pending, ['class' => 'slice-state-pending'])
- ->setLabelBig($this->summary->services_critical_unhandled)
+ ->setLabelBig((string) $this->summary->services_critical_unhandled)
->setLabelBigUrl(Links::services()->setFilter($labelBigUrlFilter)->addParams([
'sort' => 'service.state.last_state_change'
]))