Move item grid to folder bug

This commit is contained in:
Čarodej
2022-04-06 15:22:09 +02:00
parent 4ae4e70fe4
commit 9a11af3b39
13 changed files with 66 additions and 69 deletions
+2
View File
@@ -3,6 +3,8 @@
- Wasabi region list updated - Wasabi region list updated
- The delay after first upload in file request when the interface wasn't showing was removed - The delay after first upload in file request when the interface wasn't showing was removed
- If adsense banner location isn't filled, the ads space won't be showed - If adsense banner location isn't filled, the ads space won't be showed
- Fixed issue when in grid view you tried to move image into another folder
- Fixed issue when you can't move or delete items via mobile multiselect function
## Version 2.0.14 ## Version 2.0.14
#### Release date: 5. April 2022 #### Release date: 5. April 2022
+11 -11
View File
@@ -1,7 +1,7 @@
{ {
"/js/main.js": "/js/main.js", "/js/main.js": "/js/main.js",
"/chunks/request.js": "/chunks/request.js?id=9c9e321a1cbd2e92", "/chunks/request.js": "/chunks/request.js?id=2f43ec2bb19876d4",
"/chunks/request-upload.js": "/chunks/request-upload.js?id=21fea06cd44919f6", "/chunks/request-upload.js": "/chunks/request-upload.js?id=9d36f99397dfbfe7",
"/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=19a0784e59d768ec", "/chunks/setup-wizard.js": "/chunks/setup-wizard.js?id=19a0784e59d768ec",
"/chunks/status-check.js": "/chunks/status-check.js?id=f82f9939c1326fe2", "/chunks/status-check.js": "/chunks/status-check.js?id=f82f9939c1326fe2",
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=df5bd89528649783", "/chunks/purchase-code.js": "/chunks/purchase-code.js?id=df5bd89528649783",
@@ -9,8 +9,8 @@
"/chunks/environment.js": "/chunks/environment.js?id=166cd302ba7338ae", "/chunks/environment.js": "/chunks/environment.js?id=166cd302ba7338ae",
"/chunks/app-setup.js": "/chunks/app-setup.js?id=15938ff1ad2d6ed2", "/chunks/app-setup.js": "/chunks/app-setup.js?id=15938ff1ad2d6ed2",
"/chunks/admin-account.js": "/chunks/admin-account.js?id=916450217130f3b8", "/chunks/admin-account.js": "/chunks/admin-account.js?id=916450217130f3b8",
"/chunks/shared.js": "/chunks/shared.js?id=45101b95a6bb6060", "/chunks/shared.js": "/chunks/shared.js?id=e65e38133f6111e1",
"/chunks/shared/browser.js": "/chunks/shared/browser.js?id=76bae44fa3b68b60", "/chunks/shared/browser.js": "/chunks/shared/browser.js?id=e252d9d8ff7e90c9",
"/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=83a29818c408b4de", "/chunks/shared/single-file.js": "/chunks/shared/single-file.js?id=83a29818c408b4de",
"/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=672e931a9fb0b672", "/chunks/shared/authenticate.js": "/chunks/shared/authenticate.js?id=672e931a9fb0b672",
"/chunks/not-found.js": "/chunks/not-found.js?id=9f6ce23ce5d969f1", "/chunks/not-found.js": "/chunks/not-found.js?id=9f6ce23ce5d969f1",
@@ -62,13 +62,13 @@
"/chunks/settings-password.js": "/chunks/settings-password.js?id=3755d41eaf50a5b1", "/chunks/settings-password.js": "/chunks/settings-password.js?id=3755d41eaf50a5b1",
"/chunks/settings-storage.js": "/chunks/settings-storage.js?id=994b669a56fd417b", "/chunks/settings-storage.js": "/chunks/settings-storage.js?id=994b669a56fd417b",
"/chunks/billing.js": "/chunks/billing.js?id=40e758c87bcf6e89", "/chunks/billing.js": "/chunks/billing.js?id=40e758c87bcf6e89",
"/chunks/platform.js": "/chunks/platform.js?id=739f35bbaea97a36", "/chunks/platform.js": "/chunks/platform.js?id=46be2cb036e63cb9",
"/chunks/files.js": "/chunks/files.js?id=91dc4c194ffc137b", "/chunks/files.js": "/chunks/files.js?id=337db6462c828af4",
"/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=f4cd670f9728bd31", "/chunks/recent-uploads.js": "/chunks/recent-uploads.js?id=a072d7081a0f48a1",
"/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=0d3dc1e73f3d4cc2", "/chunks/my-shared-items.js": "/chunks/my-shared-items.js?id=38912afeb4e4c733",
"/chunks/trash.js": "/chunks/trash.js?id=f4fc87e9f3ce9e19", "/chunks/trash.js": "/chunks/trash.js?id=b94ddc072e787b30",
"/chunks/team-folders.js": "/chunks/team-folders.js?id=cf7f5578ddef5277", "/chunks/team-folders.js": "/chunks/team-folders.js?id=4cde9804a042eb10",
"/chunks/shared-with-me.js": "/chunks/shared-with-me.js?id=ba5a1267a4d55b29", "/chunks/shared-with-me.js": "/chunks/shared-with-me.js?id=b73ccd51d4913073",
"/chunks/invitation.js": "/chunks/invitation.js?id=9ed8456c9d6d5ce1", "/chunks/invitation.js": "/chunks/invitation.js?id=9ed8456c9d6d5ce1",
"/css/tailwind.css": "/css/tailwind.css", "/css/tailwind.css": "/css/tailwind.css",
"/css/app.css": "/css/app.css" "/css/app.css": "/css/app.css"
@@ -97,7 +97,7 @@ export default {
if (!this.clipboard.includes(this.draggingId)) { if (!this.clipboard.includes(this.draggingId)) {
this.$store.dispatch('moveItem', { this.$store.dispatch('moveItem', {
to_item: data, to_item: data,
noSelectedItem: this.draggingId, item: this.draggingId,
}) })
} }
@@ -105,7 +105,7 @@ export default {
if (this.clipboard.length > 0 && this.clipboard.includes(this.draggingId)) { if (this.clipboard.length > 0 && this.clipboard.includes(this.draggingId)) {
this.$store.dispatch('moveItem', { this.$store.dispatch('moveItem', {
to_item: data, to_item: data,
noSelectedItem: null, item: null,
}) })
} }
} else { } else {
@@ -96,7 +96,7 @@ export default {
// Move item // Move item
this.$store.dispatch('moveItem', { this.$store.dispatch('moveItem', {
to_item: this.selectedFolder, to_item: this.selectedFolder,
noSelectedItem: this.isSelectedItem ? this.pickedItem : null, item: this.isSelectedItem ? this.pickedItem : undefined,
}) })
// Close popup // Close popup
@@ -108,7 +108,7 @@ export default {
if (!this.clipboard.includes(this.draggedItem[0])) { if (!this.clipboard.includes(this.draggedItem[0])) {
this.$store.dispatch('moveItem', { this.$store.dispatch('moveItem', {
to_item: this.nodes, to_item: this.nodes,
noSelectedItem: this.draggedItem[0], item: this.draggedItem[0],
}) })
} }
@@ -116,7 +116,7 @@ export default {
if (this.clipboard.includes(this.draggedItem[0])) { if (this.clipboard.includes(this.draggedItem[0])) {
this.$store.dispatch('moveItem', { this.$store.dispatch('moveItem', {
to_item: this.nodes, to_item: this.nodes,
noSelectedItem: null, item: null,
}) })
} }
+41 -46
View File
@@ -40,22 +40,22 @@ const actions = {
// Download zip // Download zip
Vue.prototype.$downloadFile(route, 'files.zip') Vue.prototype.$downloadFile(route, 'files.zip')
}, },
moveItem: ({ commit, getters, dispatch }, { to_item, noSelectedItem }) => { moveItem: ({ commit, getters, dispatch }, { to_item, item }) => {
let itemsToMove = [] let items = item
let items = [noSelectedItem] ? [item]
: getters.clipboard
// If coming no selected item dont get items to move from clipboard let itemsToMove = items.map((data) => {
if (!noSelectedItem) items = getters.clipboard return {
items.forEach((data) =>
itemsToMove.push({
id: data.data.id, id: data.data.id,
type: data.data.type, type: data.data.type,
}) }
) })
// Remove file preview // Remove file preview
if (!noSelectedItem) commit('CLIPBOARD_CLEAR') if (!item) {
commit('CLIPBOARD_CLEAR')
}
// Get route // Get route
let route = { let route = {
@@ -63,14 +63,11 @@ const actions = {
Public: `/api/editor/move/${router.currentRoute.params.token}`, Public: `/api/editor/move/${router.currentRoute.params.token}`,
}[router.currentRoute.name] || '/api/move' }[router.currentRoute.name] || '/api/move'
let moveToId = null let moveToId = to_item.data ? to_item.data.id : to_item.id
if (to_item.data) moveToId = to_item.data.id
else if (to_item.id) moveToId = to_item.id
axios axios
.post(route, { .post(route, {
to_id: moveToId, to_id: moveToId || null,
items: itemsToMove, items: itemsToMove,
}) })
.then(() => { .then(() => {
@@ -78,9 +75,11 @@ const actions = {
commit('REMOVE_ITEM', item.id) commit('REMOVE_ITEM', item.id)
commit('INCREASE_FOLDER_ITEM', moveToId) commit('INCREASE_FOLDER_ITEM', moveToId)
if (item.type === 'folder') dispatch('getAppData') if (item.type === 'folder')
dispatch('getAppData')
if (Vue.prototype.$isThisRoute(router.currentRoute, ['Public'])) dispatch('getFolderTree') if (Vue.prototype.$isThisRoute(router.currentRoute, ['Public']))
dispatch('getFolderTree')
}) })
}) })
.catch(() => Vue.prototype.$isSomethingWrong()) .catch(() => Vue.prototype.$isSomethingWrong())
@@ -270,19 +269,18 @@ const actions = {
}) })
}, },
restoreItem: ({ commit, getters }, item) => { restoreItem: ({ commit, getters }, item) => {
let itemToRestore = [] let items = item
let items = [item] ? [item]
: getters.clipboard
let restoreToHome = Vue.prototype.$isThisRoute(router.currentRoute, ['Trash']) let restoreToHome = Vue.prototype.$isThisRoute(router.currentRoute, ['Trash'])
// If coming no selected item dont get items to restore from clipboard let itemToRestore = items.map((data) => {
if (!item) items = getters.clipboard return {
items.forEach((data) =>
itemToRestore.push({
type: data.data.type, type: data.data.type,
id: data.data.id, id: data.data.id,
}) }
) })
// Remove file preview // Remove file preview
commit('CLIPBOARD_CLEAR') commit('CLIPBOARD_CLEAR')
@@ -292,31 +290,28 @@ const actions = {
to_home: restoreToHome, to_home: restoreToHome,
items: itemToRestore, items: itemToRestore,
}) })
.then(items.forEach((item) => commit('REMOVE_ITEM', item.data.id))) .then(() => items.forEach((item) => commit('REMOVE_ITEM', item.data.id)))
.catch(() => Vue.prototype.$isSomethingWrong()) .catch(() => Vue.prototype.$isSomethingWrong())
}, },
deleteItem: ({ commit, getters, dispatch }, noSelectedItem) => { deleteItem: ({ commit, getters, dispatch }, item) => {
let itemsToDelete = [] let items = item
let items = [noSelectedItem] ? [item]
: getters.clipboard
// If coming no selected item dont get items to move from clipboard let deletedItems = items.map((data) => {
if (!noSelectedItem) items = getters.clipboard // Remove file from view
items.forEach((data) => {
itemsToDelete.push({
force_delete: !!data.data.attributes.deleted_at,
type: data.data.type,
id: data.data.id,
})
// Remove file
commit('REMOVE_ITEM', data.data.id) commit('REMOVE_ITEM', data.data.id)
commit('REMOVE_ITEM_FROM_CLIPBOARD', data.data.id) commit('REMOVE_ITEM_FROM_CLIPBOARD', data.data.id)
events.$emit('file:deleted', data.data.id) events.$emit('file:deleted', data.data.id)
// Remove item from sidebar // Remove item from sidebar
if (! ['Public', 'RequestUpload'].includes(router.currentRoute.name)) { if (! ['Public', 'RequestUpload'].includes(router.currentRoute.name) && data.data.type === 'folder')
if (data.data.type === 'folder') commit('REMOVE_ITEM_FROM_FAVOURITES', data) commit('REMOVE_ITEM_FROM_FAVOURITES', data)
return {
force_delete: !!data.data.attributes.deleted_at,
type: data.data.type,
id: data.data.id,
} }
}) })
@@ -328,10 +323,10 @@ const actions = {
axios axios
.post(route, { .post(route, {
items: itemsToDelete, items: deletedItems,
}) })
.then(() => { .then(() => {
itemsToDelete.forEach((data) => { deletedItems.forEach((data) => {
// If is folder, update app data // If is folder, update app data
if (data.type === 'folder' && getters.currentFolder && data.id === getters.currentFolder.data.id) { if (data.type === 'folder' && getters.currentFolder && data.id === getters.currentFolder.data.id) {
router.back() router.back()
+1 -1
View File
@@ -70,7 +70,7 @@
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
/> />
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
+1 -1
View File
@@ -69,7 +69,7 @@
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
/> />
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
@@ -95,7 +95,7 @@
<MobileMultiSelectToolbar> <MobileMultiSelectToolbar>
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
+1 -1
View File
@@ -44,7 +44,7 @@
/> />
<ToolbarButton <ToolbarButton
v-if="canEdit" v-if="canEdit"
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
+1 -1
View File
@@ -68,7 +68,7 @@
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
/> />
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
+1 -1
View File
@@ -92,7 +92,7 @@
<MobileMultiSelectToolbar> <MobileMultiSelectToolbar>
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
class="mr-4" class="mr-4"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
@@ -32,7 +32,7 @@
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
/> />
<ToolbarButton <ToolbarButton
@click.native="$deleteFileOrFolder(clipboard)" @click.native="$deleteFileOrFolder()"
source="trash" source="trash"
:class="{ 'is-inactive': clipboard.length < 1 }" :class="{ 'is-inactive': clipboard.length < 1 }"
:action="$t('delete')" :action="$t('delete')"