Skip to content

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

UX: Add back link to data explorer query name + description (#38049)

Martin Brennan9ccafab2ddc9
diff --git a/plugins/discourse-data-explorer/assets/javascripts/admin/templates/admin-plugins/show/explorer/index.gjs b/plugins/discourse-data-explorer/assets/javascripts/admin/templates/admin-plugins/show/explorer/index.gjs
index be9ffb29918..0ff27c85189 100644
--- a/plugins/discourse-data-explorer/assets/javascripts/admin/templates/admin-plugins/show/explorer/index.gjs
+++ b/plugins/discourse-data-explorer/assets/javascripts/admin/templates/admin-plugins/show/explorer/index.gjs
@@ -1,4 +1,4 @@
-import { array, fn } from "@ember/helper";
+import { array, concat, fn } from "@ember/helper";
import { on } from "@ember/modifier";
import { LinkTo } from "@ember/routing";
import AdminFilterControls from "discourse/admin/components/admin-filter-controls";
@@ -9,6 +9,7 @@ import PickFilesButton from "discourse/components/pick-files-button";
import TableHeaderToggle from "discourse/components/table-header-toggle";
import ageWithTooltip from "discourse/helpers/age-with-tooltip";
import icon from "discourse/helpers/d-icon";
+import getURL from "discourse/lib/get-url";
import { not } from "discourse/truth-helpers";
import { i18n } from "discourse-i18n";
import ShareReport from "discourse/plugins/discourse-data-explorer/discourse/components/share-report";
@@ -150,13 +151,23 @@ export default <template>
{{#each filteredQueries as |query|}}
<tr class="d-admin-row__content query-row">
<td class="d-admin-row__overview">
- <strong class="query-name">{{query.name}}</strong>
- {{#if query.is_default}}
- <span class="query-badge">{{i18n
- "explorer.default_query"
- }}</span>
- {{/if}}
- <div class="query-desc">{{query.description}}</div>
+ <a
+ class="query-link"
+ href={{getURL
+ (concat
+ "/admin/plugins/discourse-data-explorer/queries/"
+ query.id
+ )
+ }}
+ >
+ <strong class="query-name">{{query.name}}</strong>
+ {{#if query.is_default}}
+ <span class="query-badge">{{i18n
+ "explorer.default_query"
+ }}</span>
+ {{/if}}
+ <div class="query-desc">{{query.description}}</div>
+ </a>
</td>
<td class="d-admin-row__detail query-created-by">
<div class="d-admin-row__mobile-label">
@@ -207,7 +218,7 @@ export default <template>
@model={{query.id}}
class="btn btn-default btn-small"
>
- {{i18n "explorer.view"}}
+ {{i18n "edit"}}
</LinkTo>
</div>
diff --git a/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss b/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
index 4304ef79609..6320fd49162 100644
--- a/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
+++ b/plugins/discourse-data-explorer/assets/stylesheets/explorer.scss
@@ -437,8 +437,10 @@ table.group-reports {
}
.query-row {
- a {
- width: 100%;
+ a.query-link {
+ @include viewport.until(md) {
+ max-width: 75ch;
+ }
}
.query-name {
@@ -460,6 +462,10 @@ table.group-reports {
.query-desc {
color: var(--primary-high);
max-width: 20vw;
+
+ @include viewport.until(md) {
+ max-width: 90vw;
+ }
}
.query-created-by {
diff --git a/plugins/discourse-data-explorer/spec/system/query_runner_spec.rb b/plugins/discourse-data-explorer/spec/system/query_runner_spec.rb
index 39ee055c37b..b3d4ef56f9b 100644
--- a/plugins/discourse-data-explorer/spec/system/query_runner_spec.rb
+++ b/plugins/discourse-data-explorer/spec/system/query_runner_spec.rb
@@ -26,7 +26,7 @@ RSpec.describe "Data explorer query runner", type: :system do
expect(page).to have_css(".query-results .result-header")
find(".query-edit .previous").click
- find("a[href='/admin/plugins/discourse-data-explorer/queries/#{query_b.id}']").click
+ first("a[href='/admin/plugins/discourse-data-explorer/queries/#{query_b.id}']").click
expect(page).to have_no_css(".query-results .result-header")
end
end