You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.7 KiB

5 years ago
5 years ago
  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row, wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img(src='/_assets/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text Developer Tools
  9. .subtitle-1.grey--text Flags
  10. v-spacer
  11. v-btn(color='success', depressed, @click='save', large)
  12. v-icon(left) mdi-check
  13. span {{$t('common:actions.apply')}}
  14. v-card.mt-3(:class='$vuetify.theme.dark ? `grey darken-3-d5` : `white grey--text text--darken-3`')
  15. v-alert(color='red', :value='true', icon='mdi-alert', dark, prominent)
  16. span Do NOT enable these flags unless you know what you're doing!
  17. .caption Doing so may result in data loss or broken installation!
  18. v-card-text
  19. v-switch.mt-3(
  20. color='primary'
  21. hint='Log detailed debug info on LDAP/AD login attempts.'
  22. persistent-hint
  23. label='LDAP Debug'
  24. v-model='flags.ldapdebug'
  25. inset
  26. )
  27. v-divider.mt-3
  28. v-switch.mt-3(
  29. color='red'
  30. hint='Log all queries made to the database to console.'
  31. persistent-hint
  32. label='SQL Query Logging'
  33. v-model='flags.sqllog'
  34. inset
  35. )
  36. </template>
  37. <script>
  38. import _ from 'lodash'
  39. import flagsQuery from 'gql/admin/dev/dev-query-flags.gql'
  40. import flagsMutation from 'gql/admin/dev/dev-mutation-save-flags.gql'
  41. export default {
  42. data() {
  43. return {
  44. flags: {
  45. sqllog: false
  46. }
  47. }
  48. },
  49. methods: {
  50. async save() {
  51. try {
  52. await this.$apollo.mutate({
  53. mutation: flagsMutation,
  54. variables: {
  55. flags: _.transform(this.flags, (result, value, key) => {
  56. result.push({ key, value })
  57. }, [])
  58. },
  59. watchLoading (isLoading) {
  60. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-dev-flags-update')
  61. }
  62. })
  63. this.$store.commit('showNotification', {
  64. style: 'success',
  65. message: 'Flags applied successfully.',
  66. icon: 'check'
  67. })
  68. } catch (err) {
  69. this.$store.commit('pushGraphError', err)
  70. }
  71. }
  72. },
  73. apollo: {
  74. flags: {
  75. query: flagsQuery,
  76. fetchPolicy: 'network-only',
  77. update: (data) => _.transform(data.system.flags, (result, row) => {
  78. _.set(result, row.key, row.value)
  79. }, {}),
  80. watchLoading (isLoading) {
  81. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-dev-flags-refresh')
  82. }
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang='scss'>
  88. </style>