Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

power.vue 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <div class="wizard-project">
  3. <PageHeader>
  4. <h2 class="title">
  5. <span class="icon"><font-awesome-icon icon="sync-alt" /></span>
  6. <span>Updater</span>
  7. </h2>
  8. <h3 class="subtitle">
  9. {{ $dreampower.name }}
  10. </h3>
  11. <template v-slot:right>
  12. <button class="button" @click="$dreamtime.openAppDataFolder()">
  13. <span class="icon"><font-awesome-icon icon="folder-open" /></span>
  14. <span>{{ $dreamtime.name }} Folder</span>
  15. </button>
  16. </template>
  17. </PageHeader>
  18. <div class="project__content">
  19. <div v-if="!requirements.power.installed" class="notification notification--warning">
  20. This component needs to be installed to continue using {{ $dreamtime.name }}.
  21. </div>
  22. <div v-else-if="!requirements.power.compatible" class="notification notification--danger">
  23. <h5>ALERT</h5>
  24. This component requires an update to continue to be used in this version of {{ $dreamtime.name }}.
  25. </div>
  26. <div v-else class="notification">
  27. Installed version: <strong>{{ $dreampower.version }}</strong>
  28. </div>
  29. <AppBox>
  30. <ProjectUpdate project="dreampower" />
  31. </AppBox>
  32. <AppBox title="Settings.">
  33. <SettingsField v-if="!isMacOS"
  34. field-id="preferences.advanced.device"
  35. ignore-hardcoded
  36. @change="$dreampower.updater.refresh()" />
  37. <SettingsField v-else field-id="preferences.advanced.device" description="Mac only supports CPU.">
  38. <select class="input" disabled>
  39. <option value="CPU" selected>
  40. CPU
  41. </option>
  42. </select>
  43. </SettingsField>
  44. <SettingsField v-if="!$dreamtime.isPortable" label="Location" field-id="folders.cli">
  45. <input
  46. v-model="$settings.folders.cli"
  47. :title="$settings.folders.cli"
  48. readonly
  49. class="input"
  50. :style="{ cursor: 'pointer' }"
  51. @click.prevent="changePower">
  52. </SettingsField>
  53. <SettingsField field-id="processing.usePython" />
  54. </AppBox>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import { isNil } from 'lodash'
  60. import { requirements } from '~/modules/system'
  61. import { dreampower } from '~/modules/projects'
  62. const { dialog } = $provider.api
  63. const { existsSync } = $provider.fs
  64. export default {
  65. layout: 'wizard',
  66. middleware({ redirect }) {
  67. if (requirements.power.installed && requirements.power.compatible && !dreampower.updater.available) {
  68. redirect('/wizard/checkpoints')
  69. }
  70. },
  71. data: () => ({
  72. requirements,
  73. }),
  74. computed: {
  75. isMacOS() {
  76. return process.platform === 'darwin'
  77. },
  78. updating() {
  79. return this.$dreampower.updater.update.active
  80. },
  81. },
  82. methods: {
  83. showOpenDialog(path) {
  84. const dir = dialog.showOpenDialogSync({
  85. defaultPath: path,
  86. properties: ['openDirectory'],
  87. })
  88. if (isNil(dir)) {
  89. return path
  90. }
  91. if (!existsSync(dir[0])) {
  92. // ???
  93. return path
  94. }
  95. return dir[0]
  96. },
  97. changePower() {
  98. const dir = this.showOpenDialog(this.$settings.folders.cli)
  99. this.$settings.folders.cli = dir
  100. },
  101. },
  102. }
  103. </script>