FIX: Show error message, not exception page, to mods
This commit is contained in:
parent
d4d541747e
commit
9145e32162
|
@ -6,18 +6,17 @@ export default Discourse.Route.extend({
|
|||
model() {
|
||||
const p1 = this.store.findAll('query');
|
||||
const p2 = Discourse.ajax('/admin/plugins/explorer/schema.json', {cache: true});
|
||||
return p1.then(function(model) {
|
||||
model.forEach(function(query) {
|
||||
query.markNotDirty();
|
||||
});
|
||||
return p2.then(function(schema) {
|
||||
return { content: model, schema: schema };
|
||||
});
|
||||
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 };
|
||||
});
|
||||
},
|
||||
|
||||
setupController: function(controller, model) {
|
||||
controller.set('model', model.content);
|
||||
controller.set('schema', model.schema);
|
||||
controller.setProperties(model);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
{{#if disallow}}
|
||||
<h2>{{i18n "explorer.admins_only"}}</h2>
|
||||
{{else}}
|
||||
<div class="query-list">
|
||||
{{combo-box valueAttribute="id" value=selectedQueryId nameProperty="listName" content=content castInteger="true" nameChanges="true"}}
|
||||
{{d-button action="showCreate" icon="plus" class="no-text"}}
|
||||
|
@ -129,3 +132,5 @@
|
|||
{{/unless}}
|
||||
|
||||
<div class="explorer-pad-bottom"></div>
|
||||
|
||||
{{/if}}
|
||||
|
|
|
@ -22,6 +22,7 @@ en:
|
|||
no_semicolons: "Remove the semicolons from the query."
|
||||
dirty: "You must save the query before running."
|
||||
explorer:
|
||||
admins_only: "The data explorer is only available to admins."
|
||||
title: "Data Explorer"
|
||||
create: "Create New"
|
||||
create_placeholder: "Query name..."
|
||||
|
|
Loading…
Reference in New Issue