From 73ce97443e6fd252c55c60f7b29b774b9a5219f4 Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 25 Sep 2023 15:33:20 -0700 Subject: [PATCH 1/6] Show workspace name only in DAR table For PRIMED, we have typically been showing only the workspace name without the billing project in tables/etc. To save space in the DAR table, only show the workspace name (without billing project). --- primed/dbgap/tables.py | 2 +- primed/dbgap/tests/test_tables.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 622bbad2..120a0b09 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -207,7 +207,7 @@ def render_matching_workspaces(self, value, record): ) this_context = { "has_access": has_access, - "workspace": dbgap_workspace, + "workspace": dbgap_workspace.workspace.name, } this = Template(template_code).render(Context(this_context)) items = items + [this] diff --git a/primed/dbgap/tests/test_tables.py b/primed/dbgap/tests/test_tables.py index 01d8b538..5ca09a30 100644 --- a/primed/dbgap/tests/test_tables.py +++ b/primed/dbgap/tests/test_tables.py @@ -531,7 +531,8 @@ def test_one_matching_workspace_with_access(self): ) table = self.table_class([dar]) value = table.render_matching_workspaces(dar.get_dbgap_workspaces(), dar) - self.assertIn(str(workspace), value) + self.assertIn(workspace.workspace.name, value) + self.assertNotIn(workspace.workspace.billing_project.name, value) self.assertIn("circle-fill", value) def test_one_matching_workspace_without_access(self): @@ -542,7 +543,7 @@ def test_one_matching_workspace_without_access(self): ) table = self.table_class([dar]) value = table.render_matching_workspaces(dar.get_dbgap_workspaces(), dar) - self.assertIn(str(workspace), value) + self.assertIn(workspace.workspace.name, value) self.assertIn("square-fill", value) def test_two_matching_workspaces(self): @@ -568,8 +569,8 @@ def test_two_matching_workspaces(self): ) table = self.table_class([dar]) value = table.render_matching_workspaces(dar.get_dbgap_workspaces(), dar) - self.assertIn(str(workspace_1), value) - self.assertIn(str(workspace_2), value) + self.assertIn(workspace_1.workspace.name, value) + self.assertIn(workspace_2.workspace.name, value) def test_ordering(self): """Instances are ordered alphabetically by dbgap_dar_id.""" From 2605326a3d3c9816ba6615e4c72b33a3439de39f Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 25 Sep 2023 15:38:43 -0700 Subject: [PATCH 2/6] Show DAR info by default on DAR snapshot detail page --- primed/dbgap/tables.py | 10 ++++------ .../dbgap/dbgapdataaccesssnapshot_detail.html | 4 ++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 120a0b09..93dcb823 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -194,11 +194,9 @@ class dbGaPDataAccessRequestTable(tables.Table): def render_matching_workspaces(self, value, record): template_code = """ -
  • - {{workspace}} - -
  • + + {{workspace}} """ items = [] for dbgap_workspace in value: @@ -211,7 +209,7 @@ def render_matching_workspaces(self, value, record): } this = Template(template_code).render(Context(this_context)) items = items + [this] - html = format_html("") + html = format_html("" + "
    ".join(items)) return html def render_dbgap_phs(self, value): diff --git a/primed/templates/dbgap/dbgapdataaccesssnapshot_detail.html b/primed/templates/dbgap/dbgapdataaccesssnapshot_detail.html index 68c0ded1..a96a64ac 100644 --- a/primed/templates/dbgap/dbgapdataaccesssnapshot_detail.html +++ b/primed/templates/dbgap/dbgapdataaccesssnapshot_detail.html @@ -36,12 +36,12 @@

    -

    -
    +
    {% render_table data_access_request_table %}
    From e7102884aedfdd3fff294cf1c9cb06f48ad49a0f Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 25 Sep 2023 15:46:53 -0700 Subject: [PATCH 3/6] Shorten dbGaPDataAccessRequestTable table width Remove dbGaP from column names. Only show the consent abbreviation and not the consent code (and call it "Consent"). --- primed/dbgap/tables.py | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 93dcb823..483a09ca 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -184,14 +184,29 @@ def render_number_requested_dars(self, record): class dbGaPDataAccessRequestTable(tables.Table): """Class to render a table of dbGaPDataAccessRequest objects.""" + dbgap_dar_id = tables.columns.Column(verbose_name="DAR") + dbgap_dac = tables.columns.Column(verbose_name="DAC") dbgap_accession = tables.columns.Column( - verbose_name=" dbGaP accession", + verbose_name="Accession", accessor="get_dbgap_accession", ) + dbgap_consent_abbreviation = tables.columns.Column(verbose_name="Consent") + dbgap_current_status = tables.columns.Column(verbose_name="Current status") matching_workspaces = tables.columns.Column( accessor="get_dbgap_workspaces", orderable=False, default=" " ) + class Meta: + model = models.dbGaPDataAccessRequest + fields = ( + "dbgap_dar_id", + "dbgap_dac", + "dbgap_accession", + "dbgap_consent_abbreviation", + "dbgap_current_status", + ) + order_by = ("dbgap_dar_id",) + def render_matching_workspaces(self, value, record): template_code = """ Date: Mon, 25 Sep 2023 15:51:06 -0700 Subject: [PATCH 4/6] Use table-sm bootstrap class to save space --- primed/dbgap/tables.py | 1 + 1 file changed, 1 insertion(+) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 483a09ca..17820430 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -206,6 +206,7 @@ class Meta: "dbgap_current_status", ) order_by = ("dbgap_dar_id",) + attrs = {"class": "table table-sm"} def render_matching_workspaces(self, value, record): template_code = """ From 008a2884dafeeda17dbd59f28f2a98cb8836ed1b Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 25 Sep 2023 15:58:46 -0700 Subject: [PATCH 5/6] Add padding in between external link symbol and dbGaP accession --- primed/dbgap/tables.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 17820430..3874bd6f 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -233,10 +233,7 @@ def render_dbgap_phs(self, value): def render_dbgap_accession(self, value, record): return format_html( - """ - {} - - + """{} """.format( record.get_dbgap_link(), value ) From cfce15b263f05a98ab39a10b50694161a006572a Mon Sep 17 00:00:00 2001 From: Adrienne Stilp Date: Mon, 25 Sep 2023 15:59:32 -0700 Subject: [PATCH 6/6] Use superscript for the external link bootstrap icon --- primed/dbgap/tables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primed/dbgap/tables.py b/primed/dbgap/tables.py index 3874bd6f..13d4e363 100644 --- a/primed/dbgap/tables.py +++ b/primed/dbgap/tables.py @@ -233,7 +233,7 @@ def render_dbgap_phs(self, value): def render_dbgap_accession(self, value, record): return format_html( - """{} + """{} """.format( record.get_dbgap_link(), value )