mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
TacticalController: Utilize the new summary widgets
This commit is contained in:
parent
3ab65f7a14
commit
f8cec7ba87
1 changed files with 10 additions and 53 deletions
|
|
@ -2,15 +2,11 @@
|
|||
|
||||
namespace Icinga\Module\Icingadb\Controllers;
|
||||
|
||||
use Icinga\Chart\Donut;
|
||||
use Icinga\Module\Icingadb\Common\Links;
|
||||
use Icinga\Module\Icingadb\Model\HoststateSummary;
|
||||
use Icinga\Module\Icingadb\Model\ServicestateSummary;
|
||||
use Icinga\Module\Icingadb\Web\Controller;
|
||||
use Icinga\Module\Icingadb\Widget\HostStateBadges;
|
||||
use Icinga\Module\Icingadb\Widget\ServiceStateBadges;
|
||||
use ipl\Html\Html;
|
||||
use ipl\Html\HtmlString;
|
||||
use Icinga\Module\Icingadb\Widget\HostSummaryDonut;
|
||||
use Icinga\Module\Icingadb\Widget\ServiceSummaryDonut;
|
||||
|
||||
class TacticalController extends Controller
|
||||
{
|
||||
|
|
@ -34,54 +30,15 @@ class TacticalController extends Controller
|
|||
|
||||
$this->addControl($filterControl);
|
||||
|
||||
$hoststateSummary = $hoststateSummary->first();
|
||||
$servicestateSummary = $servicestateSummary->first();
|
||||
$this->addContent(
|
||||
(new HostSummaryDonut($hoststateSummary->first()))
|
||||
->setBaseFilter($this->getFilter())
|
||||
);
|
||||
|
||||
$hostsChart = (new Donut())
|
||||
->addSlice($hoststateSummary->hosts_up, ['class' => 'slice-state-ok'])
|
||||
->addSlice($hoststateSummary->hosts_down_handled, ['class' => 'slice-state-critical-handled'])
|
||||
->addSlice($hoststateSummary->hosts_down_unhandled, ['class' => 'slice-state-critical'])
|
||||
->addSlice($hoststateSummary->hosts_unreachable_handled, ['class' => 'slice-state-unreachable-handled'])
|
||||
->addSlice($hoststateSummary->hosts_unreachable_unhandled, ['class' => 'slice-state-unreachable'])
|
||||
->addSlice($hoststateSummary->hosts_pending, ['class' => 'slice-state-pending'])
|
||||
->setLabelBig($hoststateSummary->hosts_down_unhandled)
|
||||
->setLabelBigUrl(Links::hosts()->addFilter($this->getFilter())->addParams([
|
||||
'host.state.soft_state' => 1,
|
||||
'host.state.is_handled' => 'n',
|
||||
'sort' => 'host.state.last_state_change'
|
||||
]))
|
||||
->setLabelBigEyeCatching($hoststateSummary->hosts_down_unhandled > 0)
|
||||
->setLabelSmall($this->translate('Hosts Down'));
|
||||
|
||||
$servicesChart = (new Donut())
|
||||
->addSlice($servicestateSummary->services_ok, ['class' => 'slice-state-ok'])
|
||||
->addSlice($servicestateSummary->services_warning_handled, ['class' => 'slice-state-warning-handled'])
|
||||
->addSlice($servicestateSummary->services_warning_unhandled, ['class' => 'slice-state-warning'])
|
||||
->addSlice($servicestateSummary->services_critical_handled, ['class' => 'slice-state-critical-handled'])
|
||||
->addSlice($servicestateSummary->services_critical_unhandled, ['class' => 'slice-state-critical'])
|
||||
->addSlice($servicestateSummary->services_unknown_handled, ['class' => 'slice-state-unknown-handled'])
|
||||
->addSlice($servicestateSummary->services_unknown_unhandled, ['class' => 'slice-state-unknown'])
|
||||
->addSlice($servicestateSummary->services_pending, ['class' => 'slice-state-pending'])
|
||||
->setLabelBig($servicestateSummary->services_critical_unhandled)
|
||||
->setLabelBigUrl(Links::services()->addFilter($this->getFilter())->addParams([
|
||||
'service.state.soft_state' => 2,
|
||||
'service.state.is_handled' => 'n',
|
||||
'sort' => 'service.state.last_state_change'
|
||||
]))
|
||||
->setLabelBigEyeCatching($servicestateSummary->services_critical_unhandled > 0)
|
||||
->setLabelSmall($this->translate('Services Critical'));
|
||||
|
||||
$this->addContent(Html::tag('section', ['class' => 'donut-container', 'data-base-target' => '_next'], [
|
||||
Html::tag('h2', 'Host Summary'),
|
||||
Html::tag('div', ['class' => 'donut'], new HtmlString($hostsChart->render())),
|
||||
(new HostStateBadges($hoststateSummary))->setBaseFilter($this->getFilter())
|
||||
]));
|
||||
|
||||
$this->addContent(Html::tag('section', ['class' => 'donut-container', 'data-base-target' => '_next'], [
|
||||
Html::tag('h2', 'Service Summary'),
|
||||
Html::tag('div', ['class' => 'donut'], new HtmlString($servicesChart->render())),
|
||||
(new ServiceStateBadges($servicestateSummary))->setBaseFilter($this->getFilter())
|
||||
]));
|
||||
$this->addContent(
|
||||
(new ServiceSummaryDonut($servicestateSummary->first()))
|
||||
->setBaseFilter($this->getFilter())
|
||||
);
|
||||
|
||||
$this->setAutorefreshInterval(10);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue