Skip to content

Commit

Permalink
UserDetail: add missing information (#1031)
Browse files Browse the repository at this point in the history
fixes #1010
  • Loading branch information
sukhwinder33445 authored Jul 22, 2024
1 parent c7dae01 commit cdbaea0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/controllers/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function init()

$name = $this->params->getRequired('name');

$query = User::on($this->getDb());
$query = User::on($this->getDb())->with('timeperiod');
$query->filter(Filter::equal('user.name', $name));

$this->applyRestrictions($query);
Expand Down
2 changes: 1 addition & 1 deletion library/Icingadb/Model/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public function createBehaviors(Behaviors $behaviors)
public function createRelations(Relations $relations)
{
$relations->belongsTo('environment', Environment::class);
$relations->belongsTo('timeperiod', Timeperiod::class);
$relations->belongsTo('timeperiod', Timeperiod::class)->setJoinType('LEFT');
$relations->belongsTo('zone', Zone::class);

$relations->belongsToMany('customvar', Customvar::class)
Expand Down
5 changes: 5 additions & 0 deletions library/Icingadb/Widget/Detail/UserDetail.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ protected function createUserDetail(): array
return [
new HtmlElement('h2', null, Text::create(t('Details'))),
new HorizontalKeyValue(t('Name'), $this->user->name),
new HorizontalKeyValue(
t('Timeperiod'),
$this->user->timeperiod->display_name ?: new EmptyState(t('None', 'timeperiod'))
),
new HorizontalKeyValue(t('Notifications Enabled'), $this->user->notifications_enabled ? t('Yes') : t('No')),
new HorizontalKeyValue(t('E-Mail'), $this->user->email ?: new EmptyState(t('None', 'address'))),
new HorizontalKeyValue(t('Pager'), $this->user->pager ?: new EmptyState(t('None', 'phone-number'))),
new HorizontalKeyValue(t('Host States'), $hostStates ?: t('All')),
Expand Down

0 comments on commit cdbaea0

Please sign in to comment.