2016-10-30 21:12:01 -04:00
|
|
|
import { ajax } from 'discourse/lib/ajax';
|
2015-06-25 17:53:03 -04:00
|
|
|
|
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});
|
2015-09-21 14:19:31 -04:00
|
|
|
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) {
|
2015-09-21 14:19:31 -04:00
|
|
|
controller.setProperties(model);
|
2015-06-25 16:26:31 -04:00
|
|
|
}
|
|
|
|
});
|