Rewrite the entire scheduled maintenance implementation

This commit is contained in:
James Brooks
2016-10-30 20:54:12 +00:00
parent a2cded299d
commit ebed68a7d8
57 changed files with 1989 additions and 512 deletions
+23 -2
View File
@@ -18,6 +18,7 @@ use CachetHQ\Cachet\Models\IncidentTemplate;
use CachetHQ\Cachet\Models\IncidentUpdate;
use CachetHQ\Cachet\Models\Metric;
use CachetHQ\Cachet\Models\MetricPoint;
use CachetHQ\Cachet\Models\Schedule;
use CachetHQ\Cachet\Models\Subscriber;
use CachetHQ\Cachet\Models\User;
use CachetHQ\Cachet\Settings\Repository;
@@ -89,6 +90,7 @@ class DemoSeederCommand extends Command
$this->seedIncidentTemplates();
$this->seedMetricPoints();
$this->seedMetrics();
$this->seedSchedules();
$this->seedSettings();
$this->seedSubscribers();
$this->seedUsers();
@@ -207,7 +209,6 @@ EINCIDENT;
'message' => 'We\'re investigating an issue with our monkeys not performing as they should be.',
'status' => Incident::INVESTIGATING,
'component_id' => 0,
'scheduled_at' => null,
'visible' => 1,
'stickied' => false,
'occurred_at' => Carbon::now(),
@@ -217,7 +218,6 @@ EINCIDENT;
'message' => 'Unresolved incidents are left without a **Fixed** update.',
'status' => Incident::INVESTIGATING,
'component_id' => 0,
'scheduled_at' => null,
'visible' => 1,
'stickied' => false,
'occurred_at' => Carbon::now(),
@@ -332,6 +332,27 @@ EINCIDENT;
}
}
/**
* Seed the schedules table.
*
* @return void
*/
protected function seedSchedules()
{
$defaultSchedules = [
[
'name' => 'Demo resets every half hour!',
'message' => 'You can schedule downtime for _your_ service!',
'status' => Schedule::UPCOMING,
'scheduled_at' => (new DateTime())->add(new DateInterval('PT2H')),
],
];
foreach ($defaultSchedules as $schedule) {
Schedule::create($schedule);
}
}
/**
* Seed the settings table.
*