Integrate datatables.net 32/97632/3
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 23 Sep 2021 07:50:24 +0000 (09:50 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 25 Sep 2021 14:11:58 +0000 (16:11 +0200)
The tables we generate for JIRA issues are static and ugly. Let's bring
some dazzle to them with datatables.net, which allow for sorting,
searching, pagination and a ton of other stuff.

Change-Id: I03a7efa184801aa009dc83c77970d998ce47c6ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
docs/ext/odl-jira.py

index 400eba8932394a6f67b19dfd05e7bdda199828e7..7ca7ed6d6e73cee5d6c6e024d2b39a7a193ca7cd 100644 (file)
@@ -46,7 +46,6 @@ class JiraFixedIssuesDirective(Directive):
         # FIXME: this is not quite nice: can we emit the table markup directly
         table = [
             '.. list-table:: Issues resolved in versions %s through %s' % (from_ver, to_ver),
-            # FIXME: bind to https://datatables.net/
             '   :class: datatable',
             '   :header-rows: 1',
             '   :widths: auto',
@@ -112,7 +111,6 @@ class JiraKnownIssuesDirective(Directive):
         # FIXME: this is not quite nice: can we emit the table markup directly
         table = [
             '.. list-table:: Issues affecting versions %s through %s' % (from_ver, to_ver),
-            # FIXME: bind to https://datatables.net/
             '   :class: datatable',
             '   :header-rows: 1',
             '   :widths: auto',
@@ -167,6 +165,11 @@ def setup(app):
     app.add_directive('jira_fixed_issues', JiraFixedIssuesDirective)
     app.add_directive('jira_known_issues', JiraKnownIssuesDirective)
 
+    # https://datatables.net/ improvements to tables
+    app.add_css_file("https://cdn.datatables.net/1.11.2/css/jquery.dataTables.min.css")
+    app.add_js_file("https://cdn.datatables.net/1.11.2/js/jquery.dataTables.min.js")
+    app.add_js_file(None, **{"body": "$(document).ready( function () { $('table.datatable').DataTable(); } );", "type": "text/javascript", "class": "init"})
+
     return {
         'version': '0.1',
         'parallel_read_safe': True,