Commit 6a07c1a4 authored by Phil Hughes's avatar Phil Hughes

updated admin_email_select

parent 8b4059d3
......@@ -37,7 +37,11 @@ const Api = {
per_page: 20,
}, options),
})
.then(({ data }) => callback(data));
.then(({ data }) => {
callback(data);
return data;
});
},
// Return namespaces list. Filtered by query
......@@ -68,7 +72,11 @@ const Api = {
return axios.get(url, {
params: Object.assign(defaults, options),
})
.then(({ data }) => callback(data));
.then(({ data }) => {
callback(data);
return data;
});
},
// Return single project
......
......@@ -13,22 +13,17 @@ function AdminEmailSelect() {
multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0,
query: function(query) {
var group_result, project_result;
group_result = Api.groups(query.term, {}, function(groups) {
return groups;
});
project_result = Api.projects(query.term, {
const groupsFetch = Api.groups(query.term, {});
const projectsFetch = Api.projects(query.term, {
order_by: 'id',
membership: false
}, function(projects) {
return projects;
});
return $.when(project_result, group_result).done(function(projects, groups) {
return Promise.all([projectsFetch, groupsFetch]).done(function([projects, groups]) {
var all, data;
all = {
id: "all"
};
data = [all].concat(groups[0], projects[0]);
data = [all].concat(groups, projects);
return query.callback({
results: data
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment