From 97c0d93d221d2d5be6ef05bb03c5477c784fa1fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Poussard?= <tpoussard@neogeo.fr> Date: Tue, 30 May 2023 14:52:08 +0200 Subject: [PATCH] fix value of undefined properties & extra field name instead of label --- .../Feature/Detail/FeatureHeader.vue | 2 +- .../Feature/Detail/FeatureTable.vue | 27 +++++++++++-------- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/components/Feature/Detail/FeatureHeader.vue b/src/components/Feature/Detail/FeatureHeader.vue index 33ee77d8..1d45d3c4 100644 --- a/src/components/Feature/Detail/FeatureHeader.vue +++ b/src/components/Feature/Detail/FeatureHeader.vue @@ -170,7 +170,7 @@ @blur="updateDescription" /> </span> - <span v-else> + <span v-else-if="currentFeature && currentFeature.properties"> {{ currentFeature.properties.description }} </span> </div> diff --git a/src/components/Feature/Detail/FeatureTable.vue b/src/components/Feature/Detail/FeatureTable.vue index 66d12960..17a57ba0 100644 --- a/src/components/Feature/Detail/FeatureTable.vue +++ b/src/components/Feature/Detail/FeatureTable.vue @@ -54,7 +54,9 @@ <td> Auteur </td> - <td>{{ currentFeature.properties.display_creator }}</td> + <td v-if="currentFeature.properties"> + {{ currentFeature.properties.display_creator }} + </td> </tr> <tr> <td> @@ -62,7 +64,7 @@ </td> <td> <i - v-if="currentFeature.properties.status" + v-if="currentFeature.properties && currentFeature.properties.status" :class="['icon', statusIcon]" aria-hidden="true" /> @@ -80,7 +82,7 @@ <td> Date de création </td> - <td v-if="currentFeature.properties.created_on"> + <td v-if="currentFeature.properties && currentFeature.properties.created_on"> {{ currentFeature.properties.created_on | formatDate }} </td> </tr> @@ -88,7 +90,7 @@ <td> Date de dernière modification </td> - <td v-if="currentFeature.properties.updated_on"> + <td v-if="currentFeature.properties && currentFeature.properties.updated_on"> {{ currentFeature.properties.updated_on | formatDate }} </td> </tr> @@ -197,13 +199,16 @@ export default { }, statusLabel() { - if (this.currentFeature.properties.status.label) { - return this.currentFeature.properties.status.label; + if (this.currentFeature.properties) { + if (this.currentFeature.properties && this.currentFeature.properties.status.label) { + return this.currentFeature.properties.status.label; + } + const status = statusChoices.find( + (el) => el.value === this.currentFeature.properties.status + ); + return status ? status.name : ''; } - const status = statusChoices.find( - (el) => el.value === this.currentFeature.properties.status - ); - return status ? status.name : ''; + return ''; }, featureData() { @@ -211,7 +216,7 @@ export default { return this.featureType.customfield_set.map((xtraForm) => { return { ...xtraForm, - value: this.currentFeature.properties[xtraForm.label] + value: this.currentFeature.properties[xtraForm.name] }; }); } -- GitLab