Add stickied incident
This commit is contained in:
@@ -62,6 +62,13 @@ final class ReportIncidentCommand
|
|||||||
*/
|
*/
|
||||||
public $notify;
|
public $notify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to stick the incident on top.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $stickied;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date at which the incident occurred.
|
* The date at which the incident occurred.
|
||||||
*
|
*
|
||||||
@@ -96,6 +103,7 @@ final class ReportIncidentCommand
|
|||||||
'component_id' => 'int|required_with:component_status',
|
'component_id' => 'int|required_with:component_status',
|
||||||
'component_status' => 'int|min:1|max:4|required_with:component_id',
|
'component_status' => 'int|min:1|max:4|required_with:component_id',
|
||||||
'notify' => 'bool',
|
'notify' => 'bool',
|
||||||
|
'stickied' => 'bool',
|
||||||
'incident_date' => 'string',
|
'incident_date' => 'string',
|
||||||
'template' => 'string',
|
'template' => 'string',
|
||||||
];
|
];
|
||||||
@@ -110,13 +118,14 @@ final class ReportIncidentCommand
|
|||||||
* @param int $component_id
|
* @param int $component_id
|
||||||
* @param int $component_status
|
* @param int $component_status
|
||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
|
* @param bool $stickied
|
||||||
* @param string|null $incident_date
|
* @param string|null $incident_date
|
||||||
* @param string|null $template
|
* @param string|null $template
|
||||||
* @param array|null $template_vars
|
* @param array|null $template_vars
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
|
public function __construct($name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $incident_date, $template, array $template_vars = null)
|
||||||
{
|
{
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
$this->status = $status;
|
$this->status = $status;
|
||||||
@@ -125,6 +134,7 @@ final class ReportIncidentCommand
|
|||||||
$this->component_id = $component_id;
|
$this->component_id = $component_id;
|
||||||
$this->component_status = $component_status;
|
$this->component_status = $component_status;
|
||||||
$this->notify = $notify;
|
$this->notify = $notify;
|
||||||
|
$this->stickied = $stickied;
|
||||||
$this->incident_date = $incident_date;
|
$this->incident_date = $incident_date;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->template_vars = $template_vars;
|
$this->template_vars = $template_vars;
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ final class UpdateIncidentCommand
|
|||||||
*/
|
*/
|
||||||
public $notify;
|
public $notify;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to stick the incident on top.
|
||||||
|
*
|
||||||
|
* @var bool
|
||||||
|
*/
|
||||||
|
public $stickied;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The date that the incident occurred on.
|
* The date that the incident occurred on.
|
||||||
*
|
*
|
||||||
@@ -105,6 +112,7 @@ final class UpdateIncidentCommand
|
|||||||
'component_id' => 'int',
|
'component_id' => 'int',
|
||||||
'component_status' => 'int|min:1|max:4|required_with:component_id',
|
'component_status' => 'int|min:1|max:4|required_with:component_id',
|
||||||
'notify' => 'bool',
|
'notify' => 'bool',
|
||||||
|
'stickied' => 'bool',
|
||||||
'template' => 'string',
|
'template' => 'string',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -119,13 +127,14 @@ final class UpdateIncidentCommand
|
|||||||
* @param int $component_id
|
* @param int $component_id
|
||||||
* @param int $component_status
|
* @param int $component_status
|
||||||
* @param bool $notify
|
* @param bool $notify
|
||||||
|
* @param bool $stickied
|
||||||
* @param string|null $incident_date
|
* @param string|null $incident_date
|
||||||
* @param string|null $template
|
* @param string|null $template
|
||||||
* @param array|null $template_vars
|
* @param array|null $template_vars
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $incident_date, $template, array $template_vars = null)
|
public function __construct(Incident $incident, $name, $status, $message, $visible, $component_id, $component_status, $notify, $stickied, $incident_date, $template, array $template_vars = null)
|
||||||
{
|
{
|
||||||
$this->incident = $incident;
|
$this->incident = $incident;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
@@ -135,6 +144,7 @@ final class UpdateIncidentCommand
|
|||||||
$this->component_id = $component_id;
|
$this->component_id = $component_id;
|
||||||
$this->component_status = $component_status;
|
$this->component_status = $component_status;
|
||||||
$this->notify = $notify;
|
$this->notify = $notify;
|
||||||
|
$this->stickied = $stickied;
|
||||||
$this->incident_date = $incident_date;
|
$this->incident_date = $incident_date;
|
||||||
$this->template = $template;
|
$this->template = $template;
|
||||||
$this->template_vars = $template_vars;
|
$this->template_vars = $template_vars;
|
||||||
|
|||||||
@@ -65,9 +65,10 @@ class ReportIncidentCommandHandler
|
|||||||
public function handle(ReportIncidentCommand $command)
|
public function handle(ReportIncidentCommand $command)
|
||||||
{
|
{
|
||||||
$data = [
|
$data = [
|
||||||
'name' => $command->name,
|
'name' => $command->name,
|
||||||
'status' => $command->status,
|
'status' => $command->status,
|
||||||
'visible' => $command->visible,
|
'visible' => $command->visible,
|
||||||
|
'stickied' => $command->stickied,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($command->template) {
|
if ($command->template) {
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class ReportMaintenanceCommandHandler
|
|||||||
'scheduled_at' => $scheduledAt,
|
'scheduled_at' => $scheduledAt,
|
||||||
'status' => 0,
|
'status' => 0,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$maintenanceEvent->notify = (bool) $command->notify;
|
$maintenanceEvent->notify = (bool) $command->notify;
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ class UpdateIncidentCommandHandler
|
|||||||
'status' => $command->status,
|
'status' => $command->status,
|
||||||
'message' => $command->message,
|
'message' => $command->message,
|
||||||
'visible' => $command->visible,
|
'visible' => $command->visible,
|
||||||
|
'stickied' => $command->stickied,
|
||||||
'component_id' => $command->component_id,
|
'component_id' => $command->component_id,
|
||||||
'component_status' => $command->component_status,
|
'component_status' => $command->component_status,
|
||||||
'notify' => $command->notify,
|
'notify' => $command->notify,
|
||||||
|
|||||||
41
app/Composers/Modules/StickiedComposer.php
Normal file
41
app/Composers/Modules/StickiedComposer.php
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace CachetHQ\Cachet\Composers\Modules;
|
||||||
|
|
||||||
|
use CachetHQ\Cachet\Dates\DateFactory;
|
||||||
|
use CachetHQ\Cachet\Models\Incident;
|
||||||
|
use Illuminate\Contracts\View\View;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the status page composer.
|
||||||
|
*
|
||||||
|
* @author James Brooks <james@alt-three.com>
|
||||||
|
* @author Connor S. Parks <connor@connorvg.tv>
|
||||||
|
* @author Antoine Girard <antoine.girard@sapk.fr>
|
||||||
|
*/
|
||||||
|
class StickiedComposer
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Index page view composer.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Contracts\View\View $view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function compose(View $view)
|
||||||
|
{
|
||||||
|
$stickiedIncidents = Incident::stickied()->orderBy('scheduled_at', 'desc')->orderBy('created_at', 'desc')->get()->groupBy(function (Incident $incident) {
|
||||||
|
return app(DateFactory::class)->make($incident->is_scheduled ? $incident->scheduled_at : $incident->created_at)->toDateString();
|
||||||
|
});
|
||||||
|
$view->withStickiedIncidents($stickiedIncidents);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -205,6 +205,7 @@ EINCIDENT;
|
|||||||
'component_id' => 0,
|
'component_id' => 0,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Awesome',
|
'name' => 'Awesome',
|
||||||
@@ -213,6 +214,7 @@ EINCIDENT;
|
|||||||
'component_id' => 0,
|
'component_id' => 0,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Monitoring the fix',
|
'name' => 'Monitoring the fix',
|
||||||
@@ -221,6 +223,7 @@ EINCIDENT;
|
|||||||
'component_id' => 0,
|
'component_id' => 0,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Update',
|
'name' => 'Update',
|
||||||
@@ -229,6 +232,7 @@ EINCIDENT;
|
|||||||
'component_id' => 0,
|
'component_id' => 0,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Test Incident',
|
'name' => 'Test Incident',
|
||||||
@@ -237,6 +241,7 @@ EINCIDENT;
|
|||||||
'component_id' => 0,
|
'component_id' => 0,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => 'Investigating the API',
|
'name' => 'Investigating the API',
|
||||||
@@ -245,6 +250,16 @@ EINCIDENT;
|
|||||||
'component_id' => 1,
|
'component_id' => 1,
|
||||||
'scheduled_at' => null,
|
'scheduled_at' => null,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'name' => 'Stickied to the top',
|
||||||
|
'message' => 'Will be forever hanged here.',
|
||||||
|
'status' => 1,
|
||||||
|
'component_id' => 1,
|
||||||
|
'scheduled_at' => null,
|
||||||
|
'visible' => 1,
|
||||||
|
'stickied' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ use CachetHQ\Cachet\Composers\Modules\ComponentsComposer as ComponentsModuleComp
|
|||||||
use CachetHQ\Cachet\Composers\Modules\MetricsComposer as MetricsModuleComposer;
|
use CachetHQ\Cachet\Composers\Modules\MetricsComposer as MetricsModuleComposer;
|
||||||
use CachetHQ\Cachet\Composers\Modules\ScheduledComposer as ScheduledModuleComposer;
|
use CachetHQ\Cachet\Composers\Modules\ScheduledComposer as ScheduledModuleComposer;
|
||||||
use CachetHQ\Cachet\Composers\Modules\StatusComposer as StatusModuleComposer;
|
use CachetHQ\Cachet\Composers\Modules\StatusComposer as StatusModuleComposer;
|
||||||
|
use CachetHQ\Cachet\Composers\Modules\StickiedComposer as StickiedModuleComposer;
|
||||||
use CachetHQ\Cachet\Composers\Modules\TimelineComposer as TimelineModuleComposer;
|
use CachetHQ\Cachet\Composers\Modules\TimelineComposer as TimelineModuleComposer;
|
||||||
use CachetHQ\Cachet\Composers\ThemeComposer;
|
use CachetHQ\Cachet\Composers\ThemeComposer;
|
||||||
use CachetHQ\Cachet\Composers\TimezoneLocaleComposer;
|
use CachetHQ\Cachet\Composers\TimezoneLocaleComposer;
|
||||||
@@ -43,6 +44,7 @@ class ComposerServiceProvider extends ServiceProvider
|
|||||||
$factory->composer('*', ModuleComposer::class);
|
$factory->composer('*', ModuleComposer::class);
|
||||||
$factory->composer('partials.modules.components', ComponentsModuleComposer::class);
|
$factory->composer('partials.modules.components', ComponentsModuleComposer::class);
|
||||||
$factory->composer('partials.modules.metrics', MetricsModuleComposer::class);
|
$factory->composer('partials.modules.metrics', MetricsModuleComposer::class);
|
||||||
|
$factory->composer('partials.modules.stickied', StickiedModuleComposer::class);
|
||||||
$factory->composer('partials.modules.scheduled', ScheduledModuleComposer::class);
|
$factory->composer('partials.modules.scheduled', ScheduledModuleComposer::class);
|
||||||
$factory->composer('partials.modules.status', StatusModuleComposer::class);
|
$factory->composer('partials.modules.status', StatusModuleComposer::class);
|
||||||
$factory->composer('partials.modules.timeline', TimelineModuleComposer::class);
|
$factory->composer('partials.modules.timeline', TimelineModuleComposer::class);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ class ModuleServiceProvider extends ServiceProvider
|
|||||||
['group' => 'status', 'partial' => 'partials.modules.status'],
|
['group' => 'status', 'partial' => 'partials.modules.status'],
|
||||||
['group' => 'components', 'partial' => 'partials.modules.components'],
|
['group' => 'components', 'partial' => 'partials.modules.components'],
|
||||||
['group' => 'metrics', 'partial' => 'partials.modules.metrics'],
|
['group' => 'metrics', 'partial' => 'partials.modules.metrics'],
|
||||||
|
['group' => 'stickied', 'partial' => 'partials.modules.stickied'],
|
||||||
['group' => 'scheduled', 'partial' => 'partials.modules.scheduled'],
|
['group' => 'scheduled', 'partial' => 'partials.modules.scheduled'],
|
||||||
['group' => 'timeline', 'partial' => 'partials.modules.timeline'],
|
['group' => 'timeline', 'partial' => 'partials.modules.timeline'],
|
||||||
],
|
],
|
||||||
@@ -45,7 +46,8 @@ class ModuleServiceProvider extends ServiceProvider
|
|||||||
'components' => 30000,
|
'components' => 30000,
|
||||||
'metrics' => 40000,
|
'metrics' => 40000,
|
||||||
'scheduled' => 50000,
|
'scheduled' => 50000,
|
||||||
'timeline' => 60000,
|
'stickied' => 60000,
|
||||||
|
'timeline' => 70000,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class IncidentController extends AbstractApiController
|
|||||||
Binput::get('component_id'),
|
Binput::get('component_id'),
|
||||||
Binput::get('component_status'),
|
Binput::get('component_status'),
|
||||||
Binput::get('notify', true),
|
Binput::get('notify', true),
|
||||||
|
Binput::get('stickied', false),
|
||||||
Binput::get('created_at'),
|
Binput::get('created_at'),
|
||||||
Binput::get('template'),
|
Binput::get('template'),
|
||||||
Binput::get('vars')
|
Binput::get('vars')
|
||||||
@@ -105,6 +106,7 @@ class IncidentController extends AbstractApiController
|
|||||||
Binput::get('component_id'),
|
Binput::get('component_id'),
|
||||||
Binput::get('component_status'),
|
Binput::get('component_status'),
|
||||||
Binput::get('notify', true),
|
Binput::get('notify', true),
|
||||||
|
Binput::get('stickied', false),
|
||||||
Binput::get('created_at'),
|
Binput::get('created_at'),
|
||||||
Binput::get('template'),
|
Binput::get('template'),
|
||||||
Binput::get('vars')
|
Binput::get('vars')
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ class IncidentController extends Controller
|
|||||||
Binput::get('component_id'),
|
Binput::get('component_id'),
|
||||||
Binput::get('component_status'),
|
Binput::get('component_status'),
|
||||||
Binput::get('notify', false),
|
Binput::get('notify', false),
|
||||||
|
Binput::get('stickied', false),
|
||||||
Binput::get('created_at'),
|
Binput::get('created_at'),
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
@@ -240,6 +241,7 @@ class IncidentController extends Controller
|
|||||||
Binput::get('component_id'),
|
Binput::get('component_id'),
|
||||||
Binput::get('component_status'),
|
Binput::get('component_status'),
|
||||||
Binput::get('notify', true),
|
Binput::get('notify', true),
|
||||||
|
Binput::get('stickied', false),
|
||||||
Binput::get('created_at'),
|
Binput::get('created_at'),
|
||||||
null,
|
null,
|
||||||
null
|
null
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Incident extends Model implements HasPresenter
|
|||||||
*/
|
*/
|
||||||
protected $casts = [
|
protected $casts = [
|
||||||
'visible' => 'int',
|
'visible' => 'int',
|
||||||
|
'stickied' => 'int',
|
||||||
'scheduled_at' => 'date',
|
'scheduled_at' => 'date',
|
||||||
'deleted_at' => 'date',
|
'deleted_at' => 'date',
|
||||||
];
|
];
|
||||||
@@ -46,6 +47,7 @@ class Incident extends Model implements HasPresenter
|
|||||||
'name',
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'visible',
|
'visible',
|
||||||
|
'stickied',
|
||||||
'message',
|
'message',
|
||||||
'scheduled_at',
|
'scheduled_at',
|
||||||
'created_at',
|
'created_at',
|
||||||
@@ -62,6 +64,7 @@ class Incident extends Model implements HasPresenter
|
|||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'status' => 'required|int',
|
'status' => 'required|int',
|
||||||
'visible' => 'required|bool',
|
'visible' => 'required|bool',
|
||||||
|
'stickied' => 'bool',
|
||||||
'message' => 'required',
|
'message' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -76,6 +79,7 @@ class Incident extends Model implements HasPresenter
|
|||||||
'name',
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'visible',
|
'visible',
|
||||||
|
'stickied',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,6 +92,7 @@ class Incident extends Model implements HasPresenter
|
|||||||
'name',
|
'name',
|
||||||
'status',
|
'status',
|
||||||
'visible',
|
'visible',
|
||||||
|
'stickied',
|
||||||
'message',
|
'message',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -113,6 +118,18 @@ class Incident extends Model implements HasPresenter
|
|||||||
return $query->where('visible', 1);
|
return $query->where('visible', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Finds all stickied incidents.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Builder
|
||||||
|
*/
|
||||||
|
public function scopeStickied(Builder $query)
|
||||||
|
{
|
||||||
|
return $query->where('stickied', true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Finds all scheduled incidents (maintenance).
|
* Finds all scheduled incidents (maintenance).
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -40,10 +40,11 @@ $factory->define(ComponentGroup::class, function ($faker) {
|
|||||||
|
|
||||||
$factory->define(Incident::class, function ($faker) {
|
$factory->define(Incident::class, function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => $faker->sentence(),
|
'name' => $faker->sentence(),
|
||||||
'message' => $faker->paragraph(),
|
'message' => $faker->paragraph(),
|
||||||
'status' => random_int(1, 4),
|
'status' => random_int(1, 4),
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This file is part of Cachet.
|
||||||
|
*
|
||||||
|
* (c) Alt Three Services Limited
|
||||||
|
*
|
||||||
|
* For the full copyright and license information, please view the LICENSE
|
||||||
|
* file that was distributed with this source code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AlterTableIncidentsAddStickiedColumn extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('incidents', function (Blueprint $table) {
|
||||||
|
$table->boolean('stickied')->after('visible')->default(false);
|
||||||
|
|
||||||
|
$table->index('stickied');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('incidents', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('stickied');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ return [
|
|||||||
'past' => 'Past Incidents',
|
'past' => 'Past Incidents',
|
||||||
'previous_week' => 'Previous week',
|
'previous_week' => 'Previous week',
|
||||||
'next_week' => 'Next week',
|
'next_week' => 'Next week',
|
||||||
|
'stickied' => 'Stickied Incidents',
|
||||||
'scheduled' => 'Scheduled Maintenance',
|
'scheduled' => 'Scheduled Maintenance',
|
||||||
'scheduled_at' => ', scheduled :timestamp',
|
'scheduled_at' => ', scheduled :timestamp',
|
||||||
'status' => [
|
'status' => [
|
||||||
|
|||||||
@@ -53,6 +53,9 @@ return [
|
|||||||
'incident_time' => 'When did this incident occur?',
|
'incident_time' => 'When did this incident occur?',
|
||||||
'notify_subscribers' => 'Notify subscribers?',
|
'notify_subscribers' => 'Notify subscribers?',
|
||||||
'visibility' => 'Incident Visibility',
|
'visibility' => 'Incident Visibility',
|
||||||
|
'stick_status' => 'Stick Incident',
|
||||||
|
'stickied' => 'Stickied',
|
||||||
|
'not_stickied' => 'Not Stickied',
|
||||||
'public' => 'Viewable by public',
|
'public' => 'Viewable by public',
|
||||||
'logged_in_only' => 'Only visible to logged in users',
|
'logged_in_only' => 'Only visible to logged in users',
|
||||||
'templates' => [
|
'templates' => [
|
||||||
|
|||||||
@@ -62,6 +62,13 @@
|
|||||||
<option value='0'>{{ trans('forms.incidents.logged_in_only') }}</option>
|
<option value='0'>{{ trans('forms.incidents.logged_in_only') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="incident-name">{{ trans('forms.incidents.stick_status') }}</label>
|
||||||
|
<select name='stickied' class="form-control">
|
||||||
|
<option value='1'>{{ trans('forms.incidents.stickied') }}</option>
|
||||||
|
<option value='0' selected>{{ trans('forms.incidents.not_stickied') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
@if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty())
|
@if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty())
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>{{ trans('forms.incidents.component') }}</label>
|
<label>{{ trans('forms.incidents.component') }}</label>
|
||||||
|
|||||||
@@ -51,6 +51,13 @@
|
|||||||
<option value='0' {{ $incident->visible === 0 ? 'selected' : null }}>{{ trans('forms.incidents.logged_in_only') }}</option>
|
<option value='0' {{ $incident->visible === 0 ? 'selected' : null }}>{{ trans('forms.incidents.logged_in_only') }}</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="incident-stick">{{ trans('forms.incidents.stick_status') }}</label>
|
||||||
|
<select name="stickied" id="incident-stick" class="form-control">
|
||||||
|
<option value='1' {{ $incident->stickied === 1 ? 'selected' : null }}>{{ trans('forms.incidents.stickied') }}</option>
|
||||||
|
<option value='0' {{ $incident->stickied === 0 ? 'selected' : null }}>{{ trans('forms.incidents.not_stickied') }}</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
@if($incident->component)
|
@if($incident->component)
|
||||||
<div class="form-group" id='component-status'>
|
<div class="form-group" id='component-status'>
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
|||||||
8
resources/views/partials/modules/stickied.blade.php
Normal file
8
resources/views/partials/modules/stickied.blade.php
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
@if(!$stickied_incidents->isEmpty())
|
||||||
|
<div class="section-stickied">
|
||||||
|
<h1>{{ trans('cachet.incidents.stickied') }}</h1>
|
||||||
|
@foreach($stickied_incidents as $date => $incidents)
|
||||||
|
@include('partials.incidents', [compact($date), compact($incidents)])
|
||||||
|
@endforeach
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
@@ -55,10 +55,11 @@ class IncidentTest extends AbstractApiTestCase
|
|||||||
$this->beUser();
|
$this->beUser();
|
||||||
|
|
||||||
$this->post('/api/v1/incidents', [
|
$this->post('/api/v1/incidents', [
|
||||||
'name' => 'Foo',
|
'name' => 'Foo',
|
||||||
'message' => 'Lorem ipsum dolor sit amet',
|
'message' => 'Lorem ipsum dolor sit amet',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
]);
|
]);
|
||||||
$this->seeJson(['name' => 'Foo']);
|
$this->seeJson(['name' => 'Foo']);
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
@@ -77,6 +78,7 @@ class IncidentTest extends AbstractApiTestCase
|
|||||||
'component_id' => $component->id,
|
'component_id' => $component->id,
|
||||||
'component_status' => 1,
|
'component_status' => 1,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
]);
|
]);
|
||||||
$this->seeJson(['name' => 'Foo']);
|
$this->seeJson(['name' => 'Foo']);
|
||||||
$this->assertResponseOk();
|
$this->assertResponseOk();
|
||||||
@@ -91,6 +93,7 @@ class IncidentTest extends AbstractApiTestCase
|
|||||||
'name' => 'Foo',
|
'name' => 'Foo',
|
||||||
'status' => 1,
|
'status' => 1,
|
||||||
'visible' => 1,
|
'visible' => 1,
|
||||||
|
'stickied' => false,
|
||||||
'template' => $template->slug,
|
'template' => $template->slug,
|
||||||
'vars' => [
|
'vars' => [
|
||||||
'name' => 'Foo',
|
'name' => 'Foo',
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ class ReportIncidentCommandTest extends AbstractTestCase
|
|||||||
'component_id' => 1,
|
'component_id' => 1,
|
||||||
'component_status' => 1,
|
'component_status' => 1,
|
||||||
'notify' => false,
|
'notify' => false,
|
||||||
|
'stickied' => false,
|
||||||
'incident_date' => null,
|
'incident_date' => null,
|
||||||
'template' => null,
|
'template' => null,
|
||||||
'template_vars' => null,
|
'template_vars' => null,
|
||||||
@@ -49,6 +50,7 @@ class ReportIncidentCommandTest extends AbstractTestCase
|
|||||||
$params['component_id'],
|
$params['component_id'],
|
||||||
$params['component_status'],
|
$params['component_status'],
|
||||||
$params['notify'],
|
$params['notify'],
|
||||||
|
$params['stickied'],
|
||||||
$params['incident_date'],
|
$params['incident_date'],
|
||||||
$params['template'],
|
$params['template'],
|
||||||
$params['template_vars']
|
$params['template_vars']
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class UpdateIncidentCommandTest extends AbstractTestCase
|
|||||||
'component_id' => 1,
|
'component_id' => 1,
|
||||||
'component_status' => 1,
|
'component_status' => 1,
|
||||||
'notify' => false,
|
'notify' => false,
|
||||||
|
'stickied' => false,
|
||||||
'incident_date' => null,
|
'incident_date' => null,
|
||||||
'template' => null,
|
'template' => null,
|
||||||
'template_vars' => null,
|
'template_vars' => null,
|
||||||
@@ -52,6 +53,7 @@ class UpdateIncidentCommandTest extends AbstractTestCase
|
|||||||
$params['component_id'],
|
$params['component_id'],
|
||||||
$params['component_status'],
|
$params['component_status'],
|
||||||
$params['notify'],
|
$params['notify'],
|
||||||
|
$params['stickied'],
|
||||||
$params['incident_date'],
|
$params['incident_date'],
|
||||||
$params['template'],
|
$params['template'],
|
||||||
$params['template_vars']
|
$params['template_vars']
|
||||||
|
|||||||
Reference in New Issue
Block a user