vuefilemanager v1.4-beta.1

This commit is contained in:
carodej
2020-04-30 10:55:36 +02:00
parent 968b12c4ac
commit 606c1895a9
16 changed files with 275 additions and 32 deletions
+1 -1
View File
@@ -59,7 +59,7 @@
'appSize', 'isLogged', 'isGuest'
]),
layout() {
if (includes(['VerifyByPassword', 'SharedContent', 'SignIn', 'SignUp', 'ForgottenPassword', 'CreateNewPassword'], this.$route.name)) {
if (includes(['VerifyByPassword', 'SharedPage', 'NotFoundShared', 'SignIn', 'SignUp', 'ForgottenPassword', 'CreateNewPassword'], this.$route.name)) {
return 'unauthorized'
}
@@ -70,7 +70,8 @@
</div>
</div>
<span @click.stop="showItemActions" class="show-actions" v-if="$isMobile() && ! ( $checkPermission('visitor') && isFolder )">
<span @click.stop="showItemActions" class="show-actions"
v-if="$isMobile() && ! ( $checkPermission('visitor') && isFolder ) && canShowMobileOptions">
<FontAwesomeIcon icon="ellipsis-h" class="icon-action"></FontAwesomeIcon>
</span>
</div>
@@ -87,7 +88,7 @@
props: ['data'],
computed: {
...mapGetters([
'FilePreviewType', 'sharedDetail'
'FilePreviewType', 'sharedDetail', 'contextMenu'
]),
isFolder() {
return this.data.type === 'folder'
@@ -102,7 +103,10 @@
return !this.$isMobile()
&& !this.$isThisLocation(['trash', 'trash-root'])
&& !this.$checkPermission('visitor')
&& (this.sharedDetail && this.sharedDetail.type !== 'file')
&& !(this.sharedDetail && this.sharedDetail.type === 'file')
},
canShowMobileOptions() {
return ! (this.sharedDetail && this.sharedDetail.type === 'file')
},
canDrag() {
return !this.isDeleted && this.$checkPermission(['master', 'editor'])
@@ -194,7 +198,7 @@
renameItem: debounce(function (e) {
// Prevent submit empty string
if (e.target.innerText === '') return
if (e.target.innerText.trim() === '') return
this.$store.dispatch('renameItem', {
unique_id: this.data.unique_id,
@@ -286,6 +290,7 @@
max-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
word-break: break-all;
&[contenteditable] {
-webkit-user-select: text;
@@ -99,10 +99,13 @@
return this.data.type === 'image'
},
canEditName() {
return ! this.$isMobile() && ! this.$isThisLocation(['trash', 'trash-root']) && ! this.$checkPermission('visitor')
return !this.$isMobile()
&& !this.$isThisLocation(['trash', 'trash-root'])
&& !this.$checkPermission('visitor')
&& !(this.sharedDetail && this.sharedDetail.type === 'file')
},
canDrag() {
return ! this.isDeleted && this.$checkPermission(['master', 'editor'])
return !this.isDeleted && this.$checkPermission(['master', 'editor'])
},
timeStamp() {
return this.data.deleted_at ? this.$t('item_thumbnail.deleted_at', {time: this.data.deleted_at}) : this.data.created_at
@@ -160,7 +163,7 @@
if (this.$isMobile() && this.isFolder) {
// Go to folder
if ( this.$isThisLocation('public') ) {
if (this.$isThisLocation('public')) {
this.$store.dispatch('browseShared', [this.data, false])
} else {
this.$store.dispatch('getFolder', [this.data, false])
@@ -190,7 +193,7 @@
if (this.isFolder) {
if ( this.$isThisLocation('public') ) {
if (this.$isThisLocation('public')) {
this.$store.dispatch('browseShared', [this.data, false])
} else {
this.$store.dispatch('getFolder', [this.data, false])
+4
View File
@@ -31,6 +31,10 @@
"download_file": "Download File",
"submit": "Submit"
},
"page_shared_404": {
"subtitle": "The content you are finding was probably deleted.",
"title": "Not Found :("
},
"page_create_password": {
"title": "Only One Step to Log In",
"subtitle": "Create your new password here:",
+4
View File
@@ -31,6 +31,10 @@
"download_file": "Stiahnúť súbor",
"submit": "Potvrdiť"
},
"page_shared_404": {
"subtitle": "Obsah ktorý hľadáš bol pravdepodobne vymazaný.",
"title": "Obsah sa nenašiel :("
},
"page_create_password": {
"title": "Iba jeden krok pre prihlásenie",
"subtitle": "Vytvorte si nové heslo tu:",
+12 -3
View File
@@ -3,7 +3,8 @@ import Router from 'vue-router'
import Index from './views/Auth/SignIn'
import SignUp from './views/Auth/SignUp'
import SharedContent from './views/Shared/SharedContent'
import SharedPage from './views/Shared/SharedPage'
import NotFoundShared from './views/Shared/NotFoundShared'
import ForgottenPassword from './views/Auth/ForgottenPassword'
import CreateNewPassword from './views/Auth/CreateNewPassword'
@@ -48,9 +49,17 @@ const router = new Router({
},
},
{
name: 'SharedContent',
name: 'SharedPage',
path: '/shared/:token',
component: SharedContent,
component: SharedPage,
meta: {
requiresAuth: false
},
},
{
name: 'NotFoundShared',
path: '/shared-not-found',
component: NotFoundShared,
meta: {
requiresAuth: false
},
+18 -8
View File
@@ -23,7 +23,7 @@ const actions = {
events.$emit('show:content')
// Go to files view
if (!includes(['Files', 'SharedContent'], router.currentRoute.name)) {
if (!includes(['Files', 'SharedPage'], router.currentRoute.name)) {
router.push({name: 'Files'})
}
@@ -155,18 +155,28 @@ const actions = {
})
})
},
getSearchResult: (context, query) => {
context.commit('FLUSH_DATA')
context.commit('LOADING_STATE', true)
context.commit('CHANGE_SEARCHING_STATE', true)
getSearchResult: ({commit, getters}, query) => {
commit('FLUSH_DATA')
commit('LOADING_STATE', true)
commit('CHANGE_SEARCHING_STATE', true)
// Get route
let route = undefined
if (getters.sharedDetail && getters.sharedDetail.protected)
route = '/api/search/private'
else if (getters.sharedDetail && !getters.sharedDetail.protected)
route = '/api/search/public/' + router.currentRoute.params.token
else
route = '/api/search'
axios
.get(context.getters.api + '/search', {
.get(route, {
params: {query: query}
})
.then(response => {
context.commit('LOADING_STATE', false)
context.commit('GET_DATA', response.data)
commit('LOADING_STATE', false)
commit('GET_DATA', response.data)
})
.catch(() => {
// Show error message
@@ -0,0 +1,53 @@
<template>
<AuthContentWrapper ref="auth">
<!--Password reset link sended-->
<AuthContent name="not-found" :visible="true">
<img class="logo" :src="config.app_logo" :alt="config.app_name">
<h1>{{ $t('page_shared_404.title') }}</h1>
<h2>{{ $t('page_shared_404.subtitle') }}</h2>
<span class="additional-link">{{ $t('page_registration.have_an_account') }}
<router-link :to="{name: 'SignIn'}">
{{ $t('page_forgotten_password.password_remember_button') }}
</router-link>
</span>
</AuthContent>
</AuthContentWrapper>
</template>
<script>
import AuthContentWrapper from '@/components/Auth/AuthContentWrapper'
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import AuthContent from '@/components/Auth/AuthContent'
import AuthButton from '@/components/Auth/AuthButton'
import {required} from 'vee-validate/dist/rules'
import {mapGetters} from 'vuex'
import axios from 'axios'
export default {
name: 'NotFoundShared',
components: {
AuthContentWrapper,
ValidationProvider,
ValidationObserver,
AuthContent,
AuthButton,
required,
},
computed: {
...mapGetters(['config']),
},
data() {
return {
isLoading: false,
}
}
}
</script>
<style scoped lang="scss">
@import "@assets/app.scss";
@import '@assets/vue-file-manager/_forms';
@import '@assets/vue-file-manager/_auth';
</style>
@@ -41,7 +41,7 @@
<div v-if="currentPage === 'page-files'" id="files-view" :class="filesViewWidth">
<div id="single-file" v-if="sharedDetail.type === 'file'">
<div class="single-file-wrapper">
<FileItemGrid v-if="sharedFile" :data="sharedFile"/>
<FileItemGrid v-if="sharedFile" :data="sharedFile" :context-menu="false"/>
<ButtonBase @click.native="download" class="download-button" button-style="theme">
{{ $t('page_shared.download_file') }}
@@ -84,7 +84,7 @@
import axios from 'axios'
export default {
name: 'SharedContent',
name: 'SharedPage',
components: {
ValidationProvider,
ValidationObserver,
@@ -224,6 +224,15 @@
this.getFiles()
}
})
.catch(error => {
console.log('error not found');
if (error.response.status == 404) {
this.$router.push({name: 'NotFoundShared'})
}
})
}
}
</script>
@@ -253,6 +262,7 @@
left: 0;
top: 0;
display: grid;
height: 100%;
.single-file-wrapper {
margin: auto;