Skip to content

Commit

Permalink
Better defaults for contact info panel (#684)
Browse files Browse the repository at this point in the history
* fix: simplify fallback for access requirements metadata

- if there is a data owner, direct users to them
- if not, this is probably a bug with ingestion. show "Not provided" in
  this case

hypothesis - this will get missing metadata issues fixed more quickly

* fix: add fallbacks for contact channel and owner

In order to present a consistent contact info panel, we should always
show each of the three metadata fields, falling back to a "Not provided"
value if missing.

If access information or contact information is missing, direct the user
to the data owner. When this happens we would also like the data
owner to add in the missing metadata.

If the data owner is missing, then direct the user to us. We do not
intend to show any metadata without a data owner, so this should
be treated as a bug in the service.

part of #601

* fix: rename contact channels to "Ask a question"
  • Loading branch information
MatMoore authored Aug 20, 2024
1 parent 814912d commit 71fbb75
Show file tree
Hide file tree
Showing 4 changed files with 184 additions and 103 deletions.
52 changes: 27 additions & 25 deletions locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Find MoJ data\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 11:07+0100\n"
"POT-Creation-Date: 2024-08-19 10:23+0100\n"
"Language: en\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
Expand Down Expand Up @@ -101,7 +101,7 @@ msgid "Search"
msgstr "Search"

# Page title
#: home/views.py:25 templates/base/navigation.html:64
#: home/views.py:27 templates/base/navigation.html:64
msgid "Home"
msgstr "Home"

Expand Down Expand Up @@ -239,8 +239,8 @@ msgstr "Last updated:"
msgid "Domain:"
msgstr "Subject area:"

#: templates/details_base.html:73 templates/partial/contact_info.html:16
#: templates/partial/contact_info.html:36
#: templates/details_base.html:73 templates/partial/contact_info.html:15
#: templates/partial/contact_info.html:30
#: templates/partial/search_result.html:41
msgid "Not provided"
msgstr "Not provided."
Expand Down Expand Up @@ -282,7 +282,7 @@ msgid "Justice Data (opens in new tab)"
msgstr "Justice Data (opens in new tab)"

# Heading
#: templates/details_database.html:10 templates/details_database.html:37
#: templates/details_database.html:10 templates/details_database.html:35
msgid "Database content"
msgstr "Database content"

Expand All @@ -291,18 +291,8 @@ msgstr "Database content"
msgid "Table name"
msgstr "Table name"

# Column heading
#: templates/details_database.html:15
msgid "Schema details"
msgstr "Schema details"

# Heading
#: templates/details_database.html:30
msgid "Table details"
msgstr "Table details"

# Text for databases without any tables
#: templates/details_database.html:38
#: templates/details_database.html:36
msgid "This database is missing table information."
msgstr "This database is missing table information."

Expand Down Expand Up @@ -382,28 +372,40 @@ msgid "Access requirements"
msgstr "Request access"

# Request access link
#: templates/partial/contact_info.html:7
#: templates/partial/contact_info.html:8
msgid "Click link for access information (opens in new tab)"
msgstr "Click link for access information (opens in new tab)"

#: templates/partial/contact_info.html:12
msgid "Please use contact channels to request access."
msgstr "Please use contact channels to request access."

#: templates/partial/contact_info.html:14
#: templates/partial/contact_info.html:13
msgid "Please contact the data owner for access information."
msgstr "Please contact the data owner for access information."
msgstr "Contact the data owner to request access."

# Heading
#: templates/partial/contact_info.html:22
msgid "Contact channels for questions"
msgstr "Contact channels for questions"
msgstr "Ask a question"

# Heading
#: templates/partial/contact_info.html:34
#: templates/partial/contact_info.html:28
msgid "Contact the data owner with questions."
msgstr "Contact the data owner with questions."

# Heading
#: templates/partial/contact_info.html:36
msgid "IAO or Data Owner"
msgstr "Data owner"

# Contact us link on error pages
#: templates/partial/contact_info.html:41
msgid ""
"Not provided - <a href=\"https://moj.enterprise.slack.com/archives/"
"C06NPM2200N\" class=\"govuk-link\">contact the Data Catalogue team</a> about this "
"data."
msgstr ""
"Not provided - <a href=\"https://moj.enterprise.slack.com/archives/"
"C06NPM2200N\" class=\"govuk-link\">contact the Data Catalogue team</a> about this "
"data."

# Contact us link on error pages
#: templates/partial/contact_team.html:4
msgid ""
Expand Down
58 changes: 32 additions & 26 deletions templates/partial/contact_info.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,43 @@

<div class="govuk-body">
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Access requirements" %}</h2>
{% if access_requirements %}
{% if is_access_url %}
<p class="govuk-body"><a id="request-access" href="{{ access_requirements }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{% translate "Click link for access information (opens in new tab)" %}</a></p>
<p id="request_access" class="govuk-body">
{% if access_requirements %}
{% if is_access_url %}
<a href="{{ access_requirements }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{% translate "Click link for access information (opens in new tab)" %}</a>
{% else %}
{{ access_requirements }}
{% endif %}
{% elif data_owner_email %}
{% translate "Please contact the data owner for access information." %}
{% else %}
<p id="request-access">{{ access_requirements }} </p>
{% translate "Not provided" %}
{% endif %}
{% elif slack_channel.dc_slack_channel_url %}
<p id="request-access">{% translate "Please use contact channels to request access." %}</p>
{% elif data_owner_email %}
<p id="request-access">{% translate "Please contact the data owner for access information." %}</p>
{% else %}
<p id="request-access"> {% translate "Not provided" %} </p>
{% endif %}
</p>
</div>
<!-- placeholder until we have more contact channels than just slack -->
{% if slack_channel.dc_slack_channel_url %}
<div class="govuk-body">
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Contact channels for questions" %}</h2>
<p class="govuk-body">
{% if slack_channel %}
<!-- This should become a list of populated contact channels -->
Slack channel: <a href="{{ slack_channel.dc_slack_channel_url }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{{ slack_channel.dc_slack_channel_name }} (opens in new tab)</a>
{% else %}
{% translate 'Not provided'}
{% endif %}
</p>
</div>
{% endif %}

<div class="govuk-body">
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "Contact channels for questions" %}</h2>
<p id="contact_channels" class="govuk-body">
{% if slack_channel.dc_slack_channel_url %}
<!-- This should become a list of populated contact channels -->
Slack channel: <a href="{{ slack_channel.dc_slack_channel_url }}" class="govuk-link" rel="noreferrer noopener" target="_blank">{{ slack_channel.dc_slack_channel_name }} (opens in new tab)</a>
{% elif data_owner_email %}
{% translate "Contact the data owner with questions." %}
{% else %}
{% translate 'Not provided' %}
{% endif %}
</p>
</div>

