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.

telemetry.vue 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <div class="settings-fields">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="paper-plane" /></span>
  6. <span>Telemetry</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. Settings for sending usage information to improve the application.
  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. <div class="notification">
  18. <span class="icon"><font-awesome-icon icon="info-circle" /></span>
  19. <span>Changing this options needs a restart to take effect.</span>
  20. </div>
  21. <section class="box">
  22. <div class="box__content">
  23. <SettingsField v-model="value$" field-id="user" readonly />
  24. <SettingsField v-model="value$" field-id="telemetry.bugs" />
  25. <SettingsField v-model="value$" field-id="telemetry.dom" />
  26. </div>
  27. </section>
  28. </div>
  29. </template>
  30. <script>
  31. import { cloneDeep, merge } from 'lodash'
  32. import Swal from 'sweetalert2/dist/sweetalert2'
  33. import { VModel } from '~/mixins'
  34. export default {
  35. mixins: [VModel],
  36. methods: {
  37. async reset() {
  38. const response = await Swal.fire({
  39. title: 'Are you sure?',
  40. text: 'This will set all options in this section to their default values.',
  41. icon: 'warning',
  42. showCancelButton: true,
  43. confirmButtonColor: '#F44336',
  44. confirmButtonText: 'Yes',
  45. })
  46. if (!response.value) {
  47. return
  48. }
  49. // eslint-disable-next-line no-underscore-dangle
  50. const settings = cloneDeep($provider.settings._default.telemetry)
  51. this.value$.telemetry = merge(this.value$.telemetry, settings)
  52. window.$redirect('/')
  53. },
  54. },
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. p {
  59. @apply mb-4;
  60. }
  61. </style>