mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-18 08:12:15 +00:00
Merge remote-tracking branch 'origin/remote-upload-merge'
# Conflicts: # public/mix-manifest.json
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
<div class="flex items-center">
|
||||
<div class="mr-3 ml-0 flex items-center lg:mx-3">
|
||||
<span
|
||||
class="inline-block max-w-[150px] xs:max-w-[230px] md:max-w-[290px] overflow-hidden text-ellipsis whitespace-nowrap text-sm font-bold"
|
||||
class="inline-block max-w-[150px] xs:max-w-[220px] md:max-w-[240px] overflow-hidden text-ellipsis whitespace-nowrap text-sm font-bold"
|
||||
>
|
||||
{{ currentFile.data.attributes.name }}
|
||||
</span>
|
||||
|
||||
@@ -12,17 +12,22 @@
|
||||
:action="$t('create_something')"
|
||||
/>
|
||||
<PopoverItem name="desktop-create" side="left">
|
||||
<OptionGroup :title="$t('upload')">
|
||||
<OptionGroup :title="$t('frequently_used')">
|
||||
<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>
|
||||
|
||||
|
||||
@@ -39,6 +39,11 @@
|
||||
:title="$t('upload_folder')"
|
||||
type="folder"
|
||||
/>
|
||||
<Option
|
||||
@click.stop.native="$openRemoteUploadPopup"
|
||||
:title="$t('remote_upload')"
|
||||
icon="remote-upload"
|
||||
/>
|
||||
<Option
|
||||
@click.stop.native="$createTeamFolder"
|
||||
:class="{ 'is-inactive': canCreateTeamFolder }"
|
||||
|
||||
@@ -24,17 +24,22 @@
|
||||
:action="$t('create_something')"
|
||||
/>
|
||||
<PopoverItem name="desktop-create" side="left">
|
||||
<OptionGroup :title="$t('upload')">
|
||||
<OptionGroup :title="$t('frequently_used')">
|
||||
<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>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<!--Menu icon-->
|
||||
<div
|
||||
v-if="!isVisibleNavigationBars"
|
||||
@click="toggleNavigationBars"
|
||||
@click.stop="toggleNavigationBars"
|
||||
class="-mt-0.5 mr-2 hidden cursor-pointer p-2 lg:block"
|
||||
>
|
||||
<menu-icon size="17" />
|
||||
|
||||
@@ -119,6 +119,12 @@
|
||||
class="vue-feather group-hover-text-theme"
|
||||
:class="{ 'text-theme': isActive }"
|
||||
/>
|
||||
<link2-icon
|
||||
v-if="icon === 'remote-upload'"
|
||||
size="17"
|
||||
class="vue-feather group-hover-text-theme"
|
||||
:class="{ 'text-theme': isActive }"
|
||||
/>
|
||||
<users-icon
|
||||
v-if="icon === 'users'"
|
||||
size="17"
|
||||
@@ -246,6 +252,7 @@
|
||||
<script>
|
||||
import AlphabetIcon from '../../Icons/AlphabetIcon'
|
||||
import {
|
||||
Link2Icon,
|
||||
UserMinusIcon,
|
||||
UserCheckIcon,
|
||||
UserPlusIcon,
|
||||
@@ -287,6 +294,7 @@ export default {
|
||||
name: 'Option',
|
||||
props: ['isHoverDisabled', 'isActive', 'title', 'arrow', 'icon'],
|
||||
components: {
|
||||
Link2Icon,
|
||||
UserMinusIcon,
|
||||
UserCheckIcon,
|
||||
UserPlusIcon,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<div class="flex items-center justify-between px-6 pt-6 pb-6">
|
||||
<div class="flex items-center">
|
||||
<div class="mr-3">
|
||||
<link2-icon v-if="icon === 'remote-upload'" size="18" class="vue-feather text-theme" />
|
||||
<upload-cloud-icon v-if="icon === 'upload'" size="18" class="vue-feather text-theme" />
|
||||
<corner-down-right-icon v-if="icon === 'move'" size="18" class="vue-feather text-theme" />
|
||||
<share-icon v-if="icon === 'share'" size="18" class="vue-feather text-theme" />
|
||||
@@ -25,6 +26,7 @@
|
||||
|
||||
<script>
|
||||
import {
|
||||
Link2Icon,
|
||||
BellIcon,
|
||||
UploadCloudIcon,
|
||||
CreditCardIcon,
|
||||
@@ -43,6 +45,7 @@ export default {
|
||||
name: 'PopupHeader',
|
||||
props: ['title', 'icon'],
|
||||
components: {
|
||||
Link2Icon,
|
||||
BellIcon,
|
||||
UploadCloudIcon,
|
||||
CornerDownRightIcon,
|
||||
|
||||
135
resources/js/components/RemoteUpload/RemoteUploadPopup.vue
Normal file
135
resources/js/components/RemoteUpload/RemoteUploadPopup.vue
Normal file
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<PopupWrapper name="remote-upload">
|
||||
<PopupHeader :title="$t('upload_files_remotely')" icon="remote-upload" />
|
||||
|
||||
<PopupContent>
|
||||
<ValidationObserver @submit.prevent ref="createForm" v-slot="{ invalid }" tag="form">
|
||||
<ValidationProvider tag="div" mode="passive" name="Remote Links" rules="required" v-slot="{ errors }">
|
||||
<AppInputText
|
||||
:title="$t('remote_links')"
|
||||
:description="$t('remote_links_help')"
|
||||
:error="errors[0]"
|
||||
:is-last="true"
|
||||
>
|
||||
<textarea
|
||||
v-model="links"
|
||||
class="focus-border-theme input-dark whitespace-nowrap"
|
||||
rows="6"
|
||||
:placeholder="$t('paste_remote_links_here')"
|
||||
:class="{ '!border-rose-600': errors[0] }"
|
||||
ref="textarea"
|
||||
>
|
||||
</textarea>
|
||||
</AppInputText>
|
||||
</ValidationProvider>
|
||||
</ValidationObserver>
|
||||
</PopupContent>
|
||||
|
||||
<PopupActions>
|
||||
<ButtonBase class="w-full" @click.native="$closePopup()" button-style="secondary">
|
||||
{{ $t('cancel') }}
|
||||
</ButtonBase>
|
||||
<ButtonBase class="w-full" @click.native="upload" button-style="theme" :loading="loading">
|
||||
{{ $t('upload') }}
|
||||
</ButtonBase>
|
||||
</PopupActions>
|
||||
</PopupWrapper>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ValidationProvider, ValidationObserver } from 'vee-validate/dist/vee-validate.full'
|
||||
import PopupWrapper from '../Popups/Components/PopupWrapper'
|
||||
import PopupContent from '../Popups/Components/PopupContent'
|
||||
import PopupActions from '../Popups/Components/PopupActions'
|
||||
import PopupHeader from '../Popups/Components/PopupHeader'
|
||||
import AppInputText from '../Forms/Layouts/AppInputText'
|
||||
import { required } from 'vee-validate/dist/rules'
|
||||
import ButtonBase from '../UI/Buttons/ButtonBase'
|
||||
import { events } from '../../bus'
|
||||
|
||||
export default {
|
||||
name: 'RemoteUploadPopup',
|
||||
components: {
|
||||
ValidationProvider,
|
||||
ValidationObserver,
|
||||
required,
|
||||
PopupWrapper,
|
||||
PopupContent,
|
||||
PopupHeader,
|
||||
PopupActions,
|
||||
AppInputText,
|
||||
ButtonBase,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
links: undefined,
|
||||
loading: false,
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
async upload() {
|
||||
// Validate fields
|
||||
const isValid = await this.$refs.createForm.validate()
|
||||
|
||||
if (!isValid) return
|
||||
|
||||
this.loading = true
|
||||
|
||||
// Get route
|
||||
let route = {
|
||||
RequestUpload: `/api/upload-request/${this.$router.currentRoute.params.token}/upload/remote`,
|
||||
Public: `/api/editor/upload/remote/${this.$router.currentRoute.params.token}`,
|
||||
}[this.$router.currentRoute.name] || '/api/upload/remote'
|
||||
|
||||
let parentId = this.$store.getters.currentFolder
|
||||
? this.$store.getters.currentFolder.data.id
|
||||
: undefined
|
||||
|
||||
axios
|
||||
.post(route, {
|
||||
urls: this.links
|
||||
.replace(/^(?=\n)$|^\s*|\s*$|\n\n+/gm, "")
|
||||
.split(/\r?\n/),
|
||||
parent_id: parentId,
|
||||
})
|
||||
.then(() => {
|
||||
events.$emit('toaster', {
|
||||
type: 'success',
|
||||
message: this.$t('remote_download_processed'),
|
||||
})
|
||||
|
||||
events.$emit('popup:close')
|
||||
|
||||
// Reload data
|
||||
this.$getDataByLocation()
|
||||
})
|
||||
.catch((error) => {
|
||||
if (error.response.status === 422) {
|
||||
this.$refs.createForm.setErrors({
|
||||
'Remote Links': error.response.data.message,
|
||||
})
|
||||
}
|
||||
|
||||
events.$emit('toaster', {
|
||||
type: 'danger',
|
||||
message: this.$t('popup_error.title'),
|
||||
})
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false
|
||||
})
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
events.$on('popup:open', (args) => {
|
||||
if (args.name !== 'remote-upload') return
|
||||
|
||||
this.links = undefined
|
||||
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => this.$refs.textarea.focus(), 100)
|
||||
})
|
||||
})
|
||||
},
|
||||
}
|
||||
</script>
|
||||
@@ -139,6 +139,11 @@
|
||||
size="18"
|
||||
class="vue-feather text-theme"
|
||||
/>
|
||||
<link2-icon
|
||||
v-if="result.action.value === 'remote-upload'"
|
||||
size="18"
|
||||
class="vue-feather text-theme"
|
||||
/>
|
||||
<upload-cloud-icon
|
||||
v-if="result.action.value === 'RecentUploads'"
|
||||
size="18"
|
||||
@@ -309,6 +314,7 @@ import KeyboardHints from './Components/KeyboardHints'
|
||||
import axios from 'axios'
|
||||
import { debounce } from 'lodash'
|
||||
import {
|
||||
Link2Icon,
|
||||
FolderPlusIcon,
|
||||
SmileIcon,
|
||||
BoxIcon,
|
||||
@@ -340,6 +346,7 @@ import { mapGetters } from 'vuex'
|
||||
export default {
|
||||
name: 'Spotlight',
|
||||
components: {
|
||||
Link2Icon,
|
||||
FolderPlusIcon,
|
||||
SmileIcon,
|
||||
KeyboardHints,
|
||||
@@ -598,6 +605,13 @@ export default {
|
||||
value: 'create-file-request',
|
||||
},
|
||||
},
|
||||
{
|
||||
title: this.$t('remote_upload'),
|
||||
action: {
|
||||
type: 'function',
|
||||
value: 'remote-upload',
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
let functionList = [
|
||||
@@ -813,6 +827,10 @@ export default {
|
||||
if (arg.action.value === 'create-file-request') {
|
||||
this.$createFileRequest()
|
||||
}
|
||||
|
||||
if (arg.action.value === 'remote-upload') {
|
||||
this.$openRemoteUploadPopup()
|
||||
}
|
||||
}
|
||||
|
||||
this.exitSpotlight()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="toasters.length || notifications.length"
|
||||
class="fixed bottom-4 right-4 left-4 z-50 sm:w-[360px] sm:left-auto lg:bottom-8 lg:right-8"
|
||||
class="fixed bottom-4 right-4 left-4 z-[55] sm:w-[360px] sm:left-auto lg:bottom-8 lg:right-8"
|
||||
>
|
||||
<ToasterWrapper
|
||||
v-for="notification in notifications"
|
||||
|
||||
Reference in New Issue
Block a user