Show last updated for components. Closes #1627
This commit is contained in:
@@ -11,8 +11,10 @@
|
||||
|
||||
namespace CachetHQ\Cachet\Presenters;
|
||||
|
||||
use CachetHQ\Cachet\Dates\DateFactory;
|
||||
use CachetHQ\Cachet\Presenters\Traits\TimestampsTrait;
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use Illuminate\Support\Facades\Config;
|
||||
use McCool\LaravelAutoPresenter\BasePresenter;
|
||||
|
||||
class ComponentPresenter extends BasePresenter implements Arrayable
|
||||
@@ -44,6 +46,16 @@ class ComponentPresenter extends BasePresenter implements Arrayable
|
||||
return trans('cachet.components.status.'.$this->wrappedObject->status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Present formatted date time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function updated_at_formatted()
|
||||
{
|
||||
return ucfirst(app(DateFactory::class)->make($this->wrappedObject->updated_at)->format(Config::get('setting.incident_date_format', 'l jS F Y H:i:s')));
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the presenter instance to an array.
|
||||
*
|
||||
|
||||
@@ -12,7 +12,8 @@
|
||||
return [
|
||||
// Components
|
||||
'components' => [
|
||||
'status' => [
|
||||
'last_updated' => 'Last updated :timestamp',
|
||||
'status' => [
|
||||
1 => 'Operational',
|
||||
2 => 'Performance Issues',
|
||||
3 => 'Partial Outage',
|
||||
|
||||
@@ -14,6 +14,6 @@
|
||||
@endif
|
||||
|
||||
<div class="pull-right">
|
||||
<small class="text-component-{{ $component->status }} {{ $component->status_color }}">{{ $component->human_status }}</small>
|
||||
<small class="text-component-{{ $component->status }} {{ $component->status_color }}" data-toggle="tooltip" title="{{ trans('cachet.components.last_updated', ['timestamp' => $component->updated_at_formatted]) }}">{{ $component->human_status }}</small>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
Reference in New Issue
Block a user