mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 23:03:00 -04:00
fix(files): Add missing emptyView handling
The interface provides this option but it was never implemented. This feature of being able to render a custom empty view message is needed for public file drops to properly show the terms of service. Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de> Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
This commit is contained in:
parent
c8c84e6617
commit
f570507156
3 changed files with 57 additions and 29 deletions
|
|
@ -74,32 +74,37 @@
|
|||
:name="t('files', 'Loading current folder')" />
|
||||
|
||||
<!-- Empty content placeholder -->
|
||||
<NcEmptyContent v-else-if="!loading && isEmptyDir"
|
||||
:name="currentView?.emptyTitle || t('files', 'No files in here')"
|
||||
:description="currentView?.emptyCaption || t('files', 'Upload some content or sync with your devices!')"
|
||||
data-cy-files-content-empty>
|
||||
<template v-if="directory !== '/'" #action>
|
||||
<!-- Uploader -->
|
||||
<UploadPicker v-if="currentFolder && canUpload && !isQuotaExceeded"
|
||||
allow-folders
|
||||
class="files-list__header-upload-button"
|
||||
:content="getContent"
|
||||
:destination="currentFolder"
|
||||
:forbidden-characters="forbiddenCharacters"
|
||||
multiple
|
||||
@failed="onUploadFail"
|
||||
@uploaded="onUpload" />
|
||||
<NcButton v-else
|
||||
:aria-label="t('files', 'Go to the previous folder')"
|
||||
:to="toPreviousDir"
|
||||
type="primary">
|
||||
{{ t('files', 'Go back') }}
|
||||
</NcButton>
|
||||
</template>
|
||||
<template #icon>
|
||||
<NcIconSvgWrapper :svg="currentView.icon" />
|
||||
</template>
|
||||
</NcEmptyContent>
|
||||
<template v-else-if="!loading && isEmptyDir">
|
||||
<div v-if="currentView?.emptyView" class="files-list__empty-view-wrapper">
|
||||
<div ref="customEmptyView" />
|
||||
</div>
|
||||
<NcEmptyContent v-else
|
||||
:name="currentView?.emptyTitle || t('files', 'No files in here')"
|
||||
:description="currentView?.emptyCaption || t('files', 'Upload some content or sync with your devices!')"
|
||||
data-cy-files-content-empty>
|
||||
<template v-if="directory !== '/'" #action>
|
||||
<!-- Uploader -->
|
||||
<UploadPicker v-if="currentFolder && canUpload && !isQuotaExceeded"
|
||||
allow-folders
|
||||
class="files-list__header-upload-button"
|
||||
:content="getContent"
|
||||
:destination="currentFolder"
|
||||
:forbidden-characters="forbiddenCharacters"
|
||||
multiple
|
||||
@failed="onUploadFail"
|
||||
@uploaded="onUpload" />
|
||||
<NcButton v-else
|
||||
:aria-label="t('files', 'Go to the previous folder')"
|
||||
:to="toPreviousDir"
|
||||
type="primary">
|
||||
{{ t('files', 'Go back') }}
|
||||
</NcButton>
|
||||
</template>
|
||||
<template #icon>
|
||||
<NcIconSvgWrapper :svg="currentView.icon" />
|
||||
</template>
|
||||
</NcEmptyContent>
|
||||
</template>
|
||||
|
||||
<!-- File list -->
|
||||
<FilesListVirtual v-else
|
||||
|
|
@ -391,9 +396,27 @@ export default defineComponent({
|
|||
filtersChanged() {
|
||||
return this.filtersStore.filtersChanged
|
||||
},
|
||||
|
||||
showCustomEmptyView() {
|
||||
return !this.loading && this.isEmptyDir && this.currentView?.emptyView !== undefined
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
/**
|
||||
* Handle rendering the custom empty view
|
||||
* @param show The current state if the custom empty view should be rendered
|
||||
*/
|
||||
showCustomEmptyView(show: boolean) {
|
||||
if (show) {
|
||||
this.$nextTick(() => {
|
||||
const el = this.$refs.customEmptyView as HTMLDivElement
|
||||
// We can cast here because "showCustomEmptyView" assets that current view is set
|
||||
this.currentView!.emptyView!(el)
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
currentView(newView, oldView) {
|
||||
if (newView?.id === oldView?.id) {
|
||||
return
|
||||
|
|
@ -679,6 +702,11 @@ export default defineComponent({
|
|||
}
|
||||
}
|
||||
|
||||
&__empty-view-wrapper {
|
||||
display: flex;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
&__refresh-icon {
|
||||
flex: 0 0 44px;
|
||||
width: 44px;
|
||||
|
|
|
|||
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue