fix(files): Properly handle files in failed state

When files are loaded from API the `fileid` might be set to `-1` indicating
an error on the API.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
Ferdinand Thiessen 2024-06-13 15:06:12 +02:00
parent c76c954f56
commit d4352fe2ff
No known key found for this signature in database
GPG key ID: 45FAE7268762B400
5 changed files with 12 additions and 4 deletions

View file

@ -16,7 +16,7 @@
class="files-list__row"
v-on="rowListeners">
<!-- Failed indicator -->
<span v-if="source.attributes.failed" class="files-list__row--failed" />
<span v-if="isFailedSource" class="files-list__row--failed" />
<!-- Checkbox -->
<FileEntryCheckbox :fileid="fileid"

View file

@ -93,6 +93,7 @@ import ArrowLeftIcon from 'vue-material-design-icons/ArrowLeft.vue'
import { useNavigation } from '../../composables/useNavigation'
import CustomElementRender from '../CustomElementRender.vue'
import logger from '../../logger.js'
// The registered actions list
@ -160,7 +161,7 @@ export default defineComponent({
// Sorted actions that are enabled for this node
enabledActions() {
if (this.source.attributes.failed) {
if (this.source.status === NodeStatus.FAILED) {
return []
}

View file

@ -126,7 +126,7 @@ export default defineComponent({
},
linkTo() {
if (this.source.attributes.failed) {
if (this.source.status === NodeStatus.FAILED) {
return {
is: 'span',
params: {

View file

@ -17,7 +17,7 @@
@dragend="onDragEnd"
@drop="onDrop">
<!-- Failed indicator -->
<span v-if="source.attributes.failed" class="files-list__row--failed" />
<span v-if="isFailedSource" class="files-list__row--failed" />
<!-- Checkbox -->
<FileEntryCheckbox :fileid="fileid"

View file

@ -102,6 +102,13 @@ export default defineComponent({
return String(this.fileid) === String(this.currentFileId)
},
/**
* Check if the source is in a failed state after an API request
*/
isFailedSource() {
return this.source.status === NodeStatus.FAILED
},
canDrag() {
if (this.isRenaming) {
return false