Welcome to mirror list, hosted at ThFree Co, Russian Federation.

index.js « index « labels « admin « pages « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 17ee7c03ed6ae5d70cf40ce9c1681c784f726b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
document.addEventListener('DOMContentLoaded', () => {
  const pagination = document.querySelector('.labels .gl-pagination');
  const emptyState = document.querySelector('.labels .nothing-here-block.hidden');

  function removeLabelSuccessCallback() {
    this.closest('li').classList.add('gl-display-none!');

    const labelsCount = document.querySelectorAll(
      'ul.manage-labels-list li:not(.gl-display-none\\!)',
    ).length;

    // display the empty state if there are no more labels
    if (labelsCount < 1 && !pagination && emptyState) {
      emptyState.classList.remove('hidden');
    }
  }

  document.querySelectorAll('.js-remove-label').forEach((row) => {
    row.addEventListener('ajax:success', removeLabelSuccessCallback);
  });
});