123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <div class="wizard-project">
- <PageHeader>
- <h2 class="title">
- <span class="icon"><font-awesome-icon icon="sync-alt" /></span>
- <span>Updater</span>
- </h2>
-
- <h3 class="subtitle">
- {{ $dreampower.name }}
- </h3>
-
- <template v-slot:right>
- <button class="button" @click="$dreamtime.openAppDataFolder()">
- <span class="icon"><font-awesome-icon icon="folder-open" /></span>
- <span>{{ $dreamtime.name }} Folder</span>
- </button>
- </template>
- </PageHeader>
-
- <div class="project__content">
- <div v-if="!requirements.power.installed" class="notification notification--warning">
- This component needs to be installed to continue using {{ $dreamtime.name }}.
- </div>
-
- <div v-else-if="!requirements.power.compatible" class="notification notification--danger">
- <h5>ALERT</h5>
- This component requires an update to continue to be used in this version of {{ $dreamtime.name }}.
- </div>
-
- <div v-else class="notification">
- Installed version: <strong>{{ $dreampower.version }}</strong>
- </div>
-
- <AppBox>
- <ProjectUpdate project="dreampower" />
- </AppBox>
-
- <AppBox title="Settings.">
- <SettingsField v-if="!isMacOS"
- field-id="preferences.advanced.device"
- ignore-hardcoded
- @change="$dreampower.updater.refresh()" />
-
- <SettingsField v-else field-id="preferences.advanced.device" description="Mac only supports CPU.">
- <select class="input" disabled>
- <option value="CPU" selected>
- CPU
- </option>
- </select>
- </SettingsField>
-
- <SettingsField v-if="!$dreamtime.isPortable" label="Location" field-id="folders.cli">
- <input
- v-model="$settings.folders.cli"
- :title="$settings.folders.cli"
- readonly
- class="input"
- :style="{ cursor: 'pointer' }"
- @click.prevent="changePower">
- </SettingsField>
-
- <SettingsField field-id="processing.usePython" />
- </AppBox>
- </div>
- </div>
- </template>
-
- <script>
- import { isNil } from 'lodash'
- import { requirements } from '~/modules/system'
- import { dreampower } from '~/modules/projects'
-
- const { dialog } = $provider.api
- const { existsSync } = $provider.fs
-
- export default {
- layout: 'wizard',
-
- middleware({ redirect }) {
- if (requirements.power.installed && requirements.power.compatible && !dreampower.updater.available) {
- redirect('/wizard/checkpoints')
- }
- },
-
- data: () => ({
- requirements,
- }),
-
- computed: {
- isMacOS() {
- return process.platform === 'darwin'
- },
-
- updating() {
- return this.$dreampower.updater.update.active
- },
- },
-
- methods: {
- showOpenDialog(path) {
- const dir = dialog.showOpenDialogSync({
- defaultPath: path,
- properties: ['openDirectory'],
- })
-
- if (isNil(dir)) {
- return path
- }
-
- if (!existsSync(dir[0])) {
- // ???
- return path
- }
-
- return dir[0]
- },
-
- changePower() {
- const dir = this.showOpenDialog(this.$settings.folders.cli)
- this.$settings.folders.cli = dir
- },
- },
- }
- </script>
|