photos/js/photos-src_views_AlbumsCont...

1 line
19 KiB
Plaintext

{"version":3,"file":"photos-src_views_AlbumsContent_vue.js?v=c21ff25047d9e98957eb","mappings":";;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AChMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;AC/DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;AC1BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAkBA;AACA;;;;;;;;;;;;;;;ACvCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack:///photos/src/views/AlbumsContent.vue?vue&type=script&lang=js&","webpack:///photos/src/services/AlbumContent.js","webpack:///photos/src/views/AlbumsContent.vue?vue&type=style&index=0&id=1c00d9ab&lang=scss&scoped=true&","webpack://photos/./src/views/AlbumsContent.vue?9cf4","webpack:///photos/src/views/AlbumsContent.vue","webpack://photos/./src/views/AlbumsContent.vue?54ce","webpack:///photos/src/views/AlbumsContent.vue?vue&type=template&id=1c00d9ab&scoped=true&"],"sourcesContent":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\nimport { mapGetters } from 'vuex';\nimport getAlbumContent from '../services/AlbumContent.js';\nimport EmptyContent from '../components/EmptyContent.vue';\nimport Navigation from '../components/Navigation.vue';\nimport cancelableRequest from '../utils/CancelableRequest.js';\nexport default {\n name: 'AlbumsContent',\n components: {\n EmptyContent,\n Navigation\n },\n props: {\n rootTitle: {\n type: String,\n required: true\n },\n path: {\n type: String,\n default: '/'\n }\n },\n\n data() {\n return {\n error: null,\n cancelRequest: () => {}\n };\n },\n\n computed: { // global lists\n ...mapGetters(['files', 'albums']),\n\n /**\n * @return {string} The album id from the current path.\n */\n albumId() {\n return this.path;\n },\n\n /**\n * @return {string[]} The album information for the current albumId.\n */\n album() {\n return this.albums[this.albumId];\n },\n\n /**\n * @return {string[]} The list of items for the current albumId.\n */\n albumItems() {\n return this.album?.items.map(itemId => this.files[itemId]) ?? [];\n }\n\n },\n watch: {\n albumId() {\n this.fetchAlbumContent();\n }\n\n },\n\n async beforeMount() {\n this.fetchAlbumContent();\n },\n\n beforeDestroy() {\n this.cancelRequest('Changed view');\n },\n\n methods: {\n async fetchAlbumContent() {\n // Cancel any pending requests.\n this.cancelRequest('Changed album'); // close any potential opened viewer & sidebar\n\n OCA.Viewer && OCA.Viewer.close && OCA.Viewer.close();\n OCA.Files && OCA.Files.Sidebar.close && OCA.Files.Sidebar.close();\n this.error = null; // init cancellable request\n\n const {\n request,\n cancel\n } = cancelableRequest(getAlbumContent);\n this.cancelRequest = cancel;\n\n try {\n // Get the content for the current album.\n const {\n albumItems\n } = await request(this.path, {\n shared: this.showShared\n });\n this.$store.dispatch('addPath', {\n path: this.path,\n fileid: folder.fileid\n });\n this.$store.dispatch('updateFolders', {\n fileid: folder.fileid,\n files,\n folders\n });\n this.$store.dispatch('updateFiles', {\n folder,\n files,\n folders\n });\n } catch (error) {\n if (error.response && error.response.status) {\n if (error.response.status === 404) {\n this.error = 404;\n setTimeout(() => {\n this.$router.push({\n name: this.$route.name\n });\n }, 3000);\n } else {\n this.error = error;\n }\n } // cancelled request, moving on...\n\n\n console.error('Error fetching album data', error);\n } finally {\n // done loading even with errors\n this.$emit('update:loading', false);\n }\n }\n\n }\n};","/**\n * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @author John Molakvoæ <skjnldsv@protonmail.com>\n *\n * @license AGPL-3.0-or-later\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Affero General Public License as\n * published by the Free Software Foundation, either version 3 of the\n * License, or (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU Affero General Public License for more details.\n *\n * You should have received a copy of the GNU Affero General Public License\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\n *\n */\nimport axios from '@nextcloud/axios';\nimport { generateUrl } from '@nextcloud/router';\nimport { genFileInfo, encodeFilePath } from '../utils/fileUtils';\nimport allowedMimes from './AllowedMimes';\n/**\n * List files from a folder and filter out unwanted mimes\n *\n * @param {string} path the path relative to the user root\n * @param {object} [options] optional options for axios\n * @param {boolean} [options.shared] fetch shared albums ?\n * @return {Array} the file list\n */\n\nexport default async function () {\n let path = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '/';\n let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n const prefixPath = generateUrl(`/apps/photos/api/v1/${options.shared ? 'shared' : 'albums'}`); // fetch listing\n\n const response = await axios.get(prefixPath + encodeFilePath(path), options);\n const list = response.data.map(data => genFileInfo(data)); // filter all the files and folders\n\n let folder = {};\n const folders = [];\n const files = [];\n\n for (const entry of list) {\n // is this the current provided path ?\n if (entry.filename === path) {\n folder = entry;\n } else if (entry.type !== 'file') {\n folders.push(entry);\n } else if (allowedMimes.indexOf(entry.mime) > -1) {\n files.push(entry);\n }\n } // return current folder, subfolders and files\n\n\n return {\n folder,\n folders,\n files\n };\n}","// Imports\nimport ___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/noSourceMaps.js\";\nimport ___CSS_LOADER_API_IMPORT___ from \"../../node_modules/css-loader/dist/runtime/api.js\";\nvar ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___);\n// Module\n___CSS_LOADER_EXPORT___.push([module.id, \"@charset \\\"UTF-8\\\";\\n/**\\n * @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>\\n *\\n * @author John Molakvoæ <skjnldsv@protonmail.com>\\n *\\n * @license AGPL-3.0-or-later\\n *\\n * This program is free software: you can redistribute it and/or modify\\n * it under the terms of the GNU Affero General Public License as\\n * published by the Free Software Foundation, either version 3 of the\\n * License, or (at your option) any later version.\\n *\\n * This program is distributed in the hope that it will be useful,\\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\\n * GNU Affero General Public License for more details.\\n *\\n * You should have received a copy of the GNU Affero General Public License\\n * along with this program. If not, see <http://www.gnu.org/licenses/>.\\n *\\n */\\n@media (min-width: 0px) and (max-width: 400px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 8px 256px 8px;\\n}\\n}\\n@media (min-width: 400px) and (max-width: 700px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 8px 256px 8px;\\n}\\n}\\n@media (min-width: 700px) and (max-width: 1024px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 44px 256px 44px;\\n}\\n}\\n@media (min-width: 1024px) and (max-width: 1280px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 44px 256px 44px;\\n}\\n}\\n@media (min-width: 1280px) and (max-width: 1440px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 66px 256px 66px;\\n}\\n}\\n@media (min-width: 1440px) and (max-width: 1600px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 66px 256px 66px;\\n}\\n}\\n@media (min-width: 1600px) and (max-width: 2048px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 66px 256px 66px;\\n}\\n}\\n@media (min-width: 2048px) and (max-width: 2560px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 88px 256px 88px;\\n}\\n}\\n@media (min-width: 2560px) and (max-width: 3440px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 88px 256px 88px;\\n}\\n}\\n@media (min-width: 3440px) {\\n.grid-container[data-v-1c00d9ab] {\\n padding: 0px 88px 256px 88px;\\n}\\n}\", \"\"]);\n// Exports\nexport default ___CSS_LOADER_EXPORT___;\n","\n import API from \"!../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\";\n import domAPI from \"!../../node_modules/style-loader/dist/runtime/styleDomAPI.js\";\n import insertFn from \"!../../node_modules/style-loader/dist/runtime/insertBySelector.js\";\n import setAttributes from \"!../../node_modules/style-loader/dist/runtime/setAttributesWithoutAttributes.js\";\n import insertStyleElement from \"!../../node_modules/style-loader/dist/runtime/insertStyleElement.js\";\n import styleTagTransformFn from \"!../../node_modules/style-loader/dist/runtime/styleTagTransform.js\";\n import content, * as namedExport from \"!!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2[0].rules[0].use[3]!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AlbumsContent.vue?vue&type=style&index=0&id=1c00d9ab&lang=scss&scoped=true&\";\n \n \n\nvar options = {};\n\noptions.styleTagTransform = styleTagTransformFn;\noptions.setAttributes = setAttributes;\n\n options.insert = insertFn.bind(null, \"head\");\n \noptions.domAPI = domAPI;\noptions.insertStyleElement = insertStyleElement;\n\nvar update = API(content, options);\n\n\n\nexport * from \"!!../../node_modules/css-loader/dist/cjs.js!../../node_modules/vue-loader/lib/loaders/stylePostLoader.js!../../node_modules/postcss-loader/dist/cjs.js!../../node_modules/sass-loader/dist/cjs.js??clonedRuleSet-2[0].rules[0].use[3]!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AlbumsContent.vue?vue&type=style&index=0&id=1c00d9ab&lang=scss&scoped=true&\";\n export default content && content.locals ? content.locals : undefined;\n","import { render, staticRenderFns } from \"./AlbumsContent.vue?vue&type=template&id=1c00d9ab&scoped=true&\"\nimport script from \"./AlbumsContent.vue?vue&type=script&lang=js&\"\nexport * from \"./AlbumsContent.vue?vue&type=script&lang=js&\"\nimport style0 from \"./AlbumsContent.vue?vue&type=style&index=0&id=1c00d9ab&lang=scss&scoped=true&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n \"1c00d9ab\",\n null\n \n)\n\n/* hot reload */\nif (module.hot) {\n var api = require(\"/home/louis/workspace/nextcloud/apps/photos/node_modules/vue-hot-reload-api/dist/index.js\")\n api.install(require('vue'))\n if (api.compatible) {\n module.hot.accept()\n if (!api.isRecorded('1c00d9ab')) {\n api.createRecord('1c00d9ab', component.options)\n } else {\n api.reload('1c00d9ab', component.options)\n }\n module.hot.accept(\"./AlbumsContent.vue?vue&type=template&id=1c00d9ab&scoped=true&\", function () {\n api.rerender('1c00d9ab', {\n render: render,\n staticRenderFns: staticRenderFns\n })\n })\n }\n}\ncomponent.options.__file = \"src/views/AlbumsContent.vue\"\nexport default component.exports","import mod from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AlbumsContent.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/babel-loader/lib/index.js!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./AlbumsContent.vue?vue&type=script&lang=js&\"","var render = function () {\n var _vm = this\n var _h = _vm.$createElement\n var _c = _vm._self._c || _h\n return _vm.error === 404\n ? _c(\"EmptyContent\", { attrs: { \"illustration-name\": \"folder\" } }, [\n _vm._v(\n \"\\n\\t\" + _vm._s(_vm.t(\"photos\", \"This album does not exist\")) + \"\\n\"\n ),\n ])\n : _vm.error\n ? _c(\"EmptyContent\", [\n _vm._v(\"\\n\\t\" + _vm._s(_vm.t(\"photos\", \"An error occurred\")) + \"\\n\"),\n ])\n : !_vm.loading\n ? _c(\n \"div\",\n [\n _vm.album\n ? _c(\n \"Navigation\",\n _vm._b(\n {\n key: \"navigation\",\n attrs: {\n \"root-title\": _vm.rootTitle,\n \"show-actions\": true,\n },\n },\n \"Navigation\",\n _vm.album,\n false\n )\n )\n : _vm._e(),\n _vm._v(\" \"),\n _vm.nbFetchedFiles === 0 && _vm.loading ? _c(\"Loader\") : _vm._e(),\n _vm._v(\" \"),\n _c(\"TiledLayout\", {\n attrs: { items: _vm.itemsList },\n scopedSlots: _vm._u([\n {\n key: \"default\",\n fn: function (ref) {\n var rows = ref.rows\n return _c(\"VirtualScrolling\", {\n attrs: { rows: rows },\n on: { \"need-content\": _vm.getContent },\n scopedSlots: _vm._u([\n {\n key: \"default\",\n fn: function (ref) {\n var renderedRows = ref.renderedRows\n return _c(\"TiltedRows\", {\n attrs: { rows: renderedRows },\n scopedSlots: _vm._u(\n [\n {\n key: \"default\",\n fn: function (ref) {\n var row = ref.row\n var item = ref.item\n return _c(\"File\", {\n style: {\n width: row.height * item.ratio + \"px\",\n height: row.height + \"px\",\n },\n attrs: {\n item: _vm.files[item.id],\n \"allow-selection\": true,\n selected:\n _vm.selectedItems[item.id] === true,\n visibility: row.visibility,\n semaphore: _vm.semaphore,\n },\n on: {\n \"on-click\": _vm.openViewer,\n \"select-toggled\":\n _vm.onItemSelectToggle,\n },\n })\n },\n },\n ],\n null,\n true\n ),\n })\n },\n },\n ]),\n })\n },\n },\n ]),\n }),\n _vm._v(\" \"),\n _vm.nbFetchedFiles === 0 && !_vm.loading\n ? _c(\n \"EmptyContent\",\n {\n key: \"emptycontent\",\n attrs: { \"illustration-name\": \"empty\" },\n },\n [\n _vm._v(\n \"\\n\\t\\t\" +\n _vm._s(_vm.t(\"photos\", \"This album is empty\")) +\n \"\\n\\t\"\n ),\n ]\n )\n : _vm._e(),\n ],\n 1\n )\n : _vm._e()\n}\nvar staticRenderFns = []\nrender._withStripped = true\n\nexport { render, staticRenderFns }"],"names":[],"sourceRoot":""}