2018-03-12 04:09:54 +00:00
|
|
|
<template lang='pug'>
|
2018-09-01 03:42:14 +00:00
|
|
|
v-card(tile, :color='$vuetify.dark ? "grey darken-4" : "grey lighten-5"')
|
|
|
|
.pa-3.pt-4
|
2018-09-09 00:57:37 +00:00
|
|
|
.admin-header-icon: v-icon(size='80', color='grey lighten-2') graphic_eq
|
2018-06-10 00:11:00 +00:00
|
|
|
.headline.primary--text Logging
|
|
|
|
.subheading.grey--text Configure the system logger(s)
|
|
|
|
v-tabs(:color='$vuetify.dark ? "primary" : "grey lighten-4"', fixed-tabs, :slider-color='$vuetify.dark ? "white" : "primary"', show-arrows)
|
|
|
|
v-tab(key='settings'): v-icon settings
|
2018-09-02 02:37:20 +00:00
|
|
|
v-tab(v-for='logger in activeLoggers', :key='logger.key') {{ logger.title }}
|
2018-03-12 04:09:54 +00:00
|
|
|
|
2018-06-10 00:11:00 +00:00
|
|
|
v-tab-item(key='settings', :transition='false', :reverse-transition='false')
|
2018-09-01 03:42:14 +00:00
|
|
|
v-card.pa-3(flat, tile)
|
2018-09-02 02:37:20 +00:00
|
|
|
.body-2.grey--text.text--darken-1 Select which logging service to enable:
|
|
|
|
.caption.grey--text.pb-2 Some loggers require additional configuration in their dedicated tab (when selected).
|
2018-06-10 00:11:00 +00:00
|
|
|
v-form
|
2018-09-04 04:46:24 +00:00
|
|
|
v-checkbox.my-0(
|
2018-09-02 02:37:20 +00:00
|
|
|
v-for='(logger, n) in loggers'
|
|
|
|
v-model='logger.isEnabled'
|
|
|
|
:key='logger.key'
|
|
|
|
:label='logger.title'
|
|
|
|
color='primary'
|
2018-06-10 00:11:00 +00:00
|
|
|
hide-details
|
|
|
|
)
|
2018-03-12 04:09:54 +00:00
|
|
|
|
2018-09-02 02:37:20 +00:00
|
|
|
v-tab-item(v-for='(logger, n) in activeLoggers', :key='logger.key', :transition='false', :reverse-transition='false')
|
2018-09-01 03:42:14 +00:00
|
|
|
v-card.pa-3(flat, tile)
|
2018-06-10 00:11:00 +00:00
|
|
|
v-form
|
2018-09-02 02:37:20 +00:00
|
|
|
.loggerlogo
|
|
|
|
img(:src='logger.logo', :alt='logger.title')
|
|
|
|
v-subheader.pl-0 {{logger.title}}
|
|
|
|
.caption {{logger.description}}
|
|
|
|
.caption: a(:href='logger.website') {{logger.website}}
|
|
|
|
v-divider.mt-3
|
|
|
|
v-subheader.pl-0 Logger Configuration
|
|
|
|
.body-1.ml-3(v-if='!logger.config || logger.config.length < 1') This logger has no configuration options you can modify.
|
|
|
|
template(v-else, v-for='cfg in logger.config')
|
|
|
|
v-select(
|
|
|
|
v-if='cfg.value.type === "string" && cfg.value.enum'
|
|
|
|
outline
|
|
|
|
background-color='grey lighten-2'
|
|
|
|
:items='cfg.value.enum'
|
|
|
|
:key='cfg.key'
|
|
|
|
:label='cfg.value.title'
|
|
|
|
v-model='cfg.value.value'
|
|
|
|
prepend-icon='settings_applications'
|
|
|
|
:hint='cfg.value.hint ? cfg.value.hint : ""'
|
|
|
|
persistent-hint
|
|
|
|
:class='cfg.value.hint ? "mb-2" : ""'
|
|
|
|
)
|
|
|
|
v-switch(
|
|
|
|
v-else-if='cfg.value.type === "boolean"'
|
|
|
|
:key='cfg.key'
|
|
|
|
:label='cfg.value.title'
|
|
|
|
v-model='cfg.value.value'
|
|
|
|
color='primary'
|
|
|
|
prepend-icon='settings_applications'
|
|
|
|
:hint='cfg.value.hint ? cfg.value.hint : ""'
|
|
|
|
persistent-hint
|
|
|
|
)
|
|
|
|
v-text-field(
|
|
|
|
v-else
|
|
|
|
outline
|
|
|
|
background-color='grey lighten-2'
|
|
|
|
:key='cfg.key'
|
|
|
|
:label='cfg.value.title'
|
|
|
|
v-model='cfg.value.value'
|
|
|
|
prepend-icon='settings_applications'
|
|
|
|
:hint='cfg.value.hint ? cfg.value.hint : ""'
|
|
|
|
persistent-hint
|
|
|
|
:class='cfg.value.hint ? "mb-2" : ""'
|
|
|
|
)
|
|
|
|
v-divider.mt-3
|
|
|
|
v-subheader.pl-0 Log Level
|
|
|
|
.body-1.ml-3 Select the minimum error level that will be reported to this logger.
|
|
|
|
v-layout(row)
|
|
|
|
v-flex(xs12, md6, lg4)
|
|
|
|
.pt-3
|
|
|
|
v-select(
|
|
|
|
single-line
|
|
|
|
outline
|
|
|
|
background-color='grey lighten-2'
|
|
|
|
:items='levels'
|
|
|
|
label='Level'
|
|
|
|
v-model='logger.level'
|
|
|
|
prepend-icon='graphic_eq'
|
|
|
|
hint='Default: warn'
|
|
|
|
persistent-hint
|
|
|
|
)
|
2018-09-01 03:42:14 +00:00
|
|
|
|
|
|
|
v-card-chin
|
|
|
|
v-btn(color='primary', @click='save')
|
|
|
|
v-icon(left) chevron_right
|
|
|
|
span Apply Configuration
|
|
|
|
v-btn(color='black', dark, @click='toggleConsole')
|
|
|
|
v-icon(left) keyboard
|
|
|
|
span View Console
|
|
|
|
v-btn(color='black', dark)
|
|
|
|
v-icon(left) layers_clear
|
|
|
|
span Purge Logs
|
|
|
|
v-spacer
|
|
|
|
v-btn(icon, @click='refresh')
|
|
|
|
v-icon.grey--text refresh
|
2018-03-12 04:09:54 +00:00
|
|
|
|
2018-08-13 04:12:44 +00:00
|
|
|
logging-console(v-model='showConsole')
|
2018-03-12 04:09:54 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
import _ from 'lodash'
|
|
|
|
|
2018-08-13 04:12:44 +00:00
|
|
|
import LoggingConsole from './admin-logging-console.vue'
|
|
|
|
|
2018-09-02 02:37:20 +00:00
|
|
|
import loggersQuery from 'gql/admin/logging/logging-query-loggers.gql'
|
|
|
|
import loggersSaveMutation from 'gql/admin/logging/logging-mutation-save-loggers.gql'
|
|
|
|
|
2018-03-12 04:09:54 +00:00
|
|
|
export default {
|
2018-08-13 04:12:44 +00:00
|
|
|
components: {
|
|
|
|
LoggingConsole
|
|
|
|
},
|
2018-03-12 04:09:54 +00:00
|
|
|
data() {
|
|
|
|
return {
|
2018-08-13 04:12:44 +00:00
|
|
|
showConsole: false,
|
2018-09-02 02:37:20 +00:00
|
|
|
loggers: [],
|
|
|
|
levels: ['error', 'warn', 'info', 'debug', 'verbose']
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2018-09-02 02:37:20 +00:00
|
|
|
activeLoggers() {
|
|
|
|
return _.filter(this.loggers, 'isEnabled')
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
async refresh() {
|
2018-09-02 02:37:20 +00:00
|
|
|
await this.$apollo.queries.loggers.refetch()
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
message: 'List of loggers has been refreshed.',
|
|
|
|
style: 'success',
|
|
|
|
icon: 'cached'
|
|
|
|
})
|
2018-08-13 04:12:44 +00:00
|
|
|
},
|
2018-09-02 02:37:20 +00:00
|
|
|
async save() {
|
|
|
|
this.$store.commit(`loadingStart`, 'admin-logging-saveloggers')
|
|
|
|
await this.$apollo.mutate({
|
|
|
|
mutation: loggersSaveMutation,
|
|
|
|
variables: {
|
|
|
|
loggers: this.loggers.map(tgt => _.pick(tgt, [
|
|
|
|
'isEnabled',
|
|
|
|
'key',
|
|
|
|
'config',
|
|
|
|
'level'
|
|
|
|
])).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: cfg.value.value}))}))
|
|
|
|
}
|
|
|
|
})
|
|
|
|
this.$store.commit('showNotification', {
|
|
|
|
message: 'Logging configuration saved successfully.',
|
|
|
|
style: 'success',
|
|
|
|
icon: 'check'
|
|
|
|
})
|
|
|
|
this.$store.commit(`loadingStop`, 'admin-logging-saveloggers')
|
|
|
|
}
|
|
|
|
},
|
|
|
|
apollo: {
|
|
|
|
loggers: {
|
|
|
|
query: loggersQuery,
|
|
|
|
fetchPolicy: 'network-only',
|
|
|
|
update: (data) => _.cloneDeep(data.logging.loggers).map(str => ({...str, config: str.config.map(cfg => ({...cfg, value: JSON.parse(cfg.value)}))})),
|
|
|
|
watchLoading (isLoading) {
|
|
|
|
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-logging-refresh')
|
|
|
|
}
|
2018-03-12 04:09:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
2018-09-02 02:37:20 +00:00
|
|
|
<style lang='scss' scoped>
|
|
|
|
|
|
|
|
.loggerlogo {
|
|
|
|
width: 250px;
|
|
|
|
height: 85px;
|
|
|
|
float:right;
|
|
|
|
display: flex;
|
|
|
|
justify-content: flex-end;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
img {
|
|
|
|
max-width: 100%;
|
|
|
|
max-height: 50px;
|
|
|
|
}
|
|
|
|
}
|
2018-03-12 04:09:54 +00:00
|
|
|
|
|
|
|
</style>
|