123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- <template>
- <div class="settings-fields">
- <PageHeader>
- <h2 class="title">
- <span class="icon"><font-awesome-icon icon="cogs" /></span>
- <span>Processing</span>
- </h2>
-
- <h3 class="subtitle">
- Settings that affect the use of resources for the nudification.
- </h3>
-
- <template v-slot:right>
- <button class="button button--danger" @click="reset()">
- <span>Reset</span>
- </button>
- </template>
- </PageHeader>
-
- <AppNotification name="device-change">
- 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.
- </AppNotification>
-
- <section class="box">
- <div class="box__content">
- <SettingsField v-if="!isMacOS"
- v-model="value$"
- field-id="preferences.advanced.device"
- ignore-hardcoded />
-
- <SettingsField v-else
- field-id="preferences.advanced.device"
- description="Mac only supports CPU."
- ignore-hardcoded>
- <select v-model="value$.preferences.advanced.device" class="input" disabled>
- <option value="CPU">
- CPU
- </option>
- </select>
- </SettingsField>
-
- <SettingsField v-show="value$.preferences.advanced.device === 'GPU'" field-id="processing.gpus">
- <select v-model="value$.processing.gpus[0]" class="input">
- <option v-for="(device, index) in $provider.system.graphics" :key="index" :value="index">
- {{ device.model }}
- </option>
- <option v-for="n in 5"
- :key="`slot-${n - 1}`"
- :value="n - 1">
- Slot {{ n - 1 }}
- </option>
- </select>
- </SettingsField>
-
- <SettingsField field-id="processing.cores" :attrs="{ type: 'number', min: 1, max: $provider.system.cores }" />
- </div>
- </section>
- </div>
- </template>
-
- <script>
- import { cloneDeep, merge } from 'lodash'
- import Swal from 'sweetalert2/dist/sweetalert2'
- import { VModel } from '~/mixins'
-
- export default {
- mixins: [VModel],
-
- computed: {
- isMacOS() {
- return process.platform === 'darwin'
- },
- },
-
- methods: {
- async reset() {
- const response = await Swal.fire({
- title: 'Are you sure?',
- text: 'This will set all options in this section to their default values.',
- icon: 'warning',
- showCancelButton: true,
- confirmButtonColor: '#F44336',
- confirmButtonText: 'Yes',
- })
-
- if (!response.value) {
- return
- }
-
- // eslint-disable-next-line no-underscore-dangle
- const settings = cloneDeep($provider.settings._default.processing)
-
- this.value$.processing = merge(this.value$.processing, settings)
-
- window.$redirect('/')
- },
- },
- }
- </script>
|