Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/move #3739

Merged
merged 50 commits into from
Jul 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
334da72
Create location picker page for move
LukasHirt Jun 29, 2020
b93dfc8
Create move file action
LukasHirt Jun 29, 2020
3062bb0
Add move guide into sidebar
LukasHirt Jun 30, 2020
8eee2da
Add basic files list
LukasHirt Jul 1, 2020
ae903c3
Add real breadcrumb and use query to get resources instead of state
LukasHirt Jul 1, 2020
3d012c5
Add navigation via breadcrumbs
LukasHirt Jul 1, 2020
87b0787
Add navigation to folder
LukasHirt Jul 1, 2020
3d778b6
Fix breadcrumbs index
LukasHirt Jul 1, 2020
eac7891
Add move action
LukasHirt Jul 1, 2020
0eaed50
destination of MOVE requires full path - not only the target folder
DeepDiver1975 Jul 1, 2020
0cb6fda
Add basic files list
LukasHirt Jul 1, 2020
8c1a3ff
Add real breadcrumb and use query to get resources instead of state
LukasHirt Jul 1, 2020
d2e2a1c
Add navigation via breadcrumbs
LukasHirt Jul 1, 2020
561869f
Add navigation to folder
LukasHirt Jul 1, 2020
007715e
Add move action
LukasHirt Jul 1, 2020
03d11f6
Add helpers to get path and name
LukasHirt Jul 2, 2020
255242f
Add leaveLocationPicker method
LukasHirt Jul 2, 2020
2658ac2
Do not use grid as a wrapper
LukasHirt Jul 2, 2020
f9cd8cf
Use lead variation of breadcrumbs
LukasHirt Jul 2, 2020
52792fb
Use correct icon
LukasHirt Jul 2, 2020
81114cc
Use hasTwoRows prop
LukasHirt Jul 2, 2020
afaaa91
Display previews
LukasHirt Jul 2, 2020
34f5451
Prevent moving when unsufficient perms
LukasHirt Jul 2, 2020
1563e99
Add batch move
LukasHirt Jul 6, 2020
47584df
Return to original location when cancelling move
LukasHirt Jul 6, 2020
4d80d98
Navigate to selected folder after move
LukasHirt Jul 6, 2020
fab26b3
Add error message
LukasHirt Jul 6, 2020
a515605
Add line under breadcrumb
LukasHirt Jul 6, 2020
9281a2b
Use general location picker component
LukasHirt Jul 6, 2020
6dd0287
Add empty folder message
LukasHirt Jul 6, 2020
1eed25d
Enable move files tests
LukasHirt Jul 6, 2020
c0754f7
Enable public move tests
LukasHirt Jul 7, 2020
ee2a894
Prevent move when the name is already taken
LukasHirt Jul 7, 2020
7944eb3
Enable scroll in location picker
LukasHirt Jul 7, 2020
86725a8
Grey out folders which are being moved
LukasHirt Jul 7, 2020
b56b453
Add indicators to location picker
LukasHirt Jul 7, 2020
3688ab8
Import sharesTree
LukasHirt Jul 7, 2020
def0de8
Add translations guides
LukasHirt Jul 7, 2020
d4686ca
Enable move in drone and fix public links move
LukasHirt Jul 7, 2020
86120c0
Enable folders move tests
LukasHirt Jul 7, 2020
2636aef
Add changelog
LukasHirt Jul 7, 2020
bcbed26
Use path library, adjust translations comments and remove duplicate code
LukasHirt Jul 7, 2020
b67000e
Add translations context and display sidebar in location picker
LukasHirt Jul 8, 2020
9418999
Fix cancel route to root folder
LukasHirt Jul 8, 2020
ce03773
Add more descriptive error messages
LukasHirt Jul 8, 2020
dfc658a
Use examples in problematic files delete test
LukasHirt Jul 8, 2020
4d095bd
Use disabled as value in case previews are forbidden
LukasHirt Jul 8, 2020
364fb1b
Add cloneStateObject helper
LukasHirt Jul 8, 2020
d5ab397
Fix error messages in move tests
LukasHirt Jul 8, 2020
ad8db7e
Check for mobile breadcrumbs
LukasHirt Jul 8, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ config = {
'webUISharingFolderPermissionMultipleUsers': 'SharingFolderPermissionMultipleUsers',
'webUISharingFolderAdvancedPermissionMultipleUsers': 'SharingFolderAdvancedPermissionMU',
'webUISharingNotifications': 'SharingNotifications',
'webUIAccount': 'Account'
'webUIAccount': 'Account',
'webUIMoveFilesFolders': 'Move'
},
'extraEnvironment': {
'OPENID_LOGIN': 'true',
Expand Down
129 changes: 7 additions & 122 deletions apps/files/src/components/AllFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
:actions="actions"
:compact-mode="_sidebarOpen"
:is-action-enabled="isActionEnabled"
:has-two-rows="true"
>
<template #headerColumns>
<div ref="headerNameColumn" class="uk-text-truncate uk-text-meta uk-width-expand">
Expand Down Expand Up @@ -55,9 +56,9 @@
<file-item
:key="rowItem.viewId"
:item="rowItem"
:dav-url="davUrl"
:show-path="$_isFavoritesList"
:indicators="indicatorArray(rowItem)"
:has-two-rows="true"
@click.native.stop="
rowItem.type === 'folder'
? navigateTo(rowItem.path.substr(1))
Expand Down Expand Up @@ -155,10 +156,8 @@ import SortableColumnHeader from './FilesLists/SortableColumnHeader.vue'

import { mapGetters, mapActions, mapState } from 'vuex'
import Mixins from '../mixins'
import MixinsFilesListIndicators from '../mixins/filesListIndicators'
import FileActions from '../fileactions'
import intersection from 'lodash/intersection'
import { shareTypes, userShareTypes } from '../helpers/shareTypes'
import { getParentPaths } from '../helpers/path'

export default {
name: 'AllFilesList',
Expand All @@ -169,7 +168,7 @@ export default {
SortableColumnHeader,
QuickActions
},
mixins: [Mixins, FileActions],
mixins: [Mixins, FileActions, MixinsFilesListIndicators],
props: {
fileData: {
type: Array,
Expand Down Expand Up @@ -204,55 +203,14 @@ export default {
'activeFilesCount',
'currentFolder',
'fileSortField',
'fileSortDirectionDesc',
'sharesTree'
'fileSortDirectionDesc'
]),
...mapGetters(['configuration']),

item() {
return this.$route.params.item
},

shareTypesIndirect() {
const parentPath = this.currentFolder.path
if (!parentPath) {
return []
}
const parentPaths = getParentPaths(parentPath, true)
if (parentPaths.length === 0) {
return []
}

// remove root entry
parentPaths.pop()

const shareTypes = {}
parentPaths.forEach(parentPath => {
// TODO: optimize for performance by skipping once we got all known types
const shares = this.sharesTree[parentPath]
if (shares) {
shares.forEach(share => {
// note: no distinction between incoming and outgoing shares as we display the same
// indirect indicator for them
shareTypes[share.shareType] = true
})
}
})

return Object.keys(shareTypes).map(shareType => parseInt(shareType, 10))
},

davUrl() {
let davUrl
// FIXME: use SDK once it switches to DAV v2
if (this.publicPage()) {
davUrl = ['..', 'dav', 'public-files'].join('/')
} else {
davUrl = ['..', 'dav', 'files', this.$store.getters.user.id].join('/')
}
return this.$client.files.getFileUrl(davUrl)
},

$_isFavoritesList() {
return this.$route.name === 'files-favorites'
},
Expand Down Expand Up @@ -290,7 +248,8 @@ export default {
absolutePath: absolutePath,
$gettext: this.$gettext,
routeName: this.$route.name,
loadSharesTree: !this.publicPage()
loadSharesTree: !this.publicPage(),
isPublicPage: this.publicPage()
})
.then(() => {
const scrollTo = this.$route.query.scrollTo
Expand Down Expand Up @@ -325,80 +284,6 @@ export default {

isActionEnabled(item, action) {
return action.isEnabled(item, this.parentFolder)
},

indicatorArray(item) {
const indicators = [
{
id: 'files-sharing',
label: this.shareUserIconLabel(item),
visible: this.isUserShare(item),
icon: 'group',
handler: this.indicatorHandler
},
{
id: 'file-link',
label: this.shareLinkIconLabel(item),
visible: this.isLinkShare(item),
icon: 'link',
handler: this.indicatorHandler
}
]

return indicators.filter(indicator => indicator.visible)
},

$_shareTypes(item) {
if (typeof item.shareTypes !== 'undefined') {
return item.shareTypes
}

if (item.shares) {
return Array.from(new Set(item.shares.map(share => parseInt(share.type, 10))))
}
return []
},

isDirectUserShare(item) {
return intersection(userShareTypes, this.$_shareTypes(item)).length > 0
},

isIndirectUserShare(item) {
return (
item.isReceivedShare() || intersection(userShareTypes, this.shareTypesIndirect).length > 0
)
},

isDirectLinkShare(item) {
return this.$_shareTypes(item).indexOf(shareTypes.link) >= 0
},

isIndirectLinkShare() {
return this.shareTypesIndirect.indexOf(shareTypes.link) >= 0
},

isUserShare(item) {
return this.isDirectUserShare(item) || this.isIndirectUserShare(item)
},

isLinkShare(item) {
return this.isDirectLinkShare(item) || this.isIndirectLinkShare(item)
},

shareUserIconLabel(item) {
return this.isDirectUserShare(item)
? this.$gettext('Directly shared with collaborators')
: this.$gettext('Shared with collaborators through one of the parent folders')
},

shareLinkIconLabel(item) {
return this.isDirectLinkShare(item)
? this.$gettext('Directly shared with links')
: this.$gettext('Shared with links through one of the parent folders')
},

indicatorHandler(item, sideBarName) {
this.$_openSideBar(item, sideBarName)
}
}
}
Expand Down
7 changes: 0 additions & 7 deletions apps/files/src/components/Collaborators/SharedFilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
<file-item
:key="item.path"
:item="item"
:dav-url="davUrl"
@click.native.stop="
item.type === 'folder' ? navigateTo(item.path.substr(1)) : openFileActionBar(item)
"
Expand Down Expand Up @@ -205,12 +204,6 @@ export default {

$_isSharedWithMe() {
return this.$route.name === 'files-shared-with-me'
},

davUrl() {
// FIXME: use SDK once it switches to DAV v2
const davUrl = ['..', 'dav', 'files', this.$store.getters.user.id].join('/')
return this.$client.files.getFileUrl(davUrl)
}
},
watch: {
Expand Down
38 changes: 30 additions & 8 deletions apps/files/src/components/FileItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
key="status-indicators"
:default-indicators="indicators"
:item="item"
:are-indicators-clickable="areIndicatorsClickable"
class="files-list-indicators"
/>
<span v-else key="no-status-indicators" aria-hidden="true" v-text="'-'" />
Expand Down Expand Up @@ -71,11 +72,6 @@ export default {
required: false,
default: undefined
},
davUrl: {
type: String,
required: false,
default: undefined
},
showPath: {
type: Boolean,
default: false
Expand All @@ -84,6 +80,21 @@ export default {
type: Array,
required: false,
default: () => []
},
hasTwoRows: {
type: Boolean,
required: false,
default: false
},
displayPreview: {
type: Boolean,
required: false,
default: true
},
areIndicatorsClickable: {
type: Boolean,
required: false,
default: true
}
},
data: function() {
Expand Down Expand Up @@ -113,12 +124,23 @@ export default {
return this.fileTypeIcon(this.item)
},

hasTwoRows() {
return this.$route.name === 'files-list' || this.$route.name === 'files-favorites'
davUrl() {
let davUrl
// FIXME: use SDK once it switches to DAV v2
if (this.publicPage()) {
davUrl = ['..', 'dav', 'public-files'].join('/')
} else {
davUrl = ['..', 'dav', 'files', this.$store.getters.user.id].join('/')
}
return this.$client.files.getFileUrl(davUrl)
}
},
mounted() {
this.loadPreview()
if (this.displayPreview) {
this.loadPreview()
} else {
this.previewLoaded = 'disabled'
}
},
methods: {
loadPreview() {
Expand Down
35 changes: 27 additions & 8 deletions apps/files/src/components/FileList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
flex
class="uk-padding-small uk-padding-remove-top uk-padding-remove-bottom uk-margin-xsmall-bottom"
>
<div>
<div v-if="checkboxEnabled">
<oc-checkbox
id="filelist-check-all"
class="uk-margin-small-left"
Expand Down Expand Up @@ -44,6 +44,7 @@
>
<div
:data-is-visible="active"
:class="{ 'files-list-row-disabled': rowDisabled(rowItem) }"
@click="
selectRow(rowItem, $event)
hideRowActionsDropdown()
Expand All @@ -57,7 +58,7 @@
class="uk-padding-small oc-border-top"
:class="_rowClasses(rowItem)"
>
<div>
<div v-if="checkboxEnabled">
<oc-checkbox
class="uk-margin-small-left"
:value="selectedFiles.indexOf(rowItem) >= 0"
Expand All @@ -69,6 +70,7 @@
</div>
<slot name="rowColumns" :item="rowItem" :index="index" />
<div
v-if="actions.length > 1 || $scopedSlots.rowActions"
class="uk-flex uk-flex-middle uk-flex-right"
:class="{ 'uk-width-small': $scopedSlots.rowActions }"
>
Expand Down Expand Up @@ -133,7 +135,9 @@ export default {
type: Boolean
},
checkboxEnabled: {
type: Boolean
type: Boolean,
required: false,
default: true
},
loading: {
type: Boolean,
Expand All @@ -155,6 +159,16 @@ export default {
type: Boolean,
required: false,
default: true
},
hasTwoRows: {
type: Boolean,
required: false,
default: false
},
rowDisabled: {
type: Function,
required: false,
default: () => false
}
},
data() {
Expand Down Expand Up @@ -185,10 +199,6 @@ export default {

item() {
return this.$route.params.item
},

hasTwoRows() {
return this.$route.name === 'files-list' || this.$route.name === 'files-favorites'
}
},
watch: {
Expand Down Expand Up @@ -257,7 +267,9 @@ export default {
return 'file-row'
},
selectRow(item, event) {
if (!this.selectableRow) return
if (!this.selectableRow || this.rowDisabled(item)) {
return
}

if (item.status && (item.status === 1 || item.status === 2)) return

Expand Down Expand Up @@ -320,3 +332,10 @@ export default {
}
}
</script>

<style scoped>
.files-list-row-disabled {
opacity: 0.3;
pointer-events: none;
}
</style>
Loading