Skip to content

Commit 5b2d99e

Browse files
authored
Merge pull request #2136 from CachetHQ/only-disrupted-days
Option to only show disrupted days. Closes #2088
2 parents 628833a + 179de1f commit 5b2d99e

File tree

5 files changed

+30
-4
lines changed

5 files changed

+30
-4
lines changed

app/Composers/AppComposer.php

+1
Original file line numberDiff line numberDiff line change
@@ -78,5 +78,6 @@ public function compose(View $view)
7878
$view->withTimezone($this->dates->getTimezone());
7979
$view->withSiteTitle($this->config->get('setting.app_name'));
8080
$view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin'));
81+
$view->withOnlyDisruptedDays($this->config->get('setting.only_disrupted_days'));
8182
}
8283
}

app/Http/Controllers/StatusPageController.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,13 @@ public function showIndex()
9090
});
9191

9292
// Add in days that have no incidents
93-
foreach ($incidentDays as $i) {
94-
$date = app(DateFactory::class)->make($startDate)->subDays($i);
93+
if (Config::get('setting.only_disrupted_days') === false) {
94+
foreach ($incidentDays as $i) {
95+
$date = app(DateFactory::class)->make($startDate)->subDays($i);
9596

96-
if (!isset($allIncidents[$date->toDateString()])) {
97-
$allIncidents[$date->toDateString()] = [];
97+
if (!isset($allIncidents[$date->toDateString()])) {
98+
$allIncidents[$date->toDateString()] = [];
99+
}
98100
}
99101
}
100102

config/setting.php

+11
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,15 @@
8888
*/
8989

9090
'skip_subscriber_verification' => false,
91+
92+
/*
93+
|--------------------------------------------------------------------------
94+
| Only disrupted days
95+
|--------------------------------------------------------------------------
96+
|
97+
| Whether to only show days with incidents, or each day in the timeline.
98+
|
99+
*/
100+
101+
'only_disrupted_days' => false,
91102
];

resources/lang/en/forms.php

+1
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@
139139
'automatic_localization' => 'Automatically localise your status page to your visitor\'s language?',
140140
'enable_external_dependencies' => 'Enable Third Party Dependencies (Google Fonts, Trackers, etc...)',
141141
'show_timezone' => 'Show the timezone the status page is running in.',
142+
'only_disrupted_days' => 'Only show days containing incidents in the timeline?',
142143
],
143144
'analytics' => [
144145
'analytics_google' => 'Google Analytics code',

resources/views/dashboard/settings/app-setup.blade.php

+11
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,17 @@
117117
</div>
118118
</div>
119119
</div>
120+
<div class="row">
121+
<div class="col-xs-12">
122+
<div class="checkbox">
123+
<label>
124+
<input type="hidden" value="0" name="only_disrupted_days">
125+
<input type="checkbox" value="1" name="only_disrupted_days" {{ $only_disrupted_days ? 'checked' : null }}>
126+
{{ trans('forms.settings.app-setup.only_disrupted_days') }}
127+
</label>
128+
</div>
129+
</div>
130+
</div>
120131
</fieldset>
121132

122133
<div class="row">

0 commit comments

Comments
 (0)