DesktopToolbar.vue refactoring

This commit is contained in:
Peter Papp
2021-08-20 16:49:51 +02:00
parent 15fba236d7
commit fb6dfbe7b4
6 changed files with 117 additions and 103 deletions

View File

@@ -56,7 +56,7 @@
"/chunks/plan-settings.js": "/chunks/plan-settings.js?id=17469545c5b6a16c3bbf", "/chunks/plan-settings.js": "/chunks/plan-settings.js?id=17469545c5b6a16c3bbf",
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=0dd0a5efe0e3cb511c48", "/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=0dd0a5efe0e3cb511c48",
"/chunks/plans.js": "/chunks/plans.js?id=5a3c28288952fcad96e5", "/chunks/plans.js": "/chunks/plans.js?id=5a3c28288952fcad96e5",
"/chunks/platform.js": "/chunks/platform.js?id=6b3eb780969c508cbb61", "/chunks/platform.js": "/chunks/platform.js?id=ac3117837560f59645c5",
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=3434322e91f37e1887a6", "/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=3434322e91f37e1887a6",
"/chunks/profile.js": "/chunks/profile.js?id=658aa03af778cc2cc100", "/chunks/profile.js": "/chunks/profile.js?id=658aa03af778cc2cc100",
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=ddb7be518c092ed392ca", "/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=ddb7be518c092ed392ca",
@@ -113,7 +113,7 @@
"/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/platform~chunk~4546fed3.js": "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/platform~chunk~4546fed3.js?id=dcb0f3eb29f9bb036a83", "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/platform~chunk~4546fed3.js": "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/platform~chunk~4546fed3.js?id=dcb0f3eb29f9bb036a83",
"/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/settings~chunk~4e1df859.js": "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/settings~chunk~4e1df859.js?id=ce01da2eb15ee1ebede4", "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/settings~chunk~4e1df859.js": "/chunks/app-language~chunks/dashboard~chunks/invoices~chunks/pages~chunks/plans~chunks/settings~chunk~4e1df859.js?id=ce01da2eb15ee1ebede4",
"/chunks/files.61f541e551bb6ae551ff.hot-update.js": "/chunks/files.61f541e551bb6ae551ff.hot-update.js", "/chunks/files.61f541e551bb6ae551ff.hot-update.js": "/chunks/files.61f541e551bb6ae551ff.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.js": "/chunks/platform~chunks/shared/file-browser.js?id=3f11d3ce9b514da8ee77", "/chunks/platform~chunks/shared/file-browser.js": "/chunks/platform~chunks/shared/file-browser.js?id=f615296acb04c58b1941",
"/chunks/platform~chunks/shared~chunks/shared/file-browser.js": "/chunks/platform~chunks/shared~chunks/shared/file-browser.js?id=6ba92eab6a45cbab3af5", "/chunks/platform~chunks/shared~chunks/shared/file-browser.js": "/chunks/platform~chunks/shared~chunks/shared/file-browser.js?id=6ba92eab6a45cbab3af5",
"/chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js?id=c9e60ce6e02af680eeaa", "/chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js": "/chunks/platform~chunks/shared~chunks/shared/file-browser~chunks/shared/single-file.js?id=c9e60ce6e02af680eeaa",
"/chunks/settings-subscription~chunks/shared/file-browser~chunks/user-subscription.js": "/chunks/settings-subscription~chunks/shared/file-browser~chunks/user-subscription.js?id=439e216b216fc2572483", "/chunks/settings-subscription~chunks/shared/file-browser~chunks/user-subscription.js": "/chunks/settings-subscription~chunks/shared/file-browser~chunks/user-subscription.js?id=439e216b216fc2572483",
@@ -341,5 +341,57 @@
"/js/main.cb31c8e951615eb1e3a1.hot-update.js": "/js/main.cb31c8e951615eb1e3a1.hot-update.js", "/js/main.cb31c8e951615eb1e3a1.hot-update.js": "/js/main.cb31c8e951615eb1e3a1.hot-update.js",
"/js/main.e123ff26f3f3f227b8fe.hot-update.js": "/js/main.e123ff26f3f3f227b8fe.hot-update.js", "/js/main.e123ff26f3f3f227b8fe.hot-update.js": "/js/main.e123ff26f3f3f227b8fe.hot-update.js",
"/chunks/admin~chunks/platform.068c46bd7c6b6bbeef39.hot-update.js": "/chunks/admin~chunks/platform.068c46bd7c6b6bbeef39.hot-update.js", "/chunks/admin~chunks/platform.068c46bd7c6b6bbeef39.hot-update.js": "/chunks/admin~chunks/platform.068c46bd7c6b6bbeef39.hot-update.js",
"/chunks/admin~chunks/platform.5bca50650c704e335f3d.hot-update.js": "/chunks/admin~chunks/platform.5bca50650c704e335f3d.hot-update.js" "/chunks/admin~chunks/platform.5bca50650c704e335f3d.hot-update.js": "/chunks/admin~chunks/platform.5bca50650c704e335f3d.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.81a4a0c4265d11836cd3.hot-update.js": "/chunks/platform~chunks/shared/file-browser.81a4a0c4265d11836cd3.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.800217d4ad22f50667af.hot-update.js": "/chunks/platform~chunks/shared/file-browser.800217d4ad22f50667af.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.703fadf87f83f74d1a92.hot-update.js": "/chunks/platform~chunks/shared/file-browser.703fadf87f83f74d1a92.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.74455257d5204840b3c7.hot-update.js": "/chunks/platform~chunks/shared/file-browser.74455257d5204840b3c7.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.dfad226ef06cbbe0c4b5.hot-update.js": "/chunks/platform~chunks/shared/file-browser.dfad226ef06cbbe0c4b5.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.9ae4d81fae707d9710fc.hot-update.js": "/chunks/platform~chunks/shared/file-browser.9ae4d81fae707d9710fc.hot-update.js",
"/js/main.4068697b323c3409a72d.hot-update.js": "/js/main.4068697b323c3409a72d.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.20a7b0f5cb8819bb6a10.hot-update.js": "/chunks/platform~chunks/shared/file-browser.20a7b0f5cb8819bb6a10.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.a357f0733f38a22865cb.hot-update.js": "/chunks/platform~chunks/shared/file-browser.a357f0733f38a22865cb.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.de1f7c6ff6707374236f.hot-update.js": "/chunks/platform~chunks/shared/file-browser.de1f7c6ff6707374236f.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.a152f2b58898438412f8.hot-update.js": "/chunks/platform~chunks/shared/file-browser.a152f2b58898438412f8.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.63e642d119be863fa918.hot-update.js": "/chunks/platform~chunks/shared/file-browser.63e642d119be863fa918.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.f35b09f6b17f016e66d5.hot-update.js": "/chunks/platform~chunks/shared/file-browser.f35b09f6b17f016e66d5.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.68ffb41173a4e7bc0d9e.hot-update.js": "/chunks/platform~chunks/shared/file-browser.68ffb41173a4e7bc0d9e.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.1599a1861545cb20db7b.hot-update.js": "/chunks/platform~chunks/shared/file-browser.1599a1861545cb20db7b.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.c103ad01032007ee897e.hot-update.js": "/chunks/platform~chunks/shared/file-browser.c103ad01032007ee897e.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.fc94ef3f0f85f6c6a4c9.hot-update.js": "/chunks/platform~chunks/shared/file-browser.fc94ef3f0f85f6c6a4c9.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.02804e1991b5f7099fc7.hot-update.js": "/chunks/platform~chunks/shared/file-browser.02804e1991b5f7099fc7.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.3d9671bb0e803e65e41f.hot-update.js": "/chunks/platform~chunks/shared/file-browser.3d9671bb0e803e65e41f.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.3134a6abfad5a7ba7631.hot-update.js": "/chunks/platform~chunks/shared/file-browser.3134a6abfad5a7ba7631.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.e48050ba6c1b226da029.hot-update.js": "/chunks/platform~chunks/shared/file-browser.e48050ba6c1b226da029.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.4f35431e744ed66774a2.hot-update.js": "/chunks/platform~chunks/shared/file-browser.4f35431e744ed66774a2.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.b8cc2c5aded88db7d706.hot-update.js": "/chunks/platform~chunks/shared/file-browser.b8cc2c5aded88db7d706.hot-update.js",
"/js/main.46480f5b3108b998bd4e.hot-update.js": "/js/main.46480f5b3108b998bd4e.hot-update.js",
"/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared~738b0c2f.js": "/chunks/admin~chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared~738b0c2f.js?id=1cfe4349f2fbc54a6884",
"/chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared/file-browser~d426c4eb.46480f5b3108b998bd4e.hot-update.js": "/chunks/files~chunks/my-shared-items~chunks/platform~chunks/recent-uploads~chunks/shared/file-browser~d426c4eb.46480f5b3108b998bd4e.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.46480f5b3108b998bd4e.hot-update.js": "/chunks/platform~chunks/shared/file-browser.46480f5b3108b998bd4e.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.9302f42000c71a07b1a7.hot-update.js": "/chunks/platform~chunks/shared/file-browser.9302f42000c71a07b1a7.hot-update.js",
"/js/main.7d649514b25888f62eeb.hot-update.js": "/js/main.7d649514b25888f62eeb.hot-update.js",
"/chunks/files~chunks/my-shared-items~chunks/recent-uploads~chunks/shared/file-browser~chunks/trash.7d649514b25888f62eeb.hot-update.js": "/chunks/files~chunks/my-shared-items~chunks/recent-uploads~chunks/shared/file-browser~chunks/trash.7d649514b25888f62eeb.hot-update.js",
"/chunks/platform.7d649514b25888f62eeb.hot-update.js": "/chunks/platform.7d649514b25888f62eeb.hot-update.js",
"/chunks/platform~chunks/shared.7d649514b25888f62eeb.hot-update.js": "/chunks/platform~chunks/shared.7d649514b25888f62eeb.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.7d649514b25888f62eeb.hot-update.js": "/chunks/platform~chunks/shared/file-browser.7d649514b25888f62eeb.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.d2b2536646288e30adbe.hot-update.js": "/chunks/platform~chunks/shared/file-browser.d2b2536646288e30adbe.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.d6a6c6935aa6d7394a5c.hot-update.js": "/chunks/platform~chunks/shared/file-browser.d6a6c6935aa6d7394a5c.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.a1361f1c22837f277e52.hot-update.js": "/chunks/platform~chunks/shared/file-browser.a1361f1c22837f277e52.hot-update.js",
"/chunks/platform.4228da40812dd15ec2b3.hot-update.js": "/chunks/platform.4228da40812dd15ec2b3.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.1af64fc60480a60df720.hot-update.js": "/chunks/platform~chunks/shared/file-browser.1af64fc60480a60df720.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.0d4da0bc70d9412b8407.hot-update.js": "/chunks/platform~chunks/shared/file-browser.0d4da0bc70d9412b8407.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.ad1e633589b088c11c80.hot-update.js": "/chunks/platform~chunks/shared/file-browser.ad1e633589b088c11c80.hot-update.js",
"/js/main.bc69e270e1dc6aa30593.hot-update.js": "/js/main.bc69e270e1dc6aa30593.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.fe90422ef85b8f968ebd.hot-update.js": "/chunks/platform~chunks/shared/file-browser.fe90422ef85b8f968ebd.hot-update.js",
"/js/main.f6d7cfa798c5cddc99fc.hot-update.js": "/js/main.f6d7cfa798c5cddc99fc.hot-update.js",
"/js/main.6797ed2e048689016fa0.hot-update.js": "/js/main.6797ed2e048689016fa0.hot-update.js",
"/js/main.f3618b12ca29c7424833.hot-update.js": "/js/main.f3618b12ca29c7424833.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.b05762595cd4ada1e620.hot-update.js": "/chunks/platform~chunks/shared/file-browser.b05762595cd4ada1e620.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.3b84dd2bbbb80717ca7a.hot-update.js": "/chunks/platform~chunks/shared/file-browser.3b84dd2bbbb80717ca7a.hot-update.js",
"/js/main.3452784753f8b4ce665d.hot-update.js": "/js/main.3452784753f8b4ce665d.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.3940ff662d65d2b25d1d.hot-update.js": "/chunks/platform~chunks/shared/file-browser.3940ff662d65d2b25d1d.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.6a8d6f3ca45769e8b39a.hot-update.js": "/chunks/platform~chunks/shared/file-browser.6a8d6f3ca45769e8b39a.hot-update.js",
"/chunks/platform~chunks/shared/file-browser.64f2e9e80a9fbccc1a4e.hot-update.js": "/chunks/platform~chunks/shared/file-browser.64f2e9e80a9fbccc1a4e.hot-update.js",
"/js/main.f98f44157b78a5a1d656.hot-update.js": "/js/main.f98f44157b78a5a1d656.hot-update.js"
} }

