2323 :force-display-actions =" true"
2424 data-files-versions-version >
2525 <template #icon >
26- <img lazy = " true "
26+ <img v-if = " !previewError "
2727 :src =" previewURL"
2828 alt =" "
29- height =" 256"
30- width =" 256"
29+ class =" version__image"
30+ @error =" previewError = true" >
31+ <div v-else
3132 class =" version__image" >
33+ <ImageOffOutline :size =" 20" />
34+ </div >
3235 </template >
3336 <template #subtitle >
3437 <div class =" version__info" >
@@ -112,6 +115,7 @@ import Download from 'vue-material-design-icons/Download.vue'
112115import Pencil from ' vue-material-design-icons/Pencil.vue'
113116import Check from ' vue-material-design-icons/Check.vue'
114117import Delete from ' vue-material-design-icons/Delete.vue'
118+ import ImageOffOutline from ' vue-material-design-icons/ImageOffOutline.vue'
115119import { NcActionButton , NcActionLink , NcListItem , NcModal , NcButton , NcTextField , Tooltip } from ' @nextcloud/vue'
116120import moment from ' @nextcloud/moment'
117121import { translate } from ' @nextcloud/l10n'
@@ -133,6 +137,7 @@ export default {
133137 Pencil,
134138 Check,
135139 Delete,
140+ ImageOffOutline,
136141 },
137142 directives: {
138143 tooltip: Tooltip,
@@ -177,26 +182,29 @@ export default {
177182 showVersionLabelForm: false ,
178183 formVersionLabelValue: this .version .label ,
179184 capabilities: loadState (' core' , ' capabilities' , { files: { version_labeling: false , version_deletion: false } }),
185+ previewError: false ,
180186 }
181187 },
182188 computed: {
183189 /**
184190 * @return {string}
185191 */
186192 versionLabel () {
193+ const label = this .version .label ?? ' '
194+
187195 if (this .isCurrent ) {
188- if (this . version . label === undefined || this . version . label === ' ' ) {
196+ if (label === ' ' ) {
189197 return translate (' files_versions' , ' Current version' )
190198 } else {
191- return ` ${ this . version . label } (${ translate (' files_versions' , ' Current version' )} )`
199+ return ` ${ label} (${ translate (' files_versions' , ' Current version' )} )`
192200 }
193201 }
194202
195- if (this .isFirstVersion && this . version . label === ' ' ) {
203+ if (this .isFirstVersion && label === ' ' ) {
196204 return translate (' files_versions' , ' Initial version' )
197205 }
198206
199- return this . version . label
207+ return label
200208 },
201209
202210 /**
@@ -275,6 +283,11 @@ export default {
275283 height: 3rem ;
276284 border: 1px solid var (-- color- border);
277285 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);
278291 }
279292}
280293
0 commit comments