Show alert for major outages. Closes #1342

This commit is contained in:
James Brooks 2016-01-07 14:59:50 +00:00 committed by James Brooks
parent 54621631e6
commit f19b0d1a46
16 changed files with 60 additions and 36 deletions

View File

@ -27,23 +27,33 @@ class StatusPageComposer
*/
public function compose(View $view)
{
$totalComponents = Component::enabled()->count();
$majorOutages = Component::enabled()->status(4)->count();
$isMajorOutage = ($majorOutages / $totalComponents) >= 0.5;
// Default data
$withData = [
'systemStatus' => 'info',
'systemMessage' => trans('cachet.service.bad'),
'favicon' => 'favicon-high-alert',
'system_status' => 'info',
'system_message' => trans_choice('cachet.service.bad', $totalComponents),
'favicon' => 'favicon-high-alert',
];
if (Component::enabled()->notStatus(1)->count() === 0) {
if ($isMajorOutage) {
$withData = [
'system_status' => 'danger',
'system_message' => trans_choice('cachet.service.major', $totalComponents),
'favicon' => 'favicon-high-alert',
];
} elseif (Component::enabled()->notStatus(1)->count() === 0) {
// If all our components are ok, do we have any non-fixed incidents?
$incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
$incidentCount = $incidents->count();
if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) {
$withData = [
'systemStatus' => 'success',
'systemMessage' => trans('cachet.service.good'),
'favicon' => 'favicon',
'system_status' => 'success',
'system_message' => trans_choice('cachet.service.good', $totalComponents),
'favicon' => 'favicon',
];
}
} else {

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Alle systemer kører normalt.',
'bad' => 'Nogen systemer oplever pt. nogen problemer.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Alle Systeme sind funktionsfähig.',
'bad' => 'Einige Dienste arbeiten nicht ordnungsgemäß.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'All systems are functional',
'bad' => 'Some systems are experiencing issues',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -38,8 +38,9 @@ return [
// Service Status
'service' => [
'good' => 'Todos los sistemas funcionando.',
'bad' => 'Algunos sistemas están experimentando problemas.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -41,8 +41,9 @@ return [
// Service Status
'service' => [
'good' => 'Tous les systèmes sont fonctionnels.',
'bad' => 'Certains systèmes rencontrent des problèmes.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Seluruh sistem berfungsi baik.',
'bad' => 'Sebagian sistem mengalami masalah.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Tutti i sistemi sono operativi.',
'bad' => 'Alcuni sistemi stanno avendo problemi.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => '모든 시스템이 작동 합니다..',
'bad' => '일부 시스템에 문제가 있습니다..',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Alle systemen werken correct.',
'bad' => 'Sommige systemen ondervinden problemen.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Wszystkie systemy sprawne.',
'bad' => 'Część systemów ma problemy.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => 'Todos os serviços estão operando normalmente.',
'bad' => 'Alguns serviços estão passando por problemas.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -39,8 +39,9 @@ return [
// Service Status
'service' => [
'good' => 'Все системы работают нормально.',
'bad' => 'В некоторых системах наблюдаются проблемы.',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => '所有系统运行正常',
'bad' => '部分系统运行异常',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -40,8 +40,9 @@ return [
// Service Status
'service' => [
'good' => '所有系統正常運轉。',
'bad' => '壹些系統出了問題。',
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
'bad' => '[0,1] The system is currently experiencing issues|[2,Inf] Some systems are experiencing issues',
'major' => '[0,1] The service experiencing a major outage|[2,Inf] Some systems are experiencing a major outage',
],
'api' => [

View File

@ -8,7 +8,7 @@
@include('partials.about-app')
<div class="section-status">
<div class="alert alert-{{ $systemStatus }}">{{ $systemMessage }}</div>
<div class="alert alert-{{ $system_status }}">{{ $system_message }}</div>
</div>
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())