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.

processing.vue 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <template>
  2. <div class="settings-fields">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="cogs" /></span>
  6. <span>Processing</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. Settings that affect the use of resources for the nudification.
  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. <AppNotification name="device-change">
  18. The <strong>device</strong> option is now part of the preferences for each photo. If you already have photos in the queue, you should change the device in those photos too.
  19. </AppNotification>
  20. <section class="box">
  21. <div class="box__content">
  22. <SettingsField v-if="!isMacOS"
  23. v-model="value$"
  24. field-id="preferences.advanced.device"
  25. ignore-hardcoded />
  26. <SettingsField v-else
  27. field-id="preferences.advanced.device"
  28. description="Mac only supports CPU."
  29. ignore-hardcoded>
  30. <select v-model="value$.preferences.advanced.device" class="input" disabled>
  31. <option value="CPU">
  32. CPU
  33. </option>
  34. </select>
  35. </SettingsField>
  36. <SettingsField v-show="value$.preferences.advanced.device === 'GPU'" field-id="processing.gpus">
  37. <select v-model="value$.processing.gpus[0]" class="input">
  38. <option v-for="(device, index) in $provider.system.graphics" :key="index" :value="index">
  39. {{ device.model }}
  40. </option>
  41. <option v-for="n in 5"
  42. :key="`slot-${n - 1}`"
  43. :value="n - 1">
  44. Slot {{ n - 1 }}
  45. </option>
  46. </select>
  47. </SettingsField>
  48. <SettingsField field-id="processing.cores" :attrs="{ type: 'number', min: 1, max: $provider.system.cores }" />
  49. </div>
  50. </section>
  51. </div>
  52. </template>
  53. <script>
  54. import { cloneDeep, merge } from 'lodash'
  55. import Swal from 'sweetalert2/dist/sweetalert2'
  56. import { VModel } from '~/mixins'
  57. export default {
  58. mixins: [VModel],
  59. computed: {
  60. isMacOS() {
  61. return process.platform === 'darwin'
  62. },
  63. },
  64. methods: {
  65. async reset() {
  66. const response = await Swal.fire({
  67. title: 'Are you sure?',
  68. text: 'This will set all options in this section to their default values.',
  69. icon: 'warning',
  70. showCancelButton: true,
  71. confirmButtonColor: '#F44336',
  72. confirmButtonText: 'Yes',
  73. })
  74. if (!response.value) {
  75. return
  76. }
  77. // eslint-disable-next-line no-underscore-dangle
  78. const settings = cloneDeep($provider.settings._default.processing)
  79. this.value$.processing = merge(this.value$.processing, settings)
  80. window.$redirect('/')
  81. },
  82. },
  83. }
  84. </script>