From 53fb4ad16325d4963fdc5396b8510ab748a45e50 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 6 Jan 2023 12:10:04 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- app/assets/javascripts/groups_select.js | 93 +--------------------- .../issuable/components/related_issuable_item.vue | 1 - .../components/ml_experiment.vue | 38 ++++++++- .../pages/projects/ml/experiments/show/index.js | 3 + app/assets/javascripts/projects/commits/index.js | 19 ++++- .../ref/components/ref_results_section.vue | 8 ++ .../javascripts/ref/components/ref_selector.vue | 15 ++++ app/assets/javascripts/ref/constants.js | 2 + .../components/pagination/table_pagination.vue | 3 +- .../projects/ml/experiments_controller.rb | 25 +++++- app/views/projects/commits/show.html.haml | 2 +- app/views/projects/ml/experiments/show.html.haml | 4 +- .../shared/runners/_runner_type_alert.html.haml | 2 +- 13 files changed, 109 insertions(+), 106 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/groups_select.js b/app/assets/javascripts/groups_select.js index fb0c47fe018..2a2599801ca 100644 --- a/app/assets/javascripts/groups_select.js +++ b/app/assets/javascripts/groups_select.js @@ -1,12 +1,5 @@ import Vue from 'vue'; -import $ from 'jquery'; -import { escape } from 'lodash'; import GroupSelect from '~/vue_shared/components/group_select/group_select.vue'; -import { groupsPath } from '~/vue_shared/components/group_select/utils'; -import { __ } from '~/locale'; -import Api from './api'; -import { loadCSSFile } from './lib/utils/css_utils'; -import { select2AxiosTransport } from './lib/utils/select2_utils'; const initVueSelect = () => { [...document.querySelectorAll('.ajax-groups-select')].forEach((el) => { @@ -33,90 +26,6 @@ const initVueSelect = () => { }); }; -const groupsSelect = () => { - loadCSSFile(gon.select2_css_path) - .then(() => { - // Needs to be accessible in rspec - window.GROUP_SELECT_PER_PAGE = 20; - - $('.ajax-groups-select').each(function setAjaxGroupsSelect2() { - const $select = $(this); - const allAvailable = $select.data('allAvailable'); - const skipGroups = $select.data('skipGroups') || []; - const parentGroupID = $select.data('parentId'); - const groupsFilter = $select.data('groupsFilter'); - const minAccessLevel = $select.data('minAccessLevel'); - - $select.select2({ - placeholder: __('Search for a group'), - allowClear: $select.hasClass('allowClear'), - multiple: $select.hasClass('multiselect'), - minimumInputLength: 0, - ajax: { - url: Api.buildUrl(groupsPath(groupsFilter, parentGroupID)), - dataType: 'json', - quietMillis: 250, - transport: select2AxiosTransport, - data(search, page) { - return { - search, - page, - per_page: window.GROUP_SELECT_PER_PAGE, - all_available: allAvailable, - min_access_level: minAccessLevel, - }; - }, - results(data, page) { - const groups = data.length ? data : data.results || []; - const more = data.pagination ? data.pagination.more : false; - const results = groups.filter((group) => skipGroups.indexOf(group.id) === -1); - - return { - results, - page, - more, - }; - }, - }, - // eslint-disable-next-line consistent-return - initSelection(element, callback) { - const id = $(element).val(); - if (id !== '') { - return Api.group(id, callback); - } - }, - formatResult(object) { - return `
${escape( - object.full_name, - )}
${object.full_path}
`; - }, - formatSelection(object) { - return escape(object.full_name); - }, - dropdownCssClass: 'ajax-groups-dropdown select2-infinite', - // we do not want to escape markup since we are displaying html in results - escapeMarkup(m) { - return m; - }, - }); - - $select.on('select2-loaded', () => { - const dropdown = document.querySelector('.select2-infinite .select2-results'); - dropdown.style.height = `${Math.floor(dropdown.scrollHeight)}px`; - }); - }); - }) - .catch(() => {}); -}; - export default () => { - if ($('.ajax-groups-select').length) { - if (gon.features?.vueGroupSelect) { - initVueSelect(); - } else { - import(/* webpackChunkName: 'select2' */ 'select2/select2') - .then(groupsSelect) - .catch(() => {}); - } - } + initVueSelect(); }; diff --git a/app/assets/javascripts/issuable/components/related_issuable_item.vue b/app/assets/javascripts/issuable/components/related_issuable_item.vue index fd55f05e955..c815c7aaba9 100644 --- a/app/assets/javascripts/issuable/components/related_issuable_item.vue +++ b/app/assets/javascripts/issuable/components/related_issuable_item.vue @@ -135,7 +135,6 @@ export default { {{ title }} diff --git a/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue b/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue index f8e269d3b57..0e601a67d85 100644 --- a/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue +++ b/app/assets/javascripts/ml/experiment_tracking/components/ml_experiment.vue @@ -1,6 +1,7 @@