Add the ability to select a template when adding an incident.

This commit is contained in:
Data-Kiss
2019-10-09 19:56:14 +01:00
parent 212d807653
commit 4b5ee6668f
11 changed files with 154 additions and 108 deletions
@@ -17,6 +17,7 @@ use CachetHQ\Cachet\Bus\Commands\IncidentUpdate\UpdateIncidentUpdateCommand;
use CachetHQ\Cachet\Integrations\Contracts\System;
use CachetHQ\Cachet\Models\Incident;
use CachetHQ\Cachet\Models\IncidentUpdate;
use CachetHQ\Cachet\Models\IncidentTemplate;
use GrahamCampbell\Binput\Facades\Binput;
use Illuminate\Contracts\Auth\Guard;
use Illuminate\Routing\Controller;
@@ -88,6 +89,7 @@ class IncidentUpdateController extends Controller
{
return View::make('dashboard.incidents.updates.add')
->withIncident($incident)
->withIncidentTemplates(IncidentTemplate::all())
->withNotificationsEnabled($this->system->canNotifySubscribers());
}
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+28 -28
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -1,8 +1,8 @@
{
"/dist/js/vendor.js": "/dist/js/vendor.js?id=313e4cd2cf600307cb5c",
"/dist/js/app.js": "/dist/js/app.js?id=be35dd18d92eef9dee9f",
"/dist/css/dashboard/dashboard.css": "/dist/css/dashboard/dashboard.css?id=654823be1de9b1245f17",
"/dist/css/app.css": "/dist/css/app.css?id=1b9032e972af93e2c869",
"/dist/js/app.js": "/dist/js/app.js?id=04c40dcd7fc0f91a2cc1",
"/dist/css/dashboard/dashboard.css": "/dist/css/dashboard/dashboard.css?id=2e8a315f9f8f01a60080",
"/dist/css/app.css": "/dist/css/app.css?id=bb04d4c61e5b5d02a938",
"/dist/js/manifest.js": "/dist/js/manifest.js?id=40dcfff9d09d402daf38",
"/dist/js/all.js": "/dist/js/all.js?id=c77bbe3fb26a84b5347d"
"/dist/js/all.js": "/dist/js/all.js?id=eb6400680943aee8df85"
}
+2 -2
View File
@@ -186,7 +186,7 @@ $(function () {
});
// Incident management
/*$('select[name=template]').on('change', function () {
$('select[name=template]').on('change', function () {
var $this = $(this).find('option:selected'),
slug = $this.val();
@@ -208,7 +208,7 @@ $(function () {
}
});
}
});*/
});
// Banner removal JS
$('#remove-banner').on('click', function (){
@@ -2,6 +2,7 @@
const Vue = require('vue');
Vue.component('report-incident', require('./ReportIncident'));
Vue.component('update-incident', require('./UpdateIncident'));
Vue.component('report-schedule', require('./ReportSchedule'));
Vue.component('invite-team', require('./InviteTeam'));
@@ -0,0 +1,30 @@
<script>
module.exports = {
data () {
return {
template: null,
status: null,
message: '',
}
},
methods: {
getTemplate (template) {
axios.get('/dashboard/api/incidents/templates', {
params: {
slug: template
}
}).then(response => {
this.name = response.data.name
this.message = response.data.template
}).catch(response => {
(new Cachet.Notifier()).notify('There was an error finding that template.');
})
}
},
watch: {
'template' (template) {
this.getTemplate(template)
}
}
}
</script>
@@ -19,9 +19,21 @@
</div>
@endif
@include('partials.errors')
<update-incident inline-template>
<form class="form-vertical" name="IncidentUpdateForm" role="form" method="POST" autocomplete="off">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<fieldset>
@if($incidentTemplates->count() > 0)
<div class="form-group">
<label for="incident-template">{{ trans('forms.incidents.templates.template') }}</label>
<select class="form-control" name="template" v-model="template">
<option selected></option>
@foreach($incidentTemplates as $tpl)
<option value="{{ $tpl->slug }}">{{ $tpl->name }}</option>
@endforeach
</select>
</div>
@endif
<div class="form-group">
<label for="incident-name">{{ trans('forms.incidents.status') }}</label><br>
<label class="radio-inline">
@@ -100,6 +112,7 @@
</div>
</div>
</form>
</update-incident>
</div>
</div>
</div>