2018-10-10 07:56:23 -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({
|
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());
|
2015-09-21 14:19:31 -04:00
|
|
|
|
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) {
|
2015-09-21 14:19:31 -04:00
|
|
|
controller.setProperties(model);
|
2018-08-30 04:43:40 -04:00
|
|
|
},
|
2018-09-04 12:22:44 -04:00
|
|
|
|
2018-08-30 04:43:40 -04:00
|
|
|
actions: {
|
2018-10-10 07:56:23 -04:00
|
|
|
refreshModel: function() {
|
|
|
|
this.refresh();
|
|
|
|
}
|
2015-06-25 16:26:31 -04:00
|
|
|
}
|
2018-10-10 07:56:23 -04:00
|
|
|
});
|