Add Incident is now in sidebar item. Fixed adding of incidents.
This commit is contained in:
@@ -9,17 +9,6 @@ class DashboardController extends Controller {
|
||||
return View::make('dashboard.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident.
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentAction() {
|
||||
$_incident = Input::get('incident');
|
||||
$incident = Incident::create($_incident);
|
||||
|
||||
return Redirect::back()->with('incident', $incident);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the components view.
|
||||
* @return \Illuminate\View\View
|
||||
@@ -77,6 +66,27 @@ class DashboardController extends Controller {
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the add incident view.
|
||||
* @return \Illuminate\View\View
|
||||
*/
|
||||
public function showAddIncident() {
|
||||
return View::make('dashboard.incident-add')->with([
|
||||
'pageTitle' => 'Add Incident - Dashboard',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new incident.
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function createIncidentAction() {
|
||||
$_incident = Input::get('incident');
|
||||
$incident = Incident::create($_incident);
|
||||
|
||||
return Redirect::back()->with('incident', $incident);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the metrics view.
|
||||
* @return \Illuminate\View\View
|
||||
|
||||
@@ -34,6 +34,7 @@ return array(
|
||||
'components' => 'Components',
|
||||
'component-add' => 'Add Component',
|
||||
'incidents' => 'Incidents',
|
||||
'incident-add' => 'Add Incident',
|
||||
'metrics' => 'Metrics',
|
||||
'status_page' => 'Status Page',
|
||||
'settings' => 'Settings',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() {
|
||||
Route::get('/', ['as' => 'dashboard', 'uses' => 'DashboardController@showDashboard']);
|
||||
Route::post('/', 'DashboardController@createIncidentAction');
|
||||
|
||||
// TODO: Switch for Route::controller?
|
||||
Route::get('components', ['as' => 'dashboard.components', 'uses' => 'DashboardController@showComponents']);
|
||||
@@ -11,6 +10,9 @@ Route::group(['before' => 'auth', 'prefix' => 'dashboard'], function() {
|
||||
Route::get('components/{component}/delete', 'DashboardController@deleteComponentAction');
|
||||
|
||||
Route::get('incidents', ['as' => 'dashboard.incidents', 'uses' => 'DashboardController@showIncidents']);
|
||||
Route::get('incidents/add', ['as' => 'dashboard.incidents.add', 'uses' => 'DashboardController@showAddIncident']);
|
||||
Route::post('incidents/add', 'DashboardController@createIncidentAction');
|
||||
|
||||
Route::get('metrics', ['as' => 'dashboard.metrics', 'uses' => 'DashboardController@showMetrics']);
|
||||
Route::get('notifications', ['as' => 'dashboard.notifications', 'uses' => 'DashboardController@showNotifications']);
|
||||
Route::get('status-page', ['as' => 'dashboard.status-page', 'uses' => 'DashboardController@showStatusPage']);
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
@extends('layout.dashboard')
|
||||
|
||||
@section('content')
|
||||
<div class="header">
|
||||
<i class="fa fa-dashboard"></i> {{ Lang::get('cachet.dashboard.incident-add') }}
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Create an Incident</h3>
|
||||
|
||||
@if($incident = Session::get('incident'))
|
||||
<div class='alert alert-{{ $incident->isValid() ? "success" : "danger" }}'>
|
||||
@if($incident->isValid())
|
||||
<strong>Awesome.</strong> Incident added.
|
||||
@else
|
||||
<strong>Whoops.</strong> Something went wrong with the incident.
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
|
||||
<fieldset>
|
||||
<div class='form-group'>
|
||||
<label for='incident-name'>Incident Name</label>
|
||||
<input type='text' class='form-control' name='incident[name]' id='incident-name' required />
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label for='incident-name'>Incident Status</label><br />
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='1' /> {{ Lang::get('cachet.incident.status')[1] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='2' /> {{ Lang::get('cachet.incident.status')[2] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='3' /> {{ Lang::get('cachet.incident.status')[3] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='4' /> {{ Lang::get('cachet.incident.status')[4] }}
|
||||
</label>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Message</label>
|
||||
<textarea name='incident[message]' class='form-control' rows='5'></textarea>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<input type='hidden' name='incident[user_id]' value='{{ Auth::user()->id }}' />
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
@@ -6,48 +6,9 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Create an Incident</h3>
|
||||
<h3>Dashboard</h3>
|
||||
|
||||
@if($incident = Session::get('incident'))
|
||||
<div class='alert alert-{{ $incident->isValid() ? "success" : "danger" }}'>
|
||||
@if($incident->isValid())
|
||||
<strong>Awesome.</strong> Incident added.
|
||||
@else
|
||||
<strong>Whoops.</strong> Something went wrong with the incident.
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
{{ Form::open(['name' => 'IncidentForm', 'class' => 'form-vertical', 'role' => 'form']) }}
|
||||
<fieldset>
|
||||
<div class='form-group'>
|
||||
<label for='incident-name'>Incident Name</label>
|
||||
<input type='text' class='form-control' name='incident[name]' id='incident-name' required />
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label for='incident-name'>Incident Status</label><br />
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='1' /> {{ Lang::get('cachet.incident.status')[1] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='2' /> {{ Lang::get('cachet.incident.status')[2] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='3' /> {{ Lang::get('cachet.incident.status')[3] }}
|
||||
</label>
|
||||
<label class='radio-inline'>
|
||||
<input type='radio' name='incident[status]' value='4' /> {{ Lang::get('cachet.incident.status')[4] }}
|
||||
</label>
|
||||
</div>
|
||||
<div class='form-group'>
|
||||
<label>Message</label>
|
||||
<textarea name='incident[message]' class='form-control' rows='5'></textarea>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Submit</button>
|
||||
<input type='hidden' name='component[user_id]' value='{{ Auth::user()->id }}' />
|
||||
{{ Form::close() }}
|
||||
<p class='lead'>Let's put cool things here.</p>
|
||||
</div>
|
||||
</div>
|
||||
@stop
|
||||
|
||||
@@ -17,6 +17,16 @@
|
||||
<i class="fa fa-dashboard"></i> {{ Lang::get('cachet.dashboard.dashboard') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Request::is('dashboard/incidents') ? 'active' : '' }}">
|
||||
<a href="{{ URL::route('dashboard.incidents') }}">
|
||||
<i class="fa fa-exclamation-triangle"></i> {{ Lang::get('cachet.dashboard.incidents') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Request::is('dashboard/incidents/add') ? 'active' : '' }} sub-nav-item">
|
||||
<a href="{{ URL::route('dashboard.incidents.add') }}">
|
||||
<i class="fa fa-plus"></i> {{ Lang::get('cachet.dashboard.incident-add') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Request::is('dashboard/components') ? 'active' : '' }}">
|
||||
<a href="{{ URL::route('dashboard.components') }}">
|
||||
<i class="fa fa-list-ul"></i> {{ Lang::get('cachet.dashboard.components') }}
|
||||
@@ -27,11 +37,6 @@
|
||||
<i class="fa fa-plus"></i> {{ Lang::get('cachet.dashboard.component-add') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Request::is('dashboard/incidents') ? 'active' : '' }}">
|
||||
<a href="{{ URL::route('dashboard.incidents') }}">
|
||||
<i class="fa fa-exclamation-triangle"></i> {{ Lang::get('cachet.dashboard.incidents') }}
|
||||
</a>
|
||||
</li>
|
||||
<li class="{{ Request::is('dashboard/metrics') ? 'active' : '' }}">
|
||||
<a href="{{ URL::route('dashboard.metrics') }}">
|
||||
<i class="fa fa-area-chart"></i> {{ Lang::get('cachet.dashboard.metrics') }}
|
||||
|
||||
Reference in New Issue
Block a user