feat: admin - save locale settings + system info linux os

This commit is contained in:
NGPixel
2018-05-06 17:33:41 -04:00
parent b143aa2f8c
commit 9f8feb6540
11 changed files with 124 additions and 24 deletions

View File

@@ -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
}
}
}

View File

@@ -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 }}
</template>
<script>