<div class="govuk-body">
<h2 class="govuk-heading-s govuk-!-margin-bottom-1">{% translate "IAO or Data Owner" %}</h2>
<p class="govuk-body">
{{ data_owner_email|urlize|default:_('Not provided') }}
<p id="data_owner" class="govuk-body">
{% if data_owner_email %}
{{ data_owner_email|urlize }}
{% else %}
{% blocktranslate %}Not provided - <a href="https://moj.enterprise.slack.com/archives/C06NPM2200N" class="govuk-link">contact the Data Catalogue team</a> about this data.{% endblocktranslate %}
{% endif %}
</p>
</div>
18 changes: 13 additions & 5 deletions tests/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ def primary_heading(self):
return self.selenium.find_element(By.TAG_NAME, "h1")


class DatabaseDetailsPage(Page):
class DetailsPage(Page):
def request_access(self):
return self.selenium.find_element(By.ID, "request_access")

def contact_channels(self):
return self.selenium.find_element(By.ID, "contact_channels")

def data_owner(self):
return self.selenium.find_element(By.ID, "data_owner")


class DatabaseDetailsPage(DetailsPage):
def primary_heading(self):
return self.selenium.find_element(By.TAG_NAME, "h1")

Expand All @@ -86,11 +97,8 @@ def table_link(self):
By.CSS_SELECTOR, ".govuk-table tr td:first-child a"
)

def request_access(self):
return self.selenium.find_element(By.ID, "request-access")


class TableDetailsPage(Page):
class TableDetailsPage(DetailsPage):
def column_descriptions(self):
return [
c.text
Expand Down
Loading

0 comments on commit 71fbb75

Please sign in to comment.