Merge pull request #485 from cachethq/schedules
Added scheduled maintenance. Closes #112 (again)
This commit is contained in:
@@ -59,7 +59,7 @@ class IncidentPresenter extends BasePresenter
|
||||
{
|
||||
return ucfirst((new Date($this->resource->created_at))
|
||||
->setTimezone($this->tz)
|
||||
->format('l j F Y H:i:s'));
|
||||
->format('l jS F Y H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,6 +72,50 @@ class IncidentPresenter extends BasePresenter
|
||||
return $this->resource->created_at->setTimezone($this->tz)->toISO8601String();
|
||||
}
|
||||
|
||||
/**
|
||||
* Present diff for humans date time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function scheduled_at_diff()
|
||||
{
|
||||
return (new Date($this->resource->scheduled_at))
|
||||
->setTimezone($this->tz)
|
||||
->diffForHumans();
|
||||
}
|
||||
|
||||
/**
|
||||
* Present formated date time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function scheduled_at_formatted()
|
||||
{
|
||||
return ucfirst((new Date($this->resource->scheduled_at))
|
||||
->setTimezone($this->tz)
|
||||
->format('l jS F Y H:i:s'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Present formatted date time.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function scheduled_at_iso()
|
||||
{
|
||||
return $this->resource->scheduled_at->setTimezone($this->tz)->toISO8601String();
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the scheduled_at time ready to be used by bootstrap-datetimepicker.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function scheduled_at_datetimepicker()
|
||||
{
|
||||
return $this->resource->scheduled_at->setTimezone($this->tz)->format('d/m/Y H:i');
|
||||
}
|
||||
|
||||
/**
|
||||
* Present the status with an icon.
|
||||
*
|
||||
@@ -80,15 +124,17 @@ class IncidentPresenter extends BasePresenter
|
||||
public function icon()
|
||||
{
|
||||
switch ($this->resource->status) {
|
||||
case 1:
|
||||
case 0: // Scheduled
|
||||
return 'icon ion-android-calendar';
|
||||
case 1: // Investigating
|
||||
return 'icon ion-flag';
|
||||
case 2:
|
||||
case 2: // Identified
|
||||
return 'icon ion-alert';
|
||||
case 3:
|
||||
case 3: // Watching
|
||||
return 'icon ion-eye';
|
||||
case 4:
|
||||
case 4: // Fixed
|
||||
return 'icon ion-checkmark';
|
||||
default:
|
||||
default: // Something actually broke, this shouldn't happen.
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user