Merge pull request #50374 from nextcloud/backport/50282/stable31

[stable31] refactor: Sharing sidebar UI redesign
This commit is contained in:
Andy Scherzinger 2025-01-24 22:12:01 +01:00 committed by GitHub
commit 30a4f92202
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 222 additions and 77 deletions

View file

@ -357,11 +357,17 @@ export default {
}
return this.share.shareWith
}
if (this.index === null) {
return t('files_sharing', 'Share link')
}
}
if (this.index > 1) {
if (this.index >= 1) {
return t('files_sharing', 'Share link ({index})', { index: this.index })
}
return t('files_sharing', 'Share link')
return t('files_sharing', 'Create public link')
},
/**

View file

@ -21,7 +21,7 @@
@search="asyncFind"
@option:selected="onSelected">
<template #no-options="{ search }">
{{ search ? noResultText : t('files_sharing', 'No recommendations. Start typing.') }}
{{ search ? noResultText : placeholder }}
</template>
</NcSelect>
</div>
@ -74,6 +74,14 @@ export default {
type: Boolean,
required: true,
},
isExternal: {
type: Boolean,
default: false,
},
placeholder: {
type: String,
default: '',
},
},
data() {
@ -106,6 +114,10 @@ export default {
if (!this.canReshare) {
return t('files_sharing', 'Resharing is not allowed')
}
if (this.placeholder) {
return this.placeholder
}
// We can always search with email addresses for users too
if (!allowRemoteSharing) {
return t('files_sharing', 'Name or email …')
@ -168,19 +180,26 @@ export default {
lookup = true
}
const shareType = [
ShareType.User,
ShareType.Group,
ShareType.Remote,
ShareType.RemoteGroup,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
]
let shareType = []
if (getCapabilities().files_sharing.public.enabled === true) {
if (this.isExternal) {
shareType.push(ShareType.Remote)
shareType.push(ShareType.RemoteGroup)
} else {
// Merge shareType array
shareType = shareType.concat([
ShareType.User,
ShareType.Group,
ShareType.Team,
ShareType.Room,
ShareType.Guest,
ShareType.Deck,
ShareType.ScienceMesh,
])
}
if (getCapabilities().files_sharing.public.enabled === true && this.isExternal) {
shareType.push(ShareType.Email)
}

View file

@ -4,7 +4,7 @@
-->
<template>
<ul id="sharing-inherited-shares">
<ul v-if="shares.length" id="sharing-inherited-shares">
<!-- Main collapsible entry -->
<SharingEntrySimple class="sharing-entry__inherited"
:title="mainTitle"

View file

@ -15,8 +15,8 @@
<div v-show="!showSharingDetailsView"
class="sharingTab__content">
<!-- shared with me information -->
<ul>
<SharingEntrySimple v-if="isSharedWithMe" v-bind="sharedWithMe" class="sharing-entry__reshare">
<ul v-if="isSharedWithMe">
<SharingEntrySimple v-bind="sharedWithMe" class="sharing-entry__reshare">
<template #avatar>
<NcAvatar :user="sharedWithMe.user"
:display-name="sharedWithMe.displayName"
@ -25,50 +25,119 @@
</SharingEntrySimple>
</ul>
<!-- add new share input -->
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:reshare="reshare"
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />
<section>
<div class="section-header">
<h4>{{ t('files_sharing', 'Internal shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'Internal shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ internalSharesHelpText }}
</p>
</NcPopover>
</div>
<!-- add new share input -->
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:reshare="reshare"
:shares="shares"
:placeholder="t('files_sharing', 'Share with accounts and teams')"
@open-sharing-details="toggleShareDetailsView" />
<!-- link shares list -->
<SharingLinkList v-if="!loading"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
:shares="linkShares"
@open-sharing-details="toggleShareDetailsView" />
<!-- other shares list -->
<SharingList v-if="!loading"
ref="shareList"
:shares="shares"
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />
<!-- other shares list -->
<SharingList v-if="!loading"
ref="shareList"
:shares="shares"
:file-info="fileInfo"
@open-sharing-details="toggleShareDetailsView" />
<!-- inherited shares -->
<SharingInherited v-if="canReshare && !loading" :file-info="fileInfo" />
<!-- inherited shares -->
<SharingInherited v-if="canReshare && !loading" :file-info="fileInfo" />
<!-- internal link copy -->
<SharingEntryInternal :file-info="fileInfo" />
</section>
<!-- internal link copy -->
<SharingEntryInternal :file-info="fileInfo" />
<section>
<div class="section-header">
<h4>{{ t('files_sharing', 'External shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'External shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ externalSharesHelpText }}
</p>
</NcPopover>
</div>
<SharingInput v-if="!loading"
:can-reshare="canReshare"
:file-info="fileInfo"
:link-shares="linkShares"
:is-external="true"
:placeholder="t('files_sharing', 'Email, federated cloud id')"
:reshare="reshare"
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />
<!-- link shares list -->
<SharingLinkList v-if="!loading"
ref="linkShareList"
:can-reshare="canReshare"
:file-info="fileInfo"
:shares="linkShares"
@open-sharing-details="toggleShareDetailsView" />
</section>
<!-- projects -->
<CollectionList v-if="projectsEnabled && fileInfo"
:id="`${fileInfo.id}`"
type="file"
:name="fileInfo.name" />
</div>
<section v-if="sections.length > 0 && !showSharingDetailsView">
<div class="section-header">
<h4>{{ t('files_sharing', 'Additional shares') }}</h4>
<NcPopover popup-role="dialog">
<template #trigger>
<NcButton class="hint-icon"
type="tertiary-no-background"
:aria-label="t('files_sharing', 'Additional shares explanation')">
<template #icon>
<InfoIcon :size="20" />
</template>
</NcButton>
</template>
<p class="hint-body">
{{ additionalSharesHelpText }}
</p>
</NcPopover>
</div>
<!-- additional entries, use it with cautious -->
<div v-for="(section, index) in sections"
:ref="'section-' + index"
:key="index"
class="sharingTab__additionalContent">
<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
</div>
<!-- additional entries, use it with cautious -->
<div v-for="(section, index) in sections"
v-show="!showSharingDetailsView"
:ref="'section-' + index"
:key="index"
class="sharingTab__additionalContent">
<component :is="section($refs['section-'+index], fileInfo)" :file-info="fileInfo" />
<!-- projects (deprecated as of NC25 (replaced by related_resources) - see instance config "projects.enabled" ; ignore this / remove it / move into own section) -->
<div v-if="projectsEnabled"
v-show="!showSharingDetailsView && fileInfo"
class="sharingTab__additionalContent">
<CollectionList :id="`${fileInfo.id}`"
type="file"
:name="fileInfo.name" />
</div>
</section>
</div>
<!-- share details -->
@ -89,9 +158,13 @@ import { generateOcsUrl } from '@nextcloud/router'
import { CollectionList } from 'nextcloud-vue-collections'
import { ShareType } from '@nextcloud/sharing'
import InfoIcon from 'vue-material-design-icons/Information.vue'
import NcPopover from '@nextcloud/vue/dist/Components/NcPopover.js'
import axios from '@nextcloud/axios'
import moment from '@nextcloud/moment'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import { shareWithTitle } from '../utils/SharedWithMe.js'
@ -106,12 +179,17 @@ import SharingLinkList from './SharingLinkList.vue'
import SharingList from './SharingList.vue'
import SharingDetailsTab from './SharingDetailsTab.vue'
import ShareDetails from '../mixins/ShareDetails.js'
export default {
name: 'SharingTab',
components: {
NcAvatar,
CollectionList,
InfoIcon,
NcAvatar,
NcButton,
NcPopover,
SharingEntryInternal,
SharingEntrySimple,
SharingInherited,
@ -120,6 +198,7 @@ export default {
SharingList,
SharingDetailsTab,
},
mixins: [ShareDetails],
data() {
return {
@ -142,6 +221,10 @@ export default {
showSharingDetailsView: false,
shareDetailsData: {},
returnFocusElement: null,
internalSharesHelpText: t('files_sharing', 'Use this method to share files with individuals or teams within your organization. If the recipient already has access to the share but cannot locate it, you can send them the internal share link for easy access.'),
externalSharesHelpText: t('files_sharing', 'Use this method to share files with individuals or organizations outside your organization. Files and folders can be shared via public share links and email addresses. You can also share to other Nextcloud accounts hosted on different instances using their federated cloud ID.'),
additionalSharesHelpText: t('files_sharing', 'Shares that are not part of the internal or external shares. This can be shares from apps or other sources.'),
}
},
@ -425,10 +508,47 @@ export default {
&__content {
padding: 0 6px;
section {
padding-bottom: 16px;
.section-header {
margin-top: 2px;
margin-bottom: 2px;
display: flex;
align-items: center;
padding-bottom: 4px;
h4 {
margin: 0;
font-size: 16px;
}
.visually-hidden {
display: none;
}
.hint-icon {
color: var(--color-primary-element);
}
}
}
& > section:not(:last-child) {
border-bottom: 2px solid var(--color-border);
}
}
&__additionalContent {
margin: 44px 0;
}
}
.hint-body {
max-width: 300px;
padding: var(--border-radius-element);
}
</style>

2
dist/1191-1191.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/1191-1191.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/1191-1191.js.map.license vendored Symbolic link
View file

@ -0,0 +1 @@
1191-1191.js.license

2
dist/4253-4253.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
4253-4253.js.license

2
dist/4813-4813.js vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/4813-4813.js.map vendored Normal file

File diff suppressed because one or more lines are too long

1
dist/4813-4813.js.map.license vendored Symbolic link
View file

@ -0,0 +1 @@
4813-4813.js.license

2
dist/6244-6244.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
6244-6244.js.license

4
dist/core-common.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/core-login.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long