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

Preview fixes #7359

Merged
merged 3 commits into from
Jul 27, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ Therefore we have introduced a new top bar, where the filename will be shown
and the download and the close button will be displayed.

https://github.com/owncloud/web/pull/7216
https://github.com/owncloud/web/pull/7359
https://github.com/owncloud/web/issues/6300
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-preview-infinite-loading-spinner
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Fix infinite loading spinner on invalid preview links

The `preview` app now shows an error, when a file does not exist (for example when opening a bookmark to a file that does not exist anymore). Before it showed a loading spinner infinitely.

https://github.com/owncloud/web/pull/7359
33 changes: 19 additions & 14 deletions packages/web-app-preview/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@
@keydown.right="next"
@keydown.esc="closeApp"
>
<h1 class="oc-invisible-sr" v-text="pageTitle" />
<app-top-bar :resource="activeFilteredFile" @close="closeApp">
<template #right>
<oc-button
v-if="!isFileContentError"
class="preview-download"
size="small"
:aria-label="$gettext('Download currently viewed file')"
@click="triggerActiveFileDownload"
>
<oc-icon size="small" name="file-download" />
</oc-button>
</template>
</app-top-bar>

<div v-if="isFolderLoading || isFileContentLoading" class="oc-position-center">
<oc-spinner :aria-label="$gettext('Loading media file')" size="xlarge" />
</div>
Expand All @@ -19,19 +34,6 @@
:accessible-label="$gettext('Failed to load media file')"
/>
<template v-else>
<h1 class="oc-invisible-sr" v-text="pageTitle" />
<app-top-bar :resource="activeFilteredFile" @close="closeApp">
<template #right>
<oc-button
class="preview-download"
size="small"
:aria-label="$gettext('Download currently viewed file')"
@click="triggerActiveFileDownload"
>
<oc-icon size="small" name="file-download" />
</oc-button>
</template>
</app-top-bar>
<div
v-show="activeMediaFileCached"
class="
Expand Down Expand Up @@ -259,9 +261,12 @@ export default defineComponent({
for (let i = 0; i < this.filteredFiles.length; i++) {
if (this.filteredFiles[i].webDavPath === filePath) {
this.activeIndex = i
break
return
}
}

this.isFileContentLoading = false
this.isFileContentError = true
},

// react to PopStateEvent ()
Expand Down
12 changes: 9 additions & 3 deletions packages/web-pkg/src/components/AppTopBar.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<div class="oc-flex oc-p-s app-top-bar">
<oc-resource id="app-top-bar-resource" :is-thumbnail-displayed="false" :resource="resource" />
<oc-resource
v-if="resource"
id="app-top-bar-resource"
:is-thumbnail-displayed="false"
:resource="resource"
/>
<div v-else />

<div>
<slot name="right"></slot>
<oc-button
Expand All @@ -22,8 +29,7 @@ export default defineComponent({
name: 'AppTopBar',
props: {
resource: {
type: Object,
required: true
type: Object
}
}
})
Expand Down