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.

93 lines
2.6 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='/svg/icon-console.svg', alt='Developer Tools', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text Developer Tools
  9. .subheading.grey--text Flags
  10. v-spacer
  11. v-btn(color='success', depressed, @click='save', large)
  12. v-icon(left) check
  13. span {{$t('common:actions.apply')}}
  14. v-card.mt-3.white.grey--text.text--darken-3
  15. v-alert(color='red', value='true', icon='warning')
  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='red'
  21. hint='Log all queries made to the database to console.'
  22. persistent-hint
  23. label='SQL Query Logging'
  24. v-model='flags.sqllog'
  25. )
  26. //- v-divider.mt-3
  27. //- v-switch.mt-3(
  28. //- color='primary'
  29. //- hint='Log all queries made to the database to console.'
  30. //- persistent-hint
  31. //- label='SQL Query Log'
  32. //- v-model='flags.sqllog'
  33. //- )
  34. </template>
  35. <script>
  36. import _ from 'lodash'
  37. import flagsQuery from 'gql/admin/dev/dev-query-flags.gql'
  38. import flagsMutation from 'gql/admin/dev/dev-mutation-save-flags.gql'
  39. export default {
  40. data() {
  41. return {
  42. flags: {
  43. sqllog: false
  44. }
  45. }
  46. },
  47. methods: {
  48. async save() {
  49. try {
  50. await this.$apollo.mutate({
  51. mutation: flagsMutation,
  52. variables: {
  53. flags: _.transform(this.flags, (result, value, key) => {
  54. result.push({ key, value })
  55. }, [])
  56. },
  57. watchLoading (isLoading) {
  58. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-dev-flags-update')
  59. }
  60. })
  61. this.$store.commit('showNotification', {
  62. style: 'success',
  63. message: 'Flags applied successfully.',
  64. icon: 'check'
  65. })
  66. } catch (err) {
  67. this.$store.commit('pushGraphError', err)
  68. }
  69. }
  70. },
  71. apollo: {
  72. flags: {
  73. query: flagsQuery,
  74. fetchPolicy: 'network-only',
  75. update: (data) => _.transform(data.system.flags, (result, row) => {
  76. _.set(result, row.key, row.value)
  77. }, {}),
  78. watchLoading (isLoading) {
  79. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-dev-flags-refresh')
  80. }
  81. }
  82. }
  83. }
  84. </script>
  85. <style lang='scss'>
  86. </style>