Show last updated for components. Closes #1627

This commit is contained in:
James Brooks
2016-03-20 16:23:21 +00:00
parent a64b5c1046
commit dcec1e2e95
3 changed files with 15 additions and 2 deletions

View File

@@ -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.
*

View File

@@ -12,7 +12,8 @@
return [
// Components
'components' => [
'status' => [
'last_updated' => 'Last updated :timestamp',
'status' => [
1 => 'Operational',
2 => 'Performance Issues',
3 => 'Partial Outage',

View File

@@ -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>