implemented navigation tree controller for teams

This commit is contained in:
Čarodej
2021-10-22 16:39:53 +02:00
parent 705281325f
commit 841c1db54a
10 changed files with 128 additions and 13 deletions

View File

@@ -69,13 +69,13 @@
</PopoverWrapper>
<ToolbarButton v-if="canShowConvertToTeamFolder" @click.native="$convertAsTeamFolder(clipboard[0])" :class="{'is-inactive': ! canCreateTeamFolderInView }" source="user-plus" :action="$t('actions.convert_into_team_folder')" />
<ToolbarButton @click.native="$shareFileOrFolder(clipboard[0])" :class="{'is-inactive': canShareInView }" source="share" :action="$t('actions.share')" />
<ToolbarButton v-if="! $isThisRoute($route, ['SharedWithMe'])" @click.native="$shareFileOrFolder(clipboard[0])" :class="{'is-inactive': canShareInView }" source="share" :action="$t('actions.share')" />
</ToolbarGroup>
<!--File Controls-->
<ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isMobile()">
<ToolbarButton @click.native="$moveFileOrFolder(clipboard[0])" :class="{'is-inactive': canMoveInView }" source="move" :action="$t('actions.move')" />
<ToolbarButton @click.native="$deleteFileOrFolder(clipboard[0])" :class="{'is-inactive': canDeleteInView }" source="trash" :action="$t('actions.delete')" />
<ToolbarButton @click.native="$moveFileOrFolder(clipboard[0])" :class="{'is-inactive': canMoveInView && ! canEdit }" source="move" :action="$t('actions.move')" />
<ToolbarButton @click.native="$deleteFileOrFolder(clipboard[0])" :class="{'is-inactive': canDeleteInView && ! canEdit }" source="trash" :action="$t('actions.delete')" />
</ToolbarGroup>
<!--View Controls-->
@@ -193,6 +193,7 @@
},
canMoveInView() {
let routes = [
'SharedWithMe',
'RecentUploads',
'MySharedItems',
'Public',

View File

@@ -130,9 +130,17 @@
this.isLoadingTree = true
// Get folder tree and hide spinner
this.$store.dispatch('getFolderTree').then(() => {
this.isLoadingTree = false
})
if (this.$isThisRoute(this.$route, ['SharedWithMe'])) {
this.$store.dispatch('getTeamFolderTree').then(() => {
this.isLoadingTree = false
})
} else {
this.$store.dispatch('getFolderTree').then(() => {
this.isLoadingTree = false
})
}
// Store picked item
if (!this.clipboard.includes(args.item[0])) {

View File

@@ -2,10 +2,12 @@
<!--Folder Icon-->
<div class="folder-item-wrapper" :class="{'is-inactive': disabledById && disabledById.data.id === nodes.id || !disableId}">
<div @click="getFolder" :class="{'is-selected': isSelected, 'is-disabled-item': nodes.location === 'team-folders'}" :style="indent" class="folder-item text-theme dark-text-theme">
<div @click="getFolder" :class="{'is-selected': isSelected, 'is-disabled-item': nodes.location === 'team-folders' || nodes.location === 'shared-with-me'}" :style="indent" class="folder-item text-theme dark-text-theme">
<chevron-right-icon @click.stop="showTree" :class="{'is-opened': isVisible, 'is-visible': nodes.folders.length !== 0}" size="17" class="icon-arrow"/>
<hard-drive-icon v-if="nodes.location === 'files'" size="17" class="icon text-theme dark-text-theme"/>
<users-icon v-if="nodes.location === 'team-folders'" size="17" class="icon text-theme dark-text-theme"/>
<user-plus-icon v-if="nodes.location === 'shared-with-me'" size="17" class="icon text-theme dark-text-theme"/>
<folder-icon v-if="! nodes.location" size="17" class="icon text-theme dark-text-theme"/>
<span class="label">{{ nodes.name }}</span>
</div>
@@ -16,7 +18,7 @@
<script>
import TreeMenu from '/resources/js/components/Others/TreeMenu'
import {FolderIcon, ChevronRightIcon, HardDriveIcon, UsersIcon} from 'vue-feather-icons'
import {FolderIcon, ChevronRightIcon, HardDriveIcon, UsersIcon, UserPlusIcon} from 'vue-feather-icons'
import {events} from '/resources/js/bus'
import {mapGetters} from 'vuex'
@@ -30,6 +32,7 @@
components: {
ChevronRightIcon,
HardDriveIcon,
UserPlusIcon,
FolderIcon,
UsersIcon,
TreeMenu,

View File

@@ -2,6 +2,7 @@ import router from "../../router";
import {events} from "../../bus";
import i18n from "../../i18n";
import axios from "axios";
import Vue from "vue";
const defaultState = {
currentTeamFolder: undefined,
@@ -88,6 +89,22 @@ const actions = {
}
})
},
getTeamFolderTree: ({commit, getters}) => {
return new Promise((resolve, reject) => {
axios
.get(`/api/teams/tree/${getters.currentTeamFolder.data.id}${getters.sorting.URI}`)
.then(response => {
resolve(response)
commit('UPDATE_FOLDER_TREE', response.data)
})
.catch((error) => {
reject(error)
Vue.prototype.$isSomethingWrong()
})
})
},
}
const mutations = {