A platform for community discussion. Free, open, simple.
UX: Prevent long URLs from overflowing traffic breakdowns
Alan Guo Xiang Tanbb359cdda96e
diff --git a/app/assets/stylesheets/admin/dashboard/site-traffic-explorer.scss b/app/assets/stylesheets/admin/dashboard/site-traffic-explorer.scssindex 150d52de455..083837f6178 100644--- a/app/assets/stylesheets/admin/dashboard/site-traffic-explorer.scss+++ b/app/assets/stylesheets/admin/dashboard/site-traffic-explorer.scss@@ -254,8 +254,10 @@}&__row-link {- @include ellipsis;+ display: block;+ flex: 1 1 auto;min-width: 0;+ overflow: hidden;color: inherit;text-decoration: none;@@ -275,7 +277,7 @@align-items: center;align-self: stretch;justify-content: flex-end;- flex: 1 1 auto;+ flex: 0 0 auto;min-width: 0;margin-block: calc(-1 * var(--space-1));margin-inline-end: calc(-1 * var(--space-2));@@ -311,10 +313,18 @@}&__dimension-label {- display: inline-flex;+ display: grid;+ grid-template-columns: auto minmax(0, 1fr);align-items: center;gap: var(--space-2);min-width: 0;+ width: 100%;+ }++ &__dimension-text {+ @include ellipsis;+ grid-column: 2;+ min-width: 0;}&__card-empty {@@ -341,9 +351,28 @@}.site-traffic-breakdown-modal {+ &__dimension {+ max-width: 0;+ overflow: hidden;++ .site-traffic-explorer__row-link {+ display: block;+ }++ @include viewport.until(md) {+ max-width: none;+ }+ }+&__pageviews {+ width: 1%;+ white-space: nowrap;text-align: end;+ @include viewport.until(md) {+ width: auto;+ }+.d-table__mobile-label {text-align: start;}diff --git a/frontend/discourse/admin/components/site-traffic-explorer-breakdown-card.gjs b/frontend/discourse/admin/components/site-traffic-explorer-breakdown-card.gjsindex f661df6914f..9b600c2767f 100644--- a/frontend/discourse/admin/components/site-traffic-explorer-breakdown-card.gjs+++ b/frontend/discourse/admin/components/site-traffic-explorer-breakdown-card.gjs@@ -177,6 +177,7 @@ export default class SiteTrafficExplorerBreakdownCard extends Component {href={{rowLink.href}}rel={{rowLink.rel}}target={{rowLink.target}}+ title={{row.label}}class="site-traffic-explorer__row-link"><SiteTrafficExplorerDimensionLabeldiff --git a/frontend/discourse/admin/components/site-traffic-explorer-breakdown-modal.gjs b/frontend/discourse/admin/components/site-traffic-explorer-breakdown-modal.gjsindex e1413870658..8edc770c6b6 100644--- a/frontend/discourse/admin/components/site-traffic-explorer-breakdown-modal.gjs+++ b/frontend/discourse/admin/components/site-traffic-explorer-breakdown-modal.gjs@@ -46,13 +46,16 @@ export default class SiteTrafficExplorerBreakdownModal extends Component {<tbody class="d-table__body">{{#each this.rows as |row|}}<tr class="d-table__row">- <td class="d-table__cell --overview">+ <td+ class="d-table__cell --overview site-traffic-breakdown-modal__dimension"+ >{{#let (@model.rowLink row) as |rowLink|}}{{#if rowLink}}<ahref={{rowLink.href}}rel={{rowLink.rel}}target={{rowLink.target}}+ title={{row.label}}class="site-traffic-explorer__row-link"><SiteTrafficExplorerDimensionLabeldiff --git a/frontend/discourse/admin/components/site-traffic-explorer-dimension-label.gjs b/frontend/discourse/admin/components/site-traffic-explorer-dimension-label.gjsindex 5b98c2fca64..f8c846e0e6f 100644--- a/frontend/discourse/admin/components/site-traffic-explorer-dimension-label.gjs+++ b/frontend/discourse/admin/components/site-traffic-explorer-dimension-label.gjs@@ -30,7 +30,7 @@ export default class SiteTrafficExplorerDimensionLabel extends Component {{{else if (eq @dimension "browsers")}}{{dIcon (this.browserIcon @row.value)}}{{/if}}- <span>{{@row.label}}</span>+ <span class="site-traffic-explorer__dimension-text">{{@row.label}}</span></span></template>}diff --git a/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb b/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rbindex e8d90a22bbc..7e720d14339 100644--- a/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb+++ b/spec/system/admin_dashboard_redesign/site_traffic_explorer_spec.rb@@ -394,6 +394,7 @@ RSpec.describe "Admin Dashboard Redesign | Site Traffic Explorer" dotraffic.expand("pages")expect(traffic).to have_expanded_table(title: "Top URLs", column: "URL")+ expect(traffic).to have_expanded_url_link(label: additional_path)traffic.filter_expanded_row(label: additional_path)diff --git a/spec/system/page_objects/pages/admin_site_traffic_explorer.rb b/spec/system/page_objects/pages/admin_site_traffic_explorer.rbindex 57e7c6c69c9..b48c771d150 100644--- a/spec/system/page_objects/pages/admin_site_traffic_explorer.rb+++ b/spec/system/page_objects/pages/admin_site_traffic_explorer.rb@@ -107,7 +107,7 @@ module PageObjectsdef has_url_link?(card:, label:, href:)within("[data-test-site-traffic-card='#{card}']") do- has_css?("a[href='#{href}']", exact_text: label)+ has_css?("a[href='#{href}'][title='#{label}']", exact_text: label)endend@@ -158,6 +158,11 @@ module PageObjectshas_css?("#{selector} .d-table__body .d-table__row")end+ def has_expanded_url_link?(label:)+ selector = ".site-traffic-breakdown-modal[role='dialog']"+ has_css?("#{selector} a[href='#{label}'][title='#{label}']", exact_text: label)+ end+def filter_expanded_row(label:)within(".site-traffic-breakdown-modal[role='dialog']") dowithin("tr", text: label) { find("button[aria-label^='Filter by #{label},']").click }