discourse-data-explorer/assets/javascripts/discourse/routes/admin-plugins-explorer.js.es6

23 lines
617 B
Plaintext
Raw Normal View History

2016-10-30 21:12:01 -04:00
import { ajax } from 'discourse/lib/ajax';
2015-06-25 16:26:31 -04:00
export default Discourse.Route.extend({
controllerName: 'admin-plugins-explorer',
model() {
2015-07-08 16:45:13 -04:00
const p1 = this.store.findAll('query');
2016-10-30 21:12:01 -04:00
const p2 = ajax('/admin/plugins/explorer/schema.json', {cache: true});
return p1.then(model => {
model.forEach(query => query.markNotDirty());
return p2.then(schema => {return {model, schema};});
}).catch(() => {
p2.catch(() => {});
return { model: null, schema: null, disallow: true };
2015-07-08 16:45:13 -04:00
});
},
setupController: function(controller, model) {
controller.setProperties(model);
2015-06-25 16:26:31 -04:00
}
});