import Flash from '../../flash'; function isValidProjectId(id) { return id > 0; } class SidebarMoveIssue { constructor(mediator, dropdownToggle, confirmButton) { this.mediator = mediator; this.$dropdownToggle = $(dropdownToggle); this.$confirmButton = $(confirmButton); this.onConfirmClickedWrapper = this.onConfirmClicked.bind(this); } init() { this.initDropdown(); this.addEventListeners(); } destroy() { this.removeEventListeners(); } initDropdown() { this.$dropdownToggle.glDropdown({ search: { fields: ['name_with_namespace'], }, showMenuAbove: true, selectable: true, filterable: true, filterRemote: true, multiSelect: false, // Keep the dropdown open after selecting an option shouldPropagate: false, data: (searchTerm, callback) => { this.mediator.fetchAutocompleteProjects(searchTerm) .then(callback) .catch(() => new Flash('An error occurred while fetching projects autocomplete.')); }, renderRow: project => `