From e8d2c2579383897a1dd7f9debd359abe8ae8373d Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 20 Jul 2021 09:55:51 +0000 Subject: Add latest changes from gitlab-org/gitlab@14-1-stable-ee --- .../pages/groups/clusters/destroy/index.js | 4 +--- .../javascripts/pages/groups/clusters/edit/index.js | 4 +--- .../javascripts/pages/groups/clusters/index.js | 6 ++---- .../javascripts/pages/groups/clusters/new/index.js | 4 +--- .../javascripts/pages/groups/clusters/show/index.js | 6 ++---- app/assets/javascripts/pages/groups/issues/index.js | 2 +- .../pages/groups/merge_requests/index.js | 2 +- .../pages/groups/milestones/show/index.js | 6 ++---- .../pages/groups/new/group_path_validator.js | 21 +++++++++------------ 9 files changed, 20 insertions(+), 35 deletions(-) (limited to 'app/assets/javascripts/pages/groups') diff --git a/app/assets/javascripts/pages/groups/clusters/destroy/index.js b/app/assets/javascripts/pages/groups/clusters/destroy/index.js index 8001d2dd1da..487e7a14a16 100644 --- a/app/assets/javascripts/pages/groups/clusters/destroy/index.js +++ b/app/assets/javascripts/pages/groups/clusters/destroy/index.js @@ -1,5 +1,3 @@ import ClustersBundle from '~/clusters/clusters_bundle'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new -}); +new ClustersBundle(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/groups/clusters/edit/index.js b/app/assets/javascripts/pages/groups/clusters/edit/index.js index 8001d2dd1da..487e7a14a16 100644 --- a/app/assets/javascripts/pages/groups/clusters/edit/index.js +++ b/app/assets/javascripts/pages/groups/clusters/edit/index.js @@ -1,5 +1,3 @@ import ClustersBundle from '~/clusters/clusters_bundle'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new -}); +new ClustersBundle(); // eslint-disable-line no-new diff --git a/app/assets/javascripts/pages/groups/clusters/index.js b/app/assets/javascripts/pages/groups/clusters/index.js index d5ce5d076a2..4d48bd4be2b 100644 --- a/app/assets/javascripts/pages/groups/clusters/index.js +++ b/app/assets/javascripts/pages/groups/clusters/index.js @@ -1,7 +1,5 @@ import initIntegrationForm from '~/clusters/forms/show/index'; import initCreateCluster from '~/create_cluster/init_create_cluster'; -document.addEventListener('DOMContentLoaded', () => { - initCreateCluster(document, gon); - initIntegrationForm(); -}); +initCreateCluster(document, gon); +initIntegrationForm(); diff --git a/app/assets/javascripts/pages/groups/clusters/new/index.js b/app/assets/javascripts/pages/groups/clusters/new/index.js index 876bab0b339..de9ded87ef3 100644 --- a/app/assets/javascripts/pages/groups/clusters/new/index.js +++ b/app/assets/javascripts/pages/groups/clusters/new/index.js @@ -1,5 +1,3 @@ import initNewCluster from '~/clusters/new_cluster'; -document.addEventListener('DOMContentLoaded', () => { - initNewCluster(); -}); +initNewCluster(); diff --git a/app/assets/javascripts/pages/groups/clusters/show/index.js b/app/assets/javascripts/pages/groups/clusters/show/index.js index ccf631b2c53..5d202a8824f 100644 --- a/app/assets/javascripts/pages/groups/clusters/show/index.js +++ b/app/assets/javascripts/pages/groups/clusters/show/index.js @@ -1,7 +1,5 @@ import ClustersBundle from '~/clusters/clusters_bundle'; import initClusterHealth from '~/pages/projects/clusters/show/cluster_health'; -document.addEventListener('DOMContentLoaded', () => { - new ClustersBundle(); // eslint-disable-line no-new - initClusterHealth(); -}); +new ClustersBundle(); // eslint-disable-line no-new +initClusterHealth(); diff --git a/app/assets/javascripts/pages/groups/issues/index.js b/app/assets/javascripts/pages/groups/issues/index.js index 76db578f6f9..342c054471d 100644 --- a/app/assets/javascripts/pages/groups/issues/index.js +++ b/app/assets/javascripts/pages/groups/issues/index.js @@ -1,5 +1,5 @@ import IssuableFilteredSearchTokenKeys from 'ee_else_ce/filtered_search/issuable_filtered_search_token_keys'; -import issuableInitBulkUpdateSidebar from '~/issuable_init_bulk_update_sidebar'; +import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar'; import { mountIssuablesListApp } from '~/issues_list'; import initManualOrdering from '~/manual_ordering'; import { FILTERED_SEARCH } from '~/pages/constants'; diff --git a/app/assets/javascripts/pages/groups/merge_requests/index.js b/app/assets/javascripts/pages/groups/merge_requests/index.js index 2f6f9bb16e1..02a0a50f984 100644 --- a/app/assets/javascripts/pages/groups/merge_requests/index.js +++ b/app/assets/javascripts/pages/groups/merge_requests/index.js @@ -1,6 +1,6 @@ import addExtraTokensForMergeRequests from 'ee_else_ce/filtered_search/add_extra_tokens_for_merge_requests'; import IssuableFilteredSearchTokenKeys from '~/filtered_search/issuable_filtered_search_token_keys'; -import issuableInitBulkUpdateSidebar from '~/issuable_init_bulk_update_sidebar'; +import issuableInitBulkUpdateSidebar from '~/issuable_bulk_update_sidebar/issuable_init_bulk_update_sidebar'; import { FILTERED_SEARCH } from '~/pages/constants'; import initFilteredSearch from '~/pages/search/init_filtered_search'; import projectSelect from '~/project_select'; diff --git a/app/assets/javascripts/pages/groups/milestones/show/index.js b/app/assets/javascripts/pages/groups/milestones/show/index.js index 2a2cc5faebe..914e2831185 100644 --- a/app/assets/javascripts/pages/groups/milestones/show/index.js +++ b/app/assets/javascripts/pages/groups/milestones/show/index.js @@ -1,7 +1,5 @@ import initDeleteMilestoneModal from '~/pages/milestones/shared/delete_milestone_modal_init'; import initMilestonesShow from '~/pages/milestones/shared/init_milestones_show'; -document.addEventListener('DOMContentLoaded', () => { - initMilestonesShow(); - initDeleteMilestoneModal(); -}); +initMilestonesShow(); +initDeleteMilestoneModal(); diff --git a/app/assets/javascripts/pages/groups/new/group_path_validator.js b/app/assets/javascripts/pages/groups/new/group_path_validator.js index a0ff98645fb..c58be202043 100644 --- a/app/assets/javascripts/pages/groups/new/group_path_validator.js +++ b/app/assets/javascripts/pages/groups/new/group_path_validator.js @@ -1,6 +1,6 @@ import { debounce } from 'lodash'; -import { deprecatedCreateFlash as flash } from '~/flash'; +import createFlash from '~/flash'; import { __ } from '~/locale'; import InputValidator from '~/validators/input_validator'; import fetchGroupPathAvailability from './fetch_group_path_availability'; @@ -12,7 +12,6 @@ const parentIdSelector = 'group_parent_id'; const successMessageSelector = '.validation-success'; const pendingMessageSelector = '.validation-pending'; const unavailableMessageSelector = '.validation-error'; -const suggestionsMessageSelector = '.gl-path-suggestions'; const inputGroupSelector = '.input-group'; export default class GroupPathValidator extends InputValidator { @@ -57,21 +56,19 @@ export default class GroupPathValidator extends InputValidator { ); if (data.exists) { - GroupPathValidator.showSuggestions(inputDomElement, data.suggests); + const [suggestedSlug] = data.suggests; + const targetDomElement = document.querySelector('.js-autofill-group-path'); + targetDomElement.value = suggestedSlug; } }) - .catch(() => flash(__('An error occurred while validating group path'))); + .catch(() => + createFlash({ + message: __('An error occurred while validating group path'), + }), + ); } } - static showSuggestions(inputDomElement, suggestions) { - const messageElement = inputDomElement.parentElement.parentElement.querySelector( - suggestionsMessageSelector, - ); - const textSuggestions = suggestions && suggestions.length > 0 ? suggestions.join(', ') : 'none'; - messageElement.textContent = textSuggestions; - } - static setMessageVisibility(inputDomElement, messageSelector, isVisible = true) { const messageElement = inputDomElement .closest(inputGroupSelector) -- cgit v1.2.3