mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-29 11:15:58 +00:00
bulk-operations v0.3 add multi shared cancel to contextMenu
This commit is contained in:
@@ -130,6 +130,14 @@
|
||||
: $t('context_menu.share')
|
||||
}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="menu-option" @click="shareCancel" v-if="this.fileInfoDetail.length > 1 && !multiSelectContextMenu">
|
||||
<div class="icon">
|
||||
<link-icon size="17"></link-icon>
|
||||
</div>
|
||||
<div class="text-label">
|
||||
{{$t('context_menu.share_cancel')}}
|
||||
</div>
|
||||
</li>
|
||||
<li class="menu-option" @click="deleteItem">
|
||||
<div class="icon">
|
||||
@@ -404,6 +412,9 @@ export default {
|
||||
},
|
||||
|
||||
methods: {
|
||||
shareCancel() {
|
||||
this.$store.dispatch('shareCancel')
|
||||
},
|
||||
renameItem() {
|
||||
events.$emit('popup:open', { name: 'rename-item', item: this.item })
|
||||
},
|
||||
|
||||
@@ -226,17 +226,17 @@ export default {
|
||||
events.$emit("popup:open", { name: "move", item: this.fileInfoDetail });
|
||||
},
|
||||
shareItem() {
|
||||
if (this.fileInfoDetail) {
|
||||
if (this.fileInfoDetail[0]) {
|
||||
//ADD BY M
|
||||
if (this.fileInfoDetail.shared) {
|
||||
if (this.fileInfoDetail[0].shared) {
|
||||
events.$emit("popup:open", {
|
||||
name: "share-edit",
|
||||
item: this.fileInfoDetail,
|
||||
item: this.fileInfoDetail[0],
|
||||
});
|
||||
} else {
|
||||
events.$emit("popup:open", {
|
||||
name: "share-create",
|
||||
item: this.fileInfoDetail,
|
||||
item: this.fileInfoDetail[0],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@
|
||||
changePassword() {
|
||||
this.canChangePassword = false
|
||||
},
|
||||
destroySharing() {
|
||||
async destroySharing() {
|
||||
|
||||
// Set confirm button
|
||||
if (! this.isConfirmedDestroy) {
|
||||
@@ -170,18 +170,9 @@
|
||||
this.isDeleting = true
|
||||
|
||||
// Send delete request
|
||||
axios
|
||||
.post('/api/share/' + this.pickedItem.shared.token, {
|
||||
_method: 'delete'
|
||||
})
|
||||
.then(() => {
|
||||
// Remove item from file browser
|
||||
if ( this.isSharedLocation ) {
|
||||
this.$store.commit('REMOVE_ITEM', this.pickedItem.unique_id)
|
||||
}
|
||||
|
||||
// Flush shared data
|
||||
this.$store.commit('FLUSH_SHARED', this.pickedItem.unique_id)
|
||||
await this.$store.dispatch('shareCancel' , this.pickedItem)
|
||||
.then((response) => {
|
||||
|
||||
// End deleting spinner button
|
||||
setTimeout(() => this.isDeleting = false, 150)
|
||||
|
||||
@@ -273,6 +273,7 @@
|
||||
"rename": "重命名",
|
||||
"restore": "恢复文件",
|
||||
"share": "分享",
|
||||
"share_cancel": "Share Cancel",
|
||||
"share_edit": "编辑分享设定",
|
||||
"upload": "上传",
|
||||
"select": "Select"
|
||||
|
||||
@@ -275,6 +275,7 @@
|
||||
"rename": "Rename",
|
||||
"restore": "Restore",
|
||||
"share": "Share",
|
||||
"share_cancel": "Share Cancel",
|
||||
"share_edit": "Edit Sharing",
|
||||
"upload": "Upload",
|
||||
"select": "Select"
|
||||
|
||||
@@ -275,6 +275,7 @@
|
||||
"rename": "Premenovať",
|
||||
"restore": "Obnoviť",
|
||||
"share": "Zdieľať",
|
||||
"share_cancel": "Zrušenie zdieľania",
|
||||
"share_edit": "Upraviť zdieľanie",
|
||||
"upload": "Nahrať",
|
||||
"select": "Výber"
|
||||
|
||||
+45
@@ -65,6 +65,51 @@ const actions = {
|
||||
})
|
||||
})
|
||||
},
|
||||
shareCancel: ({commit, getters} , singleItem) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
let cancelSharedFolders = []
|
||||
let items = [singleItem]
|
||||
|
||||
if(!singleItem) {
|
||||
items = getters.fileInfoDetail
|
||||
}
|
||||
|
||||
items.forEach((data) => {
|
||||
cancelSharedFolders.push({
|
||||
'token': data.shared.token
|
||||
})
|
||||
})
|
||||
|
||||
axios
|
||||
.post('/api/share/cancel', {
|
||||
_method: 'post',
|
||||
folders: cancelSharedFolders
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
items.forEach((item) => {
|
||||
|
||||
// Remove item from file browser
|
||||
if ( getters.currentFolder , getters.currentFolder.location === 'shared' ) {
|
||||
commit('REMOVE_ITEM', item.unique_id)
|
||||
}
|
||||
|
||||
// Flush shared data
|
||||
commit('FLUSH_SHARED', item.unique_id)
|
||||
|
||||
commit('CLEAR_FILEINFO_DETAIL')
|
||||
})
|
||||
resolve(true)
|
||||
|
||||
})
|
||||
.catch((error) => {
|
||||
isSomethingWrong()
|
||||
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
},
|
||||
getSingleFile: ({commit, state}) => {
|
||||
|
||||
let route = state.sharedDetail.protected
|
||||
|
||||
Reference in New Issue
Block a user