mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
implemented navigation tree controller for teams
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=2bdbb5f9141052aaaa3d",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=a3a16f546521050656fb",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=07fd139d62a2c60f9468",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=6da8a930d3ab447dc666",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=44a689222ea574701715",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=91ea55260c78ea4e7abd",
|
||||
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=7b80324eef831d31e3e8",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=26a3951e09a8862d8dc2",
|
||||
@@ -198,5 +198,38 @@
|
||||
"/chunks/platform~chunks/shared.cdc982ee462905db2739.hot-update.js": "/chunks/platform~chunks/shared.cdc982ee462905db2739.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.da8714bce7630fc753ba.hot-update.js": "/chunks/platform~chunks/shared.da8714bce7630fc753ba.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.1c7a870b7ada9ad6da18.hot-update.js": "/chunks/platform~chunks/shared.1c7a870b7ada9ad6da18.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js": "/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js"
|
||||
"/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js": "/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js",
|
||||
"/chunks/platform.d76ce1c94ec21411e3e6.hot-update.js": "/chunks/platform.d76ce1c94ec21411e3e6.hot-update.js",
|
||||
"/chunks/platform.91fc2762aeecb9b68055.hot-update.js": "/chunks/platform.91fc2762aeecb9b68055.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.4ac66e7a23a467dc88d3.hot-update.js": "/chunks/platform~chunks/shared.4ac66e7a23a467dc88d3.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.8e6d0b4d2084e1081678.hot-update.js": "/chunks/platform~chunks/shared.8e6d0b4d2084e1081678.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.592d5ab0074b0358355f.hot-update.js": "/chunks/platform~chunks/shared.592d5ab0074b0358355f.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.16e1adde9f15b40755fc.hot-update.js": "/chunks/platform~chunks/shared.16e1adde9f15b40755fc.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.83cd81f856a97950cd20.hot-update.js": "/chunks/platform~chunks/shared.83cd81f856a97950cd20.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.bd5ac3e5e82ebb14bd8d.hot-update.js": "/chunks/platform~chunks/shared.bd5ac3e5e82ebb14bd8d.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.401339f30a50f43890ad.hot-update.js": "/chunks/platform~chunks/shared.401339f30a50f43890ad.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.d125f53113f9ae1cf449.hot-update.js": "/chunks/platform~chunks/shared.d125f53113f9ae1cf449.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.c9fd0f35248a989da1f3.hot-update.js": "/chunks/platform~chunks/shared.c9fd0f35248a989da1f3.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.3874f1076e2ce25f9a34.hot-update.js": "/chunks/platform~chunks/shared.3874f1076e2ce25f9a34.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.11630bdf1f3e8a41b885.hot-update.js": "/chunks/platform~chunks/shared.11630bdf1f3e8a41b885.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.36c3b3e5853ddad4efdd.hot-update.js": "/chunks/platform~chunks/shared.36c3b3e5853ddad4efdd.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.5b22eff6be7933d5ad4d.hot-update.js": "/chunks/platform~chunks/shared.5b22eff6be7933d5ad4d.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.5886c4145d57d18b6bce.hot-update.js": "/chunks/platform~chunks/shared.5886c4145d57d18b6bce.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.e328d6e7026762be3536.hot-update.js": "/chunks/platform~chunks/shared.e328d6e7026762be3536.hot-update.js",
|
||||
"/js/main.0fd1cc76418860ea6d95.hot-update.js": "/js/main.0fd1cc76418860ea6d95.hot-update.js",
|
||||
"/js/main.62c1aa41835e5aa8ed25.hot-update.js": "/js/main.62c1aa41835e5aa8ed25.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.07610295586367a72907.hot-update.js": "/chunks/platform~chunks/shared.07610295586367a72907.hot-update.js",
|
||||
"/js/main.47277a10039daa292fb9.hot-update.js": "/js/main.47277a10039daa292fb9.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.4cb51eb3494e8026b18c.hot-update.js": "/chunks/platform~chunks/shared.4cb51eb3494e8026b18c.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.f1aef11bbf61f935d579.hot-update.js": "/chunks/platform~chunks/shared.f1aef11bbf61f935d579.hot-update.js",
|
||||
"/js/main.8b25c07409f90dc91691.hot-update.js": "/js/main.8b25c07409f90dc91691.hot-update.js",
|
||||
"/js/main.6f1239c8df352f98bd78.hot-update.js": "/js/main.6f1239c8df352f98bd78.hot-update.js",
|
||||
"/js/main.8f75c4926ecb464119ac.hot-update.js": "/js/main.8f75c4926ecb464119ac.hot-update.js",
|
||||
"/js/main.8b2c7464f9b10f0a4585.hot-update.js": "/js/main.8b2c7464f9b10f0a4585.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.8b2c7464f9b10f0a4585.hot-update.js": "/chunks/platform~chunks/shared.8b2c7464f9b10f0a4585.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.0017758920e11a4f3479.hot-update.js": "/chunks/platform~chunks/shared.0017758920e11a4f3479.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.723db492301d9eea60ed.hot-update.js": "/chunks/platform~chunks/shared.723db492301d9eea60ed.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.610c925fd4905d8d4ee1.hot-update.js": "/chunks/platform~chunks/shared.610c925fd4905d8d4ee1.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.f61746f6ddbacb5e3b41.hot-update.js": "/chunks/platform~chunks/shared.f61746f6ddbacb5e3b41.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.b6b69d2e4330deb163ec.hot-update.js": "/chunks/platform~chunks/shared.b6b69d2e4330deb163ec.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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])) {
|
||||
|
||||
@@ -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,
|
||||
|
||||
17
resources/js/store/modules/teams.js
vendored
17
resources/js/store/modules/teams.js
vendored
@@ -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 = {
|
||||
|
||||
@@ -22,7 +22,7 @@ use Domain\Browsing\Controllers\BrowseLatestFilesController;
|
||||
use Domain\Browsing\Controllers\BrowseSharedItemsController;
|
||||
use Domain\Browsing\Controllers\BrowseTrashContentController;
|
||||
use Domain\Homepage\Controllers\SendContactMessageController;
|
||||
use Domain\Folders\Controllers\NavigationFolderTreeController;
|
||||
use Domain\Folders\Controllers\NavigationTreeController;
|
||||
use Domain\Browsing\Controllers\SearchFilesAndFoldersController;
|
||||
|
||||
// Pages
|
||||
@@ -47,7 +47,7 @@ Route::group(['middleware' => ['auth:sanctum']], function () {
|
||||
// Browse
|
||||
Route::group(['prefix' => 'browse'], function () {
|
||||
Route::get('/folders/{id}', BrowseFolderController::class);
|
||||
Route::get('/navigation', NavigationFolderTreeController::class);
|
||||
Route::get('/navigation', NavigationTreeController::class);
|
||||
Route::get('/search', SearchFilesAndFoldersController::class);
|
||||
Route::get('/latest', BrowseLatestFilesController::class);
|
||||
Route::get('/trash/{id}', BrowseTrashContentController::class);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Domain\Teams\Controllers\InvitationsController;
|
||||
use Domain\Teams\Controllers\NavigationTreeController;
|
||||
use Domain\Teams\Controllers\TeamFoldersController;
|
||||
use Domain\Teams\Controllers\BrowseSharedWithMeController;
|
||||
use Domain\Teams\Controllers\ConvertFolderIntoTeamFolderController;
|
||||
@@ -10,3 +11,5 @@ Route::apiResource('/folders', TeamFoldersController::class);
|
||||
|
||||
Route::post('/convert/{folder}', ConvertFolderIntoTeamFolderController::class);
|
||||
Route::get('/shared-with-me/{id}', BrowseSharedWithMeController::class);
|
||||
|
||||
Route::get('/tree/{id}', NavigationTreeController::class);
|
||||
|
||||
@@ -3,11 +3,13 @@ namespace Domain\Folders\Controllers;
|
||||
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class NavigationFolderTreeController
|
||||
class NavigationTreeController
|
||||
{
|
||||
public function __invoke(): array
|
||||
{
|
||||
// Get signed user folders
|
||||
$folders = Folder::with('folders:id,parent_id,id,name,team_folder')
|
||||
->where('parent_id')
|
||||
->where('team_folder', false)
|
||||
@@ -15,6 +17,7 @@ class NavigationFolderTreeController
|
||||
->sortable()
|
||||
->get(['id', 'parent_id', 'id', 'name', 'team_folder']);
|
||||
|
||||
// Get signed user team folders
|
||||
$teamFolders = Folder::with('folders:id,parent_id,id,name,team_folder')
|
||||
->where('parent_id')
|
||||
->where('team_folder', true)
|
||||
@@ -22,6 +25,16 @@ class NavigationFolderTreeController
|
||||
->sortable()
|
||||
->get(['id', 'parent_id', 'id', 'name']);
|
||||
|
||||
// Get signed user folder which are shared with him
|
||||
$sharedFolderIds = DB::table('team_folder_members')
|
||||
->where('user_id', Auth::id())
|
||||
->pluck('parent_id');
|
||||
|
||||
$sharedWithMeFolders = Folder::with('folders:id,parent_id,id,name,team_folder')
|
||||
->whereIn('id', $sharedFolderIds)
|
||||
->sortable()
|
||||
->get(['id', 'parent_id', 'id', 'name']);
|
||||
|
||||
return [
|
||||
[
|
||||
'location' => 'files',
|
||||
@@ -35,6 +48,12 @@ class NavigationFolderTreeController
|
||||
'folders' => $teamFolders,
|
||||
'isMovable' => false,
|
||||
],
|
||||
[
|
||||
'location' => 'shared-with-me',
|
||||
'name' => 'Shared With Me',
|
||||
'folders' => $sharedWithMeFolders,
|
||||
'isMovable' => false,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
30
src/Domain/Teams/Controllers/NavigationTreeController.php
Normal file
30
src/Domain/Teams/Controllers/NavigationTreeController.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
namespace Domain\Teams\Controllers;
|
||||
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Gate;
|
||||
|
||||
class NavigationTreeController
|
||||
{
|
||||
public function __invoke(string $id): array
|
||||
{
|
||||
$teamFolder = Folder::findOrFail($id)->getLatestParent();
|
||||
|
||||
if (! Gate::any(['can-edit', 'can-view'], [$teamFolder, null])) {
|
||||
abort(403, 'Access Denied');
|
||||
}
|
||||
|
||||
$folders = Folder::with('folders:id,parent_id,id,name,team_folder')
|
||||
->where('parent_id', $teamFolder->id)
|
||||
->sortable()
|
||||
->get(['id', 'parent_id', 'id', 'name', 'team_folder']);
|
||||
|
||||
return [
|
||||
[
|
||||
'name' => $teamFolder->name,
|
||||
'folders' => $folders,
|
||||
'isMovable' => true,
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ class TeamFoldersController extends Controller
|
||||
|
||||
$folders = Folder::where('parent_id', $id)
|
||||
->where('team_folder', ! Str::isUuid($id))
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user