Skip to content

Commit

Permalink
refactor(files_sharing): dissolve component SharingEntryLink into Sha…
Browse files Browse the repository at this point in the history
…ringTab

According to #48925 screen designs we've to split this into

1. Link (creation) and
2. List (of created share links)

Intermediate step.

Refs: #48925
  • Loading branch information
thlehmann-ionos authored and nfebe committed Jan 20, 2025
1 parent 0139e57 commit d22bc04
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions apps/files_sharing/src/views/SharingTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,12 @@
<hr>
<h3>External shares</h3>

<!-- link shares list -->
<SharingLinkList v-if="!loading"
ref="linkShareList"
<!-- ***** DISSOLVED OUT FROM ShareLinkList ***** -->
<SharingEntryLink v-if="!hasLinkShares && canReshare"
:can-reshare="canReshare"
:file-info="fileInfo"
:shares="linkShares"
@open-sharing-details="toggleShareDetailsView" />
@add:share="addShare" />
<!-- ***** DISSOLVED OUT FROM ShareLinkList ***** -->

<!-- TODO: component must either be configurable or diffentiated into two -->
<!-- add new email/federated share input -->
Expand All @@ -77,7 +76,22 @@
:shares="shares"
@open-sharing-details="toggleShareDetailsView" />

<!-- projects -->
<!-- ***** DISSOLVED OUT FROM ShareLinkList ***** -->
<template v-if="hasShares">
<!-- using shares[index] to work with .sync -->
<SharingEntryLink v-for="(share, index) in shares"
:key="share.id"
:index="shares.length > 1 ? index + 1 : null"
:can-reshare="canReshare"
:share.sync="shares[index]"
:file-info="fileInfo"
@add:share="addShare(...arguments)"
@update:share="awaitForShare(...arguments)"
@remove:share="removeShare"
@open-sharing-details="openSharingDetails(share)" />
</template>
<!-- ***** DISSOLVED OUT FROM ShareLinkList ***** -->

<CollectionList v-if="projectsEnabled && fileInfo"
:id="`${fileInfo.id}`"
type="file"
Expand Down Expand Up @@ -135,11 +149,15 @@ import SharingInherited from './SharingInherited.vue'
import SharingLinkList from './SharingLinkList.vue'
import SharingList from './SharingList.vue'
import SharingDetailsTab from './SharingDetailsTab.vue'
import { getCapabilities } from '@nextcloud/capabilities'
import SharingEntryLink from '../components/SharingEntryLink.vue'
import ShareDetails from '../mixins/ShareDetails.js'

export default {
name: 'SharingTab',

components: {
SharingEntryLink,
NcAvatar,
CollectionList,
SharingEntryInternal,
Expand All @@ -151,6 +169,8 @@ export default {
SharingDetailsTab,
},

mixins: [ShareDetails],

data() {
return {
config: new Config(),
Expand All @@ -172,6 +192,7 @@ export default {
showSharingDetailsView: false,
shareDetailsData: {},
returnFocusElement: null,
canLinkShare: getCapabilities().files_sharing.public.enabled,
}
},

Expand All @@ -189,6 +210,26 @@ export default {
return !!(this.fileInfo.permissions & OC.PERMISSION_SHARE)
|| !!(this.reshare && this.reshare.hasSharePermission && this.config.isResharingAllowed)
},

/**
* Do we have link shares?
* Using this to still show the `new link share`
* button regardless of mail shares
*
* @return {Array}
*/
hasLinkShares() {
return this.shares.filter(share => share.type === ShareType.Link).length > 0
},

/**
* Do we have any link or email shares?
*
* @return {boolean}
*/
hasShares() {
return this.shares.length > 0
},
},

methods: {
Expand Down

0 comments on commit d22bc04

Please sign in to comment.