From bb17976e8fb503e6af4faaaeea1e14a7ffa7bb8b Mon Sep 17 00:00:00 2001
From: James Graham <J.Graham@software.ac.uk>
Date: Fri, 16 Nov 2018 11:23:28 +0000
Subject: [PATCH] Display audit records from template in provenance app

---
 .../datasources/datasource/audit.html         | 19 +--------------
 .../templates/prov_entry/include_table.html   | 24 +++++++++++++++++++
 2 files changed, 25 insertions(+), 18 deletions(-)
 create mode 100644 provenance/templates/prov_entry/include_table.html

diff --git a/datasources/templates/datasources/datasource/audit.html b/datasources/templates/datasources/datasource/audit.html
index ca0348f..2a8a0f8 100644
--- a/datasources/templates/datasources/datasource/audit.html
+++ b/datasources/templates/datasources/datasource/audit.html
@@ -29,23 +29,6 @@
 
     <h4>Records</h4>
 
-    <table class="table">
-        <thead>
-            <tr>
-                <th scope="col"></th>
-            </tr>
-        </thead>
-        <tbody>
-            {% for record in records %}
-                <tr>
-                    <td>{{ record.to_json }}</td>
-                </tr>
-            {% empty %}
-                <tr>
-                    <td>No records</td>
-                </tr>
-            {% endfor %}
-        </tbody>
-    </table>
+    {% include 'prov_entry/include_table.html' with objects=records %}
 
 {% endblock %}
\ No newline at end of file
diff --git a/provenance/templates/prov_entry/include_table.html b/provenance/templates/prov_entry/include_table.html
new file mode 100644
index 0000000..7f8124b
--- /dev/null
+++ b/provenance/templates/prov_entry/include_table.html
@@ -0,0 +1,24 @@
+<table class="table">
+    <thead>
+        <tr>
+            <th scope="col">ID</th>
+            <th scope="col">Entity</th>
+            <th scope="col">Agents</th>
+            <th scope="col">Activity</th>
+        </tr>
+    </thead>
+    <tbody>
+        {% for object in objects %}
+            <tr>
+                <td>{{ object.id }}</td>
+                <td>{{ object.entity }}</td>
+                <td>{{ object.agent }}</td>
+                <td>{{ object.activity }}</td>
+            </tr>
+        {% empty %}
+            <tr>
+                <td>No records</td>
+            </tr>
+        {% endfor %}
+    </tbody>
+</table>
-- 
GitLab