View File

@@ -1,15 +1,14 @@
<template> <template>
<div id="desktop-toolbar"> <div id="desktop-toolbar">
<div class="toolbar-wrapper"> <div class="toolbar-wrapper">
<div @click="goBack" class="location">
<div v-if="homeDirectory" @click="goBack" class="location"> <chevron-left-icon :class="{'is-active': canGoBack }" class="icon-back" size="17" />
<chevron-left-icon :class="{'is-active': browseHistory.length > 1 }" class="icon-back" size="17" />
<span class="location-title"> <span class="location-title">
{{ directoryName }} {{ directoryName }}
</span> </span>
<span @click.stop="folderActions" v-if="browseHistory.length > 1 && $isThisLocation(['base', 'public'])" class="location-more group" id="folder-actions"> <span @click.stop="folderActions" class="location-more group" id="folder-actions">
<more-horizontal-icon size="14" class="icon-more group-hover-text-theme" /> <more-horizontal-icon size="14" class="icon-more group-hover-text-theme" />
</span> </span>
</div> </div>
@@ -31,14 +30,14 @@
</OptionGroup> </OptionGroup>
<OptionGroup> <OptionGroup>
<Option @click.stop.native="$createTeamFolder" :title="$t('Create Team Folder')" icon="users" /> <Option @click.stop.native="$createTeamFolder" :title="$t('Create Team Folder')" icon="users" />
<Option @click.stop.native="createFolder" :class="{'is-inactive': canCreateFolderInView }" :title="$t('actions.create_folder')" icon="folder-plus" /> <Option @click.stop.native="$createFolder" :class="{'is-inactive': canCreateFolderInView }" :title="$t('actions.create_folder')" icon="folder-plus" />
</OptionGroup> </OptionGroup>
</PopoverItem> </PopoverItem>
</PopoverWrapper> </PopoverWrapper>
</ToolbarGroup> </ToolbarGroup>
<!--Share Controls--> <!--Share Controls-->
<ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isMobile() && !$isThisLocation(['public'])"> <ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isMobile() && !$isThisRoute($route, ['Public'])">
<!--Team Folder Icon--> <!--Team Folder Icon-->
<PopoverWrapper> <PopoverWrapper>
@@ -47,19 +46,19 @@
<TeamFolderPreview /> <TeamFolderPreview />
<OptionGroup> <OptionGroup>
<Option @click.native="$updateTeamFolder(clipboard[0])" :title="$t('Edit Members')" icon="rename" /> <Option @click.native="$updateTeamFolder(clipboard[0])" :title="$t('Edit Members')" icon="rename" />
<Option @click.native="dissolveTeamFolder(clipboard[0])" :title="$t('Dissolve Team')" icon="trash" /> <Option @click.native="$dissolveTeamFolder(clipboard[0])" :title="$t('Dissolve Team')" icon="trash" />
</OptionGroup> </OptionGroup>
</PopoverItem> </PopoverItem>
</PopoverWrapper> </PopoverWrapper>
<ToolbarButton v-if="false" @click.native="$createTeamFolder" source="user-plus" :action="$t('actions.convert_into_team_folder')" /> <ToolbarButton v-if="false" @click.native="$createTeamFolder" source="user-plus" :action="$t('actions.convert_into_team_folder')" />
<ToolbarButton @click.native="shareItem" :class="{'is-inactive': canShareInView }" source="share" :action="$t('actions.share')" /> <ToolbarButton @click.native="$shareFileOrFolder(clipboard[0])" :class="{'is-inactive': canShareInView }" source="share" :action="$t('actions.share')" />
</ToolbarGroup> </ToolbarGroup>
<!--File Controls--> <!--File Controls-->
<ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isMobile()"> <ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isMobile()">
<ToolbarButton @click.native="moveItem" :class="{'is-inactive': canMoveInView }" source="move" :action="$t('actions.move')" /> <ToolbarButton @click.native="$moveFileOrFolder(clipboard[0])" :class="{'is-inactive': canMoveInView }" source="move" :action="$t('actions.move')" />
<ToolbarButton @click.native="deleteItem" :class="{'is-inactive': canDeleteInView }" source="trash" :action="$t('actions.delete')" /> <ToolbarButton @click.native="$deleteFileOrFolder(clipboard[0])" :class="{'is-inactive': canDeleteInView }" source="trash" :action="$t('actions.delete')" />
</ToolbarGroup> </ToolbarGroup>
<!--View Controls--> <!--View Controls-->
@@ -99,7 +98,7 @@
import {last} from 'lodash' import {last} from 'lodash'
export default { export default {
name: 'ToolBar', name: 'DesktopToolbar',
components: { components: {
TeamMembersPreview, TeamMembersPreview,
FileSortingOptions, FileSortingOptions,
@@ -119,6 +118,7 @@
}, },
computed: { computed: {
...mapGetters([ ...mapGetters([
'previousLocation',
'isVisibleSidebar', 'isVisibleSidebar',
'FilePreviewType', 'FilePreviewType',
'currentFolder', 'currentFolder',
@@ -126,6 +126,9 @@
'homeDirectory', 'homeDirectory',
'clipboard', 'clipboard',
]), ]),
canGoBack() {
return this.$route.params.id
},
hasCapacity() { hasCapacity() {
// Check if storage limitation is set // Check if storage limitation is set
if (!this.$store.getters.config.storageLimit) return true if (!this.$store.getters.config.storageLimit) return true
@@ -137,9 +140,7 @@
return this.$store.getters.user.data.attributes.storage.used <= 100 return this.$store.getters.user.data.attributes.storage.used <= 100
}, },
directoryName() { directoryName() {
return this.currentFolder return 'todo'
? this.currentFolder.name
: this.homeDirectory.name
}, },
preview() { preview() {
return this.FilePreviewType === 'list' return this.FilePreviewType === 'list'
@@ -147,46 +148,45 @@
: 'th-list' : 'th-list'
}, },
canCreateFolderInView() { canCreateFolderInView() {
return !this.$isThisLocation(['base', 'public']) return ! this.$isThisRoute(this.$route, ['Files', 'Public'])
}, },
canDeleteInView() { canDeleteInView() {
let locations = [ let routes = [
'trash-root', 'RecentUploads',
'latest', 'MySharedItems',
'shared', 'Trash',
'public', 'Public',
'trash', 'Files',
'base',
] ]
return !this.$isThisLocation(locations) || this.clipboard.length === 0 return !this.$isThisRoute(this.$route, routes) || this.clipboard.length === 0
}, },
canUploadInView() { canUploadInView() {
return !this.$isThisLocation(['base', 'public']) return ! this.$isThisRoute(this.$route, ['Files', 'Public'])
}, },
canMoveInView() { canMoveInView() {
let locations = [ let routes = [
'latest', 'RecentUploads',
'shared', 'MySharedItems',
'public', 'Public',
'base', 'Files',
] ]
return !this.$isThisLocation(locations) || this.clipboard.length === 0 return ! this.$isThisRoute(this.$route, routes) || this.clipboard.length === 0
}, },
canShareInView() { canShareInView() {
let locations = [ let routes = [
'latest', 'RecentUploads',
'shared', 'MySharedItems',
'public', 'Public',
'base', 'Files',
] ]
return !this.$isThisLocation(locations) || this.clipboard.length > 1 || this.clipboard.length === 0 return ! this.$isThisRoute(this.$route, routes) || this.clipboard.length > 1 || this.clipboard.length === 0
}, },
canCreateTeamFolderInView() { canCreateTeamFolderInView() {
let locations = [ let routes = [
'shared', 'MySharedItems',
'base', 'Files',
] ]
return this.$isThisLocation(locations) && this.clipboard.length === 1 && this.clipboard[0].type === 'folder' return this.$isThisRoute(this.$route, routes) && this.clipboard.length === 1 && this.clipboard[0].type === 'folder'
} }
}, },
data() { data() {
@@ -199,6 +199,9 @@
} }
}, },
methods: { methods: {
goBack() {
if (this.canGoBack) this.$router.back()
},
showTeamFolderMenu() { showTeamFolderMenu() {
events.$emit('popover:open', 'team-folder') events.$emit('popover:open', 'team-folder')
}, },
@@ -208,64 +211,10 @@
showSortingMenu() { showSortingMenu() {
events.$emit('popover:open', 'desktop-sorting') events.$emit('popover:open', 'desktop-sorting')
}, },
dissolveTeamFolder() {
events.$emit('confirm:open', {
title: this.$t('Are you sure you want to dissolve this team?'),
message: this.$t('All team members will lose access to your files and existing folder will be moved into your "Files" section.'),
action: {
id: 'token.id',
operation: 'dissolve-team-folder'
}
})
},
goBack() {
let previousFolder = last(this.browseHistory)
if (!previousFolder) return
if (previousFolder.location === 'trash-root') {
this.$store.dispatch('getTrash')
} else if (previousFolder.location === 'shared') {
this.$store.dispatch('getShared')
} else {
if (this.$isThisLocation('public')) {
this.$store.dispatch('browseShared', [
{folder: previousFolder, back: true, init: false}
])
} else {
this.$store.dispatch('getFolder', [
{folder: previousFolder, back: true, init: false}
])
}
}
},
folderActions() { folderActions() {
// todo: add current folder
events.$emit('folder:actions', this.currentFolder) events.$emit('folder:actions', this.currentFolder)
}, },
deleteItem() {
if (this.clipboard.length > 0)
this.$store.dispatch('deleteItem')
},
createFolder() {
this.$store.dispatch('createFolder', {name: this.$t('popup_create_folder.folder_default_name')})
events.$emit('popover:close', 'desktop-create')
},
moveItem() {
if (this.clipboard.length > 0)
events.$emit('popup:open', {name: 'move', item: this.clipboard})
},
shareItem() {
let event = this.clipboard[0].shared
? 'share-edit'
: 'share-create'
events.$emit('popup:open', {
name: event,
item: this.clipboard[0]
})
}
}, },
} }
</script> </script>

