Commit 280aa61e authored by Filipa Lacerda's avatar Filipa Lacerda

Merge branch 'mr-widget-merge-error' into 'master'

Update rendering of merge request in merge request widget

Closes #40246

See merge request gitlab-org/gitlab-ce!28238
parents b3907962 cc4b9a37
......@@ -37,7 +37,7 @@ export default {
</script>
<template>
<div class="m-3 ml-5" :class="messageClass">
<div class="m-3 ml-7" :class="messageClass">
<slot></slot>
<gl-link v-if="helpPath" :href="helpPath" target="_blank">
<icon :size="16" name="question-o" class="align-middle" />
......
......@@ -35,9 +35,7 @@ export default {
<status-icon status="warning" />
<div class="media-body space-children">
<span class="bold">
<template v-if="mr.mergeError"
>{{ mr.mergeError }}.</template
>
<template v-if="mr.mergeError">{{ mr.mergeError }}</template>
{{ s__('mrWidget|This merge request failed to be merged automatically') }}
</span>
<button
......
......@@ -330,6 +330,7 @@ export default {
:commits-count="mr.commitsCount"
:target-branch="mr.targetBranch"
:is-fast-forward-enabled="mr.ffOnlyEnabled"
:class="{ 'border-bottom': mr.mergeError }"
>
<ul class="border-top content-list commits-list flex-list">
<commit-edit
......
<script>
import _ from 'underscore';
import { __ } from '~/locale';
import { sprintf, s__, __ } from '~/locale';
import Project from '~/pages/projects/project';
import SmartInterval from '~/smart_interval';
import MRWidgetStore from 'ee_else_ce/vue_merge_request_widget/stores/mr_widget_store';
......@@ -125,6 +125,11 @@ export default {
this.mr.pipeline.target_sha !== this.mr.targetBranchSha,
);
},
mergeError() {
return sprintf(s__('mrWidget|Merge failed: %{mergeError}. Please try again.'), {
mergeError: this.mr.mergeError,
});
},
},
watch: {
state(newVal, oldVal) {
......@@ -370,6 +375,10 @@ export default {
}}
</mr-widget-alert-message>
<mr-widget-alert-message v-if="mr.mergeError" type="danger">
{{ mergeError }}
</mr-widget-alert-message>
<source-branch-removal-status v-if="shouldRenderSourceBranchRemovalStatus" />
</div>
</div>
......
......@@ -12258,6 +12258,9 @@ msgstr ""
msgid "mrWidget|Merge failed."
msgstr ""
msgid "mrWidget|Merge failed: %{mergeError}. Please try again."
msgstr ""
msgid "mrWidget|Merge locally"
msgstr ""
......
......@@ -159,8 +159,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
# Wait for the `ci_status` and `merge_check` requests
wait_for_requests
page.within('.mr-widget-body') do
expect(page).to have_content('Something went wrong')
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
end
end
end
......@@ -178,8 +178,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
# Wait for the `ci_status` and `merge_check` requests
wait_for_requests
page.within('.mr-widget-body') do
expect(page).to have_content('Something went wrong')
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
end
end
end
......
......@@ -327,8 +327,8 @@ describe 'Merge request > User sees merge widget', :js do
# Wait for the `ci_status` and `merge_check` requests
wait_for_requests
page.within('.mr-widget-body') do
expect(page).to have_content('Something went wrong')
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
end
end
end
......@@ -348,8 +348,8 @@ describe 'Merge request > User sees merge widget', :js do
# Wait for the `ci_status` and `merge_check` requests
wait_for_requests
page.within('.mr-widget-body') do
expect(page).to have_content('Something went wrong')
page.within('.mr-section-container') do
expect(page).to have_content('Merge failed: Something went wrong')
end
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment