code deletion

This commit is contained in:
Čarodej
2022-04-27 09:57:31 +02:00
parent eb4d5b4cba
commit 3b3bf62cb8
23 changed files with 121 additions and 553 deletions
@@ -7,11 +7,7 @@
class="mt-6 overflow-x-auto"
>
<template slot-scope="{ row }">
<!--Not a subscription-->
<tr
v-if="config.subscriptionType === 'none'"
class="whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5"
>
<tr class="whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5">
<td class="py-3 pr-3 md:pr-1">
<router-link
:to="{
@@ -80,157 +76,6 @@
</div>
</td>
</tr>
<!--Fixed subscription-->
<tr
v-if="config.subscriptionType === 'fixed'"
class="whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5"
>
<td class="py-3 pr-3 md:pr-1">
<router-link
:to="{
name: 'UserDetail',
params: { id: row.data.id },
}"
>
<div class="flex items-center">
<MemberAvatar :is-border="false" :size="44" :member="row" />
<div class="ml-3 pr-10">
<b
class="max-w-1 block overflow-hidden text-ellipsis whitespace-nowrap text-sm font-bold"
style="max-width: 155px"
>
{{ row.data.relationships.settings.data.attributes.name }}
</b>
<span class="block text-xs text-gray-600 dark:text-gray-500">
{{ row.data.attributes.email }}
</span>
</div>
</div>
</router-link>
</td>
<td class="px-3 md:px-1">
<ColorLabel :color="$getUserRoleColor(row.data.attributes.role)">
{{ $t(row.data.attributes.role) }}
</ColorLabel>
</td>
<td class="px-3 md:px-1" v-if="config.isSaaS">
<span class="text-sm font-bold">
{{ row.data.relationships.subscription ? $t('premium') : $t('free') }}
</span>
</td>
<td class="px-3 md:px-1">
<span v-if="row.data.attributes.storage.capacity !== 0" class="text-sm font-bold">
{{ row.data.attributes.storage.used_formatted }}
</span>
<span v-if="row.data.attributes.storage.capacity === 0" class="text-sm font-bold"> - </span>
</td>
<td class="px-3 md:px-1" v-if="config.storageLimit">
<span v-if="row.data.attributes.storage.capacity !== 0" class="text-sm font-bold">
{{ row.data.attributes.storage.capacity_formatted }}
</span>
<span v-if="row.data.attributes.storage.capacity === 0" class="text-sm font-bold"> - </span>
</td>
<td class="px-3 md:px-1">
<span class="text-sm font-bold">
{{ row.data.attributes.created_at }}
</span>
</td>
<td class="pl-3 text-right md:pl-1">
<div class="flex w-full justify-end space-x-2">
<router-link
class="flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-green-100 dark:bg-2x-dark-foreground"
:to="{
name: 'UserDetail',
params: { id: row.data.id },
}"
>
<Edit2Icon size="15" class="opacity-75" />
</router-link>
<router-link
class="flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-red-100 dark:bg-2x-dark-foreground"
:to="{
name: 'UserDelete',
params: { id: row.data.id },
}"
>
<Trash2Icon size="15" class="opacity-75" />
</router-link>
</div>
</td>
</tr>
<!--Metered subscription-->
<tr
v-if="config.subscriptionType === 'metered'"
class="whitespace-nowrap border-b border-dashed border-light dark:border-opacity-5"
>
<td class="py-3 pr-3 md:pr-1">
<router-link
:to="{
name: 'UserDetail',
params: { id: row.data.id },
}"
>
<div class="flex items-center">
<MemberAvatar :is-border="false" :size="44" :member="row" />
<div class="ml-3 pr-10">
<b
class="max-w-1 block overflow-hidden text-ellipsis whitespace-nowrap text-sm font-bold"
style="max-width: 155px"
>
{{ row.data.relationships.settings.data.attributes.name }}
</b>
<span class="block text-xs text-gray-600 dark:text-gray-500">
{{ row.data.attributes.email }}
</span>
</div>
</div>
</router-link>
</td>
<td class="px-3 md:px-1">
<ColorLabel :color="$getUserRoleColor(row.data.attributes.role)">
{{ $t(row.data.attributes.role) }}
</ColorLabel>
</td>
<td class="px-3 md:px-1">
<span class="text-sm font-bold">
{{ row.data.meta.usages ? row.data.meta.usages.featureEstimates.storage.usage : '-' }}
</span>
</td>
<td class="px-3 md:px-1">
<span class="text-sm font-bold">
{{ row.data.meta.usages ? row.data.meta.usages.costEstimate : '-' }}
</span>
</td>
<td class="px-3 md:px-1">
<span class="text-sm font-bold">
{{ row.data.attributes.created_at }}
</span>
</td>
<td class="pl-3 text-right md:pl-1">
<div class="flex w-full justify-end space-x-2">
<router-link
class="flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-green-100 dark:bg-2x-dark-foreground"
:to="{
name: 'UserDetail',
params: { id: row.data.id },
}"
>
<Edit2Icon size="15" class="opacity-75" />
</router-link>
<router-link
class="flex h-8 w-8 items-center justify-center rounded-md bg-light-background transition-colors hover:bg-red-100 dark:bg-2x-dark-foreground"
:to="{
name: 'UserDelete',
params: { id: row.data.id },
}"
>
<Trash2Icon size="15" class="opacity-75" />
</router-link>
</div>
</td>
</tr>
</template>
</DatatableWrapper>
</template>
@@ -257,97 +102,36 @@ export default {
computed: {
...mapGetters(['config']),
columns() {
return {
metered: [
{
label: this.$t('user'),
field: 'email',
sortable: true,
},
{
label: this.$t('role'),
field: 'role',
sortable: true,
},
{
label: this.$t('storage_used'),
sortable: false,
},
{
label: this.$t('billing_est.'),
sortable: false,
},
{
label: this.$t('created_at'),
field: 'created_at',
sortable: true,
},
{
label: this.$t('action'),
sortable: false,
},
],
fixed: [
{
label: this.$t('user'),
field: 'email',
sortable: true,
},
{
label: this.$t('role'),
field: 'role',
sortable: true,
},
{
label: this.$t('storage_used'),
sortable: false,
},
{
label: this.$t('max_storage'),
sortable: false,
hidden: !this.config.storageLimit,
},
{
label: this.$t('created_at'),
field: 'created_at',
sortable: true,
},
{
label: this.$t('action'),
sortable: false,
},
],
none: [
{
label: this.$t('user'),
field: 'email',
sortable: true,
},
{
label: this.$t('role'),
field: 'role',
sortable: true,
},
{
label: this.$t('storage_used'),
sortable: false,
},
{
label: this.$t('max_storage'),
sortable: false,
hidden: !this.config.storageLimit,
},
{
label: this.$t('created_at'),
field: 'created_at',
sortable: true,
},
{
label: this.$t('action'),
sortable: false,
},
],
}[this.config.subscriptionType]
return [
{
label: this.$t('user'),
field: 'email',
sortable: true,
},
{
label: this.$t('role'),
field: 'role',
sortable: true,
},
{
label: this.$t('storage_used'),
sortable: false,
},
{
label: this.$t('max_storage'),
sortable: false,
hidden: !this.config.storageLimit,
},
{
label: this.$t('created_at'),
field: 'created_at',
sortable: true,
},
{
label: this.$t('action'),
sortable: false,
},
]
},
},
data() {
+1 -1
View File
@@ -1,6 +1,6 @@
<template>
<div>
<VueFolderIcon v-if="!item.data.attributes.isTeamFolder" />
<VueFolderIcon />
</div>
</template>
@@ -12,22 +12,17 @@
:action="$t('create_something')"
/>
<PopoverItem name="desktop-create" side="left">
<OptionGroup :title="$t('frequently_used')">
<OptionGroup :title="$t('upload')">
<OptionUpload :title="$t('upload_files')" type="file" />
<OptionUpload :title="$t('upload_folder')" type="folder" />
</OptionGroup>
<OptionGroup :title="$t('create')">
<Option
@click.native="$createFolder"
:title="$t('create_folder')"
icon="folder-plus"
/>
</OptionGroup>
<OptionGroup :title="$t('others')">
<OptionUpload :title="$t('upload_folder')" type="folder" />
<Option
@click.stop.native="$openRemoteUploadPopup"
:title="$t('remote_upload')"
icon="remote-upload"
/>
</OptionGroup>
</PopoverItem>
</PopoverWrapper>
@@ -111,7 +106,7 @@ export default {
Option,
},
computed: {
...mapGetters(['isVisibleNavigationBars', 'currentTeamFolder', 'currentFolder', 'sharedDetail', 'clipboard']),
...mapGetters(['isVisibleNavigationBars', 'currentFolder', 'sharedDetail', 'clipboard']),
canEdit() {
return this.sharedDetail && this.sharedDetail.data.attributes.permission === 'editor'
},
@@ -13,7 +13,7 @@
/>
<PopoverItem name="desktop-create" side="left">
<OptionGroup
:title="$t('create')"
:title="$t('upload')"
>
<OptionUpload
:title="$t('upload_files')"
@@ -29,6 +29,10 @@
:title="$t('upload_folder')"
type="folder"
/>
</OptionGroup>
<OptionGroup
:title="$t('create')"
>
<Option
@click.native="$createFolder"
:class="{
@@ -31,22 +31,6 @@
:is-hover-disabled="true"
/>
</OptionGroup>
<OptionGroup :title="$t('collaboration')">
<Option
@click.native="goToTeamFolders"
:title="$t('team_folders')"
icon="users"
:is-active="$isThisRoute($route, 'TeamFolders')"
:is-hover-disabled="true"
/>
<Option
@click.native="goToSharedWithMe"
:title="$t('shared_with_me')"
icon="user-check"
:is-active="$isThisRoute($route, 'SharedWithMe')"
:is-hover-disabled="true"
/>
</OptionGroup>
</MenuMobileGroup>
</MenuMobile>
</template>
@@ -79,12 +63,6 @@ export default {
goToTrash() {
this.$router.push({ name: 'Trash' })
},
goToTeamFolders() {
this.$router.push({ name: 'TeamFolders' })
},
goToSharedWithMe() {
this.$router.push({ name: 'SharedWithMe' })
},
},
}
</script>
@@ -126,15 +126,9 @@ export default {
this.isLoadingTree = true
// Get folder tree and hide spinner
if (this.$isThisRoute(this.$route, ['SharedWithMe'])) {
this.$store.dispatch('getTeamFolderTree').then(() => {
this.isLoadingTree = false
})
} else {
this.$store.dispatch('getFolderTree').then(() => {
this.isLoadingTree = false
})
}
this.$store.dispatch('getFolderTree').then(() => {
this.isLoadingTree = false
})
// Store picked item
if (!this.clipboard.includes(args.item[0])) {
@@ -33,15 +33,6 @@
v-if="isFile || isVideo || isAudio || (isImage && !entry.data.attributes.thumbnail)"
class="relative mx-auto w-24"
>
<!--Member thumbnail for team folders-->
<MemberAvatar
v-if="user && canShowAuthor"
:size="38"
:is-border="true"
:member="entry.data.relationships.creator"
class="absolute right-2 -bottom-5 z-10 z-10 scale-75 transform lg:-bottom-7 lg:scale-100"
/>
<FileIconThumbnail
:entry="entry"
class="z-0 mt-5 mb-10 scale-125 transform lg:mb-12 lg:mt-6 lg:scale-150"
@@ -198,14 +189,6 @@ export default {
? this.entry.data.attributes.trashed_items
: this.entry.data.attributes.items
},
canShowAuthor() {
return (
this.$isThisRoute(this.$route, ['SharedWithMe', 'TeamFolders'])
&& !this.isFolder
&& this.entry.data.relationships.creator
&& this.user.data.id !== this.entry.data.relationships.creator.data.id
)
},
canShowLinkIcon() {
return this.entry.data.relationships.shared && !this.$isThisRoute(this.$route, ['SharedSingleFile'])
},
@@ -13,15 +13,6 @@
<!--Item thumbnail-->
<div class="relative w-16 shrink-0">
<!--Member thumbnail for team folders-->
<MemberAvatar
v-if="user && canShowAuthor"
:size="28"
:is-border="true"
:member="entry.data.relationships.creator"
class="absolute right-1.5 -bottom-2 z-10"
/>
<!--Emoji Icon-->
<Emoji
v-if="entry.data.attributes.emoji"
@@ -184,9 +175,6 @@ export default {
? this.entry.data.attributes.trashed_items
: this.entry.data.attributes.items
},
canShowAuthor() {
return !this.isFolder && (this.entry.data.relationships.creator && this.user.data.id !== this.entry.data.relationships.creator.data.id)
},
canDrag() {
return !this.isDeleted && this.$checkPermission(['master', 'editor'])
},