diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index 4fbc95990..97c60e870 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -86,7 +86,10 @@ public function index(): TemplateResponse { $this->initialStateService->provideInitialState($this->appName, 'image-mimes', Application::IMAGE_MIMES); $this->initialStateService->provideInitialState($this->appName, 'video-mimes', Application::VIDEO_MIMES); $this->initialStateService->provideInitialState($this->appName, 'maps', $this->appManager->isEnabledForUser('maps') === true); + + // User Settings $this->initialStateService->provideInitialState($this->appName, 'croppedLayout', $this->config->getUserValue($user->getUid(), Application::APP_ID, 'croppedLayout', 'false')); + $this->initialStateService->provideInitialState($this->appName, 'timelineRootFolder', $this->config->getUserValue($user->getUid(), Application::APP_ID, 'timelineRootFolder', '/')); Util::addScript(Application::APP_ID, 'photos-main'); Util::addStyle(Application::APP_ID, 'icons'); diff --git a/package-lock.json b/package-lock.json index 85946a84e..382f4507d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2554,14 +2554,24 @@ } }, "@nextcloud/dialogs": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-2.0.1.tgz", - "integrity": "sha512-Bme8vcs8n4XT5spBgkDEv1z9zNOE23AIbr5jF1WJ1A2XNMNj5Zvy29RosIh0k7H+1lN0PlU38u+eMV1Ets3E4A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-3.0.0.tgz", + "integrity": "sha512-5FVP0RSxIpKTKdSUlQ4osDDz/oCx2/4+InliB5MX2EcrjDe6q3fZMabSGnFTnIAu0CXRTzBk7RpneaIFGv+d5A==", "requires": { "@nextcloud/l10n": "^1.3.0", - "@nextcloud/typings": "^0.2.2", + "@nextcloud/typings": "^1.0.0", "core-js": "^3.6.4", "toastify-js": "^1.9.1" + }, + "dependencies": { + "@nextcloud/typings": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@nextcloud/typings/-/typings-1.0.0.tgz", + "integrity": "sha512-r8SRvXszWTyKWEhVd3gx7eBAcCKwdoLlr+ZrR8hrSxs2nfH00de/QoGdo0n/Rcv/9mMtX/haJNd71KwODM2+uQ==", + "requires": { + "@types/jquery": "2.0.54" + } + } } }, "@nextcloud/eslint-config": { @@ -2655,6 +2665,19 @@ "vue-multiselect": "^2.1.6", "vue-visible": "^1.0.2", "vue2-datepicker": "^3.6.2" + }, + "dependencies": { + "@nextcloud/dialogs": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@nextcloud/dialogs/-/dialogs-2.0.1.tgz", + "integrity": "sha512-Bme8vcs8n4XT5spBgkDEv1z9zNOE23AIbr5jF1WJ1A2XNMNj5Zvy29RosIh0k7H+1lN0PlU38u+eMV1Ets3E4A==", + "requires": { + "@nextcloud/l10n": "^1.3.0", + "@nextcloud/typings": "^0.2.2", + "core-js": "^3.6.4", + "toastify-js": "^1.9.1" + } + } } }, "@nextcloud/webpack-vue-config": { diff --git a/package.json b/package.json index 3eaef24fe..e8ace038c 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "@essentials/request-timeout": "^1.3.0", "@nextcloud/auth": "^1.3.0", "@nextcloud/axios": "^1.4.0", + "@nextcloud/dialogs": "^3.0.0", "@nextcloud/event-bus": "^1.2.0", "@nextcloud/initial-state": "^1.2.0", "@nextcloud/l10n": "^1.4.1", diff --git a/src/Photos.vue b/src/Photos.vue index 5b3f241b7..b00704c09 100644 --- a/src/Photos.vue +++ b/src/Photos.vue @@ -41,6 +41,7 @@ @@ -70,6 +71,7 @@ import AppNavigationItem from '@nextcloud/vue/dist/Components/AppNavigationItem' import AppNavigationSettings from '@nextcloud/vue/dist/Components/AppNavigationSettings' import CroppedLayoutSettings from './components/Settings/CroppedLayoutSettings' +import TimelineSettings from './components/Settings/TimelineSettings' import svgplaceholder from './assets/file-placeholder.svg' import imgplaceholder from './assets/image.svg' import videoplaceholder from './assets/video.svg' @@ -80,6 +82,7 @@ export default { components: { Content, CroppedLayoutSettings, + TimelineSettings, AppContent, AppNavigation, AppNavigationItem, diff --git a/src/components/Settings/CroppedLayoutSettings.vue b/src/components/Settings/CroppedLayoutSettings.vue index ecafd3a8f..37a7e3b1d 100644 --- a/src/components/Settings/CroppedLayoutSettings.vue +++ b/src/components/Settings/CroppedLayoutSettings.vue @@ -46,3 +46,10 @@ export default { ], } + + diff --git a/src/components/Settings/TimelineSettings.vue b/src/components/Settings/TimelineSettings.vue new file mode 100644 index 000000000..f8f743e0a --- /dev/null +++ b/src/components/Settings/TimelineSettings.vue @@ -0,0 +1,73 @@ + + + + + + + diff --git a/src/mixins/UserConfig.js b/src/mixins/UserConfig.js index efa123dcf..2bfde207e 100644 --- a/src/mixins/UserConfig.js +++ b/src/mixins/UserConfig.js @@ -30,7 +30,9 @@ const eventName = 'photos:user-config-changed' export default { data() { const croppedLayoutLocalStorage = localStorage.getItem('photos:croppedLayout') + const timelineRootFolderLocalStorage = localStorage.getItem('photos:timelineRootFolder') return { + timelineRootFolder: timelineRootFolderLocalStorage || loadState('photos', 'timelineRootFolder'), croppedLayout: croppedLayoutLocalStorage !== null ? croppedLayoutLocalStorage === 'true' : loadState('photos', 'croppedLayout') === 'true', diff --git a/src/services/PhotoSearch.js b/src/services/PhotoSearch.js index 477addb10..621f7d550 100644 --- a/src/services/PhotoSearch.js +++ b/src/services/PhotoSearch.js @@ -44,9 +44,11 @@ export default async function(onlyFavorites = false, options = {}) { page: 0, // start at the first page perPage: sizes.max.count * 10, // ten rows of the max width mimesType: allMimes, // all mimes types + rootFolder: '', }, options) - const prefixPath = `/files/${getCurrentUser().uid}` + const davPath = `/files/${getCurrentUser().uid}` + const prefixPath = `${davPath}${options.rootFolder}` // generating the search or condition // based on the allowed mimetypes @@ -68,6 +70,15 @@ export default async function(onlyFavorites = false, options = {}) { ` : '' + const eqOwner = options.rootFolder === '' + ? ` + + + + ${getCurrentUser().uid} + ` + : '' + options = Object.assign({ method: 'SEARCH', headers: { @@ -97,12 +108,7 @@ export default async function(onlyFavorites = false, options = {}) { ${orMime} ${eqFavorites} - - - - - ${getCurrentUser().uid} - + ${eqOwner} @@ -126,6 +132,6 @@ export default async function(onlyFavorites = false, options = {}) { return response.data .map(data => genFileInfo(data)) // remove prefix path from full file path - .map(data => Object.assign({}, data, { filename: data.filename.replace(prefixPath, '') })) + .map(data => Object.assign({}, data, { filename: data.filename.replace(davPath, '') })) } diff --git a/src/views/Timeline.vue b/src/views/Timeline.vue index 8eb906984..ffbf7aa58 100644 --- a/src/views/Timeline.vue +++ b/src/views/Timeline.vue @@ -71,6 +71,7 @@ import Loader from '../components/Loader' import cancelableRequest from '../utils/CancelableRequest' import GridConfigMixin from '../mixins/GridConfig' +import UserConfig from '../mixins/UserConfig' import { allMimes } from '../services/AllowedMimes' export default { @@ -80,7 +81,7 @@ export default { VirtualGrid, Navigation, }, - mixins: [GridConfigMixin], + mixins: [GridConfigMixin, UserConfig], props: { loading: { type: Boolean, @@ -237,6 +238,7 @@ export default { page: this.page, perPage: numberOfImagesPerBatch, mimesType: this.mimesType, + rootFolder: this.timelineRootFolder, }) // If we get less files than requested that means we got to the end