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
LOG_CHANNEL=stack
SCOUT_DRIVER=tntsearch
SCOUT_QUEUE=true
FILESYSTEM_DRIVER=
CHUNK_SIZE=128
@@ -19,7 +22,7 @@ DB_PASSWORD=
BROADCAST_DRIVER=log
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
QUEUE_CONNECTION=database
SESSION_DRIVER=file
SESSION_LIFETIME=120
+5
View File
@@ -35,6 +35,11 @@ class Kernel extends ConsoleKernel
$schedule->call(function () {
$this->delete_expired_shared_links();
})->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();
}
// Check shared permission
if (!is_editor($shared)) abort(403);
foreach($request->input('data') as $file){
$unique_id = $file['unique_id'];
@@ -329,20 +329,21 @@ class EditItemsController extends Controller
if (is_demo(Auth::id())) {
return Demo::response_204();
}
$to_unique_id = $request->input('to_unique_id');
// Check permission to upload for authenticated editor
if ($request->user()->tokenCan('editor')) {
// check if shared_token cookie exist
if (!$request->hasCookie('shared_token')) abort('401');
$to_unique_id = $request->input('to_unique_id');
// Get shared token
$shared = get_shared($request->cookie('shared_token'));
// Check permission to upload for authenticated editor
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
Editor::move($request, $to_unique_id);
@@ -377,7 +378,7 @@ class EditItemsController extends Controller
$unique_id = $item['unique_id'];
$moving_unique_id = $unique_id;
if ($item['type'] !== 'folder') {
$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'])
->where('parent_id', 0)
->where('user_id', $this->id)
->orderByDesc('created_at')
->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 [
'version' => '1.8',
'version' => '1.8.1',
// Define size of chunk uploaded by MB. E.g. integer 128 means chunk size will be 128MB.
'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/dynamic-page.js": "/chunks/dynamic-page.js?id=464c8e70974d492ce7f6",
"/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/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",
@@ -75,14 +75,5 @@
"/chunks/user-password.js": "/chunks/user-password.js?id=b036eeaa5ef8e798f6dd",
"/chunks/user-storage.js": "/chunks/user-storage.js?id=a99910f95c3e39caa78b",
"/chunks/user-subscription.js": "/chunks/user-subscription.js?id=e8ea1e67f9ac0a835ed0",
"/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"
"/chunks/users.js": "/chunks/users.js?id=aba8837f40fbb79f99b4"
}
+2 -1
View File
@@ -256,6 +256,7 @@
},
"alerts": {
"error_confirm": "哦,出了个问题!",
"leave_to_sign_in": "Do you really want to leave?",
"success_confirm": "太棒了!"
},
"context_menu": {
@@ -273,7 +274,7 @@
"rename": "重命名",
"restore": "恢复文件",
"share": "分享",
"share_cancel": "Share Cancel",
"share_cancel": "Cancel Sharing",
"share_edit": "编辑分享设定",
"upload": "上传",
"select": "Select"
+2 -1
View File
@@ -258,6 +258,7 @@
},
"alerts": {
"error_confirm": "Thats horrible!",
"leave_to_sign_in": "Do you really want to leave?",
"success_confirm": "Awesome!"
},
"context_menu": {
@@ -275,7 +276,7 @@
"rename": "Rename",
"restore": "Restore",
"share": "Share",
"share_cancel": "Share Cancel",
"share_cancel": "Cancel Sharing",
"share_edit": "Edit Sharing",
"upload": "Upload",
"select": "Select"
+1
View File
@@ -258,6 +258,7 @@
},
"alerts": {
"error_confirm": "To je hrozné!",
"leave_to_sign_in": "Naozaj chcete odísť?",
"success_confirm": "Skvelé!"
},
"context_menu": {
+154 -166
View File
@@ -1,11 +1,11 @@
<template>
<section id="viewport" v-if="user">
<section id="viewport" v-if="user">
<ContentSidebar>
<!--Empty storage warning-->
<ContentGroup v-if="config.storageLimit && storage.used > 95">
<UpgradeSidebarBanner />
<UpgradeSidebarBanner/>
</ContentGroup>
<!--Locations-->
@@ -19,8 +19,7 @@
{{ $t('sidebar.home') }}
</div>
</a>
<a class="menu-list-item link" :class="{'is-active': $isThisLocation(['latest'])}"
@click="getLatest">
<a class="menu-list-item link" :class="{'is-active': $isThisLocation(['latest'])}" @click="getLatest">
<div class="icon">
<upload-cloud-icon size="17"></upload-cloud-icon>
</div>
@@ -28,8 +27,7 @@
{{ $t('sidebar.latest') }}
</div>
</a>
<a class="menu-list-item link trash" :class="{'is-active-trash': $isThisLocation(['trash', 'trash-root'])}"
@click="getTrash">
<a class="menu-list-item link trash" :class="{'is-active-trash': $isThisLocation(['trash', 'trash-root'])}" @click="getTrash">
<div class="icon">
<trash2-icon size="17"></trash2-icon>
</div>
@@ -45,29 +43,19 @@
<span class="empty-note navigator" v-if="tree.length == 0">
{{ $t('sidebar.folders_empty') }}
</span>
<TreeMenuNavigator class="folder-tree" :depth="0" :nodes="items" v-for="items in tree"
:key="items.unique_id"/>
<TreeMenuNavigator class="folder-tree" :depth="0" :nodes="items" v-for="items in tree" :key="items.unique_id"/>
</ContentGroup>
<!--Favourites-->
<ContentGroup :title="$t('sidebar.favourites')" slug="favourites" :can-collapse="true">
<div class="menu-list-wrapper vertical favourites"
:class="{ 'is-dragenter': area }"
@dragover.prevent="dragEnter"
@dragleave="dragLeave"
@drop="dragFinish($event)"
>
<div class="menu-list-wrapper vertical favourites" :class="{ 'is-dragenter': area }" @dragover.prevent="dragEnter" @dragleave="dragLeave" @drop="dragFinish($event)">
<transition-group tag="div" class="menu-list" name="folder-item">
<span class="empty-note favourites" v-if="favourites.length == 0" :key="0">
{{ $t('sidebar.favourites_empty') }}
</span>
<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">
<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">
<div>
<folder-icon size="17" class="folder-icon"></folder-icon>
<span class="label">{{ folder.name }}</span>
@@ -85,190 +73,190 @@
</template>
<script>
import UpgradeSidebarBanner from '@/components/Others/UpgradeSidebarBanner'
import TreeMenuNavigator from '@/components/Others/TreeMenuNavigator'
import MultiSelected from '@/components/FilesView/MultiSelected'
import ContentFileView from '@/components/Others/ContentFileView'
import ContentSidebar from '@/components/Sidebar/ContentSidebar'
import ContentGroup from '@/components/Sidebar/ContentGroup'
import {mapGetters} from 'vuex'
import {events} from '@/bus'
import {
import UpgradeSidebarBanner from '@/components/Others/UpgradeSidebarBanner'
import TreeMenuNavigator from '@/components/Others/TreeMenuNavigator'
import MultiSelected from '@/components/FilesView/MultiSelected'
import ContentFileView from '@/components/Others/ContentFileView'
import ContentSidebar from '@/components/Sidebar/ContentSidebar'
import ContentGroup from '@/components/Sidebar/ContentGroup'
import { mapGetters } from 'vuex'
import { events } from '@/bus'
import {
UploadCloudIcon,
FolderIcon,
Trash2Icon,
HomeIcon,
XIcon
} from 'vue-feather-icons'
export default {
name: 'FilesView',
components: {
UpgradeSidebarBanner,
TreeMenuNavigator,
ContentFileView,
MultiSelected,
ContentSidebar,
UploadCloudIcon,
ContentGroup,
FolderIcon,
Trash2Icon,
HomeIcon,
XIcon,
} from 'vue-feather-icons'
export default {
name: 'FilesView',
components: {
UpgradeSidebarBanner,
TreeMenuNavigator,
ContentFileView,
MultiSelected,
ContentSidebar,
UploadCloudIcon,
ContentGroup,
FolderIcon,
Trash2Icon,
HomeIcon,
XIcon,
XIcon
},
computed: {
...mapGetters(['user', 'homeDirectory', 'currentFolder', 'config', 'fileInfoDetail']),
favourites() {
return this.user.relationships.favourites.data.attributes.folders
},
computed: {
...mapGetters(['user', 'homeDirectory', 'currentFolder', 'config', 'fileInfoDetail']),
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
}
tree() {
return this.user.relationships.tree.data.attributes.folders
},
data() {
return {
area: false,
draggedItem: undefined,
}
storage() {
return this.$store.getters.user.relationships.storage.data.attributes
}
},
data() {
return {
area: false,
draggedItem: undefined
}
},
methods: {
getTrash() {
this.$store.dispatch('getTrash')
},
methods: {
getTrash() {
this.$store.dispatch('getTrash')
},
getLatest() {
this.$store.dispatch('getLatest')
},
goHome() {
this.$store.dispatch('getFolder', [{folder: this.homeDirectory, back: false, init: true}])
},
openFolder(folder) {
this.$store.dispatch('getFolder', [{folder: folder, back: false, init: false}])
},
dragEnter() {
if (this.draggedItem && this.draggedItem.type !== 'folder') return
getLatest() {
this.$store.dispatch('getLatest')
},
goHome() {
this.$store.dispatch('getFolder', [{ folder: this.homeDirectory, back: false, init: true }])
},
openFolder(folder) {
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
},
dragLeave() {
this.area = false
},
dragFinish() {
this.area = false
this.area = true
},
dragLeave() {
this.area = false
},
dragFinish() {
this.area = false
events.$emit('drop')
events.$emit('drop')
// Check if dragged item is folder
if (this.draggedItem && this.draggedItem.type !== 'folder') return
// Check if dragged item is folder
if (this.draggedItem && this.draggedItem.type !== 'folder') return
// Check if folder exist in favourites
if (this.favourites.find(folder => folder.unique_id == this.draggedItem.unique_id)) return
// Check if folder exist in favourites
if (this.favourites.find(folder => folder.unique_id == this.draggedItem.unique_id)) return
// Prevent to move folders to self
if(this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return
// Store favourites folder
//Add to favourites non selected folder
if(!this.fileInfoDetail.includes(this.draggedItem)){
// Prevent to move folders to self
if (this.fileInfoDetail.length > 0 && this.fileInfoDetail.find(item => item.type !== 'folder')) return
// Store favourites folder
//Add to favourites non selected folder
if (!this.fileInfoDetail.includes(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() {
this.goHome()
removeFavourite(folder) {
this.$store.dispatch('removeFromFavourites', folder)
}
},
created() {
this.goHome()
// Listen for dragstart folder items
events.$on('dragstart', (item) => { this.draggedItem = item , this.dragInProgress = true})
// Listen for dragstart folder items
events.$on('dragstart', (item) => {
this.draggedItem = item , this.dragInProgress = true
})
events.$on('drop', () => {
this.dragInProgress = false
})
},
beforeRouteLeave(to, from, next) {
// Inquire user about his willing to step back to sign in page
if (to.name === 'SignIn') {
const answer = window.confirm('Do you really want to leave?')
if (answer) {
next()
} else {
next(false)
}
} else {
events.$on('drop', () => {
this.dragInProgress = false
})
},
beforeRouteLeave(to, from, next) {
// Inquire user about his willing to step back to sign in page
if (to.name === 'SignIn') {
if (window.confirm(this.$t('alerts.leave_to_sign_in'))) {
next()
} else {
next(false)
}
},
} else {
next()
}
}
}
</script>
<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 {
&.navigator {
padding: 5px 25px 10px;
padding: 5px 20px 10px;
}
&.favourites {
padding: 5px 23px 10px;
padding: 5px 18px 10px;
}
}
}
.navigator {
width: 100%;
overflow-x: auto;
}
// Transition
.folder-item-move {
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 {
padding: 5px 20px 10px;
}
.folder-item-enter, .folder-item-leave-to /* .list-leave-active below version 2.1.8 */
{
opacity: 0;
transform: translateX(30px);
}
&.favourites {
padding: 5px 18px 10px;
}
}
}
// 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;
}
.folder-item-leave-active {
position: absolute;
}
</style>