23
23
:force-display-actions="true"
24
24
data-files-versions-version>
25
25
<template #icon>
26
- <img lazy="true "
26
+ <img v-if="!previewError "
27
27
:src="previewURL"
28
28
alt=""
29
- height="256"
30
- width="256"
29
+ class="version__image"
30
+ @error="previewError = true">
31
+ <div v-else
31
32
class="version__image">
33
+ <ImageOffOutline :size="20" />
34
+ </div>
32
35
</template>
33
36
<template #subtitle>
34
37
<div class="version__info">
@@ -112,6 +115,7 @@ import Download from 'vue-material-design-icons/Download.vue'
112
115
import Pencil from 'vue-material-design-icons/Pencil.vue'
113
116
import Check from 'vue-material-design-icons/Check.vue'
114
117
import Delete from 'vue-material-design-icons/Delete'
118
+ import ImageOffOutline from 'vue-material-design-icons/ImageOffOutline.vue'
115
119
import { NcActionButton, NcActionLink, NcListItem, NcModal, NcButton, NcTextField, Tooltip } from '@nextcloud/vue'
116
120
import moment from '@nextcloud/moment'
117
121
import { translate } from '@nextcloud/l10n'
@@ -133,6 +137,7 @@ export default {
133
137
Pencil,
134
138
Check,
135
139
Delete,
140
+ ImageOffOutline,
136
141
},
137
142
directives: {
138
143
tooltip: Tooltip,
@@ -177,26 +182,29 @@ export default {
177
182
showVersionLabelForm: false,
178
183
formVersionLabelValue: this.version.label,
179
184
capabilities: loadState('core', 'capabilities', { files: { version_labeling: false, version_deletion: false } }),
185
+ previewError: false,
180
186
}
181
187
},
182
188
computed: {
183
189
/**
184
190
* @return {string}
185
191
*/
186
192
versionLabel() {
193
+ const label = this.version.label ?? ''
194
+
187
195
if (this.isCurrent) {
188
- if (this.version.label === undefined || this.version. label === '') {
196
+ if (label === '') {
189
197
return translate('files_versions', 'Current version')
190
198
} else {
191
- return `${this.version. label} (${translate('files_versions', 'Current version')})`
199
+ return `${label} (${translate('files_versions', 'Current version')})`
192
200
}
193
201
}
194
202
195
- if (this.isFirstVersion && this.version. label === '') {
203
+ if (this.isFirstVersion && label === '') {
196
204
return translate('files_versions', 'Initial version')
197
205
}
198
206
199
- return this.version. label
207
+ return label
200
208
},
201
209
202
210
/**
@@ -275,6 +283,11 @@ export default {
275
283
height: 3rem;
276
284
border: 1px solid var(--color-border);
277
285
border-radius: var(--border-radius-large);
286
+
287
+ // Useful to display no preview icon.
288
+ display: flex;
289
+ justify-content: center;
290
+ color: var(--color-text-light);
278
291
}
279
292
}
280
293
0 commit comments