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

[full-ci] Owncloud sdk files trash adjustments #6566

Merged
merged 34 commits into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1105252
Supply trash bin path to sdk trash methods, add new routes for trash bin
Mar 8, 2022
d36aac1
Fix isLocationActive
Mar 10, 2022
03780f2
Add Deleted Files action for spaces
Mar 10, 2022
f461aef
Add breadcrumbs for project trashbin
Mar 10, 2022
64b571e
Fix stuff after rebase
Mar 10, 2022
6c6b560
Update snapshots
Mar 10, 2022
5f05b19
Fix mapGetters user on wrong place
Mar 10, 2022
59f8d06
Fix tests && set /trash redirect
Mar 10, 2022
c28e60d
Add empty trash confirm dialog
Mar 11, 2022
86d5d3e
Adjust trashbin actions to work with spaces
Mar 11, 2022
724f7a6
Adjust empty message
Mar 11, 2022
7bf7b8c
Fix typo
Mar 11, 2022
09dffcf
Add tests for spaces deletedFiles action
Mar 14, 2022
f7a10f3
Update yarn.lock
Mar 14, 2022
230e1cd
Adjustments after rebase
Mar 14, 2022
b5753c5
Lint
Mar 14, 2022
1979010
Skip unit test for now
Mar 14, 2022
4273546
Update tests
Mar 14, 2022
6d63122
Fix tests
Mar 14, 2022
355eab5
add emptyTrashBin action tests
Mar 15, 2022
3420d66
Add trashbin component to avoid duplicated code
Mar 15, 2022
d6101aa
Update yarn.lock
Mar 15, 2022
c9b894e
Add route check
Mar 15, 2022
a3a3260
Add route check
Mar 15, 2022
78991ab
Add tests for delete permanent action
Mar 15, 2022
bc45d44
Add tests for actions/restore.js
Mar 16, 2022
daef965
Add changelog item
Mar 16, 2022
59b902b
Fix acceptance tests
Mar 16, 2022
efa0677
Wording
Mar 16, 2022
968f4e0
Trigger Build
Mar 16, 2022
fc3690d
Wording
Mar 16, 2022
f3f7037
rename spaceId to storageId
Mar 16, 2022
3267f50
Dedupe deps
pascalwengerter Mar 16, 2022
196da2d
Fix trashbin acceptance test (modal has been added)
pascalwengerter Mar 16, 2022
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
7 changes: 4 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
'plugin:prettier/recommended',
'plugin:jest/recommended'
],
parser: "@babel/eslint-parser",
parser: '@babel/eslint-parser',
parserOptions: {
requireConfigFile: false,
sourceType: 'module'
Expand All @@ -23,13 +23,14 @@ module.exports = {
'require-await': 'warn',
'no-new': 'off',
'jest/no-standalone-expect': 'off',
'node/no-callback-literal': 'off'
'node/no-callback-literal': 'off',
'unused-imports/no-unused-imports': 'error'
},
globals: {
require: false,
requirejs: false
},
plugins: ['jest'],
plugins: ['jest', 'unused-imports'],
overrides: [
{
files: ['**/*.vue'],
Expand Down
12 changes: 12 additions & 0 deletions changelog/unreleased/enhancement-trash-bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Enhancement: Trash bin

We've improved the trash bin in general:
* Add compatibility with owncloud-sdk 3.0.0-alpha 1
* Add a confirmation dialog while hitting the `Empty trash bin` button
* Add trash bin for project spaces
* Change personal trash bin route from `files/trash` to `files/trash/personal`

https://github.com/owncloud/web/pull/6566
https://github.com/owncloud/web/issues/6544
https://github.com/owncloud/web/issues/5974

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.2.0",
"eslint-plugin-unused-imports": "^2.0.0",
"eslint-plugin-vue": "^7.13.0",
"eslint-plugin-vuejs-accessibility": "^0.7.1",
"focus-trap": "^6.4.0",
Expand Down
32 changes: 29 additions & 3 deletions packages/web-app-files/src/components/AppBar/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ import { DavProperties } from 'web-pkg/src/constants'
import {
isLocationPublicActive,
isLocationSharesActive,
isLocationSpacesActive
isLocationSpacesActive,
isLocationTrashActive
} from '../../router'
import { useActiveLocation } from '../../composables'

Expand Down Expand Up @@ -92,7 +93,11 @@ export default {
isPersonalLocation: useActiveLocation(isLocationSpacesActive, 'files-spaces-personal-home'),
isPublicLocation: useActiveLocation(isLocationPublicActive, 'files-public-files'),
isSpacesProjectsLocation: useActiveLocation(isLocationSpacesActive, 'files-spaces-projects'),
isSpacesProjectLocation: useActiveLocation(isLocationSpacesActive, 'files-spaces-project')
isSpacesProjectLocation: useActiveLocation(isLocationSpacesActive, 'files-spaces-project'),
isTrashSpacesProjectActive: useActiveLocation(
isLocationTrashActive,
'files-trash-spaces-project'
)
}
},
data: () => ({
Expand All @@ -113,6 +118,9 @@ export default {
...mapState('Files', ['areHiddenFilesShown']),

showContextActions() {
if (this.isTrashSpacesProjectActive) {
return false
}
if (this.isSpacesProjectLocation) {
return this.currentFolder && this.breadcrumbs.length > 2
}
Expand Down Expand Up @@ -166,12 +174,30 @@ export default {
this.isPublicLocation ||
this.isPersonalLocation ||
this.isSpacesProjectsLocation ||
this.isSpacesProjectLocation
this.isSpacesProjectLocation ||
this.isTrashSpacesProjectActive
)
) {
return []
}

if (this.isTrashSpacesProjectActive) {
return [
{
text: this.$gettext('Spaces'),
to: '/files/spaces/projects'
},
{
text: this.$route.params.storageId,
to: `/files/spaces/projects/${this.$route.params.storageId}`
},
{
text: this.$gettext('Deleted Files'),
onClick: () => bus.publish('app.files.list.load')
}
]
}

const { params: routeParams, path: routePath } = this.$route
const requestedItemPath = routeParams.item || ''
const basePaths =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import { mapGetters } from 'vuex'
import ActionMenuItem from '../../ActionMenuItem.vue'
import Rename from '../../../mixins/spaces/actions/rename'
import Delete from '../../../mixins/spaces/actions/delete'
import DeletedFiles from '../../../mixins/spaces/actions/deletedFiles'
import Disable from '../../../mixins/spaces/actions/disable'
import Restore from '../../../mixins/spaces/actions/restore'
import EditDescription from '../../../mixins/spaces/actions/editDescription'
Expand All @@ -51,6 +52,7 @@ export default {
mixins: [
Rename,
Delete,
DeletedFiles,
EditDescription,
EditReadmeContent,
Disable,
Expand All @@ -70,6 +72,7 @@ export default {
...this.$_uploadImage_items,
...this.$_editReadmeContent_items,
...this.$_editQuota_items,
...this.$_deletedFiles_items,
...this.$_restore_items,
...this.$_delete_items,
...this.$_disable_items
Expand Down
7 changes: 5 additions & 2 deletions packages/web-app-files/src/components/SideBar/FileInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import Mixins from '../../mixins'
import MixinResources from '../../mixins/resources'
import MixinFavorite from '../../mixins/actions/favorite'
import { isLocationCommonActive } from '../../router'
import { isLocationTrashActive } from '../../router'

export default {
name: 'FileInfo',
Expand All @@ -61,7 +61,10 @@ export default {
return obj
}

if (isLocationCommonActive(this.$router, 'files-common-trash')) {
if (
isLocationTrashActive(this.$router, 'files-trash-personal') ||
isLocationTrashActive(this.$router, 'files-trash-spaces-project')
) {
return interpolate({
sourceTime: this.file.ddate,
infoString: this.$pgettext('inline info about deletion date', 'deleted %{timeRelative}'),
Expand Down
9 changes: 3 additions & 6 deletions packages/web-app-files/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ import { VisibilityObserver } from 'web-pkg/src/observer'
import { DavProperties } from 'web-pkg/src/constants'

import { buildResource } from '../../helpers/resources'
import {
isLocationCommonActive,
isLocationPublicActive,
isLocationSharesActive
} from '../../router'
import { isLocationPublicActive, isLocationSharesActive, isLocationTrashActive } from '../../router'
import { computed } from '@vue/composition-api'

import FileInfo from './FileInfo.vue'
Expand Down Expand Up @@ -310,7 +306,8 @@ export default {
}

if (
isLocationCommonActive(this.$router, 'files-common-trash') ||
isLocationTrashActive(this.$router, 'files-trash-personal') ||
isLocationTrashActive(this.$router, 'files-trash-spaces-project') ||
this.highlightedFileIsSpace
) {
this.selectedFile = this.highlightedFile
Expand Down
123 changes: 123 additions & 0 deletions packages/web-app-files/src/components/Trashbin.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<template>
<div>
<list-loader v-if="loadResourcesTask.isRunning" />
<template v-else>
<no-content-message
v-if="isEmpty"
id="files-trashbin-empty"
class="files-empty"
icon="delete-bin-5"
>
<template #message>
<span v-if="noContentMessage">{{ noContentMessage }}</span>
<span v-else v-translate>You have no deleted files</span>
</template>
</no-content-message>
<resource-table
v-else
id="files-trashbin-table"
v-model="selected"
class="files-table"
:class="{ 'files-table-squashed': !sidebarClosed }"
:are-paths-displayed="true"
:are-thumbnails-displayed="false"
:resources="paginatedResources"
:are-resources-clickable="false"
:header-position="fileListHeaderY"
:sort-by="sortBy"
:sort-dir="sortDir"
@sort="handleSort"
>
<template #contextMenu="{ resource }">
<context-actions v-if="isResourceInSelection(resource)" :items="selected" />
</template>
<template #footer>
<pagination :pages="paginationPages" :current-page="paginationPage" />
<list-info
v-if="paginatedResources.length > 0"
class="oc-width-1-1 oc-my-s"
:files="totalFilesCount.files"
:folders="totalFilesCount.folders"
/>
</template>
</resource-table>
</template>
</div>
</template>

<script>
import { mapGetters, mapMutations, mapState } from 'vuex'
import ResourceTable from './FilesList/ResourceTable.vue'

import MixinFilesListFilter from '../mixins/filesListFilter'
import MixinResources from '../mixins/resources'
import MixinMountSideBar from '../mixins/sidebar/mountSideBar'

import ListLoader from './FilesList/ListLoader.vue'
import NoContentMessage from './FilesList/NoContentMessage.vue'
import ListInfo from './FilesList/ListInfo.vue'
import Pagination from './FilesList/Pagination.vue'
import ContextActions from './FilesList/ContextActions.vue'
import { useResourcesViewDefaults } from '../composables'
import { bus } from 'web-pkg/src/instance'

export default {
name: 'Trashbin',

components: { ResourceTable, ListLoader, NoContentMessage, ListInfo, Pagination, ContextActions },

mixins: [MixinResources, MixinMountSideBar, MixinFilesListFilter],
props: {
noContentMessage: {
type: String,
required: false,
default: ''
}
},

setup() {
return {
...useResourcesViewDefaults()
}
},

computed: {
...mapState('Files', ['files']),
...mapGetters('Files', ['highlightedFile', 'selectedFiles', 'totalFilesCount']),
...mapState('Files/sidebar', { sidebarClosed: 'closed' }),

selected: {
get() {
return this.selectedFiles
},
set(resources) {
this.SET_FILE_SELECTION(resources)
}
},

isEmpty() {
return this.paginatedResources.length < 1
}
},

created() {
this.loadResourcesTask.perform(this)

const loadResourcesEventToken = bus.subscribe('app.files.list.load', (path) => {
this.loadResourcesTask.perform(this, this.$route.params.item === path, path)
})

this.$on('beforeDestroy', () => {
bus.unsubscribe('app.files.list.load', loadResourcesEventToken)
})
},

methods: {
...mapMutations('Files', ['LOAD_FILES', 'SET_FILE_SELECTION', 'CLEAR_CURRENT_FILES_LIST']),

isResourceInSelection(resource) {
return this.selected?.includes(resource)
}
}
}
</script>
24 changes: 17 additions & 7 deletions packages/web-app-files/src/fileSideBars.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import NoSelection from './components/SideBar/NoSelection.vue'
import SpaceActions from './components/SideBar/Actions/SpaceActions.vue'
import SpaceDetails from './components/SideBar/Details/SpaceDetails.vue'
import SpaceShares from './components/SideBar/Shares/SpaceShares.vue'
import { isLocationCommonActive, isLocationPublicActive, isLocationSpacesActive } from './router'
import { isLocationSpacesActive, isLocationTrashActive, isLocationPublicActive } from './router'
import { spaceRoleEditor, spaceRoleManager } from './helpers/share'

export default [
Expand All @@ -27,10 +27,15 @@ export default [
app: 'details-item',
icon: 'questionnaire-line',
component: FileDetails,
default: !isLocationCommonActive(router, 'files-common-trash'),
default:
!isLocationTrashActive(router, 'files-trash-personal') &&
!isLocationTrashActive(router, 'files-trash-spaces-project'),
get enabled() {
return (
!isLocationCommonActive(router, 'files-common-trash') && !multipleSelection && !rootFolder
!isLocationTrashActive(router, 'files-trash-personal') &&
!isLocationTrashActive(router, 'files-trash-spaces-project') &&
!multipleSelection &&
!rootFolder
)
}
}),
Expand All @@ -48,7 +53,9 @@ export default [
component: FileActions,
icon: 'slideshow-3',
iconFillType: 'line',
default: isLocationCommonActive(router, 'files-common-trash'),
default:
isLocationTrashActive(router, 'files-trash-personal') ||
isLocationTrashActive(router, 'files-trash-spaces-project'),
get enabled() {
return !multipleSelection && !rootFolder
}
Expand All @@ -60,7 +67,8 @@ export default [
get enabled() {
if (multipleSelection || rootFolder) return false
if (
isLocationCommonActive(router, 'files-common-trash') ||
isLocationTrashActive(router, 'files-trash-personal') ||
isLocationTrashActive(router, 'files-trash-spaces-project') ||
isLocationPublicActive(router, 'files-public-files')
) {
return false
Expand All @@ -79,7 +87,8 @@ export default [
get enabled() {
if (multipleSelection || rootFolder) return false
if (
isLocationCommonActive(router, 'files-common-trash') ||
isLocationTrashActive(router, 'files-trash-personal') ||
isLocationTrashActive(router, 'files-trash-spaces-project') ||
isLocationPublicActive(router, 'files-public-files')
) {
return false
Expand All @@ -98,7 +107,8 @@ export default [
get enabled() {
if (multipleSelection || rootFolder) return false
if (
isLocationCommonActive(router, 'files-common-trash') ||
isLocationTrashActive(router, 'files-trash-personal') ||
isLocationTrashActive(router, 'files-trash-spaces-project') ||
isLocationPublicActive(router, 'files-public-files')
) {
return false
Expand Down
8 changes: 8 additions & 0 deletions packages/web-app-files/src/helpers/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,18 @@ export function buildWebDavFilesPath(userId, path) {
return '/' + `files/${userId}/${path}`.split('/').filter(Boolean).join('/')
}

export function buildWebDavFilesTrashPath(userId, path = '') {
return '/' + `trash-bin/${userId}/${path}`.split('/').filter(Boolean).join('/')
}

export function buildWebDavSpacesPath(storageId, path) {
return '/' + `spaces/${storageId}/${path}`.split('/').filter(Boolean).join('/')
}

export function buildWebDavSpacesTrashPath(storageId, path = '') {
return '/' + `/spaces/trash-bin/${storageId}/${path}`.split('/').filter(Boolean).join('/')
}

export function attachIndicators(resource, sharesTree) {
return (resource.indicators = getIndicators(resource, sharesTree))
}
Expand Down
Loading