FIX: Import `ajax` instead.

This commit is contained in:
Guo Xiang Tan 2016-10-31 09:12:01 +08:00
parent 9e8db489b3
commit 414cda5578
3 changed files with 6 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import { ajax } from 'discourse/lib/ajax';
import Badge from 'discourse/models/badge'; import Badge from 'discourse/models/badge';
function randomIdShort() { function randomIdShort() {
@ -147,7 +147,7 @@ const QueryResultComponent = Ember.Component.extend({
addInput('explain', this.get('hasExplain')); addInput('explain', this.get('hasExplain'));
addInput('limit', '1000000'); addInput('limit', '1000000');
Discourse.ajax('/session/csrf.json').then(function(csrf) { ajax('/session/csrf.json').then(function(csrf) {
addInput('authenticity_token', csrf.csrf); addInput('authenticity_token', csrf.csrf);
document.body.appendChild(form); document.body.appendChild(form);

View File

@ -1,6 +1,7 @@
import showModal from 'discourse/lib/show-modal'; import showModal from 'discourse/lib/show-modal';
import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query'; import Query from 'discourse/plugins/discourse-data-explorer/discourse/models/query';
import { popupAjaxError } from 'discourse/lib/ajax-error'; import { popupAjaxError } from 'discourse/lib/ajax-error';
import { ajax } from 'discourse/lib/ajax';
const NoQuery = Query.create({name: "No queries", fake: true}); const NoQuery = Query.create({name: "No queries", fake: true});
@ -160,7 +161,7 @@ export default Ember.ArrayController.extend({
this.set('loading', true); this.set('loading', true);
this.set('showResults', false); this.set('showResults', false);
Discourse.ajax("/admin/plugins/explorer/queries/" + this.get('selectedItem.id') + "/run", { ajax("/admin/plugins/explorer/queries/" + this.get('selectedItem.id') + "/run", {
type: "POST", type: "POST",
data: { data: {
params: JSON.stringify(this.get('selectedItem.params')), params: JSON.stringify(this.get('selectedItem.params')),

View File

@ -1,3 +1,4 @@
import { ajax } from 'discourse/lib/ajax';
export default Discourse.Route.extend({ export default Discourse.Route.extend({
controllerName: 'admin-plugins-explorer', controllerName: 'admin-plugins-explorer',
@ -5,7 +6,7 @@ export default Discourse.Route.extend({
model() { model() {
const p1 = this.store.findAll('query'); const p1 = this.store.findAll('query');
const p2 = Discourse.ajax('/admin/plugins/explorer/schema.json', {cache: true}); const p2 = ajax('/admin/plugins/explorer/schema.json', {cache: true});
return p1.then(model => { return p1.then(model => {
model.forEach(query => query.markNotDirty()); model.forEach(query => query.markNotDirty());