diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-26 21:11:56 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-10-26 21:11:56 +0300 |
commit | ea413f31cf00268c71bfab1351b92f75e72c9a80 (patch) | |
tree | 40d55fd066fd6ef9d901d66f006bde24ee2836bb /app | |
parent | 5ef8690cb95a549153572811313b1401e77cef2d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
11 files changed, 96 insertions, 36 deletions
diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue index ac037b69dd7..efc74241941 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.vue @@ -202,7 +202,9 @@ export default { data-testid="pipeline-info-container" class="gl-display-flex gl-flex-wrap gl-align-items-center gl-justify-content-space-between" > - <p class="mr-pipeline-title gl-m-0! gl-mr-3! gl-font-weight-bold gl-text-gray-900"> + <p + class="mr-pipeline-title gl-align-self-start gl-m-0! gl-mr-3! gl-font-weight-bold gl-text-gray-900" + > {{ pipeline.details.event_type_name }} <gl-link :href="pipeline.path" class="pipeline-id" data-testid="pipeline-id" >#{{ pipeline.id }}</gl-link diff --git a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue index ea3f324b8f2..370e07b397c 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.vue @@ -28,7 +28,7 @@ export default { }; </script> <template> - <div class="gl-w-6 gl-h-6 gl-display-flex gl-align-self-center gl-mr-3"> + <div class="gl-w-6 gl-h-6 gl-display-flex gl-align-self-start gl-mr-3"> <div class="gl-display-flex gl-m-auto"> <gl-icon v-if="isMerged" name="merge" :size="16" class="gl-text-blue-500" /> <gl-icon v-else-if="isClosed" name="merge-request-close" :size="16" class="gl-text-red-500" /> diff --git a/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue b/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue index 7fc4a06cbae..267facb0a50 100644 --- a/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue +++ b/app/assets/javascripts/vue_merge_request_widget/components/states/work_in_progress.vue @@ -143,7 +143,9 @@ export default { :collapsed="mr.mergeDetailsCollapsed" @toggle="() => mr.toggleMergeDetails()" > - <span class="gl-ml-0! gl-text-body! gl-flex-grow-1"> + <span + class="gl-display-inline-flex gl-align-self-start gl-pt-2 gl-ml-0! gl-text-body! gl-flex-grow-1" + > <bold-text :message="$options.i18n.removeDraftStatus" /> </span> <template #actions> diff --git a/app/assets/javascripts/work_items/components/work_item_award_emoji.vue b/app/assets/javascripts/work_items/components/work_item_award_emoji.vue index 69861892f50..fb710836a88 100644 --- a/app/assets/javascripts/work_items/components/work_item_award_emoji.vue +++ b/app/assets/javascripts/work_items/components/work_item_award_emoji.vue @@ -7,7 +7,8 @@ import AwardsList from '~/vue_shared/components/awards_list.vue'; import { isLoggedIn } from '~/lib/utils/common_utils'; import { TYPENAME_USER } from '~/graphql_shared/constants'; -import workItemAwardEmojiQuery from '../graphql/award_emoji.query.graphql'; +import groupWorkItemAwardEmojiQuery from '../graphql/group_award_emoji.query.graphql'; +import projectWorkItemAwardEmojiQuery from '../graphql/award_emoji.query.graphql'; import updateAwardEmojiMutation from '../graphql/update_award_emoji.mutation.graphql'; import { EMOJI_THUMBSDOWN, @@ -23,6 +24,7 @@ export default { components: { AwardsList, }, + inject: ['isGroup'], props: { workItemId: { type: String, @@ -75,7 +77,9 @@ export default { }, apollo: { awardEmoji: { - query: workItemAwardEmojiQuery, + query() { + return this.isGroup ? groupWorkItemAwardEmojiQuery : projectWorkItemAwardEmojiQuery; + }, variables() { return { iid: this.workItemIid, @@ -116,7 +120,7 @@ export default { after: this.pageInfo?.endCursor, }, }); - } catch (error) { + } catch { this.$emit('error', I18N_WORK_ITEM_FETCH_AWARD_EMOJI_ERROR); } }, @@ -139,7 +143,7 @@ export default { return this.awardEmoji.nodes; } - // else make a copy of unmutable list and return the list after adding the new emoji + // else make a copy of immutable list and return the list after adding the new emoji const awardEmojiNodes = [...this.awardEmoji.nodes]; awardEmojiNodes.push({ name, @@ -162,7 +166,7 @@ export default { }, updateWorkItemAwardEmojiWidgetCache({ cache, name, toggledOn }) { const query = { - query: workItemAwardEmojiQuery, + query: this.isGroup ? groupWorkItemAwardEmojiQuery : projectWorkItemAwardEmojiQuery, variables: { fullPath: this.workItemFullpath, iid: this.workItemIid, diff --git a/app/assets/javascripts/work_items/graphql/award_emoji.query.graphql b/app/assets/javascripts/work_items/graphql/award_emoji.query.graphql index 82a532e1bea..0b9dc546df3 100644 --- a/app/assets/javascripts/work_items/graphql/award_emoji.query.graphql +++ b/app/assets/javascripts/work_items/graphql/award_emoji.query.graphql @@ -1,7 +1,7 @@ #import "~/graphql_shared/fragments/page_info.fragment.graphql" #import "~/work_items/graphql/award_emoji.fragment.graphql" -query workItemAwardEmojis($fullPath: ID!, $iid: String, $after: String, $pageSize: Int) { +query projectWorkItemAwardEmojis($fullPath: ID!, $iid: String, $after: String, $pageSize: Int) { workspace: project(fullPath: $fullPath) { id workItems(iid: $iid) { diff --git a/app/assets/javascripts/work_items/graphql/group_award_emoji.query.graphql b/app/assets/javascripts/work_items/graphql/group_award_emoji.query.graphql new file mode 100644 index 00000000000..cdf8c7cad04 --- /dev/null +++ b/app/assets/javascripts/work_items/graphql/group_award_emoji.query.graphql @@ -0,0 +1,27 @@ +#import "~/graphql_shared/fragments/page_info.fragment.graphql" +#import "~/work_items/graphql/award_emoji.fragment.graphql" + +query groupWorkItemAwardEmojis($fullPath: ID!, $iid: String, $after: String, $pageSize: Int) { + workspace: group(fullPath: $fullPath) { + id + workItems(iid: $iid) { + nodes { + id + iid + widgets { + ... on WorkItemWidgetAwardEmoji { + type + awardEmoji(first: $pageSize, after: $after) { + pageInfo { + ...PageInfo + } + nodes { + ...AwardEmojiFragment + } + } + } + } + } + } + } +} diff --git a/app/assets/stylesheets/page_bundles/merge_requests.scss b/app/assets/stylesheets/page_bundles/merge_requests.scss index 440fc7ad586..3b97ab2cc4f 100644 --- a/app/assets/stylesheets/page_bundles/merge_requests.scss +++ b/app/assets/stylesheets/page_bundles/merge_requests.scss @@ -379,6 +379,10 @@ $tabs-holder-z-index: 250; .deployment-info { margin-bottom: $gl-padding-8; } + + .gl-button { + margin-left: 0; + } } > *:not(:last-child) { @@ -645,6 +649,9 @@ $tabs-holder-z-index: 250; // to the end of the line or to force it to a // new line if there is not enough space. flex-grow: 999; + // Avoid layout shift of title when Mini Graph + // moves below title + padding-top: 5px; } .label-branch { diff --git a/app/controllers/concerns/creates_commit.rb b/app/controllers/concerns/creates_commit.rb index 27f1d1f5528..5009bf7ff0c 100644 --- a/app/controllers/concerns/creates_commit.rb +++ b/app/controllers/concerns/creates_commit.rb @@ -3,6 +3,7 @@ module CreatesCommit extend ActiveSupport::Concern include Gitlab::Utils::StrongMemoize + include SafeFormatHelper # rubocop:disable Gitlab/ModuleWithInstanceVariables def create_commit(service, success_path:, failure_path:, failure_view: nil, success_notice: nil, target_project: nil) @@ -31,10 +32,10 @@ module CreatesCommit result = service.new(@project_to_commit_into, current_user, commit_params).execute if result[:status] == :success - update_flash_notice(success_notice) - success_path = final_success_path(success_path, target_project) + update_flash_notice(success_notice, success_path) + respond_to do |format| format.html { redirect_to success_path } format.json { render json: { message: _("success"), filePath: success_path } } @@ -65,8 +66,13 @@ module CreatesCommit private - def update_flash_notice(success_notice) - flash[:notice] = success_notice || _("Your changes have been successfully committed.") + def update_flash_notice(success_notice, success_path) + changes_link = ActionController::Base.helpers.link_to _('changes'), success_path, class: 'gl-link' + + default_message = safe_format(_("Your %{changes_link} have been committed successfully."), + changes_link: changes_link) + + flash[:notice] = success_notice || default_message if create_merge_request? flash[:notice] = diff --git a/app/helpers/vite_helper.rb b/app/helpers/vite_helper.rb index 4d1085a5169..5096d3649b7 100644 --- a/app/helpers/vite_helper.rb +++ b/app/helpers/vite_helper.rb @@ -1,22 +1,6 @@ # frozen_string_literal: true module ViteHelper - def universal_javascript_include_tag(*args) - if vite_enabled - vite_javascript_tag(*args) - else - javascript_include_tag(*args) - end - end - - def universal_asset_path(*args) - if vite_enabled - vite_asset_path(*args) - else - asset_path(*args) - end - end - private def vite_enabled diff --git a/app/models/active_session.rb b/app/models/active_session.rb index e42f9eeef23..9756e1b7dd3 100644 --- a/app/models/active_session.rb +++ b/app/models/active_session.rb @@ -84,7 +84,7 @@ class ActiveSession ) Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do - redis.pipelined do |pipeline| + Gitlab::Redis::CrossSlot::Pipeline.new(redis).pipelined do |pipeline| pipeline.setex( key_name(user.id, session_private_id), expiry, @@ -135,9 +135,15 @@ class ActiveSession redis.srem(lookup_key_name(user.id), session_ids) + session_keys = rack_session_keys(session_ids) Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do - redis.del(key_names) - redis.del(rack_session_keys(session_ids)) + if Gitlab::Redis::ClusterUtil.cluster?(redis) + Gitlab::Redis::ClusterUtil.batch_unlink(key_names, redis) + Gitlab::Redis::ClusterUtil.batch_unlink(session_keys, redis) + else + redis.del(key_names) + redis.del(session_keys) + end end end @@ -206,7 +212,13 @@ class ActiveSession session_keys.each_slice(SESSION_BATCH_SIZE).flat_map do |session_keys_batch| Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do - redis.mget(session_keys_batch).compact.map do |raw_session| + raw_sessions = if Gitlab::Redis::ClusterUtil.cluster?(redis) + Gitlab::Redis::ClusterUtil.batch_get(session_keys_batch, redis) + else + redis.mget(session_keys_batch) + end + + raw_sessions.compact.map do |raw_session| load_raw_session(raw_session) end end @@ -249,7 +261,13 @@ class ActiveSession found = Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do entry_keys = session_ids.map { |session_id| key_name(user_id, session_id) } - session_ids.zip(redis.mget(entry_keys)).to_h + entries = if Gitlab::Redis::ClusterUtil.cluster?(redis) + Gitlab::Redis::ClusterUtil.batch_get(entry_keys, redis) + else + redis.mget(entry_keys) + end + + session_ids.zip(entries).to_h end found.compact! @@ -258,7 +276,13 @@ class ActiveSession fallbacks = Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do entry_keys = missing.map { |session_id| key_name_v1(user_id, session_id) } - missing.zip(redis.mget(entry_keys)).to_h + entries = if Gitlab::Redis::ClusterUtil.cluster?(redis) + Gitlab::Redis::ClusterUtil.batch_get(entry_keys, redis) + else + redis.mget(entry_keys) + end + + missing.zip(entries).to_h end fallbacks.merge(found.compact) diff --git a/app/models/ci/build_trace_chunks/redis_base.rb b/app/models/ci/build_trace_chunks/redis_base.rb index 3b7a844d122..5f6b5c30a6a 100644 --- a/app/models/ci/build_trace_chunks/redis_base.rb +++ b/app/models/ci/build_trace_chunks/redis_base.rb @@ -71,7 +71,11 @@ module Ci with_redis do |redis| # https://gitlab.com/gitlab-org/gitlab/-/issues/224171 Gitlab::Instrumentation::RedisClusterValidator.allow_cross_slot_commands do - redis.del(keys) + if Gitlab::Redis::ClusterUtil.cluster?(redis) + Gitlab::Redis::ClusterUtil.batch_unlink(keys, redis) + else + redis.del(keys) + end end end end |