current folder functionality

This commit is contained in:
Peter Papp
2021-08-20 17:36:46 +02:00
parent c697f8a451
commit b5a8fe8b1a
12 changed files with 135 additions and 38 deletions
@@ -2,13 +2,13 @@
<div id="desktop-toolbar">
<div class="toolbar-wrapper">
<div @click="goBack" class="location">
<chevron-left-icon :class="{'is-active': canGoBack }" class="icon-back" size="17" />
<chevron-left-icon :class="{'is-active': isLoadedFolder }" class="icon-back" size="17" />
<span class="location-title">
{{ directoryName }}
</span>
<span @click.stop="folderActions" class="location-more group" id="folder-actions">
<span v-if="isLoadedFolder" @click.stop="folderActions" class="location-more group" id="folder-actions">
<more-horizontal-icon size="14" class="icon-more group-hover-text-theme" />
</span>
</div>
@@ -118,7 +118,6 @@
},
computed: {
...mapGetters([
'previousLocation',
'isVisibleSidebar',
'FilePreviewType',
'currentFolder',
@@ -126,7 +125,7 @@
'homeDirectory',
'clipboard',
]),
canGoBack() {
isLoadedFolder() {
return this.$route.params.id
},
hasCapacity() {
@@ -140,7 +139,17 @@
return this.$store.getters.user.data.attributes.storage.used <= 100
},
directoryName() {
return 'todo'
if (this.currentFolder) {
return this.currentFolder.name
} else {
return {
'RecentUploads': this.$t('Recent'),
'MySharedItems': this.$t('Shared'),
'Trash': this.$t('Trash'),
'Public': this.$t('Files'),
'Files': this.$t('Files'),
}[this.$route.name]
}
},
preview() {
return this.FilePreviewType === 'list'
@@ -200,7 +209,7 @@
},
methods: {
goBack() {
if (this.canGoBack) this.$router.back()
if (this.isLoadedFolder) this.$router.back()
},
showTeamFolderMenu() {
events.$emit('popover:open', 'team-folder')
+4 -4
View File
@@ -9,7 +9,7 @@ const routesUser = [
name: 'Files',
path: '/platform/files/:id?',
component: () =>
import(/* webpackChunkName: "chunks/files" */ '../views/FileView/Home/Files'),
import(/* webpackChunkName: "chunks/files" */ '../views/FileView/Files'),
meta: {
requiresAuth: true
},
@@ -18,7 +18,7 @@ const routesUser = [
name: 'RecentUploads',
path: '/platform/recent-uploads',
component: () =>
import(/* webpackChunkName: "chunks/recent-uploads" */ '../views/FileView/RecentUploads/RecentUploads'),
import(/* webpackChunkName: "chunks/recent-uploads" */ '../views/FileView/RecentUploads'),
meta: {
requiresAuth: true
},
@@ -27,7 +27,7 @@ const routesUser = [
name: 'MySharedItems',
path: '/platform/my-shared-items',
component: () =>
import(/* webpackChunkName: "chunks/my-shared-items" */ '../views/FileView/MySharedItems/MySharedItems'),
import(/* webpackChunkName: "chunks/my-shared-items" */ '../views/FileView/MySharedItems'),
meta: {
requiresAuth: true
},
@@ -36,7 +36,7 @@ const routesUser = [
name: 'Trash',
path: '/platform/trash/:id?',
component: () =>
import(/* webpackChunkName: "chunks/trash" */ '../views/FileView/Trash/Trash'),
import(/* webpackChunkName: "chunks/trash" */ '../views/FileView/Trash'),
meta: {
requiresAuth: true
},
+10 -2
View File
@@ -21,7 +21,8 @@ const actions = {
axios
.get(`${getters.api}/browse/folders/${id}/${getters.sorting.URI}`)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
commit('LOADING_STATE', {loading: false, data: response.data.content})
commit('SET_CURRENT_FOLDER', response.data.folder)
events.$emit('scrollTop')
})
@@ -50,6 +51,8 @@ const actions = {
.get(getters.api + '/browse/latest')
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
commit('SET_CURRENT_FOLDER', undefined)
events.$emit('scrollTop')
})
.catch(() => Vue.prototype.$isSomethingWrong())
@@ -61,6 +64,7 @@ const actions = {
.get(getters.api + '/browse/share' + getters.sorting.URI)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
commit('SET_CURRENT_FOLDER', undefined)
events.$emit('scrollTop')
})
@@ -72,7 +76,8 @@ const actions = {
axios
.get(`${getters.api}/browse/trash/${id}/${getters.sorting.URI}`)
.then(response => {
commit('LOADING_STATE', {loading: false, data: response.data})
commit('LOADING_STATE', {loading: false, data: response.data.content})
commit('SET_CURRENT_FOLDER', response.data.folder)
events.$emit('scrollTop')
})
@@ -112,6 +117,9 @@ const mutations = {
state.entries = payload.data
state.isLoading = payload.loading
},
SET_CURRENT_FOLDER(state, folder) {
state.currentFolder = folder
},
UPDATE_FOLDER_TREE(state, tree) {
state.navigation = tree
},
+12 -7
View File
@@ -7,11 +7,11 @@ import Vue from 'vue'
const defaultState = {
processingPopup: undefined,
fileQueue: [],
filesInQueueTotal: 0,
filesInQueueUploaded: 0,
isProcessingFile: false,
uploadingProgress: 0
filesInQueueUploaded: 0,
filesInQueueTotal: 0,
uploadingProgress: 0,
fileQueue: [],
}
const actions = {
@@ -84,9 +84,13 @@ const actions = {
? `/api/editor/create-folder/${router.currentRoute.params.token}`
: '/api/create-folder'
let parent_id = getters.currentFolder
? getters.currentFolder.id
: undefined
axios
.post(route, {
parent_id: getters.currentFolder.id,
parent_id: parent_id,
name: folder.name,
icon: folder.icon
})
@@ -100,9 +104,10 @@ const actions = {
events.$emit('newFolder:focus', response.data.id)
}, 10)
if (getters.currentFolder.location !== 'public')
if (! Vue.prototype.$isThisRoute(router, ['Public']))
dispatch('getAppData')
if (getters.currentFolder.location === 'public')
if (Vue.prototype.$isThisRoute(router, ['Public']))
dispatch('getFolderTree')
})
@@ -55,7 +55,7 @@
import OptionGroup from '/resources/js/components/FilesView/OptionGroup'
import Option from '/resources/js/components/FilesView/Option'
import { mapGetters } from 'vuex'
import {events} from "../../../bus";
import {events} from "../../bus";
export default {
name: 'Files',
@@ -47,7 +47,7 @@
import OptionGroup from '/resources/js/components/FilesView/OptionGroup'
import Option from '/resources/js/components/FilesView/Option'
import { mapGetters } from 'vuex'
import {events} from "../../../bus";
import {events} from "../../bus";
export default {
name: 'MySharedItems',
@@ -42,7 +42,7 @@
import OptionGroup from '/resources/js/components/FilesView/OptionGroup'
import Option from '/resources/js/components/FilesView/Option'
import { mapGetters } from 'vuex'
import {events} from "../../../bus";
import {events} from "../../bus";
export default {
name: 'RecentUploads',
@@ -46,7 +46,7 @@
import OptionGroup from '/resources/js/components/FilesView/OptionGroup'
import Option from '/resources/js/components/FilesView/Option'
import { mapGetters } from 'vuex'
import {events} from "../../../bus";
import {events} from "../../bus";
export default {
name: 'Trash',