Merge branch 'feature/display-an-objects-instance-name-9945'

resolves #9945
This commit is contained in:
Johannes Meyer 2015-08-26 11:02:26 +02:00
commit 82cf896e3a
6 changed files with 68 additions and 0 deletions

View File

@ -5,6 +5,12 @@ $command = array_shift($parts);
?>
<?php if ($showInstance): ?>
<tr class="newsection">
<th><?= $this->translate('Instance'); ?></th>
<td><?= $this->escape($object->instance_name); ?></td>
</tr>
<?php endif ?>
<tr class="newsection">
<th><?= $this->translate('Command'); ?></th>
<td>

View File

@ -0,0 +1,26 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\Backend\Ido\Query;
class InstanceQuery extends IdoQuery
{
/**
* {@inheritdoc}
*/
protected $columnMap = array(
'instances' => array(
'instance_id' => 'i.instance_id',
'instance_name' => 'i.instance_name'
)
);
/**
* {@inheritdoc}
*/
protected function joinBaseTables()
{
$this->select()->from(array('i' => $this->prefix . 'instances'));
$this->joinedVirtualTables['instances'] = true;
}
}

View File

@ -0,0 +1,33 @@
<?php
/* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */
namespace Icinga\Module\Monitoring\DataView;
/**
* View representation for instances
*/
class Instance extends DataView
{
/**
* {@inheritdoc}
*/
public function getColumns()
{
return array(
'instance_id',
'instance_name'
);
}
/**
* {@inheritdoc}
*/
public function getSortRules()
{
return array(
'instance_name' => array(
'order' => self::SORT_ASC
)
);
}
}

View File

@ -89,6 +89,7 @@ class Host extends MonitoredObject
protected function getDataView()
{
$columns = array(
'instance_name',
'host_icon_image',
'host_icon_image_alt',
'host_acknowledged',

View File

@ -106,6 +106,7 @@ class Service extends MonitoredObject
protected function getDataView()
{
return $this->backend->select()->from('servicestatus', array(
'instance_name',
'host_icon_image',
'host_icon_image_alt',
'host_acknowledged',

View File

@ -91,6 +91,7 @@ abstract class MonitoredObjectController extends Controller
$delDowntimeForm->handleRequest();
$this->view->delDowntimeForm = $delDowntimeForm;
}
$this->view->showInstance = $this->backend->select()->from('instance')->count() > 1;
$this->view->object = $this->object;
}