mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 16:24:04 +02:00
parent
676f9e5f72
commit
74624601f7
@ -99,5 +99,6 @@
|
|||||||
<? endforeach; ?>
|
<? endforeach; ?>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<?= $this->paginationControl($history, null, null, array('preserve' => $this->preserve)); ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
@ -21,46 +21,29 @@ class NotificationhistoryQuery extends AbstractQuery
|
|||||||
|
|
||||||
protected function joinBaseTables()
|
protected function joinBaseTables()
|
||||||
{
|
{
|
||||||
//"('[' || cndetails.contacts || '] ' || n.output)"
|
|
||||||
// This is one of the db-specific workarounds that could be abstracted
|
|
||||||
// in a better way:
|
|
||||||
switch ($this->ds->getDbType()) {
|
switch ($this->ds->getDbType()) {
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$concat_contacts = "GROUP_CONCAT(c.alias ORDER BY c.alias SEPARATOR ', ')";
|
$concattedContacts = "GROUP_CONCAT(c.alias ORDER BY c.alias SEPARATOR ', ')";
|
||||||
break;
|
break;
|
||||||
case 'pgsql':
|
case 'pgsql':
|
||||||
// TODO: Find a way to "ORDER" these:
|
// TODO: Find a way to order the contact alias list:
|
||||||
$concat_contacts = "ARRAY_TO_STRING(ARRAY_AGG(c.alias), ', ')";
|
$concattedContacts = "ARRAY_TO_STRING(ARRAY_AGG(c.alias), ', ')";
|
||||||
break;
|
break;
|
||||||
case 'oracle':
|
case 'oracle':
|
||||||
// TODO: This is only valid for Oracle >= 11g Release 2.
|
// TODO: This is only valid for Oracle >= 11g Release 2
|
||||||
$concat_contacts = "LISTAGG(c.alias, ', ') WITHIN GROUP (ORDER BY c.alias)";
|
$concattedContacts = "LISTAGG(c.alias, ', ') WITHIN GROUP (ORDER BY c.alias)";
|
||||||
// Alternatives:
|
// Alternatives:
|
||||||
//
|
//
|
||||||
// RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()')),
|
// RTRIM(XMLAGG(XMLELEMENT(e, column_name, ',').EXTRACT('//text()')),
|
||||||
//
|
//
|
||||||
// not supported and not documented but works since 10.1,
|
// not supported and not documented but works since 10.1,
|
||||||
// however it is NOT always present;
|
// however it is NOT always present:
|
||||||
// WM_CONCAT(c.alias)
|
// WM_CONCAT(c.alias)
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
die('Not yet'); // TODO: Proper Exception
|
|
||||||
}
|
}
|
||||||
$this->columnMap['history']['output'] = "('[' || $concat_contacts || '] ' || n.output)";
|
|
||||||
/*
|
$this->columnMap['history']['output'] = "('[' || $concattedContacts || '] ' || n.output)";
|
||||||
$cndetails = $this->db->select()->from(
|
|
||||||
array('cn' => $this->prefix . 'contactnotifications'),
|
|
||||||
array(
|
|
||||||
'notification_id' => 'notification_id',
|
|
||||||
'cnt' => 'COUNT(*)',
|
|
||||||
'contacts' => $concat_contacts
|
|
||||||
)
|
|
||||||
)->join(
|
|
||||||
array('c' => $this->prefix . 'contacts'),
|
|
||||||
'cn.contact_object_id = c.contact_object_id',
|
|
||||||
array()
|
|
||||||
)->group('notification_id');
|
|
||||||
*/
|
|
||||||
$this->baseQuery = $this->db->select()->from(
|
$this->baseQuery = $this->db->select()->from(
|
||||||
array('n' => $this->prefix . 'notifications'),
|
array('n' => $this->prefix . 'notifications'),
|
||||||
array()
|
array()
|
||||||
@ -72,14 +55,14 @@ $this->columnMap['history']['output'] = "('[' || $concat_contacts || '] ' || n.o
|
|||||||
array('c' => $this->prefix . 'contacts'),
|
array('c' => $this->prefix . 'contacts'),
|
||||||
'cn.contact_object_id = c.contact_object_id',
|
'cn.contact_object_id = c.contact_object_id',
|
||||||
array()
|
array()
|
||||||
)->group('cn.notification_id')
|
)->group('cn.notification_id');
|
||||||
|
|
||||||
/*->join(
|
if ($this->ds->getDbType() === 'pgsql') {
|
||||||
array('cndetails' => $cndetails),
|
$this->baseQuery->group('n.object_id')
|
||||||
'cndetails.notification_id = n.notification_id',
|
->group('n.start_time')
|
||||||
array()
|
->group('n.output')
|
||||||
)*/
|
->group('n.state');
|
||||||
;
|
}
|
||||||
|
|
||||||
$this->joinedVirtualTables = array('history' => true);
|
$this->joinedVirtualTables = array('history' => true);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user