-
+
+
-
+
-
-
+
+
+
+
- There are no resources in this folder
+ No resources found
@@ -33,17 +39,18 @@
-
+
@@ -73,7 +84,7 @@
-
+
@@ -81,76 +92,97 @@
import { mapGetters, mapState, mapActions, mapMutations } from 'vuex'
import debounce from 'lodash-es/debounce'
-// mixins
import MixinAccessibleBreadcrumb from '../../mixins/accessibleBreadcrumb'
import MixinFileActions from '../../mixins/fileActions'
import MixinFilesListScrolling from '../../mixins/filesListScrolling'
-// components
import AppBar from '../../components/AppBar/AppBar.vue'
+import ContextActions from '../../components/FilesList/ContextActions.vue'
import CreateAndUpload from '../../components/AppBar/CreateAndUpload.vue'
-import ResourceTable from '../../components/FilesList/ResourceTable.vue'
-import QuickActions from '../../components/FilesList/QuickActions.vue'
-import AppLoadingSpinner from 'web-pkg/src/components/AppLoadingSpinner.vue'
-import NoContentMessage from 'web-pkg/src/components/NoContentMessage.vue'
-import NotFoundMessage from '../../components/FilesList/NotFoundMessage.vue'
+import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
+import KeyboardActions from '../../components/FilesList/KeyboardActions.vue'
import ListInfo from '../../components/FilesList/ListInfo.vue'
+import NotFoundMessage from '../../components/FilesList/NotFoundMessage.vue'
import Pagination from '../../components/FilesList/Pagination.vue'
-import ContextActions from '../../components/FilesList/ContextActions.vue'
-import KeyboardActions from '../../components/FilesList/KeyboardActions.vue'
+import QuickActions from '../../components/FilesList/QuickActions.vue'
+import ResourceTable from '../../components/FilesList/ResourceTable.vue'
import SideBar from '../../components/SideBar/SideBar.vue'
-import FilesViewWrapper from '../../components/FilesViewWrapper.vue'
+import SpaceHeader from '../../components/Spaces/SpaceHeader.vue'
+import AppLoadingSpinner from 'web-pkg/src/components/AppLoadingSpinner.vue'
+import NoContentMessage from 'web-pkg/src/components/NoContentMessage.vue'
-// misc
import { VisibilityObserver } from 'web-pkg/src/observer'
import { ImageDimension, ImageType } from '../../constants'
import { bus } from 'web-pkg/src/instance'
-import { createLocationSpaces } from '../../router'
+import { BreadcrumbItem, breadcrumbsFromPath, concatBreadcrumbs } from '../../helpers/breadcrumbs'
+import { createLocationPublic, createLocationSpaces } from '../../router'
import { useResourcesViewDefaults } from '../../composables'
-import { defineComponent, unref } from '@vue/composition-api'
-import { fetchResources } from '../../services/folder'
-import { move } from '../../helpers/resource'
+import { computed, defineComponent, PropType } from '@vue/composition-api'
+import { copyMoveResource } from '../../helpers/resource'
import { Resource } from 'web-client'
-import { breadcrumbsFromPath, concatBreadcrumbs } from '../../helpers/breadcrumbs'
-import { useRouteParam, useRouteQuery } from 'web-pkg/src/composables'
+import { useCapabilityShareJailEnabled } from 'web-pkg/src/composables'
+import { Location } from 'vue-router'
+import { isPublicSpaceResource, SpaceResource } from 'web-client/src/helpers'
+import { ClipboardActions } from '../../helpers/clipboardActions'
const visibilityObserver = new VisibilityObserver()
export default defineComponent({
+ name: 'GenericSpace',
+
components: {
AppBar,
- CreateAndUpload,
- ResourceTable,
- QuickActions,
AppLoadingSpinner,
+ ContextActions,
+ CreateAndUpload,
+ FilesViewWrapper,
+ KeyboardActions,
+ ListInfo,
NoContentMessage,
NotFoundMessage,
- ListInfo,
Pagination,
- ContextActions,
- KeyboardActions,
+ QuickActions,
+ ResourceTable,
SideBar,
- FilesViewWrapper
+ SpaceHeader
},
mixins: [MixinAccessibleBreadcrumb, MixinFileActions, MixinFilesListScrolling],
- setup() {
- const shareId = useRouteQuery('shareId')
- const shareName = useRouteParam('shareName')
- const relativePath = useRouteParam('item', '')
+
+ props: {
+ space: {
+ type: Object as PropType
,
+ required: false,
+ default: null
+ },
+ item: {
+ type: String,
+ required: false,
+ default: null
+ }
+ },
+
+ setup(props) {
+ const resourceTargetRouteCallback = (path: string, resource: Resource): Location => {
+ if (isPublicSpaceResource(props.space)) {
+ return createLocationPublic('files-public-link', {
+ params: { driveAliasAndItem: props.space.getDriveAliasAndItem({ path } as Resource) }
+ })
+ }
+ return createLocationSpaces('files-spaces-generic', {
+ params: { driveAliasAndItem: props.space.getDriveAliasAndItem({ path } as Resource) },
+ query: { ...(props.space.driveType === 'share' && { shareId: props.space.shareId }) }
+ })
+ }
+ const hasSpaceHeader = computed(() => {
+ // for now the space header is only available in the root of a project space.
+ return props.space.driveType === 'project' && props.item === '/'
+ })
return {
...useResourcesViewDefaults(),
- resourceTargetLocation: createLocationSpaces('files-spaces-share', {
- params: {
- shareName: unref(shareName)
- },
- query: {
- shareId: unref(shareId)
- }
- }),
- shareId,
- shareName,
- relativePath
+ resourceTargetRouteCallback,
+ hasShareJail: useCapabilityShareJailEnabled(),
+ hasSpaceHeader
}
},
@@ -163,23 +195,63 @@ export default defineComponent({
'totalFilesCount',
'totalFilesSize'
]),
- ...mapGetters(['user', 'homeFolder', 'configuration']),
+ ...mapGetters(['user', 'configuration']),
isEmpty() {
return this.paginatedResources.length < 1
},
breadcrumbs() {
+ const rootBreadcrumbItems: BreadcrumbItem[] = []
+ if (this.space.driveType === 'project') {
+ rootBreadcrumbItems.push({
+ text: this.$gettext('Spaces'),
+ to: createLocationSpaces('files-spaces-projects')
+ })
+ } else if (this.space.driveType === 'share') {
+ rootBreadcrumbItems.push(
+ {
+ text: this.$gettext('Shares'),
+ to: { path: '/files/shares' }
+ },
+ {
+ text: this.$gettext('Shared with me'),
+ to: { path: '/files/shares/with-me' }
+ }
+ )
+ }
+
+ let spaceBreadcrumbItem
+ if (this.space.driveType === 'personal') {
+ spaceBreadcrumbItem = {
+ text: this.hasShareJail ? this.$gettext('Personal') : this.$gettext('All files'),
+ to: createLocationSpaces('files-spaces-generic', {
+ params: { driveAliasAndItem: this.space.driveAlias },
+ query: this.$route.query
+ })
+ }
+ } else if (isPublicSpaceResource(this.space)) {
+ spaceBreadcrumbItem = {
+ text: this.$gettext('Public link'),
+ to: createLocationPublic('files-public-link', {
+ params: { driveAliasAndItem: this.space.driveAlias }
+ })
+ }
+ } else {
+ spaceBreadcrumbItem = {
+ allowContextActions: !this.hasSpaceHeader,
+ text: this.space.name,
+ to: createLocationSpaces('files-spaces-generic', {
+ params: { driveAliasAndItem: this.space.driveAlias },
+ query: this.$route.query
+ })
+ }
+ }
+
return concatBreadcrumbs(
- {
- text: this.$gettext('Shares'),
- to: { path: '/files/shares' }
- },
- {
- text: this.$gettext('Shared with me'),
- to: { path: '/files/shares/with-me' }
- },
- ...breadcrumbsFromPath(this.$route, [this.shareName, this.relativePath].join('/'))
+ ...rootBreadcrumbItems,
+ spaceBreadcrumbItem,
+ ...breadcrumbsFromPath(this.$route, this.item)
)
},
@@ -188,26 +260,23 @@ export default defineComponent({
},
displayThumbnails() {
- return !this.configuration.options.disablePreviews
+ return !this.configuration?.options?.disablePreviews
}
},
watch: {
- $route: {
- handler: async function () {
- await this.loadResourcesTask.perform(this, this.shareId, this.relativePath)
- // this can't be done in the task because the table will be rendered afterwards
- this.scrollToResourceFromRoute()
- },
- immediate: true
+ item: {
+ handler: function () {
+ this.performLoaderTask(true)
+ }
}
},
mounted() {
+ this.performLoaderTask(false)
const loadResourcesEventToken = bus.subscribe('app.files.list.load', (path: string) => {
- this.loadResourcesTask.perform(this, this.shareId, path)
+ this.performLoaderTask(true, path)
})
-
this.$on('beforeDestroy', () => bus.unsubscribe('app.files.list.load', loadResourcesEventToken))
},
@@ -217,32 +286,39 @@ export default defineComponent({
methods: {
...mapActions('Files', ['loadPreview']),
- ...mapActions(['showMessage']),
+ ...mapActions(['showMessage', 'createModal', 'hideModal']),
...mapMutations('Files', [
'REMOVE_FILES',
'REMOVE_FILES_FROM_SEARCHED',
'REMOVE_FILE_SELECTION'
]),
- fetchResources,
+ async performLoaderTask(sameRoute: boolean, path?: string) {
+ await this.loadResourcesTask.perform(this.space, path || this.item)
+ this.scrollToResourceFromRoute()
+ this.refreshFileListHeaderPosition()
+ this.accessibleBreadcrumb_focusAndAnnounceBreadcrumb(sameRoute)
+ },
async fileDropped(fileIdTarget) {
const selected = [...this.selectedResources]
- const targetInfo = this.paginatedResources.find((e) => e.id === fileIdTarget)
+ const targetFolder = this.paginatedResources.find((e) => e.id === fileIdTarget)
const isTargetSelected = selected.some((e) => e.id === fileIdTarget)
if (isTargetSelected) return
- if (targetInfo.type !== 'folder') return
- const movedResources = await move(
+ if (targetFolder.type !== 'folder') return
+ const movedResources = await copyMoveResource(
+ this.space,
selected,
- targetInfo,
- this.$client,
+ this.space,
+ targetFolder,
+ this.$clientService,
this.createModal,
this.hideModal,
this.showMessage,
this.$gettext,
this.$gettextInterpolate,
this.$ngettext,
- false
+ ClipboardActions.Cut
)
for (const resource of movedResources) {
this.REMOVE_FILES([resource])
diff --git a/packages/web-app-files/src/views/spaces/GenericTrash.vue b/packages/web-app-files/src/views/spaces/GenericTrash.vue
new file mode 100644
index 00000000000..02bc6c4f4be
--- /dev/null
+++ b/packages/web-app-files/src/views/spaces/GenericTrash.vue
@@ -0,0 +1,167 @@
+
+
+
+
+
+
+
+
+ {{ noContentMessage }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/packages/web-app-files/src/views/spaces/Project.vue b/packages/web-app-files/src/views/spaces/Project.vue
deleted file mode 100644
index c50d801bb57..00000000000
--- a/packages/web-app-files/src/views/spaces/Project.vue
+++ /dev/null
@@ -1,496 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ space.name }}
-
-
-
-
-
-
-
-
-
-
-
-
-
{{ space.description }}
-
-
-
-
-
-
-
- {{ markdownCollapseText }}
-
-
-
-
-
-
-
-
-
- No resources found
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/packages/web-app-files/src/views/spaces/Projects.vue b/packages/web-app-files/src/views/spaces/Projects.vue
index 3c65e5bd8c4..b4c2dd5c57b 100644
--- a/packages/web-app-files/src/views/spaces/Projects.vue
+++ b/packages/web-app-files/src/views/spaces/Projects.vue
@@ -116,7 +116,7 @@
padding-size="small"
position="bottom-end"
>
-
+
@@ -134,7 +134,7 @@