mirror of
https://github.com/Icinga/icingadb-web.git
synced 2026-05-28 04:36:06 -04:00
Merge pull request #21 from Icinga/fix/inefficient-history-joins
Fix inefficient history joins
This commit is contained in:
commit
d3dec9b85b
10 changed files with 12 additions and 18 deletions
|
|
@ -22,8 +22,6 @@ class HistoryController extends Controller
|
|||
'host.state',
|
||||
'service',
|
||||
'service.state',
|
||||
'service.host',
|
||||
'service.host.state',
|
||||
'comment',
|
||||
'downtime',
|
||||
'notification',
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ class NotificationsController extends Controller
|
|||
'host',
|
||||
'host.state',
|
||||
'service',
|
||||
'service.host',
|
||||
'service.host.state',
|
||||
'service.state'
|
||||
]);
|
||||
|
||||
|
|
|
|||
|
|
@ -121,8 +121,6 @@ class ServiceController extends Controller
|
|||
'host.state',
|
||||
'service',
|
||||
'service.state',
|
||||
'service.host',
|
||||
'service.host.state',
|
||||
'comment',
|
||||
'downtime',
|
||||
'notification',
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class CommentHistory extends Model
|
|||
{
|
||||
$relations->belongsTo('endpoint', Endpoint::class);
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('host', Host::class);
|
||||
$relations->belongsTo('service', Service::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ class DowntimeHistory extends Model
|
|||
// @TODO(el): Add relation for triggered_by_id
|
||||
$relations->belongsTo('endpoint', Endpoint::class);
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('host', Host::class);
|
||||
$relations->belongsTo('service', Service::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ class History extends Model
|
|||
// @TODO(el): Add relation for flapping_history_id
|
||||
$relations->belongsTo('endpoint', Endpoint::class);
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('host', Host::class);
|
||||
$relations->belongsTo('service', Service::class);
|
||||
$relations->belongsTo('comment', CommentHistory::class)
|
||||
->setCandidateKey('comment_history_id')
|
||||
->setForeignKey('comment_id')
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ class NotificationHistory extends Model
|
|||
public function createRelations(Relations $relations)
|
||||
{
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('host', Host::class);
|
||||
$relations->belongsTo('service', Service::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class StateHistory extends Model
|
|||
{
|
||||
$relations->belongsTo('endpoint', Endpoint::class);
|
||||
$relations->belongsTo('environment', Environment::class);
|
||||
$relations->belongsTo('host', Host::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('service', Service::class)->setJoinType('LEFT');
|
||||
$relations->belongsTo('host', Host::class);
|
||||
$relations->belongsTo('service', Service::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class HistoryListItem extends CommonListItem
|
|||
if ($this->item->object_type === 'host') {
|
||||
$link = $this->createHostLink($this->item->host, true);
|
||||
} else {
|
||||
$link = $this->createServiceLink($this->item->service, $this->item->service->host, true);
|
||||
$link = $this->createServiceLink($this->item->service, $this->item->host, true);
|
||||
}
|
||||
|
||||
$title->add([Html::tag('br'), $link]);
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class NotificationListItem extends CommonListItem
|
|||
if ($this->item->object_type === 'host') {
|
||||
$link = $this->createHostLink($this->item->host, true);
|
||||
} else {
|
||||
$link = $this->createServiceLink($this->item->service, $this->item->service->host, true);
|
||||
$link = $this->createServiceLink($this->item->service, $this->item->host, true);
|
||||
}
|
||||
|
||||
$title->add($link);
|
||||
|
|
|
|||
Loading…
Reference in a new issue