Merge pull request #1621 from CachetHQ/truncate-incident-templates

Truncate incident templates
This commit is contained in:
James Brooks
2016-03-16 09:41:52 +00:00
3 changed files with 15 additions and 0 deletions
+2
View File
@@ -13,6 +13,7 @@ namespace CachetHQ\Cachet\Composers;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Cachet\Models\Subscriber; use CachetHQ\Cachet\Models\Subscriber;
use Illuminate\Contracts\View\View; use Illuminate\Contracts\View\View;
@@ -28,6 +29,7 @@ class DashboardComposer
public function compose(View $view) public function compose(View $view)
{ {
$view->withIncidentCount(Incident::notScheduled()->count()); $view->withIncidentCount(Incident::notScheduled()->count());
$view->withIncidentTemplateCount(IncidentTemplate::count());
$view->withComponentCount(Component::all()->count()); $view->withComponentCount(Component::all()->count());
$view->withSubscriberCount(Subscriber::isVerified()->count()); $view->withSubscriberCount(Subscriber::isVerified()->count());
} }
@@ -14,6 +14,7 @@ namespace CachetHQ\Cachet\Console\Commands;
use CachetHQ\Cachet\Models\Component; use CachetHQ\Cachet\Models\Component;
use CachetHQ\Cachet\Models\ComponentGroup; use CachetHQ\Cachet\Models\ComponentGroup;
use CachetHQ\Cachet\Models\Incident; use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Cachet\Models\Metric; use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\MetricPoint; use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Models\Setting; use CachetHQ\Cachet\Models\Setting;
@@ -62,6 +63,7 @@ class DemoSeederCommand extends Command
$this->seedComponentGroups(); $this->seedComponentGroups();
$this->seedComponents(); $this->seedComponents();
$this->seedIncidents(); $this->seedIncidents();
$this->seedIncidentTemplates();
$this->seedMetricPoints(); $this->seedMetricPoints();
$this->seedMetrics(); $this->seedMetrics();
$this->seedSettings(); $this->seedSettings();
@@ -207,6 +209,16 @@ class DemoSeederCommand extends Command
} }
} }
/**
* Seed the incident templates table.
*
* @return void
*/
protected function seedIncidentTemplates()
{
IncidentTemplate::truncate();
}
/** /**
* Seed the metric points table. * Seed the metric points table.
* *
@@ -33,6 +33,7 @@
<a href="{{ route('dashboard.templates.index') }}"> <a href="{{ route('dashboard.templates.index') }}">
<i class="ion ion-ios-paper-outline"></i> <i class="ion ion-ios-paper-outline"></i>
<span>{{ trans('dashboard.incidents.incident-templates') }}</span> <span>{{ trans('dashboard.incidents.incident-templates') }}</span>
<span class="label label-info">{{ $incident_template_count }}</span>
</a> </a>
</li> </li>
<li {!! set_active('dashboard/components*') !!}> <li {!! set_active('dashboard/components*') !!}>