Skip to content

A platform for community discussion. Free, open, simple.

UX: Add See details link to Site Traffic dashboard panel (#40292)

Alan Guo Xiang Tanfd37e68fb2cd
diff --git a/app/assets/stylesheets/admin/admin_dashboard.scss b/app/assets/stylesheets/admin/admin_dashboard.scss
index 744462b10e2..e3648b0b179 100644
--- a/app/assets/stylesheets/admin/admin_dashboard.scss
+++ b/app/assets/stylesheets/admin/admin_dashboard.scss
@@ -907,6 +907,14 @@ h1 {
color: var(--danger);
font-size: var(--font-down-1-rem);
}
+
+ &__see-details {
+ align-self: flex-end;
+ display: inline-flex;
+ align-items: center;
+ gap: var(--space-1);
+ font-size: var(--font-down-1-rem);
+ }
}
.db-reports {
diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml
index c5dd966f09b..cc8eb7d8de0 100644
--- a/config/locales/client.en.yml
+++ b/config/locales/client.en.yml
@@ -7031,6 +7031,7 @@ en:
anonymous: "Anonymous"
embedded: "Embedded pageviews"
crawlers: "Crawlers"
+ see_details: "See details"
period:
last_7_days: "Last 7 days"
last_30_days: "Last 30 days"
diff --git a/frontend/discourse/admin/components/dashboard/traffic.gjs b/frontend/discourse/admin/components/dashboard/traffic.gjs
index 278ecf9463d..431a34decc5 100644
--- a/frontend/discourse/admin/components/dashboard/traffic.gjs
+++ b/frontend/discourse/admin/components/dashboard/traffic.gjs
@@ -1,10 +1,12 @@
import Component from "@glimmer/component";
-import { concat } from "@ember/helper";
+import { concat, hash } from "@ember/helper";
+import { LinkTo } from "@ember/routing";
import AdminReportStackedChart from "discourse/admin/components/admin-report-stacked-chart";
import DashboardSection from "discourse/admin/components/dashboard/section";
import { countryFlag, countryName } from "discourse/admin/lib/format-country";
import DTooltip from "discourse/float-kit/components/d-tooltip";
import { or } from "discourse/truth-helpers";
+import dIcon from "discourse/ui-kit/helpers/d-icon";
import I18n, { i18n } from "discourse-i18n";
const PERIOD_COPY_KEYS = {
@@ -108,6 +110,13 @@ export default class DashboardTraffic extends Component {
};
}
+ get reportQuery() {
+ return {
+ start_date: moment(this.args.startDate).format("YYYY-MM-DD"),
+ end_date: moment(this.args.endDate).format("YYYY-MM-DD"),
+ };
+ }
+
formatHeadlineCount(value) {
if (value >= 1_000_000) {
const formatted = I18n.toNumber(value / 1_000_000, { precision: 1 });
@@ -260,6 +269,18 @@ export default class DashboardTraffic extends Component {
class="db-section__traffic-chart-canvas"
/>
</div>
+ <LinkTo
+ class="db-traffic__see-details"
+ @route="adminReports.show"
+ @model="site_traffic"
+ @query={{hash
+ start_date=this.reportQuery.start_date
+ end_date=this.reportQuery.end_date
+ }}
+ >
+ {{i18n "admin.dashboard.site_traffic.see_details"}}
+ {{dIcon "arrow-right"}}
+ </LinkTo>
{{else}}
<div class="db-section__traffic-chart">
<div class="db-section__traffic-chart-shell"></div>
diff --git a/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb b/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb
index c2b47774026..e0f2b5e6ca8 100644
--- a/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb
+++ b/spec/system/admin_dashboard_redesign/site_traffic_section_spec.rb
@@ -128,6 +128,23 @@ describe "Admin Dashboard Redesign | Site Traffic section" do
expect(traffic).to have_chart
end
+ it "takes staff to the full site traffic report scoped to the same period when they click See details",
+ time: Time.zone.local(2026, 5, 14, 12, 0, 0) do
+ Fabricate(:logged_in_browser_application_request, date: "2026-05-05", count: 10)
+
+ dashboard.visit_with_query(range: "custom", start_date: "2026-05-01", end_date: "2026-05-12")
+ traffic = dashboard.site_traffic
+
+ expect(traffic).to have_chart
+ expect(traffic).to have_see_details_link
+
+ traffic.click_see_details
+
+ expect(page).to have_current_path(
+ "/admin/reports/site_traffic?end_date=2026-05-12&start_date=2026-05-01",
+ )
+ end
+
context "with top countries and top referrers cards" do
before do
SiteSetting.persist_browser_pageview_events = true
diff --git a/spec/system/page_objects/components/admin_dashboard_site_traffic.rb b/spec/system/page_objects/components/admin_dashboard_site_traffic.rb
index cbe336039dc..e3d1be0bf06 100644
--- a/spec/system/page_objects/components/admin_dashboard_site_traffic.rb
+++ b/spec/system/page_objects/components/admin_dashboard_site_traffic.rb
@@ -36,6 +36,14 @@ module PageObjects
has_css?(".db-section__traffic-chart canvas")
end
+ def has_see_details_link?
+ has_css?("a.db-traffic__see-details")
+ end
+
+ def click_see_details
+ find("a.db-traffic__see-details").click
+ end
+
def hover_comparison_tooltip
find("[data-trigger][data-identifier='site-traffic-comparison-tooltip']").hover
self