Merge pull request #1322 from CachetHQ/fix-component-group-status-title
Fixes missing titles
This commit is contained in:
@@ -53,7 +53,7 @@ class ComponentGroup extends Model implements HasPresenter
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $with = ['enabled_components'];
|
||||
protected $with = ['enabled_components', 'enabled_components_lowest'];
|
||||
|
||||
/**
|
||||
* A group can have many components.
|
||||
@@ -75,6 +75,16 @@ class ComponentGroup extends Model implements HasPresenter
|
||||
return $this->components()->enabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all of the enabled components ordered by status.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function enabled_components_lowest()
|
||||
{
|
||||
return $this->components()->enabled()->orderBy('status', 'desc');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the presenter class.
|
||||
*
|
||||
|
||||
@@ -24,8 +24,8 @@ class ComponentGroupPresenter extends AbstractPresenter
|
||||
*/
|
||||
public function lowest_status()
|
||||
{
|
||||
if ($enabledComponents = $this->wrappedObject->enabled_components()->orderBy('status', 'desc')->first()) {
|
||||
return $enabledComponents->status;
|
||||
if ($component = $this->wrappedObject->enabled_components_lowest->first()) {
|
||||
return $component->status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,8 +36,8 @@ class ComponentGroupPresenter extends AbstractPresenter
|
||||
*/
|
||||
public function lowest_human_status()
|
||||
{
|
||||
if ($enabledComponents = $this->wrappedObject->enabled_components()->orderBy('status', 'desc')->first()) {
|
||||
return $enabledComponents->human_status;
|
||||
if ($component = $this->wrappedObject->enabled_components_lowest->first()) {
|
||||
return $component->human_status;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ class ComponentGroupPresenter extends AbstractPresenter
|
||||
*/
|
||||
public function lowest_status_color()
|
||||
{
|
||||
if ($enabledComponents = $this->wrappedObject->enabled_components()->orderBy('status', 'desc')->first()) {
|
||||
return $enabledComponents->status_color;
|
||||
if ($component = $this->wrappedObject->enabled_components_lowest->first()) {
|
||||
return $component->status_color;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user