FIX: edit button not working (#379)

After this PR <a> link stopped working correctly page started doing a full reload. <Button> component behaves correctly.

https://github.com/discourse/discourse-data-explorer/pull/376
This commit is contained in:
Krzysztof Kotlarek 2025-06-11 14:01:11 +08:00 committed by GitHub
parent 85b485e1bf
commit 6727e32874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 10 deletions

View File

@ -59,15 +59,13 @@ export default RouteTemplate(
/>
<h1>
{{@controller.model.name}}
<span>{{@controller.model.name}}</span>
{{#unless @controller.editDisabled}}
<a
href
{{on "click" @controller.editName}}
class="edit-query-name"
>
{{icon "pencil"}}
</a>
<DButton
@action={{@controller.editName}}
@icon="pencil"
class="edit-query-name btn-transparent"
/>
{{/unless}}
</h1>
</div>

View File

@ -215,7 +215,7 @@ table.group-reports {
margin: 0 0.5em 0 0;
color: var(--primary);
a {
button .d-icon {
color: currentcolor;
}
}

View File

@ -27,6 +27,16 @@ RSpec.describe "Explorer", type: :system, js: true do
expect(page).to have_field("limit", with: 42)
end
it "allows to edit custom name" do
visit("/admin/plugins/explorer/queries/#{query_1.id}")
find(".query-run .btn-primary").click
find(".edit-query-name").click
find(".name-text-field input").fill_in(with: "My custom name edited")
find(".btn-primary").click
find("button span", text: "Save Changes and Run").click
expect(page.find(".name h1")).to have_content("My custom name edited")
end
end
context "with the old url format" do

View File

@ -320,7 +320,7 @@ acceptance("Data Explorer Plugin | Run Query", function (needs) {
await visit("/admin/plugins/explorer/queries/2");
assert
.dom("div.name h1")
.dom("div.name h1 span")
.hasText("What about 0?", "the query name was rendered");
assert