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

34 lines
765 B
Plaintext
Raw Normal View History

2018-10-10 07:56:23 -04:00
import { ajax } from "discourse/lib/ajax";
2015-06-25 16:26:31 -04:00
export default Discourse.Route.extend({
2018-10-10 07:56:23 -04:00
controllerName: "admin-plugins-explorer",
2015-06-25 16:26:31 -04:00
model() {
2018-10-10 07:56:23 -04:00
const p1 = this.store.findAll("query");
const p2 = ajax("/admin/plugins/explorer/schema.json", { cache: true });
return p1
.then(model => {
model.forEach(query => query.markNotDirty());
2018-10-10 07:56:23 -04:00
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);
},
actions: {
2018-10-10 07:56:23 -04:00
refreshModel: function() {
this.refresh();
2018-12-16 09:22:23 -05:00
return false;
2018-10-10 07:56:23 -04:00
}
2015-06-25 16:26:31 -04:00
}
2018-10-10 07:56:23 -04:00
});