From 6b774f2dfad7f8097b80539db30cfa27a355d299 Mon Sep 17 00:00:00 2001 From: Diogo Castro Date: Tue, 14 Mar 2023 00:03:10 +0100 Subject: [PATCH] Clean urls and spaces mock This commit is a workaround of the lack of spaces in our Reva backend. The idea was to implement the URL schema that we agreed in the past and to re-use the spaces logic for showing our EOS Projects. --- .../src/components/AppBar/CreateSpace.vue | 14 +- .../components/FilesList/ContextActions.vue | 3 + .../src/components/Spaces/SpaceHeader.vue | 18 +- .../filesList/useResourceRouteResolver.ts | 6 +- packages/web-app-files/src/fileSideBars.ts | 2 +- packages/web-app-files/src/index.ts | 9 +- .../src/services/folder/loaderTrashbin.ts | 15 +- .../web-app-files/src/views/Favorites.vue | 2 +- .../src/views/spaces/DriveRedirect.vue | 2 +- .../src/views/spaces/GenericSpace.vue | 6 +- .../src/views/spaces/GenericTrash.vue | 69 +++++- .../src/views/spaces/Projects.vue | 73 +++++- packages/web-client/src/ocs/capabilities.ts | 4 +- packages/web-client/src/webdav/restoreFile.ts | 5 +- packages/web-pkg/package.json | 4 + .../sideBar/Spaces/Details/SpaceDetails.vue | 207 +++++++++++++++++- .../Spaces/Details/SpaceDetailsMultiple.vue | 4 +- .../driveResolver/useDriveResolver.ts | 3 + .../web-pkg/src/mixins/spaces/deletedFiles.ts | 61 +++++- .../web-pkg/src/mixins/spaces/showMembers.ts | 2 +- packages/web-runtime/src/index.ts | 4 +- pnpm-lock.yaml | 3 + 22 files changed, 445 insertions(+), 71 deletions(-) diff --git a/packages/web-app-files/src/components/AppBar/CreateSpace.vue b/packages/web-app-files/src/components/AppBar/CreateSpace.vue index 8a7749e1ec9..f298e4f1c0d 100644 --- a/packages/web-app-files/src/components/AppBar/CreateSpace.vue +++ b/packages/web-app-files/src/components/AppBar/CreateSpace.vue @@ -2,14 +2,14 @@ - New Space + New Project @@ -33,6 +33,12 @@ export default defineComponent({ ...mapMutations('runtime/spaces', ['UPSERT_SPACE']), ...mapMutations('Files', ['UPSERT_RESOURCE', 'UPDATE_RESOURCE_FIELD']), + onNewProjectButtonClick() { + window.open( + 'https://cern.service-now.com/service-portal?id=sc_cat_item&name=request-storage-space&se=CERNBox-Service', + '_blank' + ) + }, showCreateSpaceModal() { const modal = { variation: 'passive', diff --git a/packages/web-app-files/src/components/FilesList/ContextActions.vue b/packages/web-app-files/src/components/FilesList/ContextActions.vue index efa4ef34f90..a1f29dd7204 100644 --- a/packages/web-app-files/src/components/FilesList/ContextActions.vue +++ b/packages/web-app-files/src/components/FilesList/ContextActions.vue @@ -18,12 +18,14 @@ import SpaceNavigate from 'web-pkg/src/mixins/spaces/navigate' import { PropType } from 'vue' import { Resource } from 'web-client' import { SpaceResource } from 'web-client/src/helpers' +import DeletedFiles from 'web-pkg/src/mixins/spaces/deletedFiles' export default { name: 'ContextActions', components: { ContextActionMenu }, mixins: [ FileActions, + DeletedFiles, CreateQuicklink, EmptyTrashBin, Paste, @@ -155,6 +157,7 @@ export default { return action }), ...fileHandlers, + ...this.$_deletedFiles_items_generic, ...this.$_showDetails_items ].filter((item) => item.isEnabled(this.filterParams)) } diff --git a/packages/web-app-files/src/components/Spaces/SpaceHeader.vue b/packages/web-app-files/src/components/Spaces/SpaceHeader.vue index 54c25443637..a07b538bc3d 100644 --- a/packages/web-app-files/src/components/Spaces/SpaceHeader.vue +++ b/packages/web-app-files/src/components/Spaces/SpaceHeader.vue @@ -18,7 +18,7 @@
-

{{ space.name }}

+

{{ spaceName }}

diff --git a/packages/web-app-files/src/composables/filesList/useResourceRouteResolver.ts b/packages/web-app-files/src/composables/filesList/useResourceRouteResolver.ts index 12bfdc5094c..7e32475b2ad 100644 --- a/packages/web-app-files/src/composables/filesList/useResourceRouteResolver.ts +++ b/packages/web-app-files/src/composables/filesList/useResourceRouteResolver.ts @@ -41,7 +41,7 @@ export const useResourceRouteResolver = (options: ResourceRouteResolverOptions, return unref(targetRouteCallback)(createTargetRouteOptions) } - const { path, fileId, resource } = createTargetRouteOptions + const { path, fileId = null, resource } = createTargetRouteOptions let space if (resource.shareId) { space = buildShareSpaceResource({ @@ -49,13 +49,13 @@ export const useResourceRouteResolver = (options: ResourceRouteResolverOptions, shareName: basename(resource.shareRoot), serverUrl: configurationManager.serverUrl }) - } else if (!resource.shareId && !getInternalSpace(resource.storageId)) { + } /*else if (!resource.shareId && !getInternalSpace(resource.storageId)) { if (path === '/') { return createLocationShares('files-shares-with-me') } // FIXME: This is a hacky way to resolve re-shares, but we don't have other options currently return { name: 'resolvePrivateLink', params: { fileId } } - } else { + } */ else { space = getMatchingSpace(resource) } if (!space) { diff --git a/packages/web-app-files/src/fileSideBars.ts b/packages/web-app-files/src/fileSideBars.ts index 0a32774b3cb..b5c30a2da32 100644 --- a/packages/web-app-files/src/fileSideBars.ts +++ b/packages/web-app-files/src/fileSideBars.ts @@ -230,7 +230,7 @@ const panelGenerators: (({ } }, get enabled() { - return resource?.type === 'space' && !multipleSelection + return false//resource?.type === 'space' && !multipleSelection } }), ({ capabilities, resource, router, multipleSelection, rootFolder }) => ({ diff --git a/packages/web-app-files/src/index.ts b/packages/web-app-files/src/index.ts index 7d2ecf31f3c..dd1d868abb3 100644 --- a/packages/web-app-files/src/index.ts +++ b/packages/web-app-files/src/index.ts @@ -35,12 +35,13 @@ const appInfo = { const navItems = [ { name(capabilities) { - return capabilities.spaces?.enabled ? $gettext('Personal') : $gettext('All files') + return capabilities.spaces?.enabled ? $gettext('All files') : $gettext('All files') }, icon: appInfo.icon, route: { path: `/${appInfo.id}/spaces/personal` - } + }, + activeFor: [{ path: `/${appInfo.id}/spaces/eos` }] }, { name: $gettext('Favorites'), @@ -64,7 +65,7 @@ const navItems = [ } }, { - name: $gettext('Spaces'), + name: $gettext('Projects'), icon: 'layout-grid', route: { path: `/${appInfo.id}/spaces/projects` @@ -78,7 +79,7 @@ const navItems = [ name: $gettext('Deleted files'), icon: 'delete-bin-5', route: { - path: `/${appInfo.id}/trash` + path: `/${appInfo.id}/trash/eos` }, enabled(capabilities) { return capabilities.dav && capabilities.dav.trashbin === '1.0' diff --git a/packages/web-app-files/src/services/folder/loaderTrashbin.ts b/packages/web-app-files/src/services/folder/loaderTrashbin.ts index 41ac93ed445..6078d9dbc72 100644 --- a/packages/web-app-files/src/services/folder/loaderTrashbin.ts +++ b/packages/web-app-files/src/services/folder/loaderTrashbin.ts @@ -27,13 +27,18 @@ export class FolderLoaderTrashbin implements FolderLoader { } = context const hasShareJail = useCapabilityShareJailEnabled(store) - return useTask(function* (signal1, signal2, space: Resource) { + return useTask(function* (signal1, signal2, space: Resource, projectName) { store.commit('Files/CLEAR_CURRENT_FILES_LIST') - const path = unref(hasShareJail) - ? buildWebDavSpacesTrashPath(space.id) - : buildWebDavFilesTrashPath(space.id) - const resources = yield client.fileTrash.list(path, '1', DavProperties.Trashbin) + // const path = unref(hasShareJail) + // ? buildWebDavSpacesTrashPath(space.id) + // : buildWebDavFilesTrashPath(space.id) + const path = buildWebDavFilesTrashPath(space.id) //user.id + const query = projectName + ? { base_path: `/eos/project/${projectName[0]}/${projectName}` } + : undefined + + const resources = yield client.fileTrash.list(path, '1', DavProperties.Trashbin, query) store.commit('Files/LOAD_FILES', { currentFolder: buildResource(resources[0]), diff --git a/packages/web-app-files/src/views/Favorites.vue b/packages/web-app-files/src/views/Favorites.vue index e2957ee90ca..281a6cb7954 100644 --- a/packages/web-app-files/src/views/Favorites.vue +++ b/packages/web-app-files/src/views/Favorites.vue @@ -1,7 +1,7 @@