From 718e0434bae861a44960597fa055db29747de31b Mon Sep 17 00:00:00 2001
From: Fabio Manganiello <fabio@manganiello.tech>
Date: Mon, 20 Mar 2023 14:32:03 +0100
Subject: [PATCH] Display all available entity attributes on EntityModal.

---
 .../src/components/panels/Entities/Modal.vue  | 37 +++++++++++++++----
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue b/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue
index b2d6f183b..bcacf4f43 100644
--- a/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue
+++ b/platypush/backend/http/webapp/src/components/panels/Entities/Modal.vue
@@ -90,13 +90,6 @@
       </div>
     </div>
 
-    <div v-for="value, attr in entity.data || {}" :key="attr">
-      <div class="table-row" v-if="value != null">
-        <div class="title" v-text="prettify(attr)" />
-        <div class="value" v-text="'' + value" />
-      </div>
-    </div>
-
     <div class="table-row" v-if="entity.created_at">
       <div class="title">Created at</div>
       <div class="value" v-text="formatDateTime(entity.created_at)" />
@@ -107,6 +100,20 @@
       <div class="value" v-text="formatDateTime(entity.updated_at)" />
     </div>
 
+    <div v-for="value, attr in entity" :key="attr">
+      <div class="table-row" v-if="value != null && specialFields.indexOf(attr) < 0">
+        <div class="title" v-text="prettify(attr)" />
+        <div class="value" v-text="'' + value" />
+      </div>
+    </div>
+
+    <div v-for="value, attr in (entity.data || {})" :key="attr">
+      <div class="table-row" v-if="value != null">
+        <div class="title" v-text="prettify(attr)" />
+        <div class="value" v-text="'' + value" />
+      </div>
+    </div>
+
     <div class="table-row delete-entity-container">
       <div class="title">Delete Entity</div>
       <div class="value">
@@ -152,6 +159,21 @@ import Utils from "@/Utils";
 import Entity from "./Entity";
 import meta from './meta.json';
 
+// These fields have a different rendering logic than the general-purpose one
+const specialFields = [
+  'created_at',
+  'data',
+  'description',
+  'external_id',
+  'external_url',
+  'id',
+  'image_url',
+  'meta',
+  'name',
+  'plugin',
+  'updated_at',
+]
+
 export default {
   name: "EntityModal",
   components: {Entity, Modal, EditButton, NameEditor, Icon, ConfirmDialog},
@@ -188,6 +210,7 @@ export default {
       editName: false,
       editIcon: false,
       configCollapsed: true,
+      specialFields: specialFields,
     }
   },