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

refactor: remove shares panel separation for details query #10696

Merged
merged 1 commit into from
Apr 2, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,19 @@
<div>
<oc-loader v-if="sharesLoading" :aria-label="$gettext('Loading list of shares')" />
<template v-else>
<space-members
v-if="showSpaceMembers"
ref="peopleShares"
class="oc-background-highlight oc-p-m oc-mb-s"
/>
<file-shares v-else ref="peopleShares" class="oc-background-highlight oc-p-m oc-mb-s" />
<file-links v-if="showLinks" ref="linkShares" class="oc-background-highlight oc-p-m" />
<space-members v-if="showSpaceMembers" class="oc-background-highlight oc-p-m oc-mb-s" />
<file-shares v-else class="oc-background-highlight oc-p-m oc-mb-s" />
<file-links v-if="showLinks" class="oc-background-highlight oc-p-m" />
</template>
</div>
</template>

<script lang="ts">
import { ComponentPublicInstance, defineComponent, inject, Ref } from 'vue'
import { defineComponent } from 'vue'
import FileLinks from './FileLinks.vue'
import FileShares from './FileShares.vue'
import SpaceMembers from './SpaceMembers.vue'
import { useSharesStore } from '@ownclouders/web-pkg'
import { Resource } from '@ownclouders/web-client'
import { storeToRefs } from 'pinia'

export default defineComponent({
Expand All @@ -39,31 +34,7 @@ export default defineComponent({
const { loading: sharesLoading } = storeToRefs(sharesStore)

return {
sharesLoading,
resource: inject<Ref<Resource>>('resource'),
activePanel: inject<String>('activePanel')
}
},
watch: {
sharesLoading: {
handler: function (sharesLoading, old) {
// FIXME: !old can be removed as soon as https://github.com/owncloud/web/issues/7621 has been fixed
if (!this.activePanel || !old) {
return
}
this.$nextTick(() => {
const [panelName, ref] = this.activePanel.split('#')

if (!ref || !this.$refs[ref]) {
return
}
this.$emit('scrollToElement', {
element: (this.$refs[ref] as ComponentPublicInstance).$el,
panelName
})
})
},
immediate: true
sharesLoading
}
}
})
Expand Down