summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2024-02-07 12:50:41 +0100
committerLouis Chemineau <louis@chmn.me>2024-02-15 16:24:02 +0100
commit8f16b065c645810c66c6a71782c13785d5859a8b (patch)
treec8443eacb6f95b4537f61a3a97a02ef89cc7db76
parente3c39266b1e1027c5cf028d2896007d1e16355b7 (diff)
Restrict source folder selection to 1
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--lib/Service/UserConfigService.php2
-rw-r--r--src/components/Settings/PhotosSourceLocationsSettings.vue42
2 files changed, 24 insertions, 20 deletions
diff --git a/lib/Service/UserConfigService.php b/lib/Service/UserConfigService.php
index bb3b0a38..d2362fe9 100644
--- a/lib/Service/UserConfigService.php
+++ b/lib/Service/UserConfigService.php
@@ -34,7 +34,7 @@ class UserConfigService {
public const DEFAULT_CONFIGS = [
'croppedLayout' => 'false',
'photosLocation' => '/Photos',
- 'photosSourceFolders' => '["/Photos"]',
+ 'photosSourceFolder' => '/Photos',
];
private IConfig $config;
diff --git a/src/components/Settings/PhotosSourceLocationsSettings.vue b/src/components/Settings/PhotosSourceLocationsSettings.vue
index 514c1483..0e7ab12d 100644
--- a/src/components/Settings/PhotosSourceLocationsSettings.vue
+++ b/src/components/Settings/PhotosSourceLocationsSettings.vue
@@ -23,18 +23,24 @@
<template>
<div class="photos-locations">
<ul>
- <li v-for="(source, index) in photosSourceFolders"
+ <PhotosFolder :path="photosSourceFolder" :root-folder-label="t('photos', 'All folders')" />
+ <!-- TODO: uncomment when SEARCH on multiple folders is implemented. -->
+ <!-- <li v-for="(source, index) in photosSourceFolder"
:key="index">
- <PhotosFolder :path="source" :can-delete="photosSourceFolders.length !== 1" @remove-folder="removeSourceFolder(index)" :root-folder-label="t('photos', 'All folders')"/>
- </li>
+ <PhotosFolder :path="source"
+ :can-delete="photosSourceFolder.length !== 1"
+ :root-folder-label="t('photos', 'All folders')"
+ @remove-folder="removeSourceFolder(index)" />
+ </li> -->
</ul>
- <NcButton :aria-label="t('photos', 'Add source directory')"
+ <NcButton :aria-label="t('photos', 'Choose a source Photos for the timelines')"
@click="debounceAddSourceFolder">
- <template #icon>
+ <!-- TODO: uncomment when SEARCH on multiple folders is implemented. -->
+ <!-- <template #icon>
<Plus :size="20" />
- </template>
- {{ t('photos', 'Add folder') }}
+ </template> -->
+ {{ t('photos', 'Choose a different folder') }}
</NcButton>
</div>
</template>
@@ -43,8 +49,6 @@
import debounce from 'debounce'
import { defineComponent } from 'vue'
-import Plus from 'vue-material-design-icons/Plus.vue'
-
import { NcButton } from '@nextcloud/vue'
import { getFilePickerBuilder } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
@@ -56,14 +60,13 @@ export default defineComponent({
components: {
NcButton,
- Plus,
PhotosFolder,
},
computed: {
- /** @return {string[]} */
- photosSourceFolders() {
- return this.$store.state.userConfig.photosSourceFolders
+ /** @return {string} */
+ photosSourceFolder() {
+ return this.$store.state.userConfig.photosSourceFolder
},
},
@@ -86,16 +89,17 @@ export default defineComponent({
async addSourceFolder() {
const pickedFolder = await this.openFilePicker(t('photos', 'Select a source folder for your media'))
- if (this.photosSourceFolders.includes(pickedFolder)) {
- return
- }
- this.$store.dispatch('updateUserConfig', { key: 'photosSourceFolders', value: [...this.photosSourceFolders, pickedFolder] })
+ // TODO: uncomment when SEARCH on multiple folders is implemented.
+ // if (this.photosSourceFolder.includes(pickedFolder)) {
+ // return
+ // }
+ this.$store.dispatch('updateUserConfig', { key: 'photosSourceFolder', value: pickedFolder })
},
removeSourceFolder(index) {
- const folders = [...this.photosSourceFolders]
+ const folders = [...this.photosSourceFolder]
folders.splice(index, 1)
- this.$store.dispatch('updateUserConfig', { key: 'photosSourceFolders', value: folders })
+ this.$store.dispatch('updateUserConfig', { key: 'photosSourceFolder', value: folders })
},
t,