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

WIP new share urls #9221

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
3b21199
feat: use remoteItem to utilize mountpoint drives for shares
kulmann May 16, 2023
9833da0
refactor: cleanup imports
kulmann May 19, 2023
2329bf4
Make share link on Shared with me page work
JammingBen Aug 3, 2023
36d3995
Fix crash
dschmidt Aug 3, 2023
81e0414
make shares with file ids work
JammingBen Aug 9, 2023
6fcc5f7
more fixing for id based urls
JammingBen Aug 9, 2023
7955506
remove buildsharespace usages
JammingBen Aug 10, 2023
a61f1b4
Keep mountpoints and root spaces in runtime spaces
dschmidt Aug 10, 2023
f2f5114
Remove share spaces, ensure mount points are loaded when needed
JammingBen Aug 11, 2023
02b8119
work on breadcrumbs
JammingBen Aug 11, 2023
2bd99dd
Fix breadcrumbs
JammingBen Aug 15, 2023
bef3e5b
Fix parent folder names
dschmidt Aug 15, 2023
9670714
Fix uploads
dschmidt Aug 15, 2023
073ce34
Properly type Resource.driveType and UppyResource.driveType
dschmidt Aug 15, 2023
5fa7e70
Remove debugger statement
dschmidt Aug 15, 2023
b0d4d53
Refactor breadcrumbs
JammingBen Aug 16, 2023
1068569
Hide share owner path
JammingBen Aug 16, 2023
650fbd6
Hide share owner path
JammingBen Aug 16, 2023
f563770
Remove console logs
JammingBen Sep 11, 2023
ba88c52
load ancestor meta data in drive resolver
JammingBen Sep 11, 2023
584ac28
wip: find mount point via ancestor meta data
JammingBen Sep 11, 2023
24d5659
wip: find mount point via ancestor meta data
JammingBen Sep 11, 2023
a3d36ee
wip: Fix breadcrumbs
dschmidt Sep 12, 2023
e45a8b3
fixup! wip: Fix breadcrumbs
dschmidt Sep 13, 2023
bc782ab
fix reload and breadcrumbs in shares
JammingBen Sep 13, 2023
44e6bbf
Fix visible paths
JammingBen Sep 13, 2023
2e492a4
Fix root breadcrumb items in share
JammingBen Sep 13, 2023
c157673
fix preview app
dschmidt Sep 13, 2023
f004f1b
Simplify ancestor retrieval
dschmidt Sep 13, 2023
6dfd835
Reduce flickering in topbar when navigating
JammingBen Sep 14, 2023
db33a95
Fix app file loading for shares
JammingBen Sep 14, 2023
a8f9f9b
Fix cern use case
JammingBen Sep 14, 2023
49068cb
Show fullShareOwnerPath breadcrumbs
dschmidt Sep 14, 2023
d7d9991
Fix navigating into subfolder when idBased routing is turned off
dschmidt Sep 14, 2023
ea0d11a
Do not apply dirname on cached data (where it has already been applied)
dschmidt Sep 14, 2023
151d82b
Fix flicker on navigation to subfolder in fullShareOwnerPath mode wit…
dschmidt Sep 14, 2023
b978282
Fix ancestor loading when idBased routing is off
dschmidt Sep 14, 2023
e447188
Fix ...
dschmidt Sep 14, 2023
9875f02
Fix URLs in search results
JammingBen Sep 15, 2023
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
4 changes: 4 additions & 0 deletions dev/docker/ocis.web.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
"showAllOnLoad": true
}
},
"routing": {
"fullShareOwnerPaths": true,
"idBased": false
},
"previewFileMimeTypes": [
"image/gif",
"image/png",
Expand Down
31 changes: 15 additions & 16 deletions packages/design-system/src/components/OcBreadcrumb/OcBreadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,8 @@
:aria-current="getAriaCurrent(index)"
:to="item.isTruncationPlaceholder ? lastHiddenItem.to : item.to"
>
<span class="oc-breadcrumb-item-text">{{ item.text }}</span>
<span class="oc-breadcrumb-item-text oc-breadcrumb-item-navigable">{{ item.text }}</span>
</router-link>
<oc-icon
v-if="item.to"
color="var(--oc-color-text-default)"
name="arrow-right-s"
class="oc-mx-xs"
fill-type="line"
/>
<oc-button
v-else-if="item.onClick"
:aria-current="getAriaCurrent(index)"
Expand All @@ -47,6 +40,7 @@
<span
:class="[
'oc-breadcrumb-item-text',
'oc-breadcrumb-item-navigable',
{
'oc-breadcrumb-item-text-last': index === displayItems.length - 1
}
Expand All @@ -61,6 +55,13 @@
tabindex="-1"
v-text="item.text"
/>
<oc-icon
v-if="index !== displayItems.length - 1"
color="var(--oc-color-text-default)"
name="arrow-right-s"
class="oc-mx-xs"
fill-type="line"
/>
<template v-if="showContextActions && index === displayItems.length - 1">
<oc-button
id="oc-breadcrumb-contextmenu-trigger"
Expand All @@ -84,7 +85,7 @@
</li>
</ol>
<oc-button
v-if="displayItems.length > 1"
v-if="parentFolderTo && displayItems.length > 1"
appearance="raw"
type="router-link"
:aria-label="$gettext('Navigate one level up')"
Expand Down Expand Up @@ -280,7 +281,7 @@ export default defineComponent({
return [...props.items].reverse()[0]
})
const parentFolderTo = computed(() => {
return [...props.items].reverse()[1].to
return [...props.items].reverse()[1]?.to
})

const contextMenuLabel = computed(() => {
Expand Down Expand Up @@ -343,6 +344,10 @@ export default defineComponent({
}
}

&-item-navigable:hover {
text-decoration: underline;
}

&-mobile-current,
&-mobile-navigation {
@media (min-width: $oc-breakpoint-small-default) {
Expand Down Expand Up @@ -380,12 +385,6 @@ export default defineComponent({
> :last-child > span {
color: var(--oc-color-text-default);
}

> li a:hover,
> li span:not([aria-current='page']):not(.oc-icon):hover,
> li button:hover {
text-decoration: underline;
}
}

/* stylelint-disable */
Expand Down
55 changes: 25 additions & 30 deletions packages/design-system/src/components/OcResource/OcResource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
:name="resource.name"
:extension="resource.extension"
:type="resource.type"
:full-path="resource.path"
:full-path="resource.visiblePath"
:is-path-displayed="isPathDisplayed"
:is-extension-displayed="isExtensionDisplayed"
/>
Expand All @@ -67,7 +67,7 @@
@click.stop="$emit('parentFolderClicked')"
>
<oc-icon v-bind="parentFolderLinkIconAttrs" />
<span class="text" v-text="parentFolder" />
<span class="text" v-text="parentFolderName" />
</component>
</div>
</div>
Expand Down Expand Up @@ -102,51 +102,51 @@ export default defineComponent({
},
props: {
/**
* The resource folder link
* The resource to be displayed
*/
folderLink: {
type: Object,
required: false,
default: null
resource: {
type: Object as PropType<Resource>,
required: true
},
/**
* The resource parent folder link path
* The resource folder link
*/
parentFolderLink: {
folderLink: {
type: Object,
required: false,
default: null
},
/**
* The resource parent folder link path icon additional attributes
* Asserts whether the resource path should be displayed
*/
parentFolderLinkIconAdditionalAttributes: {
type: Object,
isPathDisplayed: {
type: Boolean,
required: false,
default: () => {}
},
/**
* The resource to be displayed
*/
resource: {
type: Object as PropType<Resource>,
required: true
default: false
},
/**
* The resource parent folder name to be displayed
*/
parentFolderNameDefault: {
parentFolderName: {
type: String,
required: false,
default: ''
},
/**
* Asserts whether the resource path should be displayed
* The resource parent folder link path
*/
isPathDisplayed: {
type: Boolean,
parentFolderLink: {
type: Object,
required: false,
default: false
default: null
},
/**
* The resource parent folder link path icon additional attributes
*/
parentFolderLinkIconAdditionalAttributes: {
type: Object,
required: false,
default: () => {}
},
/**
* Asserts whether the resource extension should be displayed
Expand Down Expand Up @@ -187,11 +187,6 @@ export default defineComponent({
return this.parentFolderLink !== null ? 'router-link' : 'span'
},

parentFolder() {
const folder = path.basename(path.dirname(this.resource.path)).replace('.', '')
return folder !== '' ? folder : this.parentFolderNameDefault
},

parentFolderStyle() {
const hasLinkTarget = this.parentFolderLink !== null
return {
Expand Down
9 changes: 7 additions & 2 deletions packages/web-app-files/src/HandleUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { UppyService } from 'web-runtime/src/services/uppyService'
import { ResourceConflict } from './helpers/resource'
import { locationPublicLink } from './router/public'
import { locationSpacesGeneric } from './router/spaces'
import { isShareSpaceResource } from 'web-client/src/helpers'
import { isPersonalSpaceResource, isShareSpaceResource } from 'web-client/src/helpers'
import { ClientService } from 'web-pkg/types'

export interface HandleUploadOptions {
Expand Down Expand Up @@ -201,7 +201,12 @@ export class HandleUpload extends BasePlugin {
targetUploadSpace = this.spaces.find((space) => space.id === uppyResource.meta.spaceId)
}

if (!targetUploadSpace || isShareSpaceResource(targetUploadSpace)) {
if (
!targetUploadSpace ||
isShareSpaceResource(targetUploadSpace) ||
(isPersonalSpaceResource(targetUploadSpace) &&
targetUploadSpace.ownerId !== this.store.getters.user.uuid)
) {
return acc
}

Expand Down
20 changes: 11 additions & 9 deletions packages/web-app-files/src/components/AppBar/CreateAndUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ import {
watch,
ref
} from 'vue'
import { useUpload } from 'web-runtime/src/composables/upload'
import { UppyResource, useUpload } from 'web-runtime/src/composables/upload'
import { eventBus } from 'web-pkg/src/services/eventBus'
import { Resource, SpaceResource, isShareSpaceResource } from 'web-client/src/helpers'
import { useService } from 'web-pkg/src/composables/service'
Expand Down Expand Up @@ -321,27 +321,30 @@ export default defineComponent({

const onUploadComplete = async (result) => {
if (result.successful) {
const file = result.successful[0]
const file = result.successful[0] as UppyResource

if (!file) {
return
}

store.dispatch('hideModal')
const { spaceId, currentFolder, currentFolderId } = file.meta
if (!['public', 'share'].includes(file.meta.driveType)) {
if (unref(hasSpaces)) {
const { spaceId, currentFolder, currentFolderId, driveType } = file.meta
if (unref(hasSpaces)) {
const spaces = store.getters['runtime/spaces/spaces']
const user = store.getters['user']
const isOwnSpace = spaces.find((space) => space.id === spaceId)?.ownerId === user.uuid
if (driveType === 'project' || isOwnSpace) {
const client = clientService.graphAuthenticated
const driveResponse = await client.drives.getDrive(spaceId)
store.commit('runtime/spaces/UPDATE_SPACE_FIELD', {
id: driveResponse.data.id,
field: 'spaceQuota',
value: driveResponse.data.quota
})
} else {
const user = await clientService.owncloudSdk.users.getUser(store.getters.user.id)
store.commit('SET_QUOTA', user.quota)
}
} else {
const user = await clientService.owncloudSdk.users.getUser(store.getters.user.id)
store.commit('SET_QUOTA', user.quota)
}

const sameFolder =
Expand Down Expand Up @@ -408,7 +411,6 @@ export default defineComponent({
computed: {
...mapGetters(['capabilities', 'configuration', 'newFileHandlers', 'user']),
...mapGetters('Files', ['files', 'selectedFiles', 'clipboardResources']),
...mapGetters('runtime/ancestorMetaData', ['ancestorMetaData']),
...mapGetters('runtime/spaces', ['spaces']),

showPasteHereButton() {
Expand Down
41 changes: 26 additions & 15 deletions packages/web-app-files/src/components/FilesList/ResourceTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
:key="`${item.path}-${resourceDomSelector(item)}-${item.thumbnail}`"
:resource="item"
:is-path-displayed="arePathsDisplayed"
:parent-folder-name-default="getDefaultParentFolderName(item)"
:parent-folder-name="getParentFolderName(item)"
:is-thumbnail-displayed="shouldDisplayThumbnails(item)"
:is-icon-displayed="!$slots['image']"
:is-extension-displayed="areFileExtensionsShown"
Expand Down Expand Up @@ -211,10 +211,16 @@
<script lang="ts">
import { defineComponent, PropType, computed, unref, ref, ComputedRef } from 'vue'
import { mapGetters, mapActions, mapState } from 'vuex'
import { basename, dirname } from 'path'
import { dirname } from 'path'
import { useWindowSize } from '@vueuse/core'
import { Resource } from 'web-client'
import { extractDomSelector, isProjectSpaceResource, SpaceResource } from 'web-client/src/helpers'
import {
extractDomSelector,
extractParentFolderName,
isProjectSpaceResource,
isShareRoot,
SpaceResource
} from 'web-client/src/helpers'
import { ShareTypes } from 'web-client/src/helpers/share'

import {
Expand Down Expand Up @@ -491,7 +497,7 @@ export default defineComponent({
}
},
computed: {
...mapGetters(['configuration']),
...mapGetters(['configuration', 'user']),
...mapState('Files', [
'areFileExtensionsShown',
'latestSelectedId',
Expand Down Expand Up @@ -764,21 +770,21 @@ export default defineComponent({
},
folderLink(file: Resource) {
return this.createFolderLink({
path: file.path,
path: file.visiblePath,
fileId: file.fileId,
resource: file
})
},
parentFolderLink(file: Resource) {
if (file.shareId && file.path === '/') {
if (isShareRoot(file)) {
return createLocationShares('files-shares-with-me')
}
if (isProjectSpaceResource(file)) {
return createLocationSpaces('files-spaces-projects')
}

return this.createFolderLink({
path: dirname(file.path),
path: dirname(file.visiblePath),
...(file.parentFolderId && { fileId: file.parentFolderId }),
resource: file
})
Expand Down Expand Up @@ -967,7 +973,16 @@ export default defineComponent({
ownerName: resource.owner[0].displayName
})
},
getDefaultParentFolderName(resource: Resource) {
getParentFolderName(resource: Resource) {
if (isShareRoot(resource)) {
return this.$gettext('Shared with me')
}

const parentFolder = extractParentFolderName(resource)
if (parentFolder) {
return parentFolder
}

if (this.hasProjectSpaces) {
if (isProjectSpaceResource(resource)) {
return this.$gettext('Spaces')
Expand All @@ -982,13 +997,9 @@ export default defineComponent({
return this.$gettext('All files and folders')
}

if (resource.shareId) {
return resource.path === '/'
? this.$gettext('Shared with me')
: basename(resource.shareRoot)
}

if (!this.getInternalSpace(resource.storageId)) {
const space = this.getInternalSpace(resource.storageId)
const isOwnPersonalSpace = space.ownerId === this.user.uuid
if (!isOwnPersonalSpace) {
return this.$gettext('Shared with me')
}

Expand Down
Loading