Commit 6ae22486 authored by Clement Ho's avatar Clement Ho

Merge branch...

Merge branch 'winh-65764-add-missing-error-handling-to-add-list-dropdown-in-issue-boards' into 'master'

Add missing error handling to "Add list" dropdown in issue boards

See merge request gitlab-org/gitlab!16896
parents 744cb32e edd86ebc
/* eslint-disable func-names, no-new, promise/catch-or-return */
/* eslint-disable func-names, no-new */
import $ from 'jquery';
import { __ } from '~/locale';
import axios from '~/lib/utils/axios_utils';
import flash from '~/flash';
import CreateLabelDropdown from '../../create_label';
import boardsStore from '../stores/boards_store';
......@@ -26,18 +28,23 @@ $(document)
export default function initNewListDropdown() {
$('.js-new-board-list').each(function() {
const $this = $(this);
const $dropdownToggle = $(this);
const $dropdown = $dropdownToggle.closest('.dropdown');
new CreateLabelDropdown(
$this.closest('.dropdown').find('.dropdown-new-label'),
$this.data('namespacePath'),
$this.data('projectPath'),
$dropdown.find('.dropdown-new-label'),
$dropdownToggle.data('namespacePath'),
$dropdownToggle.data('projectPath'),
);
$this.glDropdown({
$dropdownToggle.glDropdown({
data(term, callback) {
axios.get($this.attr('data-list-labels-path')).then(({ data }) => {
callback(data);
});
axios
.get($dropdownToggle.attr('data-list-labels-path'))
.then(({ data }) => callback(data))
.catch(() => {
$dropdownToggle.data('bs.dropdown').hide();
flash(__('Error fetching labels.'));
});
},
renderRow(label) {
const active = boardsStore.findListByLabelId(label.id);
......
---
title: Adds missing error handling
merge_request: 16896
author: toptalo
type: fixed
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