From f19b0d1a463b3dd0c5eba3155d1f9af8c0d70207 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Thu, 7 Jan 2016 14:59:50 +0000 Subject: [PATCH] Show alert for major outages. Closes #1342 --- app/Composers/StatusPageComposer.php | 24 +++++++++++++++++------- resources/lang/da/cachet.php | 5 +++-- resources/lang/de/cachet.php | 5 +++-- resources/lang/en/cachet.php | 5 +++-- resources/lang/es/cachet.php | 5 +++-- resources/lang/fr/cachet.php | 5 +++-- resources/lang/id/cachet.php | 5 +++-- resources/lang/it/cachet.php | 5 +++-- resources/lang/ko/cachet.php | 5 +++-- resources/lang/nl/cachet.php | 5 +++-- resources/lang/pl/cachet.php | 5 +++-- resources/lang/pt-BR/cachet.php | 5 +++-- resources/lang/ru/cachet.php | 5 +++-- resources/lang/zh-CN/cachet.php | 5 +++-- resources/lang/zh-TW/cachet.php | 5 +++-- resources/views/index.blade.php | 2 +- 16 files changed, 60 insertions(+), 36 deletions(-) diff --git a/app/Composers/StatusPageComposer.php b/app/Composers/StatusPageComposer.php index 28b62d9f..2d138722 100644 --- a/app/Composers/StatusPageComposer.php +++ b/app/Composers/StatusPageComposer.php @@ -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 { diff --git a/resources/lang/da/cachet.php b/resources/lang/da/cachet.php index 61a70b94..c8ea678b 100755 --- a/resources/lang/da/cachet.php +++ b/resources/lang/da/cachet.php @@ -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' => [ diff --git a/resources/lang/de/cachet.php b/resources/lang/de/cachet.php index a7540466..8885a68b 100755 --- a/resources/lang/de/cachet.php +++ b/resources/lang/de/cachet.php @@ -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' => [ diff --git a/resources/lang/en/cachet.php b/resources/lang/en/cachet.php index fba30900..e84c744c 100755 --- a/resources/lang/en/cachet.php +++ b/resources/lang/en/cachet.php @@ -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' => [ diff --git a/resources/lang/es/cachet.php b/resources/lang/es/cachet.php index 7cc7f441..029e5925 100755 --- a/resources/lang/es/cachet.php +++ b/resources/lang/es/cachet.php @@ -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' => [ diff --git a/resources/lang/fr/cachet.php b/resources/lang/fr/cachet.php index eed2d7d5..b42f4bce 100755 --- a/resources/lang/fr/cachet.php +++ b/resources/lang/fr/cachet.php @@ -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' => [ diff --git a/resources/lang/id/cachet.php b/resources/lang/id/cachet.php index 5090e6b0..40cf14ac 100755 --- a/resources/lang/id/cachet.php +++ b/resources/lang/id/cachet.php @@ -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' => [ diff --git a/resources/lang/it/cachet.php b/resources/lang/it/cachet.php index 1309f98e..dee0ea30 100644 --- a/resources/lang/it/cachet.php +++ b/resources/lang/it/cachet.php @@ -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' => [ diff --git a/resources/lang/ko/cachet.php b/resources/lang/ko/cachet.php index 5d7a83f2..351e79a2 100755 --- a/resources/lang/ko/cachet.php +++ b/resources/lang/ko/cachet.php @@ -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' => [ diff --git a/resources/lang/nl/cachet.php b/resources/lang/nl/cachet.php index 9b2792d8..9699acc5 100755 --- a/resources/lang/nl/cachet.php +++ b/resources/lang/nl/cachet.php @@ -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' => [ diff --git a/resources/lang/pl/cachet.php b/resources/lang/pl/cachet.php index cc2728ce..aeceda7a 100755 --- a/resources/lang/pl/cachet.php +++ b/resources/lang/pl/cachet.php @@ -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' => [ diff --git a/resources/lang/pt-BR/cachet.php b/resources/lang/pt-BR/cachet.php index 6be63801..e9bcfe95 100755 --- a/resources/lang/pt-BR/cachet.php +++ b/resources/lang/pt-BR/cachet.php @@ -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' => [ diff --git a/resources/lang/ru/cachet.php b/resources/lang/ru/cachet.php index afee203f..86fe23f4 100644 --- a/resources/lang/ru/cachet.php +++ b/resources/lang/ru/cachet.php @@ -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' => [ diff --git a/resources/lang/zh-CN/cachet.php b/resources/lang/zh-CN/cachet.php index f199b77c..f25f15ae 100755 --- a/resources/lang/zh-CN/cachet.php +++ b/resources/lang/zh-CN/cachet.php @@ -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' => [ diff --git a/resources/lang/zh-TW/cachet.php b/resources/lang/zh-TW/cachet.php index fe522062..6f4e5ce1 100644 --- a/resources/lang/zh-TW/cachet.php +++ b/resources/lang/zh-TW/cachet.php @@ -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' => [ diff --git a/resources/views/index.blade.php b/resources/views/index.blade.php index 72ff0ca5..c89d242a 100644 --- a/resources/views/index.blade.php +++ b/resources/views/index.blade.php @@ -8,7 +8,7 @@ @include('partials.about-app')
-
{{ $systemMessage }}
+
{{ $system_message }}
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())