Skip to content

Commit

Permalink
Merge pull request #3041 from shuichiro-makigaki/add-major-outage-rat…
Browse files Browse the repository at this point in the history
…e-setting

Add rate setting for major outage
  • Loading branch information
jbrooksuk committed May 14, 2018
2 parents 1eb045f + f07c071 commit c18b9e8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Integrations/Core/System.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ public function getStatus()

$totalComponents = Component::enabled()->authenticated($includePrivate)->count();
$majorOutages = Component::enabled()->authenticated($includePrivate)->status(4)->count();
$isMajorOutage = $totalComponents ? ($majorOutages / $totalComponents) >= 0.5 : false;
$majorOutageRate = (int) $this->config->get('setting.major_outage_rate', '50');
$isMajorOutage = $totalComponents ? ($majorOutages / $totalComponents)*100 >= $majorOutageRate : false;

// Default data
$status = [
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
'about-this-page' => 'About this page',
'days-of-incidents' => 'How many days of incidents to show?',
'time_before_refresh' => 'Status page refresh rate (in seconds)',
'major_outage_rate' => 'Major outage threshold (in %)',
'banner' => 'Banner Image',
'banner-help' => "It's recommended that you upload files no bigger than 930px wide",
'subscribers' => 'Allow people to signup to email notifications?',
Expand Down
8 changes: 8 additions & 0 deletions resources/views/dashboard/settings/app-setup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label>{{ trans('forms.settings.app-setup.major_outage_rate') }}</label>
<input type="number" name="major_outage_rate" class="form-control" value="{{ Config::get('setting.major_outage_rate', 50) }}" placeholder="{{ trans('forms.settings.app-setup.major_outage_rate') }}">
</div>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="checkbox">
Expand Down

0 comments on commit c18b9e8

Please sign in to comment.