This commit is contained in:
Joffrey JAFFEUX 2019-09-11 10:30:39 -05:00
parent 51a0b9318a
commit a3ae064654
7 changed files with 10 additions and 19 deletions

View File

@ -55,10 +55,10 @@ export default Ember.Controller.extend({
},
@computed("selectedItem", "editing")
selectedGroupNames(selectedItem) {
selectedGroupNames() {
const groupIds = this.selectedItem.group_ids || [];
const groupNames = groupIds.map(id => {
return this.groupOptions.find(groupOption => groupOption.id == id).name;
return this.groupOptions.find(groupOption => groupOption.id === id).name;
});
return groupNames.join(", ");
},

View File

@ -1,10 +1,3 @@
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
import { ajax } from "discourse/lib/ajax";
import {
default as computed,
observes
} from "ember-addons/ember-computed-decorators";
export default Ember.Controller.extend({
queries: Ember.computed.alias("model.queries")
});

View File

@ -1,10 +1,5 @@
import Query from "discourse/plugins/discourse-data-explorer/discourse/models/query";
import { popupAjaxError } from "discourse/lib/ajax-error";
import { ajax } from "discourse/lib/ajax";
import {
default as computed,
observes
} from "ember-addons/ember-computed-decorators";
export default Ember.Controller.extend({
showResults: false,

View File

@ -5,7 +5,9 @@ export default Discourse.Route.extend({
model() {
const groupPromise = this.store.findAll("group");
const schemaPromise = ajax("/admin/plugins/explorer/schema.json", { cache: true });
const schemaPromise = ajax("/admin/plugins/explorer/schema.json", {
cache: true
});
const queryPromise = this.store.findAll("query");
return groupPromise

View File

@ -16,12 +16,13 @@ export default Discourse.Route.extend({
this.transitionTo("group.members", group);
});
},
afterModel(model) {
if (
!model.group.get("is_group_user") &&
!(this.currentUser && this.currentUser.admin)
) {
this.transitionTo("group.members", group);
this.transitionTo("group.members", model.group);
}
},

View File

@ -12,7 +12,7 @@ export default Discourse.Route.extend({
group: group
};
})
.catch(err => {
.catch(() => {
this.transitionTo("group.members", group);
});
},