Skip to content

Commit

Permalink
Merge pull request #377 from GSA/add-dataset-title
Browse files Browse the repository at this point in the history
Add dataset page column to global download and outbound tables
  • Loading branch information
rshewitt authored Dec 11, 2024
2 parents cbe5e55 + 725dce8 commit 969daa0
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 9 deletions.
6 changes: 3 additions & 3 deletions _data/metrics.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ const REPORTS = {
title: "Most Downloaded Dataset Files",
description: "Top 10 downloaded files",
url: "global__download_requests__last30.[end_date].csv",
columnKeys: ["linkUrl", "eventCount"]
columnKeys: ["linkUrl", "pageTitle", "eventCount"]
},
MOST_CLICKED_OUTBOUND_LINKS: {
title: "Most Clicked Outbound Links",
description: "Top 10 external link clicks",
url: "global__link_requests__last30.[end_date].csv",
columnKeys: ["linkUrl", "eventCount"]
columnKeys: ["linkUrl", "pageTitle", "eventCount"]
},
DATASETS_PER_ORG: {
title: "Number of Datasets per Organization",
Expand Down Expand Up @@ -77,7 +77,7 @@ const ENUMS = {
"deviceCategory": "Device Category",
"activeUsers": "Users",
"searchTerm": "Search Term",
"pageTitle": "Title",
"pageTitle": "Page Title",
"eventCount": "Count",
"organization": "Organization",
"count": "Count",
Expand Down
21 changes: 19 additions & 2 deletions pages/metrics/metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ <h3>{{ block.data[1] | toLocaleString }}</h3>
<div class="grid-col-12">
<h4>{{block.meta.title}}</h4>
<p>{{block.meta.description}}</p>
<table class="usa-table usa-table--borderless usa-table--stacked full-width">
{%- if cacheKey == "MOST_DOWNLOADED_DATASETS" or cacheKey == "MOST_CLICKED_OUTBOUND_LINKS"-%}
<table class="usa-table usa-table--borderless usa-table--stacked">
{%- else -%}
<table class="usa-table usa-table--borderless usa-table--stacked full-width">
{%- endif -%}
<caption>
<a href="{{block.meta.reportLink}}">{% usa_icon 'file_download' %} Download Full Report -
{{block.meta.title}}</a>
Expand Down Expand Up @@ -94,8 +98,21 @@ <h4>{{block.meta.title}}</h4>
<td>{{column}}</td>
{%- endif -%}
{%- else -%}
<td align="right">{{column | toLocaleString}}</td>

{%- if cacheKey == "MOST_DOWNLOADED_DATASETS" -%}
{%- assign pageURL = 5 -%}
{%- elsif cacheKey == "MOST_CLICKED_OUTBOUND_LINKS" -%}
{%- assign pageURL = 4 -%}
{%- endif -%}
{%- if block.data[0][forloop.index0] == "pageTitle" -%}
<td>
<a href="{{row[pageURL]}}" target="_blank">{{column | toLocaleString | replace: " - Catalog", ""}}</a>
</td>
{%- else -%}
<td>{{column | toLocaleString}}</td>
{%- endif -%}
{%- endif -%}

{%- endif -%}
{% endfor %}
</tr>
Expand Down
16 changes: 12 additions & 4 deletions pages/metrics/metrics_per-org.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ <h6 class="usa-heading">Report Date: {{ metrics.end_date}}</h6>
<div class="grid-col-12">
<h4>{{block.meta.title}}</h4>
<p>{{block.meta.description}}</p>
<table class="usa-table usa-table--borderless usa-table--stacked full-width">
{%- if cacheKey == "MOST_VIEWED_DATASETS" -%}
<table class="usa-table usa-table--borderless usa-table--stacked full-width">
{%- else -%}
<table class="usa-table usa-table--borderless usa-table--stacked">
{%- endif -%}
<caption>
<a href="{{block.meta.reportLink}}">{% usa_icon 'file_download' %} Download Full Report -
{{block.meta.title}}</a>
Expand Down Expand Up @@ -60,13 +64,17 @@ <h4>{{block.meta.title}}</h4>
{%- endif -%}

{%- else -%}
{%- assign pageURL = 5 -%}
{%- if cacheKey == "MOST_DOWNLOADED_DATASETS" -%}
{%- assign pageURL = 5 -%}
{%- else -%}
{%- assign pageURL = 4 -%}
{%- endif -%}
{%- if block.data[0][forloop.index0] == "pageTitle" -%}
<td align="right">
<td>
<a href="{{row[pageURL]}}" target="_blank">{{column | toLocaleString | replace: " - Catalog", ""}}</a>
</td>
{%- else -%}
<td align="right">{{column | toLocaleString}}</td>
<td>{{column | toLocaleString}}</td>
{%- endif -%}
{%- endif -%}
{%- endif -%}
Expand Down
4 changes: 4 additions & 0 deletions styles/partials/overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ button {
background-color: #fff;
}

.usa-table td {
text-align: left
}

.usa-table.full-width tr {
td:first-child {
width: 90%;
Expand Down

0 comments on commit 969daa0

Please sign in to comment.