diff --git a/client/components/admin/admin-mail.vue b/client/components/admin/admin-mail.vue index 91ac6e83..6fda10c1 100644 --- a/client/components/admin/admin-mail.vue +++ b/client/components/admin/admin-mail.vue @@ -136,11 +136,11 @@ :label='$t(`admin:mail.testRecipient`)' :counter='255' prepend-icon='mail' - disabled + :disabled='testLoading' ) v-card-chin v-spacer - v-btn(color='teal', :dark='false', disabled) {{ $t('admin:mail.testSend') }} + v-btn(color='teal', dark, @click='sendTest', :loading='testLoading') {{ $t('admin:mail.testSend') }} @@ -149,6 +149,7 @@ import _ from 'lodash' import { get } from 'vuex-pathify' import mailConfigQuery from 'gql/admin/mail/mail-query-config.gql' import mailUpdateConfigMutation from 'gql/admin/mail/mail-mutation-save-config.gql' +import mailTestMutation from 'gql/admin/mail/mail-mutation-sendtest.gql' export default { data() { @@ -166,7 +167,8 @@ export default { dkimKeySelector: '', dkimPrivateKey: '' }, - testEmail: '' + testEmail: '', + testLoading: false } }, computed: { @@ -202,6 +204,31 @@ export default { } catch (err) { this.$store.commit('pushGraphError', err) } + }, + async sendTest () { + try { + const resp = await this.$apollo.mutate({ + mutation: mailTestMutation, + variables: { + recipientEmail: this.testEmail + }, + watchLoading (isLoading) { + this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-mail-test') + } + }) + if (!_.get(resp, 'data.mail.sendTest.responseResult.succeeded', false)) { + throw new Error(_.get(resp, 'data.mail.sendTest.responseResult.message', 'An unexpected error occured.')) + } + + this.testEmail = '' + this.$store.commit('showNotification', { + style: 'success', + message: this.$t('admin:mail.sendTestSuccess'), + icon: 'check' + }) + } catch (err) { + this.$store.commit('pushGraphError', err) + } } }, apollo: { diff --git a/client/components/admin/admin-pages.vue b/client/components/admin/admin-pages.vue index 159dce4c..0da626a6 100644 --- a/client/components/admin/admin-pages.vue +++ b/client/components/admin/admin-pages.vue @@ -14,7 +14,7 @@ v-icon(left) add span New Page v-card.wiki-form.mt-3 - v-toolbar(flat, :color='$vuetify.dark ? `grey darken-3-d5` : `white`', height='80') + v-toolbar(flat, :color='$vuetify.dark ? `grey darken-3-d5` : `grey lighten-5`', height='80') v-spacer v-text-field( outline diff --git a/client/components/admin/admin-users-create.vue b/client/components/admin/admin-users-create.vue index 63e335fc..1deeacee 100644 --- a/client/components/admin/admin-users-create.vue +++ b/client/components/admin/admin-users-create.vue @@ -64,8 +64,8 @@ v-card-chin v-spacer v-btn(flat, @click='isShown = false') Cancel - v-btn(color='primary', @click='newUser') Create - v-btn(color='primary', @click='newUser') Create and Close + v-btn(color='primary', @click='newUser(true)') Create + v-btn(color='primary', @click='newUser(false)') Create and Close