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

updated admin_email_select

parent 8b4059d3
...@@ -37,7 +37,11 @@ const Api = { ...@@ -37,7 +37,11 @@ const Api = {
per_page: 20, per_page: 20,
}, options), }, options),
}) })
.then(({ data }) => callback(data)); .then(({ data }) => {
callback(data);
return data;
});
}, },
// Return namespaces list. Filtered by query // Return namespaces list. Filtered by query
...@@ -68,7 +72,11 @@ const Api = { ...@@ -68,7 +72,11 @@ const Api = {
return axios.get(url, { return axios.get(url, {
params: Object.assign(defaults, options), params: Object.assign(defaults, options),
}) })
.then(({ data }) => callback(data)); .then(({ data }) => {
callback(data);
return data;
});
}, },
// Return single project // Return single project
......
...@@ -13,22 +13,17 @@ function AdminEmailSelect() { ...@@ -13,22 +13,17 @@ function AdminEmailSelect() {
multiple: $(select).hasClass('multiselect'), multiple: $(select).hasClass('multiselect'),
minimumInputLength: 0, minimumInputLength: 0,
query: function(query) { query: function(query) {
var group_result, project_result; const groupsFetch = Api.groups(query.term, {});
group_result = Api.groups(query.term, {}, function(groups) { const projectsFetch = Api.projects(query.term, {
return groups;
});
project_result = Api.projects(query.term, {
order_by: 'id', order_by: 'id',
membership: false 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; var all, data;
all = { all = {
id: "all" id: "all"
}; };
data = [all].concat(groups[0], projects[0]); data = [all].concat(groups, projects);
return query.callback({ return query.callback({
results: data 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