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

Changes to links in sidebar, fix tooltips #6959

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions changelog/unreleased/enhancement-changes-to-links-in-sidebar
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Enhancement: Changes in sidebar, fix tooltips

We've added a `runningOnEos` setting which, if on, displays two entries in the sidebar: the EOS
path and a direct link to the file. These paths along with the sidebar tooltips can now handle very
long text without overflowing.

https://github.com/owncloud/web/issues/6849
https://github.com/owncloud/web/pull/6959
1 change: 1 addition & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ substring of a value of the authenticated user. Examples are `/Shares`, `/{{.Id}
- `options.feedbackLink.description` Provide any description you want to see as tooltip and as accessible description. Defaults to `Provide your feedback: We'd like to improve the web design and would be happy to hear your feedback. Thank you! Your ownCloud team.`
- `options.sharingRecipientsPerPage` Sets the amount of users shown as recipients in the dropdown when sharing resources. Default amount is 200.
- `options.sidebar.shares.showAllOnLoad` Sets the list of (link) shares list in the sidebar to be initially expanded (default is a collapsed state, only showing the first three shares).
- `options.runningOnEos` Set this option to `true` if running on an [EOS storage backend](https://eos-web.web.cern.ch/eos-web/) to enable its specific features. Defaults to `false`.

### Sentry

Expand Down
147 changes: 130 additions & 17 deletions packages/web-app-files/src/components/SideBar/Details/FileDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</div>
<table class="details-table" :aria-label="detailsTableLabel">
<tr v-if="hasTimestamp" data-testid="timestamp">
<th scope="col" class="oc-pr-s" v-text="timestampTitle" />
<th scope="col" class="oc-pr-s" v-text="timestampLabel" />
<td>
<oc-button
v-if="showVersions"
Expand Down Expand Up @@ -51,7 +51,7 @@
</td>
</tr>
<tr v-if="ownerDisplayName" data-testid="ownerDisplayName">
<th scope="col" class="oc-pr-s" v-text="ownerTitle" />
<th scope="col" class="oc-pr-s" v-text="ownerLabel" />
<td>
<p class="oc-m-rm">
{{ ownerDisplayName }}
Expand All @@ -63,11 +63,11 @@
</td>
</tr>
<tr v-if="showSize" data-testid="sizeInfo">
<th scope="col" class="oc-pr-s" v-text="sizeTitle" />
<th scope="col" class="oc-pr-s" v-text="sizeLabel" />
<td v-text="getResourceSize(file.size)" />
</tr>
<tr v-if="showVersions" data-testid="versionsInfo">
<th scope="col" class="oc-pr-s" v-text="versionsTitle" />
<th scope="col" class="oc-pr-s" v-text="versionsLabel" />
<td>
<oc-button
v-oc-tooltip="seeVersionsLabel"
Expand All @@ -78,6 +78,62 @@
/>
</td>
</tr>
<tr v-if="runningOnEos">
<th scope="col" class="oc-pr-s" v-text="eosPathLabel" />
<td>
<div class="oc-flex oc-flex-middle oc-flex-between oc-width-1-1">
<p
ref="filePath"
v-oc-tooltip="file.path"
class="oc-my-rm oc-text-truncate"
v-text="file.path"
/>
<oc-button
v-oc-tooltip="copyEosPathLabel"
:aria-label="copyEosPathLabel"
appearance="raw"
:variation="copiedEos ? 'success' : 'passive'"
@click="copyEosPathToClipboard"
>
<oc-icon
v-if="copiedEos"
key="oc-copy-to-clipboard-copied"
name="checkbox-circle"
class="_clipboard-success-animation"
/>
<oc-icon v-else key="oc-copy-to-clipboard-copy" name="clipboard" />
</oc-button>
</div>
</td>
</tr>
<tr>
<th scope="col" class="oc-pr-s" v-text="directLinkLabel" />
<td>
<div class="oc-flex oc-flex-middle oc-flex-between oc-width-1-1">
<p
ref="directLink"
v-oc-tooltip="directLink"
class="oc-my-rm oc-text-truncate"
v-text="directLink"
/>
<oc-button
v-oc-tooltip="copyDirectLinkLabel"
:aria-label="copyDirectLinkLabel"
appearance="raw"
:variation="copiedDirect ? 'success' : 'passive'"
@click="copyDirectLinkToClipboard"
>
<oc-icon
v-if="copiedDirect"
key="oc-copy-to-clipboard-copied"
name="checkbox-circle"
class="_clipboard-success-animation"
/>
<oc-icon v-else key="oc-copy-to-clipboard-copy" name="clipboard" />
</oc-button>
</div>
</td>
</tr>
</table>
</div>
<p v-else data-testid="noContentText" v-text="noContentText" />
Expand All @@ -96,6 +152,8 @@ import { createLocationSpaces, isAuthenticatedRoute, isLocationSpacesActive } fr
import { ShareTypes } from '../../../helpers/share'
import { useRoute, useRouter } from 'web-pkg/src/composables'
import { getIndicators } from '../../../helpers/statusIndicators'
import copyToClipboard from 'copy-to-clipboard'
import { encodePath } from 'web-pkg/src/utils'

export default defineComponent({
name: 'FileDetails',
Expand Down Expand Up @@ -131,7 +189,10 @@ export default defineComponent({
sharedByDisplayName: '',
sharedTime: 0,
sharedItem: null,
shareIndicators: []
shareIndicators: [],
copiedDirect: false,
copiedEos: false,
timeout: null
}),
computed: {
...mapGetters('Files', ['versions', 'sharesTree', 'sharesTreeLoading']),
Expand All @@ -140,7 +201,9 @@ export default defineComponent({
file() {
return this.displayedItem.value
},

runningOnEos() {
return !!this.configuration?.options?.runningOnEos
},
hasContent() {
return (
this.hasTimestamp ||
Expand All @@ -157,10 +220,10 @@ export default defineComponent({
return this.$gettext('Overview of the information about the selected file')
},
shareDateLabel() {
return this.$gettext('Shared:')
return this.$gettext('Shared')
},
sharedViaLabel() {
return this.$gettext('Shared via:')
return this.$gettext('Shared via')
},
sharedViaTooltip() {
return this.$gettextInterpolate(
Expand Down Expand Up @@ -197,16 +260,16 @@ export default defineComponent({
return this.$gettext('This file has been shared.')
},
sharedByLabel() {
return this.$gettext('Shared by:')
return this.$gettext('Shared by')
},
hasTimestamp() {
return this.file.mdate?.length > 0
},
timestampTitle() {
return this.$gettext('Last modified:')
timestampLabel() {
return this.$gettext('Last modified')
},
ownerTitle() {
return this.$gettext('Owner:')
ownerLabel() {
return this.$gettext('Owner')
},
ownerDisplayName() {
return (
Expand All @@ -218,20 +281,35 @@ export default defineComponent({
ownerAdditionalInfo() {
return this.file.owner?.[0].additionalInfo
},
directLink() {
return `${this.configuration.server}files/spaces/personal/home${encodePath(this.file.path)}`
},
directLinkLabel() {
return this.$gettext('Direct link')
},
copyDirectLinkLabel() {
return this.$gettext('Copy direct link')
},
eosPathLabel() {
return this.$gettext('EOS Path')
},
copyEosPathLabel() {
return this.$gettext('Copy EOS path')
},
showSize() {
return this.getResourceSize(this.file.size) !== '?'
},
sizeTitle() {
return this.$gettext('Size:')
sizeLabel() {
return this.$gettext('Size')
},
showVersions() {
if (this.file.type === 'folder') {
return
}
return this.versions.length > 0 && isAuthenticatedRoute(this.$route)
},
versionsTitle() {
return this.$gettext('Versions:')
versionsLabel() {
return this.$gettext('Versions')
},
seeVersionsLabel() {
return this.$gettext('See all versions')
Expand Down Expand Up @@ -349,6 +427,31 @@ export default defineComponent({
}
await Promise.all(calls.map((p) => p.catch((e) => e)))
this.loading = false
},
copyEosPathToClipboard() {
copyToClipboard(this.file.path)
this.copiedEos = true
this.clipboardSuccessHandler()
this.showMessage({
title: this.$gettext('EOS path copied'),
desc: this.$gettext('The EOS path has been copied to your clipboard.')
})
},
copyDirectLinkToClipboard() {
copyToClipboard(this.directLink)
this.copiedDirect = true
this.clipboardSuccessHandler()
this.showMessage({
title: this.$gettext('Direct link copied'),
desc: this.$gettext('The direct link has been copied to your clipboard.')
})
},
clipboardSuccessHandler() {
clearTimeout(this.timeout)
this.timeout = setTimeout(() => {
this.copiedDirect = false
this.copiedEos = false
}, 550)
}
}
})
Expand All @@ -359,10 +462,20 @@ export default defineComponent({

tr {
height: 1.5rem;

td {
max-width: 0;
width: 100%;

div {
min-width: 0;
}
}
}

th {
font-weight: 600;
white-space: nowrap;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,13 @@ function createWrapper(testResource, testVersions = [], testPreview, publicRoute
getters: {
user: function () {
return { id: 'marie' }
},
configuration: function () {
return {
options: {
runningOnEos: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should test both variants, I can merge your PR into an intermediate branch and add this myself

}
}
}
},
modules: {
Expand Down
Loading