FIX: Click not opening query (#191)

Due to recent core changes for Ember in
0221855ba7
and 952b033165
the correct way of calling these actions must be observed,
otherwise clicking on a query did nothing.

This commit fixes the click and also makes scrollTop
work with the new {{on X}} Ember syntax.
This commit is contained in:
Martin Brennan 2022-10-28 14:56:01 +10:00 committed by GitHub
parent 0deecbe2ae
commit bf1a79c9ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View File

@ -3,7 +3,10 @@ import showModal from "discourse/lib/show-modal";
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import discourseComputed, { observes } from "discourse-common/utils/decorators";
import discourseComputed, {
bind,
observes,
} from "discourse-common/utils/decorators";
import I18n from "I18n";
import { Promise } from "rsvp";
import { inject as service } from "@ember/service";
@ -165,6 +168,12 @@ export default Controller.extend({
});
},
@bind
scrollTop() {
window.scrollTo(0, 0);
this.setProperties({ editing: false, everEditing: false });
},
actions: {
dummy() {},
@ -207,11 +216,6 @@ export default Controller.extend({
window.open(this.get("selectedItem.downloadUrl"), "_blank");
},
scrollTop() {
window.scrollTo(0, 0);
this.setProperties({ editing: false, everEditing: false });
},
goHome() {
this.setProperties({
asc: null,

View File

@ -346,7 +346,7 @@
<tr class="query-row">
<td>
<a
{{action "scrollTop"}}
{{on "click" this.scrollTop}}
href="/admin/plugins/explorer/?id={{query.id}}"
>
<b class="query-name">{{query.name}}</b>