mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 13:38:20 +01:00
Show alert for major outages. Closes #1342
This commit is contained in:
parent
54621631e6
commit
f19b0d1a46
@ -27,23 +27,33 @@ class StatusPageComposer
|
|||||||
*/
|
*/
|
||||||
public function compose(View $view)
|
public function compose(View $view)
|
||||||
{
|
{
|
||||||
|
$totalComponents = Component::enabled()->count();
|
||||||
|
$majorOutages = Component::enabled()->status(4)->count();
|
||||||
|
$isMajorOutage = ($majorOutages / $totalComponents) >= 0.5;
|
||||||
|
|
||||||
// Default data
|
// Default data
|
||||||
$withData = [
|
$withData = [
|
||||||
'systemStatus' => 'info',
|
'system_status' => 'info',
|
||||||
'systemMessage' => trans('cachet.service.bad'),
|
'system_message' => trans_choice('cachet.service.bad', $totalComponents),
|
||||||
'favicon' => 'favicon-high-alert',
|
'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?
|
// If all our components are ok, do we have any non-fixed incidents?
|
||||||
$incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
|
$incidents = Incident::notScheduled()->orderBy('created_at', 'desc')->get();
|
||||||
$incidentCount = $incidents->count();
|
$incidentCount = $incidents->count();
|
||||||
|
|
||||||
if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) {
|
if ($incidentCount === 0 || ($incidentCount >= 1 && (int) $incidents->first()->status === 4)) {
|
||||||
$withData = [
|
$withData = [
|
||||||
'systemStatus' => 'success',
|
'system_status' => 'success',
|
||||||
'systemMessage' => trans('cachet.service.good'),
|
'system_message' => trans_choice('cachet.service.good', $totalComponents),
|
||||||
'favicon' => 'favicon',
|
'favicon' => 'favicon',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Alle systemer kører normalt.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Nogen systemer oplever pt. nogen problemer.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Alle Systeme sind funktionsfähig.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Einige Dienste arbeiten nicht ordnungsgemäß.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'All systems are functional',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Some systems are experiencing issues',
|
'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' => [
|
'api' => [
|
||||||
|
@ -38,8 +38,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Todos los sistemas funcionando.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Algunos sistemas están experimentando problemas.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -41,8 +41,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Tous les systèmes sont fonctionnels.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Certains systèmes rencontrent des problèmes.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Seluruh sistem berfungsi baik.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Sebagian sistem mengalami masalah.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Tutti i sistemi sono operativi.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Alcuni sistemi stanno avendo problemi.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => '모든 시스템이 작동 합니다..',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => '일부 시스템에 문제가 있습니다..',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Alle systemen werken correct.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Sommige systemen ondervinden problemen.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Wszystkie systemy sprawne.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Część systemów ma problemy.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Todos os serviços estão operando normalmente.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'Alguns serviços estão passando por problemas.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -39,8 +39,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => 'Все системы работают нормально.',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => 'В некоторых системах наблюдаются проблемы.',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => '所有系统运行正常',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => '部分系统运行异常',
|
'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' => [
|
'api' => [
|
||||||
|
@ -40,8 +40,9 @@ return [
|
|||||||
|
|
||||||
// Service Status
|
// Service Status
|
||||||
'service' => [
|
'service' => [
|
||||||
'good' => '所有系統正常運轉。',
|
'good' => '[0,1] System operational|[2,Inf] All systems are operational',
|
||||||
'bad' => '壹些系統出了問題。',
|
'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' => [
|
'api' => [
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
@include('partials.about-app')
|
@include('partials.about-app')
|
||||||
|
|
||||||
<div class="section-status">
|
<div class="section-status">
|
||||||
<div class="alert alert-{{ $systemStatus }}">{{ $systemMessage }}</div>
|
<div class="alert alert-{{ $system_status }}">{{ $system_message }}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())
|
@if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user