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.

notifications.vue 1.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <template>
  2. <div class="settings-fields">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="bell" /></span>
  6. <span>Notifications</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. Desktop notification settings.
  10. </h3>
  11. <template v-slot:right>
  12. <button class="button button--danger" @click="reset()">
  13. <span>Reset</span>
  14. </button>
  15. </template>
  16. </PageHeader>
  17. <section class="box">
  18. <div class="box__content">
  19. <SettingsField v-model="value$" field-id="notifications.run" />
  20. <SettingsField v-model="value$" field-id="notifications.allRuns" />
  21. <SettingsField v-model="value$" field-id="notifications.update" />
  22. </div>
  23. </section>
  24. </div>
  25. </template>
  26. <script>
  27. import { cloneDeep, merge } from 'lodash'
  28. import Swal from 'sweetalert2/dist/sweetalert2'
  29. import { VModel } from '~/mixins'
  30. export default {
  31. mixins: [VModel],
  32. methods: {
  33. async reset() {
  34. const response = await Swal.fire({
  35. title: 'Are you sure?',
  36. text: 'This will set all options in this section to their default values.',
  37. icon: 'warning',
  38. showCancelButton: true,
  39. confirmButtonColor: '#F44336',
  40. confirmButtonText: 'Yes',
  41. })
  42. if (!response.value) {
  43. return
  44. }
  45. // eslint-disable-next-line no-underscore-dangle
  46. const settings = cloneDeep($provider.settings._default.notifications)
  47. this.value$.notifications = merge(this.value$.notifications, settings)
  48. window.$redirect('/')
  49. },
  50. },
  51. }
  52. </script>