-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the controller to handle requests to the multi-detail view and fix some bugs in the multiselection of the mainDetailGrid component refs #3788
- Loading branch information
Showing
4 changed files
with
101 additions
and
17 deletions.
There are no files selected for viewing
82 changes: 82 additions & 0 deletions
82
modules/monitoring/application/controllers/MultiController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
<?php | ||
|
||
// {{{ICINGA_LICENSE_HEADER}}} | ||
/** | ||
* This file is part of Icinga 2 Web. | ||
* | ||
* Icinga 2 Web - Head for multiple monitoring backends. | ||
* Copyright (C) 2013 Icinga Development Team | ||
* | ||
* This program is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License | ||
* as published by the Free Software Foundation; either version 2 | ||
* of the License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
* | ||
* @copyright 2013 Icinga Development Team <info@icinga.org> | ||
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2 | ||
* @author Icinga Development Team <info@icinga.org> | ||
*/ | ||
// {{{ICINGA_LICENSE_HEADER}}} | ||
|
||
use \Icinga\Web\Controller\ActionController; | ||
|
||
/** | ||
* Displays aggregations collections of multiple objects. | ||
*/ | ||
class Monitoring_MultiController extends ActionController | ||
{ | ||
public function init() | ||
{ | ||
$this->view->objects = $this->getDetailQueries(); | ||
} | ||
|
||
public function hostAction() | ||
{ | ||
$this->view->hosts = $this->_getAllParams(); | ||
} | ||
|
||
public function servicesAction() | ||
{ | ||
} | ||
|
||
public function notificationsAction() | ||
{ | ||
} | ||
|
||
public function historyAction() | ||
{ | ||
} | ||
|
||
/** | ||
* Fetch all queries from the 'detail' parameter and prepare | ||
* them for further processing. | ||
* | ||
* @return array An array containing all requests and their filter values. | ||
*/ | ||
private function getDetailQueries() | ||
{ | ||
$details = $this->_getAllParams(); | ||
$objects = array(); | ||
foreach ($details as $property => $values) { | ||
if (!is_array($values)) { | ||
continue; | ||
} | ||
foreach ($values as $index => $value) { | ||
if (!array_key_exists($index, $objects)) { | ||
$objects[$index] = array(); | ||
} | ||
$objects[$index][$property] = $value; | ||
} | ||
} | ||
return $objects; | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
modules/monitoring/application/views/scripts/multi/components/summary.phtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div class="panel panel-default"> | ||
<div class="panel-heading"> | ||
<span>Summary for <?= count($objects) ?> object(s) </span> | ||
</div> | ||
<div class="panel-body"> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<?= $this->render('multi/components/summary.phtml'); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters