diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/boards/components/board_filtered_search.vue | 22 | ||||
-rw-r--r-- | app/assets/javascripts/boards/components/issue_board_filtered_search.vue | 20 | ||||
-rw-r--r-- | app/assets/javascripts/boards/stores/actions.js | 1 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue | 8 | ||||
-rw-r--r-- | app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue | 2 | ||||
-rw-r--r-- | app/controllers/concerns/notes_actions.rb | 2 | ||||
-rw-r--r-- | app/services/admin/propagate_service_template.rb | 11 | ||||
-rw-r--r-- | app/services/concerns/admin/propagate_service.rb | 37 | ||||
-rw-r--r-- | app/services/integrations/propagate_service.rb (renamed from app/services/admin/propagate_integration_service.rb) | 30 | ||||
-rw-r--r-- | app/services/integrations/propagate_template_service.rb | 10 | ||||
-rw-r--r-- | app/views/shared/issuable/form/_title.html.haml | 2 | ||||
-rw-r--r-- | app/workers/propagate_integration_worker.rb | 2 | ||||
-rw-r--r-- | app/workers/propagate_service_template_worker.rb | 2 |
13 files changed, 71 insertions, 78 deletions
diff --git a/app/assets/javascripts/boards/components/board_filtered_search.vue b/app/assets/javascripts/boards/components/board_filtered_search.vue index 6e6ada2d109..6fa5f018875 100644 --- a/app/assets/javascripts/boards/components/board_filtered_search.vue +++ b/app/assets/javascripts/boards/components/board_filtered_search.vue @@ -39,6 +39,7 @@ export default { assigneeUsername, search, milestoneTitle, + iterationId, types, weight, epicId, @@ -83,6 +84,13 @@ export default { }); } + if (iterationId) { + filteredSearchValue.push({ + type: 'iteration', + value: { data: iterationId, operator: '=' }, + }); + } + if (weight) { filteredSearchValue.push({ type: 'weight', @@ -118,6 +126,13 @@ export default { }); } + if (this.filterParams['not[iteration_id]']) { + filteredSearchValue.push({ + type: 'iteration_id', + value: { data: this.filterParams['not[iteration_id]'], operator: '!=' }, + }); + } + if (this.filterParams['not[weight]']) { filteredSearchValue.push({ type: 'weight', @@ -179,8 +194,8 @@ export default { weight, epicId, myReactionEmoji, + iterationId, } = this.filterParams; - let notParams = {}; if (Object.prototype.hasOwnProperty.call(this.filterParams, 'not')) { @@ -194,6 +209,7 @@ export default { 'not[weight]': this.filterParams.not.weight, 'not[epic_id]': this.filterParams.not.epicId, 'not[my_reaction_emoji]': this.filterParams.not.myReactionEmoji, + 'not[iteration_id]': this.filterParams.not.iterationId, }, undefined, ); @@ -205,6 +221,7 @@ export default { 'label_name[]': labelName, assignee_username: assigneeUsername, milestone_title: milestoneTitle, + iteration_id: iterationId, search, types, weight, @@ -261,6 +278,9 @@ export default { case 'milestone_title': filterParams.milestoneTitle = filter.value.data; break; + case 'iteration': + filterParams.iterationId = filter.value.data; + break; case 'weight': filterParams.weight = filter.value.data; break; diff --git a/app/assets/javascripts/boards/components/issue_board_filtered_search.vue b/app/assets/javascripts/boards/components/issue_board_filtered_search.vue index bdb9c2be836..c20b5e3f377 100644 --- a/app/assets/javascripts/boards/components/issue_board_filtered_search.vue +++ b/app/assets/javascripts/boards/components/issue_board_filtered_search.vue @@ -12,6 +12,7 @@ import { __ } from '~/locale'; import { DEFAULT_MILESTONES_GRAPHQL, TOKEN_TITLE_MY_REACTION, + OPERATOR_IS_AND_IS_NOT, } from '~/vue_shared/components/filtered_search_bar/constants'; import AuthorToken from '~/vue_shared/components/filtered_search_bar/tokens/author_token.vue'; import EmojiToken from '~/vue_shared/components/filtered_search_bar/tokens/emoji_token.vue'; @@ -35,8 +36,6 @@ export default { issue: __('Issue'), milestone: __('Milestone'), weight: __('Weight'), - is: __('is'), - isNot: __('is not'), }, components: { BoardFilteredSearch }, inject: ['isSignedIn'], @@ -62,8 +61,6 @@ export default { tokensCE() { const { label, - is, - isNot, author, assignee, issue, @@ -84,10 +81,7 @@ export default { icon: 'user', title: assignee, type: 'assignee_username', - operators: [ - { value: '=', description: is }, - { value: '!=', description: isNot }, - ], + operators: OPERATOR_IS_AND_IS_NOT, token: AuthorToken, unique: true, fetchAuthors, @@ -97,10 +91,7 @@ export default { icon: 'pencil', title: author, type: 'author_username', - operators: [ - { value: '=', description: is }, - { value: '!=', description: isNot }, - ], + operators: OPERATOR_IS_AND_IS_NOT, symbol: '@', token: AuthorToken, unique: true, @@ -111,10 +102,7 @@ export default { icon: 'labels', title: label, type: 'label_name', - operators: [ - { value: '=', description: is }, - { value: '!=', description: isNot }, - ], + operators: OPERATOR_IS_AND_IS_NOT, token: LabelToken, unique: false, symbol: '~', diff --git a/app/assets/javascripts/boards/stores/actions.js b/app/assets/javascripts/boards/stores/actions.js index 3a96e535cf7..5a111cdf81b 100644 --- a/app/assets/javascripts/boards/stores/actions.js +++ b/app/assets/javascripts/boards/stores/actions.js @@ -373,7 +373,6 @@ export default { commit(types.REQUEST_ITEMS_FOR_LIST, { listId, fetchNext }); const { fullPath, fullBoardId, boardType, filterParams } = state; - const variables = { fullPath, boardId: fullBoardId, diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue index aff93ebc9c0..4a1dbf9d3fe 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/tokens/iteration_token.vue @@ -1,7 +1,6 @@ <script> import { GlDropdownDivider, GlDropdownSectionHeader, GlFilteredSearchSuggestion } from '@gitlab/ui'; import createFlash from '~/flash'; -import { getIdFromGraphQLId } from '~/graphql_shared/utils'; import { __ } from '~/locale'; import BaseToken from '~/vue_shared/components/filtered_search_bar/tokens/base_token.vue'; import { formatDate } from '~/lib/utils/datetime_utility'; @@ -43,7 +42,7 @@ export default { }, methods: { getActiveIteration(iterations, data) { - return iterations.find((iteration) => this.getValue(iteration) === data); + return iterations.find((iteration) => iteration.id === data); }, groupIterationsByCadence(iterations) { const cadences = []; @@ -80,9 +79,6 @@ export default { this.loading = false; }); }, - getValue(iteration) { - return String(getIdFromGraphQLId(iteration.id)); - }, /** * TODO: https://gitlab.com/gitlab-org/gitlab/-/issues/344619 * This method also exists as a utility function in ee/../iterations/utils.js @@ -125,7 +121,7 @@ export default { <gl-filtered-search-suggestion v-for="iteration in cadence.iterations" :key="iteration.id" - :value="getValue(iteration)" + :value="iteration.id" > {{ iteration.title }} <div v-if="glFeatures.iterationCadences" class="gl-text-gray-400"> diff --git a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue index 4234bc72f3a..7e259cb8b96 100644 --- a/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue +++ b/app/assets/javascripts/vue_shared/components/sidebar/labels_select_vue/labels_select_root.vue @@ -179,6 +179,8 @@ export default { document.addEventListener('mousedown', this.handleDocumentMousedown); document.addEventListener('click', this.handleDocumentClick); + + this.updateLabelsSetState(); }, beforeDestroy() { document.removeEventListener('mousedown', this.handleDocumentMousedown); diff --git a/app/controllers/concerns/notes_actions.rb b/app/controllers/concerns/notes_actions.rb index c2ee735a2b5..113030429d8 100644 --- a/app/controllers/concerns/notes_actions.rb +++ b/app/controllers/concerns/notes_actions.rb @@ -341,3 +341,5 @@ module NotesActions noteable.discussions_rendered_on_frontend? end end + +NotesActions.prepend_mod_with('NotesActions') diff --git a/app/services/admin/propagate_service_template.rb b/app/services/admin/propagate_service_template.rb deleted file mode 100644 index c251537c479..00000000000 --- a/app/services/admin/propagate_service_template.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -module Admin - class PropagateServiceTemplate - include PropagateService - - def propagate - # TODO: Remove this as part of https://gitlab.com/gitlab-org/gitlab/-/issues/335178 - end - end -end diff --git a/app/services/concerns/admin/propagate_service.rb b/app/services/concerns/admin/propagate_service.rb deleted file mode 100644 index 03e422aec54..00000000000 --- a/app/services/concerns/admin/propagate_service.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -module Admin - module PropagateService - extend ActiveSupport::Concern - - BATCH_SIZE = 10_000 - - class_methods do - def propagate(integration) - new(integration).propagate - end - end - - def initialize(integration) - @integration = integration - end - - private - - attr_reader :integration - - def create_integration_for_projects_without_integration - propagate_integrations( - Project.without_integration(integration), - PropagateIntegrationProjectWorker - ) - end - - def propagate_integrations(relation, worker_class) - relation.each_batch(of: BATCH_SIZE) do |records| - min_id, max_id = records.pick("MIN(#{relation.table_name}.id), MAX(#{relation.table_name}.id)") - worker_class.perform_async(integration.id, min_id, max_id) - end - end - end -end diff --git a/app/services/admin/propagate_integration_service.rb b/app/services/integrations/propagate_service.rb index f7a4bf1a9f9..6d27929d2d0 100644 --- a/app/services/admin/propagate_integration_service.rb +++ b/app/services/integrations/propagate_service.rb @@ -1,8 +1,12 @@ # frozen_string_literal: true -module Admin - class PropagateIntegrationService - include PropagateService +module Integrations + class PropagateService + BATCH_SIZE = 10_000 + + def initialize(integration) + @integration = integration + end def propagate if integration.instance_level? @@ -16,8 +20,21 @@ module Admin end end + def self.propagate(integration) + new(integration).propagate + end + private + attr_reader :integration + + def create_integration_for_projects_without_integration + propagate_integrations( + Project.without_integration(integration), + PropagateIntegrationProjectWorker + ) + end + def update_inherited_integrations propagate_integrations( Integration.by_type(integration.type).inherit_from_id(integration.id), @@ -52,5 +69,12 @@ module Admin PropagateIntegrationProjectWorker ) end + + def propagate_integrations(relation, worker_class) + relation.each_batch(of: BATCH_SIZE) do |records| + min_id, max_id = records.pick("MIN(#{relation.table_name}.id), MAX(#{relation.table_name}.id)") + worker_class.perform_async(integration.id, min_id, max_id) + end + end end end diff --git a/app/services/integrations/propagate_template_service.rb b/app/services/integrations/propagate_template_service.rb new file mode 100644 index 00000000000..85a82ba4c8e --- /dev/null +++ b/app/services/integrations/propagate_template_service.rb @@ -0,0 +1,10 @@ +# frozen_string_literal: true + +module Integrations + # TODO: Remove this as part of https://gitlab.com/gitlab-org/gitlab/-/issues/335178 + class PropagateTemplateService + def self.propagate(_integration) + # no-op + end + end +end diff --git a/app/views/shared/issuable/form/_title.html.haml b/app/views/shared/issuable/form/_title.html.haml index 561ca0afd60..c0a6322eb1b 100644 --- a/app/views/shared/issuable/form/_title.html.haml +++ b/app/views/shared/issuable/form/_title.html.haml @@ -5,7 +5,7 @@ - div_class = no_issuable_templates ? 'col-sm-10' : 'col-sm-7 col-lg-8' - toggle_wip_link_start = '<a href="" class="js-toggle-wip">' - toggle_wip_link_end = '</a>' -- add_wip_text = (_('%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request that is a work in progress from being merged before it\'s ready.') % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: '<code>Draft:</code>'.html_safe } ).html_safe +- add_wip_text = (_('%{link_start}Start the title with %{draft_snippet}%{link_end} to prevent a merge request draft from merging before it\'s ready.') % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: '<code>Draft:</code>'.html_safe } ).html_safe - remove_wip_text = (_('%{link_start}Remove the %{draft_snippet} prefix%{link_end} from the title to allow this merge request to be merged when it\'s ready.' ) % { link_start: toggle_wip_link_start, link_end: toggle_wip_link_end, draft_snippet: '<code>Draft</code>'.html_safe } ).html_safe %div{ class: div_class } diff --git a/app/workers/propagate_integration_worker.rb b/app/workers/propagate_integration_worker.rb index 9d21d92b6e3..099f423dc0f 100644 --- a/app/workers/propagate_integration_worker.rb +++ b/app/workers/propagate_integration_worker.rb @@ -12,6 +12,6 @@ class PropagateIntegrationWorker idempotent! def perform(integration_id) - Admin::PropagateIntegrationService.propagate(Integration.find(integration_id)) + ::Integrations::PropagateService.propagate(Integration.find(integration_id)) end end diff --git a/app/workers/propagate_service_template_worker.rb b/app/workers/propagate_service_template_worker.rb index 908f867279f..9d629308ee5 100644 --- a/app/workers/propagate_service_template_worker.rb +++ b/app/workers/propagate_service_template_worker.rb @@ -16,7 +16,7 @@ class PropagateServiceTemplateWorker # rubocop:disable Scalability/IdempotentWor def perform(template_id) return unless try_obtain_lease_for(template_id) - Admin::PropagateServiceTemplate.propagate(Integration.find_by_id(template_id)) + ::Integrations::PropagateTemplateService.propagate(Integration.find_by_id(template_id)) end private |