Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dataset page column to global download and outbound tables #377

Merged
merged 5 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 align="left">
<a href="{{row[pageURL]}}" target="_blank">{{column | toLocaleString | replace: " - Catalog", ""}}</a>
</td>
{%- else -%}
<td align="right">{{column | toLocaleString}}</td>
{%- endif -%}
{%- endif -%}

{%- endif -%}
{% endfor %}
</tr>
Expand Down
14 changes: 11 additions & 3 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,9 +64,13 @@ <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 align="left">
btylerburton marked this conversation as resolved.
Show resolved Hide resolved
<a href="{{row[pageURL]}}" target="_blank">{{column | toLocaleString | replace: " - Catalog", ""}}</a>
</td>
{%- else -%}
Expand Down
Loading