View File

@@ -28,6 +28,17 @@ const itemHelpers = {
}) })
} }
Vue.prototype.$dissolveTeamFolder = function () {
events.$emit('confirm:open', {
title: this.$t('Are you sure you want to dissolve this team?'),
message: this.$t('All team members will lose access to your files and existing folder will be moved into your "Files" section.'),
action: {
id: 'token.id',
operation: 'dissolve-team-folder'
}
})
},
Vue.prototype.$createTeamFolder = function (entry) { Vue.prototype.$createTeamFolder = function (entry) {
events.$emit('popup:open', {name: 'create-team-folder'}) events.$emit('popup:open', {name: 'create-team-folder'})
} }

View File

@@ -720,6 +720,8 @@ const router = new Router({
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
store.commit('SET_PREVIOUS_LOCATION', from.name)
if (to.matched.some(record => record.meta.requiresAuth)) { if (to.matched.some(record => record.meta.requiresAuth)) {
// this route requires auth, check if logged in // this route requires auth, check if logged in
// if not, redirect to login page. // if not, redirect to login page.

View File

@@ -6,10 +6,10 @@ import i18n from '/resources/js/i18n/index'
const defaultState = { const defaultState = {
currentFolder: undefined, currentFolder: undefined,
fastPreview: undefined,
navigation: undefined, navigation: undefined,
isLoading: true, isLoading: true,
browseHistory: [], browseHistory: [],
fastPreview: undefined,
clipboard: [], clipboard: [],
entries: [], entries: [],
} }
@@ -180,11 +180,11 @@ const mutations = {
} }
const getters = { const getters = {
fastPreview: state => state.fastPreview,
clipboard: state => state.clipboard,
currentFolder: state => state.currentFolder, currentFolder: state => state.currentFolder,
browseHistory: state => state.browseHistory, browseHistory: state => state.browseHistory,
fastPreview: state => state.fastPreview,
navigation: state => state.navigation, navigation: state => state.navigation,
clipboard: state => state.clipboard,
isLoading: state => state.isLoading, isLoading: state => state.isLoading,
entries: state => state.entries, entries: state => state.entries,
} }

View File

@@ -46,7 +46,7 @@
<!--Locations--> <!--Locations-->
<ContentGroup :title="$t('Collaboration')" slug="collaboration" :can-collapse="true"> <ContentGroup :title="$t('Collaboration')" slug="collaboration" :can-collapse="true">
<div class="menu-list-wrapper vertical"> <div class="menu-list-wrapper vertical">
<router-link class="menu-list-item link"> <!-- <router-link class="menu-list-item link">
<div class="icon text-theme"> <div class="icon text-theme">
<users-icon size="17" /> <users-icon size="17" />
</div> </div>
@@ -61,7 +61,7 @@
<div class="label text-theme"> <div class="label text-theme">
{{ $t('Shared with Me') }} {{ $t('Shared with Me') }}
</div> </div>
</router-link> </router-link>-->
</div> </div>
</ContentGroup> </ContentGroup>