From d807770ff63893d0fd561de15b0915b5bca0b021 Mon Sep 17 00:00:00 2001 From: James Brooks Date: Fri, 15 Sep 2017 07:39:40 +0100 Subject: [PATCH] Resource changes --- resources/assets/js/app.js | 43 +- resources/assets/js/cachet.js | 6 +- resources/assets/js/components/Setup.js | 49 +++ .../js/components/dashboard/Dashboard.js | 16 + .../js/components/dashboard/InviteTeam.js | 29 ++ .../js/components/dashboard/ReportIncident.js | 43 ++ resources/lang/en/forms.php | 2 +- .../views/dashboard/incidents/add.blade.php | 216 +++++----- resources/views/dashboard/index.blade.php | 155 +++---- .../partials/welcome-modal.blade.php | 6 - .../views/dashboard/team/invite.blade.php | 58 ++- resources/views/layout/clean.blade.php | 10 +- resources/views/layout/dashboard.blade.php | 18 +- resources/views/layout/master.blade.php | 6 +- resources/views/setup/index.blade.php | 398 +++++++++--------- 15 files changed, 615 insertions(+), 440 deletions(-) create mode 100644 resources/assets/js/components/Setup.js create mode 100644 resources/assets/js/components/dashboard/Dashboard.js create mode 100644 resources/assets/js/components/dashboard/InviteTeam.js create mode 100644 resources/assets/js/components/dashboard/ReportIncident.js diff --git a/resources/assets/js/app.js b/resources/assets/js/app.js index 6fa63484..38bd72c0 100644 --- a/resources/assets/js/app.js +++ b/resources/assets/js/app.js @@ -13,12 +13,39 @@ require('./bootstrap'); window.Vue = require('vue'); -/** - * Next, we will create a fresh Vue application instance and attach it to - * the page. Then, you may begin adding components to this application - * or customize the JavaScript scaffolding to fit your unique needs. - */ +window.axios = require('axios'); -const app = new Vue({ - el: '#app' -}); +window.axios.defaults.headers.common = { + 'X-CSRF-Token': window.Global.csrfToken, + 'X-Requested-With': 'XMLHttpRequest' +}; + +((win, doc) => { + /** + * Next, we will create a fresh Vue application instance and attach it to + * the page. Then, you may begin adding components to this application + * or customize the JavaScript scaffolding to fit your unique needs. + */ + + new Vue({ + el: '#app', + data () { + return { + // TODO: Fill this with the active user. + user: null, + messages: [ + // + ], + system: { + updateAvailable: false, + } + } + }, + components: { + 'setup': require('./components/Setup.js'), + 'dashboard': require('./components/dashboard/Dashboard.js'), + 'report-incident': require('./components/dashboard/ReportIncident.js'), + 'invite-team': require('./components/dashboard/InviteTeam.js'), + } + }) +})() diff --git a/resources/assets/js/cachet.js b/resources/assets/js/cachet.js index 31ea20e6..2444940a 100644 --- a/resources/assets/js/cachet.js +++ b/resources/assets/js/cachet.js @@ -3,7 +3,7 @@ $(function () { $.ajaxPrefilter(function(options, originalOptions, jqXHR) { var token; if (! options.crossDomain) { - token = $('meta[name="token"]').attr('content'); + token = window.Global.csrfToken; if (token) { jqXHR.setRequestHeader('X-CSRF-Token', token); } @@ -232,7 +232,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(); @@ -254,7 +254,7 @@ $(function () { } }); } - }); + });*/ // Banner removal JS $('#remove-banner').on('click', function (){ diff --git a/resources/assets/js/components/Setup.js b/resources/assets/js/components/Setup.js new file mode 100644 index 00000000..6bb0e73d --- /dev/null +++ b/resources/assets/js/components/Setup.js @@ -0,0 +1,49 @@ +module.exports = { + props: [], + data () { + return { + env: { + cache_driver: null, + queue_driver: null, + session_driver: null, + mail_driver: null, + }, + mail: { + host: null, + from: { + email: null, + name: 'status@cachethq.io', + }, + username: null, + password: null, + + requiresHost: true, + requiresUsername: true, + requiresPassword: true, + }, + system: { + name: null, + domain: null, + timezone: null, + language: null + } + } + }, + watch: { + 'env.mail_driver' (driver) { + if (driver === 'log' || driver === 'mail') { + this.mail.requiresHost = false + this.mail.requiresUsername = false + this.mail.requiresPassword = false + } else if (driver === 'ses' || driver === 'mandrill') { + this.mail.requiresHost = false + this.mail.requiresUsername = true + this.mail.requiresPassword = true + } else { + this.mail.requiresHost = true + this.mail.requiresUsername = true + this.mail.requiresPassword = true + } + } + } +} diff --git a/resources/assets/js/components/dashboard/Dashboard.js b/resources/assets/js/components/dashboard/Dashboard.js new file mode 100644 index 00000000..176907f7 --- /dev/null +++ b/resources/assets/js/components/dashboard/Dashboard.js @@ -0,0 +1,16 @@ +module.exports = { + props: ['welcome-user'], + mounted () { + if (this.welcomeUser) { + $('#welcome-modal').modal('show'); + } + }, + methods: { + fetchIncidentTimeline () { + // + }, + fetchSubscriberTimeline () { + // + } + } +} diff --git a/resources/assets/js/components/dashboard/InviteTeam.js b/resources/assets/js/components/dashboard/InviteTeam.js new file mode 100644 index 00000000..20812706 --- /dev/null +++ b/resources/assets/js/components/dashboard/InviteTeam.js @@ -0,0 +1,29 @@ +module.exports = { + data () { + return { + canRemove: true, + emails: [ + { email: '' }, + { email: '' }, + { email: '' }, + { email: '' }, + { email: '' }, + ] + } + }, + methods: { + add () { + this.emails.push("") + }, + remove (key) { + if (this.canRemove) { + this.$delete(this.emails, key) + } + }, + }, + watch: { + 'emails' (val) { + this.canRemove = val.length > 1 + } + } +} diff --git a/resources/assets/js/components/dashboard/ReportIncident.js b/resources/assets/js/components/dashboard/ReportIncident.js new file mode 100644 index 00000000..8d6ade64 --- /dev/null +++ b/resources/assets/js/components/dashboard/ReportIncident.js @@ -0,0 +1,43 @@ +module.exports = { + data () { + return { + template: null, + name: '', + status: null, + visible: 1, + sticky: 0, + message: '', + when: null, + notify: false, + component: { + id: null, + status: null + } + } + }, + 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) + }, + 'component.id' (id) { + // If we unselect a component then reset the status. + if (id === '') { + this.component.status = null + } + } + } +} diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php index c800d80f..b057b053 100644 --- a/resources/lang/en/forms.php +++ b/resources/lang/en/forms.php @@ -215,7 +215,7 @@ return [ ], 'team' => [ 'description' => 'Invite your team members by entering their email addresses here.', - 'email' => 'Email #:id', + 'email' => 'Your Team Members Email Address', ], ], diff --git a/resources/views/dashboard/incidents/add.blade.php b/resources/views/dashboard/incidents/add.blade.php index 5e41a04c..f91c1a39 100644 --- a/resources/views/dashboard/incidents/add.blade.php +++ b/resources/views/dashboard/incidents/add.blade.php @@ -14,122 +14,124 @@
@include('dashboard.partials.errors') -
- -
- @if($incident_templates->count() > 0) -
- - -
- @endif -
- - -
-
-
- - - - -
-
- - -
-
- - -
- @if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty()) -
- - +
+ @if($incident_templates->count() > 0) +
+ + +
+ @endif +
+ + +
+
+
+ + + + +
+
+ + +
+
+ + +
+ @if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty()) +
+ + - {{ trans('forms.optional') }} -
- @endif -
+
- -
- +
+ + {{ trans('forms.cancel') }}
-
- {{ trans('forms.optional') }} - -
- -
- -
-
- -
-
- - {{ trans('forms.cancel') }} -
-
-
+ +
diff --git a/resources/views/dashboard/index.blade.php b/resources/views/dashboard/index.blade.php index 4822d57d..06d7c4e1 100644 --- a/resources/views/dashboard/index.blade.php +++ b/resources/views/dashboard/index.blade.php @@ -1,92 +1,95 @@ @extends('layout.dashboard') @section('content') -
- - - {{ trans('dashboard.dashboard') }} - -
-
-
-
- + +
+
+ + + {{ trans('dashboard.dashboard') }} +
-
- -
-
-
- @if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty()) - @include('dashboard.partials.components') - @else - - @endif -
-
-
- -
-
-
- -
-
+
+
+
+
-
-
-
- -
-
-
+
+
+
+ @if(!$component_groups->isEmpty() || !$ungrouped_components->isEmpty()) + @include('dashboard.partials.components') + @else + + @endif +
+
-
-
-
-
-
-
- {{ trans('dashboard.widgets.support') }} - {!! trans('dashboard.widgets.support_subtitle') !!} +
+
+
+ +
+
+
+
-
-
- @if($entries) -
-
-
- {{ trans('dashboard.widgets.news') }} - {{ trans('dashboard.widgets.news_subtitle') }} -
-
-
- @foreach($entries as $entry) - {{ $entry->title }}, {{ $entry->pubDate }} - @endforeach +
+
-
- @endif -
-
-@includeWhen($welcome_user, 'dashboard.partials.welcome-modal') +
+
+
+
+ {{ trans('dashboard.widgets.support') }} + {!! trans('dashboard.widgets.support_subtitle') !!} +
+
+
+ + @if($entries) +
+
+
+ {{ trans('dashboard.widgets.news') }} + {{ trans('dashboard.widgets.news_subtitle') }} +
+
+
+ @foreach($entries as $entry) + {{ $entry->title }}, {{ $entry->pubDate }} + @endforeach +
+
+
+
+ @endif +
+
+ @includeWhen($welcome_user, 'dashboard.partials.welcome-modal') +
+ @stop diff --git a/resources/views/dashboard/partials/welcome-modal.blade.php b/resources/views/dashboard/partials/welcome-modal.blade.php index 33094069..90f252a5 100644 --- a/resources/views/dashboard/partials/welcome-modal.blade.php +++ b/resources/views/dashboard/partials/welcome-modal.blade.php @@ -64,9 +64,3 @@
- - diff --git a/resources/views/dashboard/team/invite.blade.php b/resources/views/dashboard/team/invite.blade.php index 202889d9..d63f7378 100644 --- a/resources/views/dashboard/team/invite.blade.php +++ b/resources/views/dashboard/team/invite.blade.php @@ -10,38 +10,36 @@
-
-
- @include('dashboard.partials.errors') -
- -
-
- - -
-
- -
-
- -
-
- -
-
- -
-
+ +
+
+ @include('dashboard.partials.errors') + + +
+
+ +
+
+
+ + + + +
+
+
-
-
- - {{ trans('forms.cancel') }} +
+
+ + {{ trans('forms.cancel') }} + +
-
- + +
-
+
@stop diff --git a/resources/views/layout/clean.blade.php b/resources/views/layout/clean.blade.php index ab437d8b..66bf8ed5 100644 --- a/resources/views/layout/clean.blade.php +++ b/resources/views/layout/clean.blade.php @@ -23,7 +23,7 @@ {{ $page_title or $site_title }} @if($enable_external_dependencies) - + {{-- --}} @endif @yield('css') @@ -34,12 +34,16 @@ var Global = {}; Global.locale = '{{ $app_locale }}'; - + + + -
+
@yield('content')
+@yield('js') + diff --git a/resources/views/layout/dashboard.blade.php b/resources/views/layout/dashboard.blade.php index e4a2a897..9438fb8d 100644 --- a/resources/views/layout/dashboard.blade.php +++ b/resources/views/layout/dashboard.blade.php @@ -22,6 +22,12 @@ {{ $page_title or $site_title }} + + @if($enable_external_dependencies) @endif @@ -30,15 +36,12 @@ @include('partials.crowdin') - - + + -
+
@include('dashboard.partials.sidebar')
@if(!$is_writeable) @@ -56,6 +59,7 @@ @yield('content')
- @yield('js') +@yield('js') + diff --git a/resources/views/layout/master.blade.php b/resources/views/layout/master.blade.php index f9f6a40e..5700e3aa 100644 --- a/resources/views/layout/master.blade.php +++ b/resources/views/layout/master.blade.php @@ -76,17 +76,19 @@ Global.locale = '{{ $app_locale }}'; - + + @yield('outer-content') @include('partials.banner') -
+
@yield('content')
@yield('bottom-content') + diff --git a/resources/views/setup/index.blade.php b/resources/views/setup/index.blade.php index 9957e202..6d864652 100644 --- a/resources/views/setup/index.blade.php +++ b/resources/views/setup/index.blade.php @@ -26,213 +26,217 @@
+
-
-
-
-
-
-
- - - @if($errors->has('env.cache_driver')) - {{ $errors->first('env.cache_driver') }} - @endif -
-
- - - @if($errors->has('env.queue_driver')) - {{ $errors->first('env.queue_driver') }} - @endif -
-
- - - @if($errors->has('env.session_driver')) - {{ $errors->first('env.session_driver') }} - @endif + + + +
+
+
+
+
+ + + @if($errors->has('env.cache_driver')) + {{ $errors->first('env.cache_driver') }} + @endif +
+
+ + + @if($errors->has('env.queue_driver')) + {{ $errors->first('env.queue_driver') }} + @endif +
+
+ + + @if($errors->has('env.session_driver')) + {{ $errors->first('env.session_driver') }} + @endif +
-
-
-
- - - @if($errors->has('env.mail_driver')) - {{ $errors->first('env.mail_driver') }} - @endif -
-
- - - @if($errors->has('env.mail_host')) - {{ $errors->first('env.mail_host') }} - @endif -
-
- - - @if($errors->has('env.mail_address')) - {{ $errors->first('env.mail_address') }} - @endif -
-
- - - @if($errors->has('env.mail_username')) - {{ $errors->first('env.mail_username') }} - @endif -
-
- - - @if($errors->has('env.mail_password')) - {{ $errors->first('env.mail_password') }} - @endif -
-
-
-
- - {{ trans('pagination.next') }} - -
-
- - -
@stop