2018-03-09 15:18:59 -05:00
|
|
|
import $ from 'jquery';
|
2017-08-01 04:50:59 -04:00
|
|
|
import Api from './api';
|
2020-08-24 14:10:19 -04:00
|
|
|
import initDeprecatedJQueryDropdown from '~/deprecated_jquery_dropdown';
|
2017-08-01 04:50:59 -04:00
|
|
|
|
2018-02-21 15:22:56 -05:00
|
|
|
export default () => {
|
2020-08-24 14:10:19 -04:00
|
|
|
initDeprecatedJQueryDropdown($('#js-project-dropdown'), {
|
2017-08-01 04:50:59 -04:00
|
|
|
data: (term, callback) => {
|
2018-10-10 03:13:34 -04:00
|
|
|
Api.projects(
|
|
|
|
term,
|
|
|
|
{
|
|
|
|
order_by: 'last_activity_at',
|
|
|
|
},
|
|
|
|
data => {
|
|
|
|
callback(data);
|
|
|
|
},
|
|
|
|
);
|
2017-08-01 04:50:59 -04:00
|
|
|
},
|
2018-10-10 03:13:34 -04:00
|
|
|
text: project => project.name_with_namespace || project.name,
|
2017-08-01 04:50:59 -04:00
|
|
|
selectable: true,
|
|
|
|
fieldName: 'author_id',
|
|
|
|
filterable: true,
|
|
|
|
search: {
|
|
|
|
fields: ['name_with_namespace'],
|
|
|
|
},
|
|
|
|
id: data => data.id,
|
2018-10-10 03:13:34 -04:00
|
|
|
isSelected: data => data.id === 2,
|
2017-08-01 04:50:59 -04:00
|
|
|
});
|
2018-02-21 15:22:56 -05:00
|
|
|
};
|