Merge branch 'bulk-operations' into sorting

This commit is contained in:
Milos Holba
2020-12-05 17:25:38 +01:00
16 changed files with 228 additions and 200 deletions
+4 -1
View File
@@ -6,7 +6,10 @@ APP_URL=http://localhost
APP_DEMO=false APP_DEMO=false
LOG_CHANNEL=stack LOG_CHANNEL=stack
SCOUT_DRIVER=tntsearch SCOUT_DRIVER=tntsearch
SCOUT_QUEUE=true
FILESYSTEM_DRIVER= FILESYSTEM_DRIVER=
CHUNK_SIZE=128 CHUNK_SIZE=128
@@ -19,7 +22,7 @@ DB_PASSWORD=
BROADCAST_DRIVER=log BROADCAST_DRIVER=log
CACHE_DRIVER=file CACHE_DRIVER=file
QUEUE_CONNECTION=sync QUEUE_CONNECTION=database
SESSION_DRIVER=file SESSION_DRIVER=file
SESSION_LIFETIME=120 SESSION_LIFETIME=120
+5
View File
@@ -35,6 +35,11 @@ class Kernel extends ConsoleKernel
$schedule->call(function () { $schedule->call(function () {
$this->delete_expired_shared_links(); $this->delete_expired_shared_links();
})->everyMinute(); })->everyMinute();
// Run queue jobs every minute
$schedule->command('queue:work --tries=3')
->everyMinute()
->withoutOverlapping();
} }
/** /**
@@ -228,10 +228,10 @@ class EditItemsController extends Controller
return Demo::response_204(); return Demo::response_204();
} }
// Check shared permission // Check shared permission
if (!is_editor($shared)) abort(403); if (!is_editor($shared)) abort(403);
foreach($request->input('data') as $file){ foreach($request->input('data') as $file){
$unique_id = $file['unique_id']; $unique_id = $file['unique_id'];
@@ -329,20 +329,21 @@ class EditItemsController extends Controller
if (is_demo(Auth::id())) { if (is_demo(Auth::id())) {
return Demo::response_204(); return Demo::response_204();
} }
$to_unique_id = $request->input('to_unique_id');
// Check permission to upload for authenticated editor $to_unique_id = $request->input('to_unique_id');
if ($request->user()->tokenCan('editor')) {
// check if shared_token cookie exist
if (!$request->hasCookie('shared_token')) abort('401');
// Get shared token // Check permission to upload for authenticated editor
$shared = get_shared($request->cookie('shared_token')); if ($request->user()->tokenCan('editor')) {
// check if shared_token cookie exist
if (!$request->hasCookie('shared_token')) abort('401');
// Get shared token
$shared = get_shared($request->cookie('shared_token'));
// Check access to requested directory
Guardian::check_item_access($to_unique_id, $shared);
}
// Check access to requested directory
Guardian::check_item_access($to_unique_id, $shared);
}
// Move item // Move item
Editor::move($request, $to_unique_id); Editor::move($request, $to_unique_id);
@@ -377,7 +378,7 @@ class EditItemsController extends Controller
$unique_id = $item['unique_id']; $unique_id = $item['unique_id'];
$moving_unique_id = $unique_id; $moving_unique_id = $unique_id;
if ($item['type'] !== 'folder') { if ($item['type'] !== 'folder') {
$file = FileManagerFile::where('unique_id', $unique_id) $file = FileManagerFile::where('unique_id', $unique_id)
+1
View File
@@ -198,6 +198,7 @@ class User extends Authenticatable
return FileManagerFolder::with(['folders.shared', 'shared:token,id,item_id,permission,protected,expire_in']) return FileManagerFolder::with(['folders.shared', 'shared:token,id,item_id,permission,protected,expire_in'])
->where('parent_id', 0) ->where('parent_id', 0)
->where('user_id', $this->id) ->where('user_id', $this->id)
->orderByDesc('created_at')
->get(); ->get();
} }
+1 -1
View File
@@ -41,7 +41,7 @@ return [
| |
*/ */
'queue' => env('SCOUT_QUEUE', false), 'queue' => env('SCOUT_QUEUE', true),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
+1 -1
View File
@@ -2,7 +2,7 @@
return [ return [
'version' => '1.8', 'version' => '1.8.1',
// Define size of chunk uploaded by MB. E.g. integer 128 means chunk size will be 128MB. // Define size of chunk uploaded by MB. E.g. integer 128 means chunk size will be 128MB.
'chunk_size' => env('CHUNK_SIZE', '128'), 'chunk_size' => env('CHUNK_SIZE', '128'),
@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+2 -11
View File
@@ -27,7 +27,7 @@
"/chunks/database.js": "/chunks/database.js?id=0b21e6ff3bac5c963d9a", "/chunks/database.js": "/chunks/database.js?id=0b21e6ff3bac5c963d9a",
"/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=464c8e70974d492ce7f6", "/chunks/dynamic-page.js": "/chunks/dynamic-page.js?id=464c8e70974d492ce7f6",
"/chunks/environment-setup.js": "/chunks/environment-setup.js?id=826fbaa6cc4acab69f5d", "/chunks/environment-setup.js": "/chunks/environment-setup.js?id=826fbaa6cc4acab69f5d",
"/chunks/files.js": "/chunks/files.js?id=4a8c342f4ebaff88b93c", "/chunks/files.js": "/chunks/files.js?id=35936c1c34e3290a6072",
"/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js": "/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js?id=8ccd35de575e8a91d02f", "/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js": "/chunks/files~chunks/settings-subscription~chunks/shared-files~chunks/shared-page~chunks/user-subscription.js?id=8ccd35de575e8a91d02f",
"/chunks/files~chunks/shared-files.js": "/chunks/files~chunks/shared-files.js?id=89b1ef0899f60355a6ea", "/chunks/files~chunks/shared-files.js": "/chunks/files~chunks/shared-files.js?id=89b1ef0899f60355a6ea",
"/chunks/files~chunks/shared-files~chunks/shared-page.js": "/chunks/files~chunks/shared-files~chunks/shared-page.js?id=6d26830448c5744bdcf8", "/chunks/files~chunks/shared-files~chunks/shared-page.js": "/chunks/files~chunks/shared-files~chunks/shared-page.js?id=6d26830448c5744bdcf8",
@@ -75,14 +75,5 @@
"/chunks/user-password.js": "/chunks/user-password.js?id=b036eeaa5ef8e798f6dd", "/chunks/user-password.js": "/chunks/user-password.js?id=b036eeaa5ef8e798f6dd",
"/chunks/user-storage.js": "/chunks/user-storage.js?id=a99910f95c3e39caa78b", "/chunks/user-storage.js": "/chunks/user-storage.js?id=a99910f95c3e39caa78b",
"/chunks/user-subscription.js": "/chunks/user-subscription.js?id=e8ea1e67f9ac0a835ed0", "/chunks/user-subscription.js": "/chunks/user-subscription.js?id=e8ea1e67f9ac0a835ed0",
"/chunks/users.js": "/chunks/users.js?id=aba8837f40fbb79f99b4", "/chunks/users.js": "/chunks/users.js?id=aba8837f40fbb79f99b4"
"/chunks/files~chunks/shared-files.cb2c4953e6755ff42b2f.hot-update.js": "/chunks/files~chunks/shared-files.cb2c4953e6755ff42b2f.hot-update.js",
"/chunks/files~chunks/shared-files.02f748077714fecfe13e.hot-update.js": "/chunks/files~chunks/shared-files.02f748077714fecfe13e.hot-update.js",
"/chunks/files~chunks/shared-files.b2d9e82249a0816b2259.hot-update.js": "/chunks/files~chunks/shared-files.b2d9e82249a0816b2259.hot-update.js",
"/chunks/files~chunks/shared-files.df5cc314bc28acdf4ecc.hot-update.js": "/chunks/files~chunks/shared-files.df5cc314bc28acdf4ecc.hot-update.js",
"/chunks/files~chunks/shared-files.6c3d3b165272b08d5a2a.hot-update.js": "/chunks/files~chunks/shared-files.6c3d3b165272b08d5a2a.hot-update.js",
"/chunks/files~chunks/shared-files.f7d46158c86c074e9345.hot-update.js": "/chunks/files~chunks/shared-files.f7d46158c86c074e9345.hot-update.js",
"/js/main.e955e25c70758fdb15b8.hot-update.js": "/js/main.e955e25c70758fdb15b8.hot-update.js",
"/chunks/files~chunks/shared-files~chunks/shared-page.62aa119dfea85a9796d6.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.62aa119dfea85a9796d6.hot-update.js",
"/chunks/files~chunks/shared-files~chunks/shared-page.4a8cbac6db0d7b697883.hot-update.js": "/chunks/files~chunks/shared-files~chunks/shared-page.4a8cbac6db0d7b697883.hot-update.js"
} }
+2 -1
View File
@@ -256,6 +256,7 @@
}, },
"alerts": { "alerts": {
"error_confirm": "哦,出了个问题!", "error_confirm": "哦,出了个问题!",
"leave_to_sign_in": "Do you really want to leave?",
"success_confirm": "太棒了!" "success_confirm": "太棒了!"
}, },
"context_menu": { "context_menu": {
@@ -273,7 +274,7 @@
"rename": "重命名", "rename": "重命名",
"restore": "恢复文件", "restore": "恢复文件",
"share": "分享", "share": "分享",
"share_cancel": "Share Cancel", "share_cancel": "Cancel Sharing",
"share_edit": "编辑分享设定", "share_edit": "编辑分享设定",
"upload": "上传", "upload": "上传",
"select": "Select" "select": "Select"
+2 -1
View File
@@ -258,6 +258,7 @@
}, },
"alerts": { "alerts": {
"error_confirm": "Thats horrible!", "error_confirm": "Thats horrible!",
"leave_to_sign_in": "Do you really want to leave?",
"success_confirm": "Awesome!" "success_confirm": "Awesome!"
}, },
"context_menu": { "context_menu": {
@@ -275,7 +276,7 @@
"rename": "Rename", "rename": "Rename",
"restore": "Restore", "restore": "Restore",
"share": "Share", "share": "Share",
"share_cancel": "Share Cancel", "share_cancel": "Cancel Sharing",
"share_edit": "Edit Sharing", "share_edit": "Edit Sharing",
"upload": "Upload", "upload": "Upload",
"select": "Select" "select": "Select"
+1
View File
@@ -258,6 +258,7 @@
}, },
"alerts": { "alerts": {
"error_confirm": "To je hrozné!", "error_confirm": "To je hrozné!",
"leave_to_sign_in": "Naozaj chcete odísť?",
"success_confirm": "Skvelé!" "success_confirm": "Skvelé!"
}, },
"context_menu": { "context_menu": {
+154 -166
View File
@@ -1,11 +1,11 @@
<template> <template>
<section id="viewport" v-if="user"> <section id="viewport" v-if="user">
<ContentSidebar> <ContentSidebar>
<!--Empty storage warning--> <!--Empty storage warning-->
<ContentGroup v-if="config.storageLimit && storage.used > 95"> <ContentGroup v-if="config.storageLimit && storage.used > 95">
<UpgradeSidebarBanner /> <UpgradeSidebarBanner/>
</ContentGroup> </ContentGroup>
<!--Locations--> <!--Locations-->
@@ -19,8 +19,7 @@
{{ $t('sidebar.home') }} {{ $t('sidebar.home') }}
</div> </div>
</a> </a>
<a class="menu-list-item link" :class="{'is-active': $isThisLocation(['latest'])}" <a class="menu-list-item link" :class="{'is-active': $isThisLocation(['latest'])}" @click="getLatest">
@click="getLatest">
<div class="icon"> <div class="icon">
<upload-cloud-icon size="17"></upload-cloud-icon> <upload-cloud-icon size="17"></upload-cloud-icon>
</div> </div>
@@ -28,8 +27,7 @@
{{ $t('sidebar.latest') }} {{ $t('sidebar.latest') }}
</div> </div>
</a> </a>
<a class="menu-list-item link trash" :class="{'is-active-trash': $isThisLocation(['trash', 'trash-root'])}" <a class="menu-list-item link trash" :class="{'is-active-trash': $isThisLocation(['trash', 'trash-root'])}" @click="getTrash">
@click="getTrash">
<div class="icon"> <div class="icon">
<trash2-icon size="17"></trash2-icon> <trash2-icon size="17"></trash2-icon>
</div> </div>
@@ -45,29 +43,19 @@
<span class="empty-note navigator" v-if="tree.length == 0"> <span class="empty-note navigator" v-if="tree.length == 0">
{{ $t('sidebar.folders_empty') }} {{ $t('sidebar.folders_empty') }}
</span> </span>
<TreeMenuNavigator class="folder-tree" :depth="0" :nodes="items" v-for="items in tree" <TreeMenuNavigator class="folder-tree" :depth="0" :nodes="items" v-for="items in tree" :key="items.unique_id"/>
:key="items.unique_id"/>
</ContentGroup> </ContentGroup>
<!--Favourites--> <!--Favourites-->
<ContentGroup :title="$t('sidebar.favourites')" slug="favourites" :can-collapse="true"> <ContentGroup :title="$t('sidebar.favourites')" slug="favourites" :can-collapse="true">
<div class="menu-list-wrapper vertical favourites" <div class="menu-list-wrapper vertical favourites" :class="{ 'is-dragenter': area }" @dragover.prevent="dragEnter" @dragleave="dragLeave" @drop="dragFinish($event)">
:class="{ 'is-dragenter': area }"
@dragover.prevent="dragEnter"
@dragleave="dragLeave"
@drop="dragFinish($event)"
>
<transition-group tag="div" class="menu-list" name="folder-item"> <transition-group tag="div" class="menu-list" name="folder-item">
<span class="empty-note favourites" v-if="favourites.length == 0" :key="0"> <span class="empty-note favourites" v-if="favourites.length == 0" :key="0">
{{ $t('sidebar.favourites_empty') }} {{ $t('sidebar.favourites_empty') }}
</span> </span>
<a @click.stop="openFolder(folder)" <a @click.stop="openFolder(folder)" class="menu-list-item" :class="{'is-current': (folder && currentFolder) && (currentFolder.unique_id === folder.unique_id)}" v-for="folder in favourites" :key="folder.unique_id">
class="menu-list-item"
:class="{'is-current': (folder && currentFolder) && (currentFolder.unique_id === folder.unique_id)}"
v-for="folder in favourites"
:key="folder.unique_id">
<div> <div>
<folder-icon size="17" class="folder-icon"></folder-icon> <folder-icon size="17" class="folder-icon"></folder-icon>
<span class="label">{{ folder.name }}</span> <span class="label">{{ folder.name }}</span>
@@ -85,190 +73,190 @@
</template> </template>
<script> <script>
import UpgradeSidebarBanner from '@/components/Others/UpgradeSidebarBanner' import UpgradeSidebarBanner from '@/components/Others/UpgradeSidebarBanner'
import TreeMenuNavigator from '@/components/Others/TreeMenuNavigator' import TreeMenuNavigator from '@/components/Others/TreeMenuNavigator'
import MultiSelected from '@/components/FilesView/MultiSelected' import MultiSelected from '@/components/FilesView/MultiSelected'
import ContentFileView from '@/components/Others/ContentFileView' import ContentFileView from '@/components/Others/ContentFileView'
import ContentSidebar from '@/components/Sidebar/ContentSidebar' import ContentSidebar from '@/components/Sidebar/ContentSidebar'
import ContentGroup from '@/components/Sidebar/ContentGroup' import ContentGroup from '@/components/Sidebar/ContentGroup'
import {mapGetters} from 'vuex' import { mapGetters } from 'vuex'
import {events} from '@/bus' import { events } from '@/bus'
import { import {
UploadCloudIcon,
FolderIcon,
Trash2Icon,
HomeIcon,
XIcon
} from 'vue-feather-icons'
export default {
name: 'FilesView',
components: {
UpgradeSidebarBanner,
TreeMenuNavigator,
ContentFileView,
MultiSelected,
ContentSidebar,
UploadCloudIcon, UploadCloudIcon,
ContentGroup,
FolderIcon, FolderIcon,
Trash2Icon, Trash2Icon,
HomeIcon, HomeIcon,
XIcon, XIcon
} from 'vue-feather-icons' },
computed: {
export default { ...mapGetters(['user', 'homeDirectory', 'currentFolder', 'config', 'fileInfoDetail']),
name: 'FilesView', favourites() {
components: { return this.user.relationships.favourites.data.attributes.folders
UpgradeSidebarBanner,
TreeMenuNavigator,
ContentFileView,
MultiSelected,
ContentSidebar,
UploadCloudIcon,
ContentGroup,
FolderIcon,
Trash2Icon,
HomeIcon,
XIcon,
}, },
computed: { tree() {
...mapGetters(['user', 'homeDirectory', 'currentFolder', 'config', 'fileInfoDetail']), return this.user.relationships.tree.data.attributes.folders
favourites() {
return this.user.relationships.favourites.data.attributes.folders
},
tree() {
return this.user.relationships.tree.data.attributes.folders
},
storage() {
return this.$store.getters.user.relationships.storage.data.attributes
}
}, },
data() { storage() {
return { return this.$store.getters.user.relationships.storage.data.attributes
area: false, }
draggedItem: undefined, },
} data() {
return {
area: false,
draggedItem: undefined
}
},
methods: {
getTrash() {
this.$store.dispatch('getTrash')
}, },
methods: { getLatest() {
getTrash() { this.$store.dispatch('getLatest')
this.$store.dispatch('getTrash') },
}, goHome() {
getLatest() { this.$store.dispatch('getFolder', [{ folder: this.homeDirectory, back: false, init: true }])
this.$store.dispatch('getLatest') },
}, openFolder(folder) {
goHome() { this.$store.dispatch('getFolder', [{ folder: folder, back: false, init: false }])
this.$store.dispatch('getFolder', [{folder: this.homeDirectory, back: false, init: true}]) },
}, dragEnter() {
openFolder(folder) { if (this.draggedItem && this.draggedItem.type !== 'folder') return
this.$store.dispatch('getFolder', [{folder: folder, back: false, init: false}])
},
dragEnter() {
if (this.draggedItem && this.draggedItem.type !== 'folder') return
if(this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return if (this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return
this.area = true this.area = true
}, },
dragLeave() { dragLeave() {
this.area = false this.area = false
}, },
dragFinish() { dragFinish() {
this.area = false this.area = false
events.$emit('drop') events.$emit('drop')
// Check if dragged item is folder // Check if dragged item is folder
if (this.draggedItem && this.draggedItem.type !== 'folder') return if (this.draggedItem && this.draggedItem.type !== 'folder') return
// Check if folder exist in favourites // Check if folder exist in favourites
if (this.favourites.find(folder => folder.unique_id == this.draggedItem.unique_id)) return if (this.favourites.find(folder => folder.unique_id == this.draggedItem.unique_id)) return
// Prevent to move folders to self // Prevent to move folders to self
if(this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return if (this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return
// Store favourites folder // Store favourites folder
//Add to favourites non selected folder //Add to favourites non selected folder
if(!this.fileInfoDetail.includes(this.draggedItem)){ if (!this.fileInfoDetail.includes(this.draggedItem)) {
this.$store.dispatch('addToFavourites', this.draggedItem) this.$store.dispatch('addToFavourites', this.draggedItem)
}
//Add to favourites selected folders
if(this.fileInfoDetail.includes(this.draggedItem)) {
this.$store.dispatch('addToFavourites', null)
}
},
removeFavourite(folder) {
this.$store.dispatch('removeFromFavourites', folder)
} }
//Add to favourites selected folders
if (this.fileInfoDetail.includes(this.draggedItem)) {
this.$store.dispatch('addToFavourites', null)
}
}, },
created() { removeFavourite(folder) {
this.goHome() this.$store.dispatch('removeFromFavourites', folder)
}
},
created() {
this.goHome()
// Listen for dragstart folder items // Listen for dragstart folder items
events.$on('dragstart', (item) => { this.draggedItem = item , this.dragInProgress = true}) events.$on('dragstart', (item) => {
this.draggedItem = item , this.dragInProgress = true
})
events.$on('drop', () => { events.$on('drop', () => {
this.dragInProgress = false this.dragInProgress = false
}) })
}, },
beforeRouteLeave(to, from, next) { beforeRouteLeave(to, from, next) {
// Inquire user about his willing to step back to sign in page // Inquire user about his willing to step back to sign in page
if (to.name === 'SignIn') { if (to.name === 'SignIn') {
const answer = window.confirm('Do you really want to leave?') if (window.confirm(this.$t('alerts.leave_to_sign_in'))) {
if (answer) {
next()
} else {
next(false)
}
} else {
next() next()
} else {
next(false)
} }
}, } else {
next()
}
} }
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.empty-note {
&.navigator {
padding: 5px 25px 10px;
}
&.favourites {
padding: 5px 23px 10px;
}
}
.navigator {
width: 100%;
overflow-x: auto;
}
@media only screen and (max-width: 1024px) {
.empty-note { .empty-note {
&.navigator { &.navigator {
padding: 5px 25px 10px; padding: 5px 20px 10px;
} }
&.favourites { &.favourites {
padding: 5px 23px 10px; padding: 5px 18px 10px;
} }
} }
}
.navigator { // Transition
width: 100%; .folder-item-move {
overflow-x: auto; transition: transform 300s ease;
} }
@media only screen and (max-width: 1024px) { .folder-item-enter-active {
transition: all 300ms ease;
}
.empty-note { .folder-item-leave-active {
transition: all 300ms;
}
&.navigator { .folder-item-enter, .folder-item-leave-to /* .list-leave-active below version 2.1.8 */
padding: 5px 20px 10px; {
} opacity: 0;
transform: translateX(30px);
}
&.favourites { .folder-item-leave-active {
padding: 5px 18px 10px; position: absolute;
} }
}
}
// Transition
.folder-item-move {
transition: transform 300s ease;
}
.folder-item-enter-active {
transition: all 300ms ease;
}
.folder-item-leave-active {
transition: all 300ms;
}
.folder-item-enter, .folder-item-leave-to /* .list-leave-active below version 2.1.8 */
{
opacity: 0;
transform: translateX(30px);
}
.folder-item-leave-active {
position: absolute;
}
</style> </style>