about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFrederick Muriuki Muriithi2023-08-10 10:55:54 +0300
committerFrederick Muriuki Muriithi2023-08-10 10:55:54 +0300
commitfbffae03945e15b3c0300e151a80a341616886ad (patch)
treeb804007c5525b4089569ef739ddd069e026ae0e0
parente252d45f3cdc337b2d1eacaf947c7c646b267ce3 (diff)
downloadgenenetwork2-fbffae03945e15b3c0300e151a80a341616886ad.tar.gz
Bug: Avoid repetition of data. Simplify UI.
-rw-r--r--wqflask/wqflask/metadata_edits.py2
-rw-r--r--wqflask/wqflask/templates/edit_history.html63
2 files changed, 27 insertions, 38 deletions
diff --git a/wqflask/wqflask/metadata_edits.py b/wqflask/wqflask/metadata_edits.py
index 43651525..585ddbb3 100644
--- a/wqflask/wqflask/metadata_edits.py
+++ b/wqflask/wqflask/metadata_edits.py
@@ -601,7 +601,7 @@ def show_history(dataset_id: str = "", name: str = ""):
             lambda x: x.timestamp)
     return render_template(
         "edit_history.html",
-        diff=diff_data_,
+        diff={key: set(val) for key,val in diff_data_},
         version=get_setting("GN_VERSION"),
     )
 
diff --git a/wqflask/wqflask/templates/edit_history.html b/wqflask/wqflask/templates/edit_history.html
index 7538324b..876ab085 100644
--- a/wqflask/wqflask/templates/edit_history.html
+++ b/wqflask/wqflask/templates/edit_history.html
@@ -9,46 +9,35 @@
 <!-- Start of body -->
 <div class="container">
 
-    <h1>History</h1>
+  <h1>History</h1>
     {% if diff %}
     <div class="row">
-	<table id="history" class="table-responsive table-hover table-striped cell-border">
-            <tbody>
-		<tr>
-                    <th>Timestamp</th>
-                    <th>Editor</th>
-                    <th>Field</th>
-                    <th>Diff</th>
-		</tr>
-		{% set ns = namespace(display_cell=True) %}
-
-		{% for timestamp, group in diff %}
-		{% set ns.display_cell = True %}
-		{% for i in group %}
-		<tr>
-                    {% if ns.display_cell and i.timestamp == timestamp %}
-
-                    {% set author = i.author %}
-                    {% set timestamp_ = i.timestamp %}
-
-                    {% else %}
-
-                    {% set author = "" %}
-                    {% set timestamp_ = "" %}
-
-                    {% endif %}
-                    <td>{{ timestamp_ }}</td>
-		    <td>{{ author }}</td>
-		    <td>{{ i.diff.field }}</td>
-		    <td><pre>{{ i.diff.diff }}</pre></td>
-		    {% set ns.display_cell = False %}
-		</tr>
-		{% endfor %}
-		{% endfor %}
-	    </tbody>
-	</table>
+      <table id="history" class="table-responsive table-hover table-striped cell-border">
+	<thead>
+          <th>Timestamp</th>
+          <th>Editor</th>
+          <th>Field</th>
+          <th>Diff</th>
+	</thead>
+	<tbody>
+	  {%set ns = namespace(display_ts=True)%}
+	  {%for ts, item in diff.items()%}
+	  {%set ns.display_ts = True%}
+	  {%for the_diff in item%}
+	  <tr>
+	    {%if ns.display_ts%}
+	    <td rowspan={{item | length}}>{{ts}}</td>
+	    {%set ns.display_ts = False%}
+	    {%endif%}
+	    <td>{{the_diff.author}}</td>
+	    <td>{{the_diff.diff.field}}</td>
+	    <td><pre>{{the_diff.diff.diff}}</pre></td>
+	  </tr>
+	  {%endfor%}
+	  {%endfor%}
+	</tbody>
+      </table>
     </div>
-
     {% endif %}
 
 </div>