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.

88 lines
3.0 KiB

  1. <template lang='pug'>
  2. v-card
  3. v-toolbar(flat, color='primary', dark, dense)
  4. .subheading {{ $t('admin:utilities.cacheTitle') }}
  5. v-card-text
  6. v-subheader.pl-0.primary--text Flush Pages and Assets Cache
  7. .body-1 Pages and Assets are cached to disk for better performance. You can flush the cache to force all content to be fetched from the DB again.
  8. v-btn(outline, color='primary', @click='flushCache', :disabled='loading').ml-0.mt-3
  9. v-icon(left) build
  10. span Proceed
  11. v-divider.my-3
  12. v-subheader.pl-0.primary--text Flush Temporary Uploads
  13. .body-1 New uploads are temporarily saved to disk while they are being processed. They are automatically deleted after processing, but you can force an immediate cleanup using this tool.
  14. .body-1.red--text Note that performing this action while an upload is in progress can result in a failed upload.
  15. v-btn(outline, color='primary', @click='flushUploads', :disabled='loading').ml-0.mt-3
  16. v-icon(left) build
  17. span Proceed
  18. </template>
  19. <script>
  20. import _ from 'lodash'
  21. import utilityCacheFlushCacheMutation from 'gql/admin/utilities/utilities-mutation-cache-flushcache.gql'
  22. import utilityCacheFlushUploadsMutation from 'gql/admin/utilities/utilities-mutation-cache-flushuploads.gql'
  23. export default {
  24. data() {
  25. return {
  26. loading: false
  27. }
  28. },
  29. methods: {
  30. async flushCache() {
  31. this.loading = true
  32. this.$store.commit(`loadingStart`, 'admin-utilities-cache-flushCache')
  33. try {
  34. const respRaw = await this.$apollo.mutate({
  35. mutation: utilityCacheFlushCacheMutation
  36. })
  37. const resp = _.get(respRaw, 'data.pages.flushCache.responseResult', {})
  38. if (resp.succeeded) {
  39. this.$store.commit('showNotification', {
  40. message: 'Cache flushed successfully.',
  41. style: 'success',
  42. icon: 'check'
  43. })
  44. } else {
  45. throw new Error(resp.message)
  46. }
  47. } catch (err) {
  48. this.$store.commit('pushGraphError', err)
  49. }
  50. this.$store.commit(`loadingStop`, 'admin-utilities-cache-flushCache')
  51. this.loading = false
  52. },
  53. async flushUploads() {
  54. this.loading = true
  55. this.$store.commit(`loadingStart`, 'admin-utilities-cache-flushUploads')
  56. try {
  57. const respRaw = await this.$apollo.mutate({
  58. mutation: utilityCacheFlushUploadsMutation
  59. })
  60. const resp = _.get(respRaw, 'data.assets.flushTempUploads.responseResult', {})
  61. if (resp.succeeded) {
  62. this.$store.commit('showNotification', {
  63. message: 'Temporary Uploads flushed successfully.',
  64. style: 'success',
  65. icon: 'check'
  66. })
  67. } else {
  68. throw new Error(resp.message)
  69. }
  70. } catch (err) {
  71. this.$store.commit('pushGraphError', err)
  72. }
  73. this.$store.commit(`loadingStop`, 'admin-utilities-cache-flushUploads')
  74. this.loading = false
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang='scss'>
  80. </style>