backend update

This commit is contained in:
carodej
2020-06-09 18:06:04 +02:00
parent 0b7bc27a5f
commit 95bc310def
48 changed files with 1013 additions and 657 deletions
@@ -61,6 +61,14 @@
if (args.emoji) {
this.emoji = args.emoji
}
if (args.buttonStyle) {
this.buttonStyle = args.buttonStyle
}
if (args.button) {
this.button = args.button
}
})
// Show alert
@@ -274,7 +274,10 @@
EyeIcon,
},
computed: {
...mapGetters(['app']),
...mapGetters(['user']),
favourites() {
return this.user.relationships.favourites.data.attributes.folders
},
isFolder() {
return this.item && this.item.type === 'folder'
},
@@ -285,7 +288,7 @@
return this.item && this.item.type === 'image'
},
isInFavourites() {
return this.app.favourites.find(el => el.unique_id == this.item.unique_id)
return this.favourites.find(el => el.unique_id == this.item.unique_id)
},
},
data() {
@@ -312,7 +315,7 @@
},
addToFavourites() {
// Check if folder is in favourites and then add/remove from favourites
if (this.app.favourites && !this.app.favourites.find(el => el.unique_id == this.item.unique_id)) {
if (this.favourites && !this.favourites.find(el => el.unique_id == this.item.unique_id)) {
this.$store.dispatch('addToFavourites', this.item)
} else {
this.$store.dispatch('removeFromFavourites', this.item)
@@ -27,7 +27,7 @@
<!--Files controlls-->
<div class="toolbar-button-wrapper" v-if="$checkPermission(['master', 'editor'])">
<ToolbarButtonUpload
:class="{'is-inactive': canUploadInView}"
:class="{'is-inactive': canUploadInView || ! hasCapacity}"
:action="$t('actions.upload')"
/>
<ToolbarButton
@@ -109,6 +109,9 @@
'browseHistory',
'homeDirectory',
]),
hasCapacity() {
return this.$store.getters.user.relationships.storage.data.attributes.used <= 100
},
directoryName() {
return this.currentFolder ? this.currentFolder.name : this.homeDirectory.name
},
@@ -288,6 +288,7 @@
bottom: 0;
@include transition;
overflow-y: auto;
overflow-x: hidden;
&.is-offset {
margin-top: 50px;
@@ -1,7 +1,7 @@
<template>
<div class="file-info-content" v-if="fileInfoDetail">
<div class="file-headline" spellcheck="false">
<FilePreview />
<FilePreview/>
<!--File info-->
<div class="flex">
@@ -14,45 +14,38 @@
</div>
</div>
<div class="file-info">
<span ref="name" class="name">{{ fileInfoDetail.name }}</span>
<span ref="name" class="name">{{ fileInfoDetail.name }}</span>
<span class="mimetype" v-if="fileInfoDetail.mimetype">.{{ fileInfoDetail.mimetype }}</span>
</div>
</div>
</div>
<!--Info list-->
<ul class="list-info">
<ListInfo>
<ListInfoItem v-if="fileInfoDetail.filesize"
:title="$t('file_detail.size')"
:content="fileInfoDetail.filesize">
</ListInfoItem>
<!--Filesize-->
<li v-if="fileInfoDetail.filesize" class="list-info-item">
<b>{{ $t('file_detail.size') }}</b>
<span>{{ fileInfoDetail.filesize }}</span>
</li>
<ListInfoItem v-if="$checkPermission(['master']) && fileInfoDetail.user_scope !== 'master'"
:title="$t('file_detail.author')"
:content="$t('file_detail.author_participant')">
</ListInfoItem>
<!--Latest change-->
<li v-if="$checkPermission(['master']) && fileInfoDetail.user_scope !== 'master'" class="list-info-item">
<b>{{ $t('file_detail.author') }}</b>
<span>{{ $t('file_detail.author_participant') }}</span>
</li>
<ListInfoItem
:title="$t('file_detail.created_at')"
:content="fileInfoDetail.created_at">
</ListInfoItem>
<!--Latest change-->
<li class="list-info-item">
<b>{{ $t('file_detail.created_at') }}</b>
<span>{{ fileInfoDetail.created_at }}</span>
</li>
<!--Parent-->
<li v-if="$checkPermission(['master'])" class="list-info-item">
<b>{{ $t('file_detail.where') }}</b>
<ListInfoItem v-if="$checkPermission(['master'])"
:title="$t('file_detail.where')">
<div class="action-button" @click="moveItem">
<span>{{ fileInfoDetail.parent ? fileInfoDetail.parent.name : $t('locations.home') }}</span>
<edit-2-icon size="10" class="edit-icon"></edit-2-icon>
</div>
</li>
<!--Parent-->
<li v-if="$checkPermission('master') && fileInfoDetail.shared" class="list-info-item">
<b>{{ $t('file_detail.shared') }}</b>
</ListInfoItem>
<ListInfoItem v-if="$checkPermission('master') && fileInfoDetail.shared"
:title="$t('file_detail.shared')">
<div class="action-button" @click="shareItemOptions">
<span>{{ sharedInfo }}</span>
<edit-2-icon size="10" class="edit-icon"></edit-2-icon>
@@ -60,24 +53,27 @@
<div class="sharelink">
<lock-icon v-if="isLocked" @click="shareItemOptions" class="lock-icon" size="17"></lock-icon>
<unlock-icon v-if="! isLocked" @click="shareItemOptions" class="lock-icon" size="17"></unlock-icon>
<CopyInput class="copy-sharelink" size="small" :value="fileInfoDetail.shared.link" />
<CopyInput class="copy-sharelink" size="small" :value="fileInfoDetail.shared.link"/>
</div>
</li>
</ul>
</ListInfoItem>
</ListInfo>
</div>
</template>
<script>
import { Edit2Icon, LockIcon, UnlockIcon, ImageIcon, VideoIcon, FolderIcon, FileIcon } from 'vue-feather-icons'
import {Edit2Icon, LockIcon, UnlockIcon, ImageIcon, VideoIcon, FolderIcon, FileIcon} from 'vue-feather-icons'
import FilePreview from '@/components/FilesView/FilePreview'
import CopyInput from '@/components/Others/Forms/CopyInput'
import ListInfoItem from '@/components/Others/ListInfoItem'
import ListInfo from '@/components/Others/ListInfo'
import {mapGetters} from 'vuex'
import {events} from "@/bus"
export default {
name: 'FileInfoPanel',
components: {
ListInfoItem,
ListInfo,
FilePreview,
FolderIcon,
UnlockIcon,
@@ -92,23 +88,23 @@
...mapGetters(['fileInfoDetail', 'permissionOptions']),
fileType() {
return this.fileInfoDetail.type
/* switch () {
case 'folder':
return 'folder'
break;
case 'file':
return 'file'
break;
case 'image':
return 'file-image'
break;
case 'video':
return 'file-video'
break;
case 'file':
return 'file-audio'
break;
}*/
/* switch () {
case 'folder':
return 'folder'
break;
case 'file':
return 'file'
break;
case 'image':
return 'file-image'
break;
case 'video':
return 'file-video'
break;
case 'file':
return 'file-audio'
break;
}*/
},
sharedInfo() {
@@ -123,10 +119,10 @@
switch (this.fileInfoDetail.shared.permission) {
case 'editor':
return 'user-edit'
break
break
case 'visitor':
return 'user'
break
break
default:
return 'download'
}
@@ -199,41 +195,6 @@
}
}
.list-info {
.list-info-item {
display: block;
padding-top: 20px;
&:first-child {
padding-top: 0;
}
.action-button {
cursor: pointer;
.edit-icon {
display: inline-block;
margin-left: 3px;
}
}
b {
display: block;
@include font-size(13);
color: $theme;
margin-bottom: 2px;
}
span {
display: inline-block;
@include font-size(14);
font-weight: bold;
color: $text;
}
}
}
.sharelink {
display: flex;
width: 100%;
@@ -264,23 +225,6 @@
}
}
.list-info {
.list-info-item {
span {
color: $dark_mode_text_primary
}
.action-button {
.icon {
color: $dark_mode_text_primary;
}
}
}
}
.sharelink {
.lock-icon {
@@ -258,9 +258,12 @@
EyeIcon,
},
computed: {
...mapGetters(['fileInfoDetail', 'app']),
...mapGetters(['fileInfoDetail', 'user']),
favourites() {
return this.user.relationships.favourites.data.attributes.folders
},
isInFavourites() {
return this.app.favourites.find(el => el.unique_id == this.fileInfoDetail.unique_id)
return this.favourites.find(el => el.unique_id == this.fileInfoDetail.unique_id)
},
isFile() {
return (this.fileInfoDetail && this.fileInfoDetail.type !== 'folder') && (this.fileInfoDetail && this.fileInfoDetail.type !== 'image')
@@ -292,7 +295,7 @@
}
},
addToFavourites() {
if (this.app.favourites && !this.app.favourites.find(el => el.unique_id == this.fileInfoDetail.unique_id)) {
if (this.favourites && !this.favourites.find(el => el.unique_id == this.fileInfoDetail.unique_id)) {
this.$store.dispatch('addToFavourites', this.fileInfoDetail)
} else {
this.$store.dispatch('removeFromFavourites', this.fileInfoDetail)
@@ -18,7 +18,7 @@ export default {
.progress-bar {
width: 100%;
height: 5px;
background: $dark_background;
background: $light_background;
margin-top: 5px;
border-radius: 10px;
@@ -115,7 +115,7 @@
}
.input-area {
border: 1px solid #ebebeb;
border: 1px solid transparent;
justify-content: space-between;
background: $light_mode_input_background;
@include transition(150ms);
@@ -20,11 +20,13 @@
.setup-box {
padding: 20px;
border-radius: 8px;
margin-bottom: 30px;
.title {
@include font-size(19);
margin-bottom: 15px;
@include font-size(21);
margin-bottom: 5px;
display: block;
font-weight: 700;
}
.description {
@@ -0,0 +1,16 @@
<template>
<ul class="list-info">
<slot></slot>
</ul>
</template>
<script>
export default {
name: 'ListInfo',
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
</style>
@@ -0,0 +1,67 @@
<template>
<li class="list-info-item">
<b>{{ title }}</b>
<span v-if="content">{{ content }}</span>
<slot></slot>
</li>
</template>
<script>
export default {
name: 'ListInfoItem',
props: ['title', 'content']
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.list-info-item {
display: block;
padding-bottom: 20px;
&:first-child {
padding-bottom: 0;
}
.action-button {
cursor: pointer;
.edit-icon {
display: inline-block;
margin-left: 3px;
}
}
b {
display: block;
@include font-size(13);
color: $theme;
margin-bottom: 2px;
}
span {
display: inline-block;
@include font-size(14);
font-weight: bold;
color: $text;
}
}
@media (prefers-color-scheme: dark) {
.list-info-item {
span {
color: $dark_mode_text_primary
}
.action-button {
.icon {
color: $dark_mode_text_primary;
}
}
}
}
</style>
@@ -1,5 +1,5 @@
<template>
<div class="mobile-main-navigation" v-if="app">
<div class="mobile-main-navigation" v-if="user">
<transition name="context-menu">
<nav v-if="isVisible" class="mobile-navigation">
@@ -34,7 +34,7 @@
UserAvatar,
},
computed: {
...mapGetters(['app', 'homeDirectory']),
...mapGetters(['user', 'homeDirectory']),
navigation() {
return [
{
@@ -71,7 +71,7 @@
icon: 'settings',
title: this.$t('menu.admin'),
routeName: 'AdminMobileMenu',
isVisible: this.app.user.role === 'admin',
isVisible: this.user.data.attributes.role === 'admin',
},
{
icon: 'power',
@@ -49,9 +49,15 @@
}
},
created() {
axios.get('/api/public/pricing')
.then(response => {
this.plans = response.data.data
this.plans = response.data.data.filter(plan => {
if (this.$store.getters.user.relationships.subscription)
return plan.data.attributes.capacity > this.$store.getters.user.relationships.subscription.data.attributes.capacity
return true
})
this.$emit('load', false)
})
}
@@ -133,6 +139,7 @@
display: flex;
flex-wrap: wrap;
margin: 0 -25px;
justify-content: center;
}
@media only screen and (max-width: 1024px) {
@@ -97,7 +97,7 @@
required,
},
computed: {
...mapGetters(['app', 'permissionOptions']),
...mapGetters(['permissionOptions']),
itemTypeTitle() {
return this.pickedItem && this.pickedItem.type === 'folder' ? this.$t('types.folder') : this.$t('types.file')
},
+1 -1
View File
@@ -101,7 +101,7 @@
required,
},
computed: {
...mapGetters(['app', 'permissionOptions', 'currentFolder']),
...mapGetters(['user', 'permissionOptions', 'currentFolder']),
isFolder() {
return this.pickedItem && this.pickedItem.type === 'folder'
},
@@ -8,6 +8,7 @@
@click="sort(column.field, column.sortable, index)"
:key="index"
:class="{ sortable: column.sortable }"
v-if="! column.hidden"
>
<span>{{ column.label }}</span>
@@ -0,0 +1,98 @@
<template>
<div class="upgrade-banner">
<div class="header-title">
<hard-drive-icon size="19" class="icon"></hard-drive-icon>
<span class="title">{{ storage.used }}% From {{ storage.capacity_formatted }}</span>
</div>
<div class="content">
<p v-if="storage.used > 95" class="reach-capacity">You reach your storage capacity. Please upgrade.</p>
<p v-else class="reach-capacity">You nearly reach your storage capacity.</p>
</div>
<div class="footer">
<router-link :to="{name: 'UpgradePlan'}" class="button">
Upgrade
</router-link>
</div>
</div>
</template>
<script>
import ButtonBase from '@/components/FilesView/ButtonBase'
import { HardDriveIcon } from 'vue-feather-icons'
export default {
name: 'UpgradeSidebarBanner',
components: {
HardDriveIcon,
ButtonBase,
},
computed: {
storage() {
return this.$store.getters.user.relationships.storage.data.attributes
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.upgrade-banner {
background: rgba($danger, 0.1);
padding: 10px;
border-radius: 6px;
margin: 0 16px;
}
.header-title {
margin-bottom: 12px;
display: flex;
align-items: center;
.icon {
margin-right: 10px;
line, path {
stroke: $danger;
}
}
.title {
@include font-size(13);
font-weight: 800;
color: $danger;
}
}
.content {
margin-bottom: 12px;
p {
@include font-size(12);
color: $danger;
font-weight: 700;
}
}
.button {
background: $danger;
border-radius: 50px;
padding: 6px 0;
width: 100%;
color: white;
text-align: center;
@include font-size(12);
font-weight: 700;
display: block;
box-shadow: 0 4px 10px rgba($danger, 0.35);
}
@media only screen and (max-width: 1024px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
@@ -1,6 +1,6 @@
<template>
<div class="user-avatar" :class="size">
<img :src="app.user.avatar" :alt="app.user.name">
<img :src="user.data.attributes.avatar" :alt="user.data.attributes.name">
</div>
</template>
@@ -13,7 +13,7 @@
'size'
],
computed: {
...mapGetters(['app']),
...mapGetters(['user']),
},
}
</script>
+25 -15
View File
@@ -1,5 +1,5 @@
<template>
<nav class="menu-bar" v-if="app">
<nav class="menu-bar" v-if="user">
<!--Navigation Icons-->
<div class="icon-navigation menu">
@@ -26,13 +26,13 @@
</div>
</router-link>
<router-link :to="{name: 'Profile'}" :class="{'is-active': $isThisRoute($route, ['Password', 'Profile', 'Storage'])}" class="icon-navigation-item settings">
<router-link :to="{name: 'Profile'}" :class="{'is-active': isUserProfileRoute}" class="icon-navigation-item settings">
<div class="button-icon">
<user-icon size="19"></user-icon>
</div>
</router-link>
<router-link v-if="app.user.role === 'admin'" :to="{name: 'Users'}" :class="{'is-active': $isThisRoute($route, adminRoutes)}" class="icon-navigation-item users">
<router-link v-if="user.data.attributes.role === 'admin'" :to="{name: 'Users'}" :class="{'is-active': $isThisRoute($route, adminRoutes)}" class="icon-navigation-item users">
<div class="button-icon">
<settings-icon size="19"></settings-icon>
</div>
@@ -74,24 +74,34 @@
UserIcon,
},
computed: {
...mapGetters(['app']),
...mapGetters(['user']),
isUserProfileRoute() {
return this.$isThisRoute(this.$route, ['Profile', 'Password', 'Storage', 'Invoice', 'Subscription'])
}
},
data() {
return {
adminRoutes: [
'PlanSubscribers',
'PlanSettings',
'PlanDelete',
'GatewayTransactions',
'GatewaySettings',
'UserInvoices',
'UserInvoices',
'UserPassword',
'UserStorage',
'PlanCreate',
'UserCreate',
'UserDelete',
'UserDetail',
'Invoices',
'Gateways',
'Gateway',
'Plans',
'Users',
'User',
'UserDetail',
'UserStorage',
'UserPassword',
'UserDelete',
'Plans',
'Invoices',
'UserInvoices',
'Gateway',
'Gateways',
'GatewaySettings',
'GatewayTransactions',
]
}
},
@@ -1,7 +1,7 @@
<template>
<div class="user-meta" v-if="app">
<b class="name">{{ app.user.name }}</b>
<span class="email">{{ app.user.email }}</span>
<b class="name">{{ user.data.attributes.name }}</b>
<span class="email">{{ user.data.attributes.email }}</span>
</div>
</template>
@@ -12,7 +12,7 @@
export default {
name: 'UserHeadline',
computed: {
...mapGetters(['app']),
...mapGetters(['user']),
},
}
</script>