From 9f8feb65407d738df6e9ae0ab93f388c2dba18ea Mon Sep 17 00:00:00 2001 From: NGPixel Date: Sun, 6 May 2018 17:33:41 -0400 Subject: [PATCH] feat: admin - save locale settings + system info linux os --- client/components/admin/admin-locale.vue | 44 ++++++++++++++++++++- client/components/admin/admin-system.vue | 12 ++++-- client/graph/admin-locale-mutation-save.gql | 12 ++++++ client/graph/admin-locale-query-list.gql | 4 ++ client/graph/admin-system-query-info.gql | 6 ++- package.json | 1 + server/graph/resolvers/localization.js | 8 +++- server/graph/resolvers/system.js | 25 ++++++++++-- server/graph/schemas/localization.graphql | 2 +- server/graph/schemas/system.graphql | 20 +++++----- yarn.lock | 12 ++++++ 11 files changed, 123 insertions(+), 23 deletions(-) create mode 100644 client/graph/admin-locale-mutation-save.gql diff --git a/client/components/admin/admin-locale.vue b/client/components/admin/admin-locale.vue index 512e5f60..ad5de6c1 100644 --- a/client/components/admin/admin-locale.vue +++ b/client/components/admin/admin-locale.vue @@ -15,6 +15,7 @@ v-select(:items='installedLocales' prepend-icon='public' v-model='selectedLocale' + item-value='code' item-text='name' label='Site Locale' persistent-hint @@ -39,7 +40,9 @@ ) v-divider .px-3.pb-3 - v-btn(color='primary') Save + v-btn(color='primary', :loading='loading', @click='save') + v-icon(left) chevron_right + span Save v-flex(lg6 xs12) v-card v-toolbar(color='teal', dark, dense, flat) @@ -65,13 +68,15 @@ import _ from 'lodash' import localesQuery from 'gql/admin-locale-query-list.gql' +import localesMutation from 'gql/admin-locale-mutation-save.gql' export default { data() { return { + loading: false, locales: [], selectedLocale: 'en', - autoUpdate: true + autoUpdate: false } }, computed: { @@ -79,6 +84,33 @@ export default { return _.filter(this.locales, ['isInstalled', true]) } }, + methods: { + async save() { + this.loading = true + const respRaw = await this.$apollo.mutate({ + mutation: localesMutation, + variables: { + locale: this.selectedLocale, + autoUpdate: this.autoUpdate + } + }) + const resp = _.get(respRaw, 'data.localization.updateLocale.responseResult', {}) + if (resp.succeeded) { + this.$store.commit('showNotification', { + message: 'Locale settings updated successfully.', + style: 'success', + icon: 'check' + }) + } else { + this.$store.commit('showNotification', { + message: `Error: ${resp.message}`, + style: 'error', + icon: 'warning' + }) + } + this.loading = false + } + }, apollo: { locales: { query: localesQuery, @@ -86,6 +118,14 @@ export default { watchLoading (isLoading) { this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-locale-refresh') } + }, + selectedLocale: { + query: localesQuery, + update: (data) => data.localization.config.locale + }, + autoUpdate: { + query: localesQuery, + update: (data) => data.localization.config.autoUpdate } } } diff --git a/client/components/admin/admin-system.vue b/client/components/admin/admin-system.vue index 6152bea8..b3f02ddb 100644 --- a/client/components/admin/admin-system.vue +++ b/client/components/admin/admin-system.vue @@ -58,6 +58,12 @@ v-list-tile-content v-list-tile-title Working Directory v-list-tile-sub-title {{ info.workingDirectory }} + v-list-tile(avatar) + v-list-tile-avatar + v-icon.blue-grey.white--text settings + v-list-tile-content + v-list-tile-title Configuration File + v-list-tile-sub-title {{ info.configFile }} v-flex(lg6 xs12) v-card.pb-3 @@ -85,14 +91,14 @@ v-divider - v-subheader PostgreSQL + v-subheader {{ info.dbType }} v-list-tile(avatar) v-list-tile-avatar v-avatar.indigo.darken-1(size='40') icon-database(fillColor='#FFFFFF') v-list-tile-content - v-list-tile-title {{ info.postgreVersion }} - v-list-tile-sub-title {{ info.postgreHost }} + v-list-tile-title {{ info.dbVersion }} + v-list-tile-sub-title {{ info.dbHost }}