user management v1.6-alpha.1

This commit is contained in:
carodej
2020-05-27 10:22:33 +02:00
parent 143aca64dc
commit a76d1dec3b
54 changed files with 3489 additions and 535 deletions
+5
View File
@@ -21,6 +21,9 @@
<!--Navigation Sidebar-->
<MenuBar/>
<!--Toastr-->
<ToastrWrapper/>
<!--File page-->
<router-view :class="{'is-scaled-down': isScaledDown}"/>
</div>
@@ -33,6 +36,7 @@
</template>
<script>
import ToastrWrapper from '@/components/Others/Notifications/ToastrWrapper'
import MobileNavigation from '@/components/Others/MobileNavigation'
import MobileMenu from '@/components/FilesView/MobileMenu'
import ShareCreate from '@/components/Others/ShareCreate'
@@ -50,6 +54,7 @@
name: 'app',
components: {
MobileNavigation,
ToastrWrapper,
ShareCreate,
MobileMenu,
ShareEdit,
@@ -27,6 +27,7 @@
border: 0;
padding: 10px 28px;
display: inline-block;
white-space: nowrap;
&:active {
transform: scale(0.95);
@@ -9,6 +9,7 @@
<settings-icon v-if="link.icon === 'settings'" size="17"></settings-icon>
<upload-cloud-icon v-if="link.icon === 'latest'" size="17"></upload-cloud-icon>
<user-icon v-if="link.icon === 'user'" size="17"></user-icon>
<users-icon v-if="link.icon === 'users'" size="17"></users-icon>
<lock-icon v-if="link.icon === 'lock'" size="17"></lock-icon>
</div>
<b class="menu-link">
@@ -28,6 +29,7 @@
Trash2Icon,
PowerIcon,
ShareIcon,
UsersIcon,
UserIcon,
LockIcon,
} from 'vue-feather-icons'
@@ -41,6 +43,7 @@
SettingsIcon,
Trash2Icon,
PowerIcon,
UsersIcon,
ShareIcon,
LockIcon,
UserIcon,
@@ -7,7 +7,7 @@
</div>
<!--Folder Title-->
<div class="location-name">{{ $router.currentRoute.meta.title }}</div>
<div class="location-name">{{ title }}</div>
<!--More Actions-->
<div @click="showMobileNavigation" class="mobile-menu">
@@ -26,6 +26,9 @@
export default {
name: 'MenuBar',
props: [
'title'
],
components: {
ChevronLeftIcon,
MenuIcon,
@@ -46,7 +49,7 @@
@import '@assets/vue-file-manager/_mixins';
.mobile-header {
padding: 10px 15px;
padding: 10px 0;
text-align: center;
background: white;
position: sticky;
@@ -0,0 +1,44 @@
<template>
<b class="color-label" :class="color">
<slot></slot>
</b>
</template>
<script>
export default {
name: 'ColorLabel',
props: ['color'],
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.color-label {
text-transform: capitalize;
@include font-size(12);
display: inline-block;
border-radius: 6px;
font-weight: 700;
padding: 4px 6px;
&.purple {
color: $purple;
background: rgba($purple, 0.1);
}
&.yellow {
color: $yellow;
background: rgba($yellow, 0.1);
}
}
@media only screen and (max-width: 1024px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
@@ -84,6 +84,7 @@
.select {
position: relative;
user-select: none;
width: 100%;
}
.input-options {
@@ -0,0 +1,129 @@
<template>
<div class="setup-box" :class="theme">
<b class="title">{{ title }}</b>
<p class="description">{{ description }}</p>
<slot></slot>
</div>
</template>
<script>
export default {
name: 'SetupBox',
props: ['title', 'description', 'theme'],
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.setup-box {
padding: 20px;
border-radius: 8px;
.title {
@include font-size(19);
margin-bottom: 15px;
display: block;
//color: $theme;
}
.description {
@include font-size(15);
line-height: 1.5;
margin-bottom: 20px;
}
&.base {
background: $light_background;
}
&.danger {
background: $light_background;
.title {
color: $danger;
}
}
/deep/ .form {
margin-top: 20px;
&.block-form {
max-width: 450px;
.single-line-form {
display: flex;
.submit-button {
margin-left: 20px;
}
}
}
}
}
@media only screen and (max-width: 960px) {
.setup-box {
/deep/ .form {
&.block-form {
max-width: 100%;
}
input {
min-width: initial;
}
}
}
}
@media only screen and (max-width: 690px) {
.setup-box {
/deep/ .form.block-form {
.single-line-form {
display: block;
.submit-button {
margin-left: 0;
margin-top: 10px;
}
}
}
}
}
@media (prefers-color-scheme: dark) {
.setup-box {
&.base {
background: $dark_mode_foreground;
}
&.danger {
background: $dark_mode_foreground;
}
/deep/ input {
&[type='text'],
&[type='number'],
.input-area {
background: $dark_mode_background;
}
}
/deep/ .input-area {
background: $dark_mode_background;
}
}
}
</style>
@@ -1,16 +1,16 @@
<template>
<div class="mobile-main-navigation">
<div class="mobile-main-navigation" v-if="app">
<transition name="context-menu">
<nav v-if="isVisible" class="mobile-navigation">
<!--User Info-->
<div class="user-info">
<UserAvatar size="large" />
<UserAvatar size="large"/>
<UserHeadline/>
</div>
<!--Navigation-->
<MenuItemList :navigation="navigation" @menu="action" />
<MenuItemList :navigation="navigation" @menu="action"/>
</nav>
</transition>
<transition name="fade">
@@ -35,11 +35,8 @@
},
computed: {
...mapGetters(['app', 'homeDirectory']),
},
data() {
return {
isVisible: false,
navigation: [
navigation() {
return [
{
icon: 'hard-drive',
title: this.$t('menu.files'),
@@ -70,6 +67,12 @@
routeName: 'MobileSettings',
isVisible: true,
},
{
icon: 'users',
title: this.$t('menu.admin'),
routeName: 'Users',
isVisible: this.app.user.role === 'admin',
},
{
icon: 'power',
title: this.$t('menu.logout'),
@@ -77,6 +80,11 @@
isVisible: true,
},
]
},
},
data() {
return {
isVisible: false,
}
},
methods: {
@@ -0,0 +1,136 @@
<template>
<transition appear name="fade">
<li class="toastr-item" :class="item.type" v-show="isActive">
<div class="toastr-content-wrapper">
<span class="toastr-icon">
<check-icon v-if="item.type == 'success'" size="22"></check-icon>
<x-icon v-if="item.type == 'danger'" size="22"></x-icon>
</span>
<div class="toastr-content">
<p class="toastr-description">{{ item.message }}</p>
</div>
</div>
<div class="progressbar">
<span></span>
</div>
</li>
</transition>
</template>
<script>
import {XIcon, CheckIcon} from 'vue-feather-icons'
export default {
components: {
XIcon,
CheckIcon
},
props: ['item'],
data() {
return {
isActive: 0
}
},
created() {
this.isActive = 1
setTimeout(() => (this.isActive = 0), 5000)
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.fade-enter-active,
.fade-leave-active {
transition: 0.8s ease;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
@include transform(translateX(100%));
}
.toastr-content-wrapper {
display: flex;
align-items: center;
padding: 15px;
box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
}
.progressbar {
position: absolute;
bottom: 0;
left: 0;
right: 0;
opacity: 0.35;
span {
width: 0;
height: 3px;
display: block;
background: $theme;
animation: progressbar 5s linear;
}
}
@keyframes progressbar {
0% {
width: 0;
}
100% {
width: 100%;
}
}
.toastr-item {
max-width: 320px;
margin-bottom: 20px;
position: relative;
overflow: hidden;
display: block;
border-radius: 8px;
.toastr-description {
@include font-size(15);
font-weight: bold;
}
.toastr-icon {
height: 42px;
width: 42px;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0;
font-size: 20px;
}
&.success {
background: $theme_light;
polyline {
stroke: $theme;
}
.toastr-description {
color: $theme;
}
}
&.danger {
background: rgba($danger, 0.1);
polyline {
stroke: $danger;
}
.toastr-description {
color: $danger;
}
}
}
</style>
@@ -0,0 +1,51 @@
<template>
<div id="toastr-wrapper">
<ToastrItem :item="item" v-for="(item, i) in notifications" :key="i"/>
</div>
</template>
<script>
import ToastrItem from '@/components/Others/Notifications/ToastrItem'
import {events} from "@/bus";
export default {
components: {
ToastrItem,
},
data() {
return {
notifications: []
}
},
created() {
events.$on('toaster', notification => this.notifications.push(notification))
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.toastr-list {
transition: all 5s ease;
display: inline-block;
}
.toastr-list-enter,
.toastr-list-leave-to {
opacity: 0;
transform: translateY(-100%);
}
.toastr-list-leave-active {
position: absolute;
}
#toastr-wrapper {
position: absolute;
right: 30px;
top: 30px;
z-index: 10;
}
</style>
@@ -16,7 +16,7 @@
export default {
name: 'PageHeader',
props: [
'title', 'description'
'title'
],
computed: {
...mapGetters(['appSize']),
@@ -44,9 +44,10 @@
align-items: center;
background: white;
z-index: 9;
max-width: 700px;
width: 100%;
margin: 20px auto 30px;
position: sticky;
top: 0;
padding: 20px 0;
.title {
@include font-size(18);
@@ -64,8 +65,6 @@
@media only screen and (max-width: 960px) {
.page-header {
padding: 20px 15px;
margin: 0;
.title {
@include font-size(18);
@@ -0,0 +1,58 @@
<template>
<tr class="table-row">
<td
class="table-cell"
v-for="(collumn, index) in normalizedColumns"
:key="index"
>
<span>{{ collumn }}</span>
</td>
</tr>
</template>
<script>
export default {
props: ['data'],
computed: {
normalizedColumns() {
// Remove ID from object
if (this.data['id']) delete this.data['id']
// Return object
return Object.values(this.data)
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.table-row {
border-radius: 8px;
&:hover {
background: $light_background;
}
.table-cell {
padding-top: 15px;
padding-bottom: 15px;
&:first-child {
padding-left: 15px;
}
&:last-child {
padding-right: 15px;
text-align: right;
}
span {
@include font-size(16);
font-weight: bold;
}
}
}
</style>
@@ -0,0 +1,397 @@
<template>
<div class="datatable">
<table v-if="hasData" class="table">
<thead class="table-header">
<tr>
<td
v-for="(column, index) in columns"
@click="sort(column.field, column.sortable, index)"
:key="index"
:class="{ sortable: column.sortable }"
>
<span>{{ column.label }}</span>
<chevron-up-icon v-if="false" :class="{ 'arrow-down': filter.sort === 'ASC' }" size="14" class="filter-arrow"></chevron-up-icon>
</td>
</tr>
</thead>
<tbody class="table-body">
<slot v-for="row in visibleData" :row="row">
<DatatableCell :data="row" :key="row.id"/>
</slot>
</tbody>
</table>
<div v-if="hasData && paginator" class="paginator-wrapper">
<ul v-if="chunks.length > 1" class="pagination">
<li class="page-item">
<a
@click="goToPage(pageIndex - 1)"
class="page-link"
:class="{ disabled: pageIndex == 0 }"
>
<chevron-left-icon size="14" class="icon"></chevron-left-icon>
</a>
</li>
<li
v-for="(row, index) in chunks"
:key="index"
class="page-item"
@click="goToPage(index)"
>
<a
class="page-link"
:class="{ active: pageIndex == index }">
{{ index + 1 }}
</a>
</li>
<li class="page-item">
<a
@click="goToPage(pageIndex + 1)"
class="page-link"
:class="{ disabled: pageIndex + 1 == chunks.length }"
>
<chevron-right-icon size="14" class="icon"></chevron-right-icon>
</a>
</li>
</ul>
<span class="paginator-info">{{ $t('datatable.paginate_info', {visible: visibleData.length, total: data.length}) }}</span>
</div>
</div>
</template>
<script>
import { ChevronUpIcon, ChevronLeftIcon, ChevronRightIcon } from 'vue-feather-icons'
import DatatableCell from '@/components/Others/Tables/DatatableCell'
import {chunk, sortBy} from 'lodash'
export default {
props: ['columns', 'data', 'scope', 'paginator'],
components: {
ChevronRightIcon,
ChevronLeftIcon,
DatatableCell,
ChevronUpIcon,
},
data() {
return {
items_per_view: 20,
pageIndex: 0,
paginatorVisible: true,
chunks: [],
filter: {
sort: 'DESC',
field: undefined,
index: undefined,
}
}
},
methods: {
goToPage(index) {
if (index == this.chunks.length || index == -1) return
// Update page index
this.pageIndex = index
},
sort(field, sortable, index) {
// Prevent sortable if is disabled
if (!sortable) return
// Set filter
this.filter.field = field
this.filter.index = index
// Set sorting direction
if (this.filter.sort === 'DESC') {
this.filter.sort = 'ASC'
} else if (this.filter.sort === 'ASC') {
this.filter.sort = 'DESC'
}
}
},
computed: {
hasData() {
return this.data.length > 0 ? true : false
},
visibleData() {
// Prefent errors when data is empty
if (!this.hasData) return
// Reconfigure data
if (this.filter.field) {
// Set chunks with sorting
if (this.filter.sort === 'DESC') {
// DESC
this.chunks = chunk(sortBy(this.data, this.filter.field), this.items_per_view)
} else {
// ASC
this.chunks = chunk(sortBy(this.data, this.filter.field).reverse(), this.items_per_view)
}
} else {
// Get data to chunks
this.chunks = chunk(this.data, this.items_per_view)
}
// Return chunks
return this.chunks[this.pageIndex]
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.datatable {
height: 100%;
}
.table-row {
@include transition;
}
.table-row-enter,
.table-row-leave-to {
opacity: 0;
@include transform(translateY(-100%));
}
.table-row-leave-active {
position: absolute;
}
.table {
width: 100%;
border-collapse: collapse;
tr {
width: 100%;
td {
&:first-child {
padding-left: 15px;
}
&:last-child {
padding-right: 15px;
text-align: right;
}
}
}
.table-header {
margin-bottom: 10px;
tr {
td {
padding-top: 10px;
padding-bottom: 10px;
span {
color: #AFAFAF;
font-weight: 700;
@include font-size(12);
}
&.sortable {
cursor: pointer;
}
&:last-child {
text-align: right;
}
}
}
.filter-arrow {
vertical-align: middle;
margin-left: 8px;
@include transition;
path {
fill: $text-muted;
}
&.arrow-down {
@include transform(rotate(180deg));
}
}
span {
font-size: 13px;
color: $text-muted;
font-weight: bold;
}
}
.table-body {
tr {
border-radius: 8px;
&:hover {
background: $light_background;
}
td {
padding-top: 12px;
padding-bottom: 12px;
&:last-child {
button {
margin-right: 0;
}
}
}
}
span, a.page-link {
@include font-size(15);
font-weight: 700;
padding: 10px 0;
display: block;
}
}
}
.pagination {
.page-item {
padding: 3px;
display: inline-block;
}
.page-link {
width: 30px;
height: 30px;
display: block;
color: $text;
border-radius: 6px;
text-align: center;
line-height: 2.4;
font-weight: bold;
font-size: 13px;
cursor: pointer;
@include transition(0.15s);
.icon {
vertical-align: middle;
margin-top: -2px;
}
&:hover:not(.disabled) {
background: $light_background;
color: $text;
}
&.active {
color: $text;
background: $light_background;
}
&.disabled {
background: transparent;
cursor: default;
svg path {
fill: $text-muted;
}
}
}
}
.paginator-wrapper {
margin-top: 30px;
margin-bottom: 40px;
display: flex;
justify-content: space-between;
align-items: center;
.paginator-info {
font-size: 13px;
color: $text-muted;
}
}
.user-preview {
display: flex;
align-items: center;
cursor: pointer;
img {
width: 45px;
margin-right: 22px;
}
}
@media (prefers-color-scheme: dark) {
.table {
.table-header {
tr {
td {
span {
color: $theme;
}
}
}
}
.table-body {
tr {
&:hover {
background: $dark_mode_foreground;
}
}
}
}
.paginator-wrapper {
.paginator-info {
color: $dark_mode_text_secondary;
}
}
.pagination {
.page-link {
color: $dark_mode_text_secondary;
svg polyline {
stroke: $dark_mode_text_primary;
}
&:hover:not(.disabled) {
color: $theme;
background: rgba($theme, 0.1);
}
&.active {
color: $theme;
background: rgba($theme, 0.1);
}
&.disabled {
background: transparent;
cursor: default;
svg polyline {
stroke: $dark_mode_text_secondary;
}
}
}
}
}
</style>
@@ -31,6 +31,12 @@
<settings-icon size="19"></settings-icon>
</div>
</router-link>
<router-link v-if="app.user.role === 'admin'" :to="{name: 'Users'}" :class="{'is-active': $isThisRoute($route, ['Users'])}" class="icon-navigation-item users">
<div class="button-icon">
<users-icon size="19"></users-icon>
</div>
</router-link>
</div>
<!--User avatar & Logout-->
@@ -51,6 +57,7 @@
HardDriveIcon,
SettingsIcon,
Trash2Icon,
UsersIcon,
PowerIcon,
ShareIcon,
} from 'vue-feather-icons'
@@ -64,6 +71,7 @@
Trash2Icon,
PowerIcon,
ShareIcon,
UsersIcon,
},
computed: {
...mapGetters(['app']),
@@ -167,6 +175,16 @@
}
}
}
&.users {
.button-icon {
background: rgba($pink, 0.1);
path, line, polyline, rect, circle {
stroke: $pink;
}
}
}
}
}
+68 -2
View File
@@ -6,7 +6,12 @@
"profile": "User Profile",
"settings_password": "Change Password",
"settings_storage": "Storage",
"settings_mobile": "Settings"
"settings_mobile": "Settings",
"users_user": "User",
"users_detail": "Detail",
"users_storage_usage": "Storage Usage",
"users_password": "Password",
"users_delete": "Delete User"
},
"profile": {
"store_pass": "保存您的密码",
@@ -166,7 +171,8 @@
"logout": "Log Out",
"profile": "Profile Settings",
"password": "Password",
"storage": "Storage"
"storage": "Storage",
"admin": "Admin"
},
"sidebar": {
"favourites": "收藏",
@@ -255,5 +261,65 @@
"popup_paylod_error": {
"title": "File is too large",
"message": "Sorry, your file is too large and can't be uploaded"
},
"popup_deleted_user": {
"title": "User was deleted",
"message": "Your user was deleted with all user data content."
},
"user_box_storage": {
"title": "Change User Storage Capacity",
"description": "Change user storage capacity by input bellow. You have to type only number e.g. value '5' means, user will have 5GB of storage capacity."
},
"user_box_password": {
"title": "Change User Password",
"description": "You can send password reset email via button bellow. User will be redirected to page where he can update password for his account."
},
"user_box_delete": {
"title": "Delete User",
"description": "You can delete your user, but, pay attention! This event is irreversible and all user data include user files will be deleted."
},
"user_box_role": {
"title": "Change User Role",
"description": "You can change role for current user. Admin role can edit or create new users, change storage capacity and any other application settings."
},
"admin_menu": {
"admin_label": "Admin",
"users": "Users"
},
"admin_page_user": {
"select_role": "Select user role",
"save_role": "Save Role",
"label_person_info": "Personal Information",
"label_delete_user": "Type with Case Sensitive user name {user}",
"label_change_capacity": "Type storage capacity in GB",
"placeholder_delete_user": "Type here",
"delete_user": "Delete User",
"change_capacity": "Change Capacity",
"send_password_link": "Send Password Reset Link",
"tabs": {
"detail": "Detail",
"storage": "Storage Usage",
"password": "Password",
"delete": "Delete User"
},
"table": {
"name": "User",
"role": "Role",
"storage_used": "Storage Used",
"storage_capacity": "Storage Capacity",
"action": "Action"
}
},
"toaster": {
"changed_user": "You successfully changed user's role!",
"sended_password": "You successfully send user email for reset password!",
"changed_capacity": "You successfully changed user's storage size!"
},
"roles": {
"admin": "Admin",
"user": "User"
},
"datatable": {
"paginate_info": "Showing 1 - {visible} from {total} records"
}
}
+68 -2
View File
@@ -6,7 +6,12 @@
"profile": "User Profile",
"settings_password": "Change Password",
"settings_storage": "Storage",
"settings_mobile": "Settings"
"settings_mobile": "Settings",
"users_user": "User",
"users_detail": "Detail",
"users_storage_usage": "Storage Usage",
"users_password": "Password",
"users_delete": "Delete User"
},
"profile": {
"store_pass": "Store New Password",
@@ -166,7 +171,8 @@
"logout": "Log Out",
"profile": "Profile Settings",
"password": "Password",
"storage": "Storage"
"storage": "Storage",
"admin": "Admin"
},
"sidebar": {
"favourites": "Favourites",
@@ -255,5 +261,65 @@
"popup_paylod_error": {
"title": "File is too large",
"message": "Sorry, your file is too large and can't be uploaded"
},
"popup_deleted_user": {
"title": "User was deleted",
"message": "Your user was deleted with all user data content."
},
"user_box_storage": {
"title": "Change User Storage Capacity",
"description": "Change user storage capacity by input bellow. You have to type only number e.g. value '5' means, user will have 5GB of storage capacity."
},
"user_box_password": {
"title": "Change User Password",
"description": "You can send password reset email via button bellow. User will be redirected to page where he can update password for his account."
},
"user_box_delete": {
"title": "Delete User",
"description": "You can delete your user, but, pay attention! This event is irreversible and all user data include user files will be deleted."
},
"user_box_role": {
"title": "Change User Role",
"description": "You can change role for current user. Admin role can edit or create new users, change storage capacity and any other application settings."
},
"admin_menu": {
"admin_label": "Admin",
"users": "Users"
},
"admin_page_user": {
"select_role": "Select user role",
"save_role": "Save Role",
"label_person_info": "Personal Information",
"label_delete_user": "Type with Case Sensitive user name {user}",
"label_change_capacity": "Type storage capacity in GB",
"placeholder_delete_user": "Type here",
"delete_user": "Delete User",
"change_capacity": "Change Capacity",
"send_password_link": "Send Password Reset Link",
"tabs": {
"detail": "Detail",
"storage": "Storage Usage",
"password": "Password",
"delete": "Delete User"
},
"table": {
"name": "User",
"role": "Role",
"storage_used": "Storage Used",
"storage_capacity": "Storage Capacity",
"action": "Action"
}
},
"toaster": {
"changed_user": "You successfully changed user's role!",
"sended_password": "You successfully send user email for reset password!",
"changed_capacity": "You successfully changed user's storage size!"
},
"roles": {
"admin": "Admin",
"user": "User"
},
"datatable": {
"paginate_info": "Showing 1 - {visible} from {total} records"
}
}
+68 -2
View File
@@ -6,7 +6,12 @@
"profile": "Uživateľský profil",
"settings_password": "Zmeniť heslo",
"settings_storage": "Úložisko",
"settings_mobile": "Nastavenia"
"settings_mobile": "Nastavenia",
"users_user": "Uživateľ",
"users_detail": "Detail",
"users_storage_usage": "Využitie úložiska",
"users_password": "Heslo",
"users_delete": "Vymazať uživateľa"
},
"profile": {
"store_pass": "Uložiť nové heslo",
@@ -166,7 +171,8 @@
"logout": "Odhlásiť sa",
"profile": "Nastavenia profilu",
"password": "Heslo",
"storage": "Úložisko"
"storage": "Úložisko",
"admin": "Administrácia"
},
"sidebar": {
"favourites": "Obľúbené",
@@ -255,5 +261,65 @@
"popup_paylod_error": {
"title": "Súbor je príliš veľký",
"message": "Prepáčte, súbor je príliš veľký a nemôže byť nahraný."
},
"popup_deleted_user": {
"title": "Uživateľ bol vymazaný",
"message": "Uživateľ bol vymazaný so všetkými uživateľskými dátami."
},
"user_box_storage": {
"title": "Zmeňiť kapacitu úložiska",
"description": "Zmeňiť kapacitu úložiska formulárom nižšie. Môžeš písať iba čiselné hodnoty, napríklad hodnota '5' znamená, že uživateľ bude mať 5GB kapacitz úložiska."
},
"user_box_password": {
"title": "Zmeňiť uživateľské heslo",
"description": "Môžete zmeniť uživateľské heslo zaslaním resetovacieho emailu uživateľovi. Uživateľ bude presmerovaný na stránku, kde si môže zmeniť heslo na nové."
},
"user_box_delete": {
"title": "Vymazať uživateľa",
"description": "Môžete vymazať svojho uživateľa, lenže, dávaj pozor! Táto událosť je nezvratná a všetke uživateľské dáta vrátane uživateľových súborov budú vymazané!"
},
"user_box_role": {
"title": "Zmeniť uživateľskú rolu",
"description": "Môžete zmeniť uživateľskú rolu pre aktuálneho uživateľa. Administrátorska rola môže editovať alebo vytvárať nových uživateľov, zmeniť kapacitu úložiska a mnoho dalších nastavení aplikácie."
},
"admin_menu": {
"admin_label": "Administrácia",
"users": "Uživatelia"
},
"admin_page_user": {
"select_role": "Vyberte uživateľskú rolu",
"save_role": "Uložiť Rolu",
"label_person_info": "Osobné informácie",
"label_delete_user": "Napíšte uživateľovo meno {user}. Rozlišujte medzi malými a veľkými písmenami",
"label_change_capacity": "Vpíšte kapacitu úložiska v GB",
"placeholder_delete_user": "Píšte sem",
"delete_user": "Vymazať uživateľa",
"change_capacity": "Zmeniť kapacitu",
"send_password_link": "Odoslať email s resetom hesla",
"tabs": {
"detail": "Detail",
"storage": "Využitie úložiska",
"password": "Heslo",
"delete": "Vymazať uživateľa"
},
"table": {
"name": "Užívateľ",
"role": "Rola",
"storage_used": "Využitie úložiska",
"storage_capacity": "Kapacita úložiska",
"action": "Akcia"
}
},
"toaster": {
"changed_user": "Úspešne ste zmenili rolu užívateľa",
"sended_password": "Úspešne ste odoslali email uživateľovi pre reset hesla!",
"changed_capacity": "Úspešne ste zmenili kapacitu úložiska uživateľa!"
},
"roles": {
"admin": "Admin",
"user": "Užívateľ"
},
"datatable": {
"paginate_info": "Zobrazuje sa 1 - {visible} z {total} položiek"
}
}
+76
View File
@@ -19,6 +19,15 @@ import SharedFiles from './views/FilePages/SharedFiles'
import MobileSettings from './views/Mobile/MobileSettings'
import Admin from './views/Admin'
import Users from './views/Admin/Users'
import User from './views/Admin/Users/User'
import UserDetail from './views/Admin/Users/UserTabs/UserDetail'
import UserDelete from './views/Admin/Users/UserTabs/UserDelete'
import UserStorage from './views/Admin/Users/UserTabs/UserStorage'
import UserPassword from './views/Admin/Users/UserTabs/UserPassword'
Vue.use(Router)
const router = new Router({
@@ -96,6 +105,73 @@ const router = new Router({
requiresAuth: true
},
},
{
name: 'Admin',
path: '/admin',
component: Admin,
meta: {
requiresAuth: true,
title: 'Admin'
},
children: [
{
name: 'Users',
path: '/admin/users',
component: Users,
meta: {
requiresAuth: true,
title: 'Users'
},
},
{
name: 'User',
path: '/admin/user/:id',
component: User,
meta: {
requiresAuth: true,
title: i18n.t('routes_title.users_user')
},
children: [
{
name: 'UserDetail',
path: '/admin/user/:id/details',
component: UserDetail,
meta: {
requiresAuth: true,
title: i18n.t('routes_title.users_detail')
},
},
{
name: 'UserStorage',
path: '/admin/user/:id/storage',
component: UserStorage,
meta: {
requiresAuth: true,
title: i18n.t('routes_title.users_storage_usage')
},
},
{
name: 'UserPassword',
path: '/admin/user/:id/password',
component: UserPassword,
meta: {
requiresAuth: true,
title: i18n.t('routes_title.users_password')
},
},
{
name: 'UserDelete',
path: '/admin/user/:id/delete',
component: UserDelete,
meta: {
requiresAuth: true,
title: i18n.t('routes_title.users_delete')
},
},
]
},
]
},
{
name: 'Settings',
path: '/settings',
+49
View File
@@ -0,0 +1,49 @@
<template>
<section id="viewport">
<ContentSidebar>
<!--Locations-->
<ContentGroup :title="$t('admin_menu.admin_label')" class="navigator">
<div class="menu-list-wrapper">
<router-link :to="{name: 'Users'}" class="menu-list-item link">
<div class="icon">
<users-icon size="17"></users-icon>
</div>
<div class="label">
{{ $t('admin_menu.users') }}
</div>
</router-link>
</div>
</ContentGroup>
</ContentSidebar>
<router-view/>
</section>
</template>
<script>
import ContentSidebar from '@/components/Sidebar/ContentSidebar'
import ContentGroup from '@/components/Sidebar/ContentGroup'
import { mapGetters } from 'vuex'
import { UsersIcon } from 'vue-feather-icons'
export default {
name: 'Settings',
computed: {
...mapGetters(['config']),
},
components: {
ContentSidebar,
ContentGroup,
UsersIcon,
},
}
</script>
<style lang="scss" scoped>
.user-headline {
margin-bottom: 38px;
}
</style>
+228
View File
@@ -0,0 +1,228 @@
<template>
<div id="single-page">
<div id="page-content" class="full-width" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<PageHeader :title="$router.currentRoute.meta.title"/>
<div class="content-page">
<DatatableWrapper :paginator="true" :columns="columns" :data="users" class="table table-users">
<template scope="{ row }">
<tr>
<td style="width: 320px">
<router-link :to="{name: 'UserDetail', params: {id: row.data.id}}" tag="div" class="user-thumbnail">
<div class="avatar">
<img :src="row.data.attributes.avatar" :alt="row.data.attributes.name">
</div>
<div class="info">
<b class="name">{{ row.data.attributes.name }}</b>
<span class="email">{{ row.data.attributes.email }}</span>
</div>
</router-link>
</td>
<td>
<ColorLabel :color="getRoleColor(row.data.attributes.role)">
{{ row.data.attributes.role }}
</ColorLabel>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.storage.used }}%
</span>
</td>
<td>
<span class="cell-item">
{{ row.data.attributes.storage.capacity_formatted }}
</span>
</td>
<td>
<div class="action-icons">
<router-link :to="{name: 'UserDetail', params: {id: row.data.id}}">
<edit-2-icon size="15" class="icon icon-edit"></edit-2-icon>
</router-link>
<router-link :to="{name: 'UserDelete', params: {id: row.data.id}}">
<trash2-icon size="15" class="icon icon-trash"></trash2-icon>
</router-link>
</div>
</td>
</tr>
</template>
</DatatableWrapper>
</div>
</div>
<div id="loader" v-if="isLoading">
<Spinner></Spinner>
</div>
</div>
</template>
<script>
import DatatableWrapper from '@/components/Others/Tables/DatatableWrapper'
import MobileHeader from '@/components/Mobile/MobileHeader'
import SectionTitle from '@/components/Others/SectionTitle'
import {Trash2Icon, Edit2Icon} from "vue-feather-icons";
import PageHeader from '@/components/Others/PageHeader'
import ColorLabel from '@/components/Others/ColorLabel'
import Spinner from '@/components/FilesView/Spinner'
import axios from 'axios'
export default {
name: 'Profile',
components: {
DatatableWrapper,
SectionTitle,
MobileHeader,
Trash2Icon,
PageHeader,
ColorLabel,
Edit2Icon,
Spinner,
},
data() {
return {
isLoading: true,
users: [],
columns: [
{
label: this.$t('admin_page_user.table.name'),
field: 'attributes.name',
sortable: true
},
{
label: this.$t('admin_page_user.table.role'),
field: 'attributes.role',
sortable: true
},
{
label: this.$t('admin_page_user.table.storage_used'),
field: 'attributes.storage.used',
sortable: true
},
{
label: this.$t('admin_page_user.table.storage_capacity'),
field: 'attributes.storage.capacity',
sortable: true
},
{
label: this.$t('admin_page_user.table.action'),
field: 'action',
sortable: false
},
],
}
},
methods: {
getRoleColor(role) {
switch(role) {
case 'admin':
return 'purple'
break;
case 'user':
return 'yellow'
break;
}
}
},
created() {
axios.get('/api/users')
.then(response => {
this.users = response.data.data
this.isLoading = false
})
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.action-icons {
a {
display: inline-block;
margin-left: 10px;
&:first-child {
margin-left: 0;
}
}
.icon {
cursor: pointer;
circle, path, line, polyline {
stroke: $text;
}
&.icon-trash {
circle, path, line, polyline {
stroke: $red;
}
}
}
}
.table {
.cell-item {
@include font-size(15);
}
}
.user-thumbnail {
display: flex;
align-items: center;
cursor: pointer;
.avatar {
margin-right: 20px;
line-height: 0;
img {
line-height: 0;
width: 48px;
height: 48px;
border-radius: 8px;
}
}
.info {
.name {
display: block;
@include font-size(15);
line-height: 1;
}
.email {
color: $text-muted;
@include font-size(12);
}
}
}
@media (prefers-color-scheme: dark) {
.action-icons {
.icon {
cursor: pointer;
circle, path, line, polyline {
stroke: $dark_mode_text_primary;
}
}
}
.user-thumbnail {
.info {
.email {
color: $dark_mode_text_secondary;
}
}
}
}
</style>
+174
View File
@@ -0,0 +1,174 @@
<template>
<div id="single-page" v-if="app">
<div id="page-content" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<PageHeader :title="$router.currentRoute.meta.title"/>
<div class="content-page">
<!--User thumbnail-->
<div class="user-thumbnail">
<div class="avatar">
<img :src="user.attributes.avatar" :alt="user.attributes.name">
</div>
<div class="info">
<b class="name">
{{ user.attributes.name }}
<ColorLabel color="purple">
{{ user.attributes.role }}
</ColorLabel></b>
<span class="email">{{ user.attributes.email }}</span>
</div>
</div>
<!--Page Tab links-->
<div class="menu-list-wrapper horizontal">
<router-link replace :to="{name: 'UserDetail'}" class="menu-list-item link">
<div class="icon">
<user-icon size="17"></user-icon>
</div>
<div class="label">
{{ $t('admin_page_user.tabs.detail') }}
</div>
</router-link>
<router-link replace :to="{name: 'UserStorage'}" class="menu-list-item link">
<div class="icon">
<hard-drive-icon size="17"></hard-drive-icon>
</div>
<div class="label">
{{ $t('admin_page_user.tabs.storage') }}
</div>
</router-link>
<router-link replace :to="{name: 'UserPassword'}" class="menu-list-item link">
<div class="icon">
<lock-icon size="17"></lock-icon>
</div>
<div class="label">
{{ $t('admin_page_user.tabs.password') }}
</div>
</router-link>
<router-link replace :to="{name: 'UserDelete'}" v-if="user.attributes.name !== app.user.name" class="menu-list-item link">
<div class="icon">
<trash2-icon size="17"></trash2-icon>
</div>
<div class="label">
{{ $t('admin_page_user.tabs.delete') }}
</div>
</router-link>
</div>
<!--Router Content-->
<router-view :user="user" @reload-user="fetchUser" />
</div>
</div>
<div id="loader" v-if="isLoading">
<Spinner></Spinner>
</div>
</div>
</template>
<script>
import { UserIcon, HardDriveIcon, LockIcon, Trash2Icon } from 'vue-feather-icons'
import StorageItemDetail from '@/components/Others/StorageItemDetail'
import MobileHeader from '@/components/Mobile/MobileHeader'
import SectionTitle from '@/components/Others/SectionTitle'
import PageHeader from '@/components/Others/PageHeader'
import ColorLabel from '@/components/Others/ColorLabel'
import Spinner from '@/components/FilesView/Spinner'
import { mapGetters } from 'vuex'
import axios from 'axios'
export default {
name: 'Profile',
components: {
Trash2Icon,
LockIcon,
HardDriveIcon,
StorageItemDetail,
SectionTitle,
MobileHeader,
PageHeader,
ColorLabel,
UserIcon,
Spinner,
},
computed: {
...mapGetters(['app']),
},
data() {
return {
isLoading: true,
user: undefined,
}
},
methods: {
fetchUser() {
axios.get('/api/users/' + this.$route.params.id + '/detail')
.then(response => {
this.user = response.data.data
this.isLoading = false
})
}
},
created() {
this.fetchUser()
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.user-thumbnail {
display: flex;
align-items: center;
cursor: pointer;
.avatar {
margin-right: 20px;
img {
line-height: 0;
width: 62px;
height: 62px;
border-radius: 12px;
}
}
.info {
.name {
display: block;
@include font-size(17);
line-height: 1;
}
.email {
color: $text-muted;
@include font-size(14);
}
}
}
@media only screen and (max-width: 960px) {
}
@media (prefers-color-scheme: dark) {
.user-thumbnail {
.info {
.email {
color: $dark_mode_text_secondary;
}
}
}
}
</style>
@@ -0,0 +1,122 @@
<template>
<div class="page-tab">
<!--Change role-->
<div class="page-tab-group">
<SetupBox
theme="danger"
:title="$t('user_box_delete.title')"
:description="$t('user_box_delete.description')"
>
<ValidationObserver ref="deleteUser" @submit.prevent="deleteUser" v-slot="{ invalid }" tag="form"
class="form block-form">
<ValidationProvider tag="div" class="block-wrapper" v-slot="{ errors }" mode="passive"
name="User name" :rules="'required|is:' + user.attributes.name">
<label>{{ $t('admin_page_user.label_delete_user', {user: user.attributes.name}) }}:</label>
<div class="single-line-form">
<input v-model="userName"
:placeholder="$t('admin_page_user.placeholder_delete_user')"
type="text"
:class="{'is-error': errors[0]}"
/>
<ButtonBase :loading="isSendingRequest" :disabled="isSendingRequest" type="submit"
button-style="danger" class="submit-button">
{{ $t('admin_page_user.delete_user') }}
</ButtonBase>
</div>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
</SetupBox>
</div>
</div>
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import ButtonBase from '@/components/FilesView/ButtonBase'
import SetupBox from '@/components/Others/Forms/SetupBox'
import {required, is} from 'vee-validate/dist/rules'
import {events} from "@/bus"
import axios from 'axios'
export default {
name: 'UserDelete',
props: [
'user'
],
components: {
ValidationProvider,
ValidationObserver,
ButtonBase,
SetupBox,
required,
},
data() {
return {
isSendingRequest: false,
isLoading: false,
userName: '',
}
},
methods: {
async deleteUser() {
// Validate fields
const isValid = await this.$refs.deleteUser.validate();
if (!isValid) return;
this.isSendingRequest = true
axios
.delete(this.$store.getters.api + '/users/' + this.$route.params.id + '/delete',
{
data: {
name: this.userName
}
}
)
.then(() => {
this.isSendingRequest = false
// Show error message
events.$emit('success:open', {
emoji: '👍',
title: this.$t('popup_deleted_user.title'),
message: this.$t('popup_deleted_user.message'),
})
this.$router.push({name: 'Users'})
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
@import '@assets/vue-file-manager/_forms';
.page-tab {
.page-tab-group {
margin-bottom: 45px;
}
}
.block-form {
max-width: 100%;
}
@media only screen and (max-width: 960px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
@@ -0,0 +1,165 @@
<template>
<div class="page-tab">
<!--Change role-->
<div class="page-tab-group">
<SetupBox
theme="base"
:title="$t('user_box_role.title')"
:description="$t('user_box_role.description')"
>
<ValidationObserver ref="changeRole" @submit.prevent="changeRole" v-slot="{ invalid }" tag="form" class="form block-form">
<ValidationProvider tag="div" class="block-wrapper" v-slot="{ errors }" mode="passive" name="Role" rules="required">
<label>{{ $t('admin_page_user.select_role') }}:</label>
<div class="single-line-form">
<SelectInput v-model="userRole" :options="roles" :placeholder="$t('admin_page_user.select_role')" :isError="errors[0]"/>
<ButtonBase :loading="isSendingRequest" :disabled="isSendingRequest" type="submit" button-style="theme" class="submit-button">
{{ $t('admin_page_user.save_role') }}
</ButtonBase>
</div>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
</SetupBox>
</div>
<!--Personal Information-->
<div class="page-tab-group">
<ValidationObserver ref="personalInformation" v-slot="{ invalid }" tag="form" class="form block-form">
<b class="form-group-label">{{ $t('admin_page_user.label_person_info') }}</b>
<div class="wrapper-inline">
<!--Email-->
<div class="block-wrapper">
<label>{{ $t('page_registration.label_email') }}</label>
<div class="input-wrapper">
<input :value="user.attributes.email" :placeholder="$t('page_registration.placeholder_email')" type="email" disabled />
</div>
</div>
<!--Name-->
<div class="block-wrapper">
<label>{{ $t('page_registration.label_name') }}</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Full Name" rules="required"
v-slot="{ errors }">
<input :value="user.attributes.name"
:placeholder="$t('page_registration.placeholder_name')"
type="text"
disabled
/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
</div>
</ValidationObserver>
</div>
</div>
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import StorageItemDetail from '@/components/Others/StorageItemDetail'
import SelectInput from '@/components/Others/Forms/SelectInput'
import ButtonBase from '@/components/FilesView/ButtonBase'
import SetupBox from '@/components/Others/Forms/SetupBox'
import {required} from 'vee-validate/dist/rules'
import {events} from "@/bus"
import axios from 'axios'
export default {
name: 'UserDetail',
props: [
'user'
],
components: {
ValidationProvider,
ValidationObserver,
StorageItemDetail,
SelectInput,
ButtonBase,
SetupBox,
required,
},
data() {
return {
isLoading: false,
isSendingRequest: false,
roles: [
{
label: this.$t('roles.admin'),
value: 'admin',
},
{
label: this.$t('roles.user'),
value: 'user',
},
],
userRole: undefined,
}
},
methods: {
async changeRole() {
// Validate fields
const isValid = await this.$refs.changeRole.validate();
if (!isValid) return;
this.isSendingRequest = true
// Send request to get user reset link
axios
.patch(this.$store.getters.api + '/users/' + this.$route.params.id + '/role', {
attributes: {
role: this.userRole,
}
})
.then(() => {
// Reset errors
this.$refs.changeRole.reset()
this.isSendingRequest = false
this.$emit('reload-user')
events.$emit('toaster', {
type: 'success',
message: this.$t('toaster.changed_user'),
})
})
.catch(error => {
this.isSendingRequest = false
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
@import '@assets/vue-file-manager/_forms';
.page-tab {
.page-tab-group {
margin-bottom: 45px;
}
}
.block-form {
max-width: 100%;
}
@media only screen and (max-width: 960px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
@@ -0,0 +1,90 @@
<template>
<div class="page-tab">
<!--Change role-->
<div class="page-tab-group">
<SetupBox
theme="base"
:title="$t('user_box_password.title')"
:description="$t('user_box_password.description')"
>
<ButtonBase @click.native="requestPasswordResetEmail" :loading="isSendingRequest"
:disabled="isSendingRequest" type="submit" button-style="theme" class="submit-button">
{{ $t('admin_page_user.send_password_link') }}
</ButtonBase>
</SetupBox>
</div>
</div>
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import ButtonBase from '@/components/FilesView/ButtonBase'
import SetupBox from '@/components/Others/Forms/SetupBox'
import {required} from 'vee-validate/dist/rules'
import {events} from "@/bus"
import axios from 'axios'
export default {
name: 'UserPassword',
components: {
ValidationProvider,
ValidationObserver,
ButtonBase,
SetupBox,
required,
},
data() {
return {
isLoading: false,
isSendingRequest: false,
}
},
methods: {
requestPasswordResetEmail() {
this.isSendingRequest = true
axios
.post(this.$store.getters.api + '/users/' + this.$route.params.id + '/send-password-email',
{}
)
.then(() => {
this.isSendingRequest = false
events.$emit('toaster', {
type: 'success',
message: this.$t('toaster.sended_password'),
})
})
}
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
@import '@assets/vue-file-manager/_forms';
.page-tab {
.page-tab-group {
margin-bottom: 45px;
}
}
.block-form {
max-width: 100%;
}
@media only screen and (max-width: 960px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
@@ -0,0 +1,150 @@
<template>
<div class="page-tab" v-if="storage">
<!--Change role-->
<div class="page-tab-group">
<StorageItemDetail
type="disk"
:title="$t('storage.total_used', {used: storage.attributes.used})"
:percentage="storage.attributes.percentage"
:used="$t('storage.total_capacity', {capacity: storage.attributes.capacity})"
/>
<SetupBox
theme="base"
:title="$t('user_box_storage.title')"
:description="$t('user_box_storage.description')"
>
<ValidationObserver ref="changeStorageCapacity" @submit.prevent="changeStorageCapacity" v-slot="{ invalid }" tag="form" class="form block-form">
<ValidationProvider tag="div" class="block-wrapper" v-slot="{ errors }" mode="passive" name="Capacity" rules="required">
<label>{{ $t('admin_page_user.label_change_capacity') }}:</label>
<div class="single-line-form">
<input v-model="capacity"
:placeholder="$t('admin_page_user.label_change_capacity')"
type="number"
:class="{'is-error': errors[0]}"
/>
<ButtonBase :loading="isSendingRequest" :disabled="isSendingRequest" type="submit" button-style="theme" class="submit-button">
{{ $t('admin_page_user.change_capacity') }}
</ButtonBase>
</div>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</ValidationObserver>
</SetupBox>
</div>
<div class="page-tab-group">
<b class="form-group-label">{{ $t('storage.sec_details') }}</b>
<StorageItemDetail type="images" :title="$t('storage.images')" :percentage="storage.meta.images.percentage" :used="storage.meta.images.used" />
<StorageItemDetail type="videos" :title="$t('storage.videos')" :percentage="storage.meta.videos.percentage" :used="storage.meta.videos.used" />
<StorageItemDetail type="audios" :title="$t('storage.audios')" :percentage="storage.meta.audios.percentage" :used="storage.meta.audios.used" />
<StorageItemDetail type="documents" :title="$t('storage.documents')" :percentage="storage.meta.documents.percentage" :used="storage.meta.documents.used" />
<StorageItemDetail type="others" :title="$t('storage.others')" :percentage="storage.meta.others.percentage" :used="storage.meta.others.used" />
</div>
</div>
</template>
<script>
import {ValidationProvider, ValidationObserver} from 'vee-validate/dist/vee-validate.full'
import StorageItemDetail from '@/components/Others/StorageItemDetail'
import ButtonBase from '@/components/FilesView/ButtonBase'
import SetupBox from '@/components/Others/Forms/SetupBox'
import {required} from 'vee-validate/dist/rules'
import {events} from "@/bus"
import axios from 'axios'
export default {
name: 'UserStorage',
components: {
ValidationProvider,
ValidationObserver,
StorageItemDetail,
ButtonBase,
SetupBox,
required,
},
data() {
return {
isLoading: true,
isSendingRequest: false,
capacity: undefined,
storage: undefined,
}
},
methods: {
async changeStorageCapacity() {
// Validate fields
const isValid = await this.$refs.changeStorageCapacity.validate();
if (!isValid) return;
this.isSendingRequest = true
// Send request to get user reset link
axios
.patch(this.$store.getters.api + '/users/' + this.$route.params.id + '/capacity', {
attributes: {
storage_capacity: this.capacity
}
})
.then(() => {
// Reset errors
this.$refs.changeStorageCapacity.reset()
this.isSendingRequest = false
this.getStorageDetails()
events.$emit('toaster', {
type: 'success',
message: this.$t('toaster.changed_capacity'),
})
})
.catch(error => {
this.isSendingRequest = false
})
},
getStorageDetails() {
axios.get('/api/users/' + this.$route.params.id + '/storage')
.then(response => {
this.storage = response.data.data
this.isLoading = false
})
}
},
created() {
this.getStorageDetails()
}
}
</script>
<style lang="scss" scoped>
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
@import '@assets/vue-file-manager/_forms';
.page-tab {
.page-tab-group {
margin-bottom: 45px;
}
}
.block-form {
max-width: 100%;
}
@media only screen and (max-width: 960px) {
}
@media (prefers-color-scheme: dark) {
}
</style>
+2 -2
View File
@@ -86,8 +86,8 @@
return {
isLoading: false,
checkedAccount: undefined,
loginPassword: '',
loginEmail: '',
loginPassword: 'vuefilemanager',
loginEmail: 'howdy@hi5ve.digital',
}
},
methods: {
+13 -13
View File
@@ -1,13 +1,18 @@
<template>
<div class="page">
<div id="single-page">
<div id="page-content" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<div class="content-page">
<nav class="mobile-navigation">
<MobileHeader />
<nav class="mobile-navigation">
<!--Navigation-->
<MenuItemList :navigation="navigation" />
</nav>
<!--Navigation-->
<MenuItemList :navigation="navigation" />
</nav>
</div>
</div>
<div id="loader" v-if="isLoading">
<Spinner></Spinner>
</div>
</div>
</template>
@@ -60,12 +65,7 @@
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
.page {
width: 100%;
}
.mobile-navigation {
padding: 0 20px;
width: 100%;
bottom: 0;
left: 0;
+38 -57
View File
@@ -1,42 +1,46 @@
<template>
<div id="user-settings">
<div id="single-page">
<div id="page-content" class="full-width" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<PageHeader :title="$router.currentRoute.meta.title"/>
<MobileHeader />
<PageHeader :title="$router.currentRoute.meta.title"/>
<div class="content-page">
<div class="content-page">
<ValidationObserver ref="password" @submit.prevent="resetPassword" v-slot="{ invalid }" tag="form"
class="form block-form">
<ValidationObserver ref="password" @submit.prevent="resetPassword" v-slot="{ invalid }" tag="form"
class="form block-form">
<div class="block-wrapper">
<label>{{ $t('page_create_password.label_new_pass') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="New Password"
rules="required" v-slot="{ errors }">
<input v-model="newPassword" :placeholder="$t('page_create_password.label_new_pass')"
type="password"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('page_create_password.label_new_pass') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="New Password"
rules="required" v-slot="{ errors }">
<input v-model="newPassword" :placeholder="$t('page_create_password.label_new_pass')"
type="password"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('page_create_password.label_confirm_pass') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Confirm Your Password"
rules="required" v-slot="{ errors }">
<input v-model="newPasswordConfirmation"
:placeholder="$t('page_create_password.label_confirm_pass')" type="password"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<label>{{ $t('page_create_password.label_confirm_pass') }}:</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Confirm Your Password"
rules="required" v-slot="{ errors }">
<input v-model="newPasswordConfirmation"
:placeholder="$t('page_create_password.label_confirm_pass')" type="password"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
<div class="block-wrapper">
<ButtonBase type="submit" button-style="theme" class="confirm-form">
{{ $t('profile.store_pass') }}
</ButtonBase>
</div>
</ValidationObserver>
<div class="block-wrapper">
<ButtonBase type="submit" button-style="theme" class="confirm-form">
{{ $t('profile.store_pass') }}
</ButtonBase>
</div>
</ValidationObserver>
</div>
</div>
<div id="loader" v-if="isLoading">
<Spinner></Spinner>
</div>
</div>
</template>
@@ -72,6 +76,7 @@
return {
newPasswordConfirmation: '',
newPassword: '',
isLoading: false,
}
},
methods: {
@@ -125,32 +130,8 @@
@import '@assets/vue-file-manager/_mixins';
@import '@assets/vue-file-manager/_forms';
#user-settings {
overflow: hidden;
width: 100%;
height: 100%;
position: relative;
.content-page {
overflow-y: auto;
height: 100%;
padding-bottom: 100px;
max-width: 700px;
width: 100%;
margin: 0 auto;
}
}
@media only screen and (max-width: 960px) {
#user-settings {
.content-page {
padding-left: 15px;
padding-right: 15px;
}
}
.form {
.button-base {
width: 100%;
+38 -57
View File
@@ -1,41 +1,45 @@
<template>
<div id="user-settings" v-if="app">
<div id="single-page">
<div id="page-content" class="full-width" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<PageHeader :title="$router.currentRoute.meta.title"/>
<MobileHeader />
<PageHeader :title="$router.currentRoute.meta.title" />
<div class="content-page">
<div class="avatar-upload">
<UserImageInput
v-model="avatar"
:avatar="app.user.avatar"
/>
<div class="info">
<span class="description">{{ $t('profile.photo_description') }}</span>
<span class="supported">{{ $t('profile.photo_supported') }}</span>
</div>
</div>
<ValidationObserver ref="account" v-slot="{ invalid }" tag="form" class="form block-form">
<div class="block-wrapper">
<label>{{ $t('page_registration.label_email') }}</label>
<div class="input-wrapper">
<input :value="app.user.email" :placeholder="$t('page_registration.placeholder_email')" type="email" disabled/>
<div class="content-page">
<div class="avatar-upload">
<UserImageInput
v-model="avatar"
:avatar="app.user.avatar"
/>
<div class="info">
<span class="description">{{ $t('profile.photo_description') }}</span>
<span class="supported">{{ $t('profile.photo_supported') }}</span>
</div>
</div>
<div class="block-wrapper">
<label>{{ $t('page_registration.label_name') }}</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Full Name" rules="required"
v-slot="{ errors }">
<input @keyup="$updateText('/user/profile', 'name', name)" v-model="name"
:placeholder="$t('page_registration.placeholder_name')" type="text"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
</ValidationObserver>
<ValidationObserver ref="account" v-slot="{ invalid }" tag="form" class="form block-form">
<div class="block-wrapper">
<label>{{ $t('page_registration.label_email') }}</label>
<div class="input-wrapper">
<input :value="app.user.email" :placeholder="$t('page_registration.placeholder_email')" type="email" disabled/>
</div>
</div>
<div class="block-wrapper">
<label>{{ $t('page_registration.label_name') }}</label>
<ValidationProvider tag="div" mode="passive" class="input-wrapper" name="Full Name" rules="required"
v-slot="{ errors }">
<input @keyup="$updateText('/user/profile', 'name', name)" v-model="name"
:placeholder="$t('page_registration.placeholder_name')" type="text"
:class="{'is-error': errors[0]}"/>
<span class="error-message" v-if="errors[0]">{{ errors[0] }}</span>
</ValidationProvider>
</div>
</ValidationObserver>
</div>
</div>
<div id="loader" v-if="isLoading">
<Spinner></Spinner>
</div>
</div>
</template>
@@ -79,6 +83,7 @@
return {
avatar: undefined,
name: '',
isLoading: false,
}
},
created() {
@@ -118,32 +123,8 @@
}
}
#user-settings {
overflow: hidden;
width: 100%;
height: 100%;
position: relative;
.content-page {
overflow-y: auto;
height: 100%;
padding-bottom: 100px;
max-width: 700px;
width: 100%;
margin: 0 auto;
}
}
@media only screen and (max-width: 960px) {
#user-settings {
.content-page {
padding-left: 15px;
padding-right: 15px;
}
}
.form {
.button-base {
width: 100%;
+9 -11
View File
@@ -1,19 +1,19 @@
<template>
<div id="single-page">
<div id="page-content" v-if="! isLoading">
<MobileHeader/>
<div id="page-content" class="full-width" v-if="! isLoading">
<MobileHeader :title="$router.currentRoute.meta.title"/>
<PageHeader :title="$router.currentRoute.meta.title"/>
<div class="content-page">
<SectionTitle>{{ $t('storage.sec_capacity') }}</SectionTitle>
<StorageItemDetail type="disk" :title="$t('storage.total_used', {used: storage.used})" :percentage="storage.percentage" :used="$t('storage.total_capacity', {capacity: storage.capacity})"/>
<StorageItemDetail type="disk" :title="$t('storage.total_used', {used: storage.attributes.used})" :percentage="storage.attributes.percentage" :used="$t('storage.total_capacity', {capacity: storage.attributes.capacity})"/>
<SectionTitle>{{ $t('storage.sec_details') }}</SectionTitle>
<StorageItemDetail type="images" :title="$t('storage.images')" :percentage="storageDetails.images.percentage" :used="storageDetails.images.used" />
<StorageItemDetail type="videos" :title="$t('storage.videos')" :percentage="storageDetails.videos.percentage" :used="storageDetails.videos.used" />
<StorageItemDetail type="audios" :title="$t('storage.audios')" :percentage="storageDetails.audios.percentage" :used="storageDetails.audios.used" />
<StorageItemDetail type="documents" :title="$t('storage.documents')" :percentage="storageDetails.documents.percentage" :used="storageDetails.documents.used" />
<StorageItemDetail type="others" :title="$t('storage.others')" :percentage="storageDetails.others.percentage" :used="storageDetails.others.used" />
<StorageItemDetail type="images" :title="$t('storage.images')" :percentage="storage.meta.images.percentage" :used="storage.meta.images.used" />
<StorageItemDetail type="videos" :title="$t('storage.videos')" :percentage="storage.meta.videos.percentage" :used="storage.meta.videos.used" />
<StorageItemDetail type="audios" :title="$t('storage.audios')" :percentage="storage.meta.audios.percentage" :used="storage.meta.audios.used" />
<StorageItemDetail type="documents" :title="$t('storage.documents')" :percentage="storage.meta.documents.percentage" :used="storage.meta.documents.used" />
<StorageItemDetail type="others" :title="$t('storage.others')" :percentage="storage.meta.others.percentage" :used="storage.meta.others.used" />
</div>
</div>
<div id="loader" v-if="isLoading">
@@ -43,14 +43,12 @@
return {
isLoading: true,
storage: undefined,
storageDetails: undefined
}
},
created() {
axios.get('/api/user/storage')
.then(response => {
this.storage = response.data.data.attributes
this.storageDetails = response.data.data.relationships
this.storage = response.data.data
this.isLoading = false
})
}
+66 -5
View File
@@ -1,5 +1,4 @@
// Fonts
@import '@assets/vue-file-manager/_variables';
@import '@assets/vue-file-manager/_mixins';
@@ -19,14 +18,60 @@
}
}
#single-page {
overflow-x: hidden;
width: 100%;
height: 100%;
position: relative;
padding-left: 25px;
padding-right: 25px;
.page-content {
height: 100%;
max-width: 1024px;
width: 100%;
margin: 0 auto;
.full-width {
max-width: 100%;
}
}
}
.menu-list-wrapper {
margin-bottom: 20px;
&.vertical {
margin-bottom: 20px;
.menu-list-item {
display: block;
padding: 12px 15px 12px 25px;
}
}
&.horizontal {
display: flex;
border-bottom: 2px solid $light_mode_border;
margin-bottom: 30px;
overflow-x: auto;
.menu-list-item {
display: inline-block;
padding: 20px 10px;
margin: 0 10px;
&:first-child {
margin-left: 0;
}
&.router-link-exact-active {
border-bottom: 2px solid $theme;
}
}
}
.menu-list-item {
display: block;
padding: 12px 15px 12px 25px;
text-decoration: none;
@include transition(150ms);
cursor: pointer;
position: relative;
white-space: nowrap;
@@ -165,10 +210,26 @@
}
}
@media only screen and (max-width: 960px) {
#single-page {
padding-left: 15px;
padding-right: 15px;
}
}
@media (prefers-color-scheme: dark) {
.empty-note {
color: $dark_mode_text_secondary;
}
.menu-list-wrapper {
&.horizontal {
border-bottom: 2px solid $dark_mode_border_color;
}
.menu-list-item {
&.link {
+37 -10
View File
@@ -22,6 +22,16 @@
&.block-form {
.wrapper-inline {
display: flex;
margin: 0 -15px;
.block-wrapper {
width: 100%;
padding: 0 15px;
}
}
.block-wrapper {
margin-bottom: 20px;
@@ -32,6 +42,10 @@
display: block;
margin-bottom: 5px;
}
&:last-child {
margin-bottom: 0;
}
}
.button {
@@ -40,15 +54,12 @@
}
}
.input-wrapper {
.error-message {
@include font-size(14);
color: $danger;
padding-top: 5px;
display: block;
text-align: left;
}
.error-message {
@include font-size(14);
color: $danger;
padding-top: 5px;
display: block;
text-align: left;
}
textarea {
@@ -58,6 +69,7 @@ textarea {
textarea,
input[type="password"],
input[type="text"],
input[type="number"],
input[type="email"] {
border: 1px solid transparent;
@include transition(150ms);
@@ -76,7 +88,6 @@ input[type="email"] {
}
&::placeholder {
//color: $light_text;
color: rgba($text, 0.5);
@include font-size(15);
}
@@ -108,6 +119,13 @@ input[type="email"] {
}
}
.form-group-label {
@include font-size(17);
font-weight: 500;
margin-bottom: 25px;
display: block;
}
@media only screen and (max-width: 960px) {
.form {
@@ -163,12 +181,20 @@ input[type="email"] {
textarea,
input[type="password"],
input[type="number"],
input[type="text"],
input[type="email"] {
padding: 14px 20px;
}
}
@media only screen and (max-width: 690px) {
.form.block-form .wrapper-inline {
display: block;
}
}
@media (prefers-color-scheme: dark) {
.form {
@@ -184,6 +210,7 @@ input[type="email"] {
textarea,
input[type="password"],
input[type="text"],
input[type="number"],
input[type="email"] {
background: $dark_mode_foreground;
color: $dark_mode_text_primary;
+1
View File
@@ -3,6 +3,7 @@ $text: #1c1d1f;
$text-muted: rgba($text, 0.7);
$theme: #00BC7E;
$theme_light: #ECF7F2;
$yellow: #FFBD2D;
$pink: #FE66A1;