Commit cc4b9a37 authored by Phil Hughes's avatar Phil Hughes

Update rendering of merge request in merge request widget

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40246
parent 6d3ab5d8
...@@ -37,7 +37,7 @@ export default { ...@@ -37,7 +37,7 @@ export default {
</script> </script>
<template> <template>
<div class="m-3 ml-5" :class="messageClass"> <div class="m-3 ml-7" :class="messageClass">
<slot></slot> <slot></slot>
<gl-link v-if="helpPath" :href="helpPath" target="_blank"> <gl-link v-if="helpPath" :href="helpPath" target="_blank">
<icon :size="16" name="question-o" class="align-middle" /> <icon :size="16" name="question-o" class="align-middle" />
......
...@@ -35,9 +35,7 @@ export default { ...@@ -35,9 +35,7 @@ export default {
<status-icon status="warning" /> <status-icon status="warning" />
<div class="media-body space-children"> <div class="media-body space-children">
<span class="bold"> <span class="bold">
<template v-if="mr.mergeError" <template v-if="mr.mergeError">{{ mr.mergeError }}</template>
>{{ mr.mergeError }}.</template
>
{{ s__('mrWidget|This merge request failed to be merged automatically') }} {{ s__('mrWidget|This merge request failed to be merged automatically') }}
</span> </span>
<button <button
......
...@@ -330,6 +330,7 @@ export default { ...@@ -330,6 +330,7 @@ export default {
:commits-count="mr.commitsCount" :commits-count="mr.commitsCount"
:target-branch="mr.targetBranch" :target-branch="mr.targetBranch"
:is-fast-forward-enabled="mr.ffOnlyEnabled" :is-fast-forward-enabled="mr.ffOnlyEnabled"
:class="{ 'border-bottom': mr.mergeError }"
> >
<ul class="border-top content-list commits-list flex-list"> <ul class="border-top content-list commits-list flex-list">
<commit-edit <commit-edit
......
<script> <script>
import _ from 'underscore'; import _ from 'underscore';
import { __ } from '~/locale'; import { sprintf, s__, __ } from '~/locale';
import Project from '~/pages/projects/project'; import Project from '~/pages/projects/project';
import SmartInterval from '~/smart_interval'; import SmartInterval from '~/smart_interval';
import MRWidgetStore from 'ee_else_ce/vue_merge_request_widget/stores/mr_widget_store'; import MRWidgetStore from 'ee_else_ce/vue_merge_request_widget/stores/mr_widget_store';
...@@ -125,6 +125,11 @@ export default { ...@@ -125,6 +125,11 @@ export default {
this.mr.pipeline.target_sha !== this.mr.targetBranchSha, this.mr.pipeline.target_sha !== this.mr.targetBranchSha,
); );
}, },
mergeError() {
return sprintf(s__('mrWidget|Merge failed: %{mergeError}. Please try again.'), {
mergeError: this.mr.mergeError,
});
},
}, },
watch: { watch: {
state(newVal, oldVal) { state(newVal, oldVal) {
...@@ -370,6 +375,10 @@ export default { ...@@ -370,6 +375,10 @@ export default {
}} }}
</mr-widget-alert-message> </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" /> <source-branch-removal-status v-if="shouldRenderSourceBranchRemovalStatus" />
</div> </div>
</div> </div>
......
...@@ -12234,6 +12234,9 @@ msgstr "" ...@@ -12234,6 +12234,9 @@ msgstr ""
msgid "mrWidget|Merge failed." msgid "mrWidget|Merge failed."
msgstr "" msgstr ""
msgid "mrWidget|Merge failed: %{mergeError}. Please try again."
msgstr ""
msgid "mrWidget|Merge locally" msgid "mrWidget|Merge locally"
msgstr "" msgstr ""
......
...@@ -158,8 +158,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -158,8 +158,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
# Wait for the `ci_status` and `merge_check` requests # Wait for the `ci_status` and `merge_check` requests
wait_for_requests wait_for_requests
page.within('.mr-widget-body') do page.within('.mr-section-container') do
expect(page).to have_content('Something went wrong') expect(page).to have_content('Merge failed: Something went wrong')
end end
end end
end end
...@@ -177,8 +177,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do ...@@ -177,8 +177,8 @@ describe 'Merge request > User merges when pipeline succeeds', :js do
# Wait for the `ci_status` and `merge_check` requests # Wait for the `ci_status` and `merge_check` requests
wait_for_requests wait_for_requests
page.within('.mr-widget-body') do page.within('.mr-section-container') do
expect(page).to have_content('Something went wrong') expect(page).to have_content('Merge failed: Something went wrong')
end end
end end
end end
......
...@@ -326,8 +326,8 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -326,8 +326,8 @@ describe 'Merge request > User sees merge widget', :js do
# Wait for the `ci_status` and `merge_check` requests # Wait for the `ci_status` and `merge_check` requests
wait_for_requests wait_for_requests
page.within('.mr-widget-body') do page.within('.mr-section-container') do
expect(page).to have_content('Something went wrong') expect(page).to have_content('Merge failed: Something went wrong')
end end
end end
end end
...@@ -347,8 +347,8 @@ describe 'Merge request > User sees merge widget', :js do ...@@ -347,8 +347,8 @@ describe 'Merge request > User sees merge widget', :js do
# Wait for the `ci_status` and `merge_check` requests # Wait for the `ci_status` and `merge_check` requests
wait_for_requests wait_for_requests
page.within('.mr-widget-body') do page.within('.mr-section-container') do
expect(page).to have_content('Something went wrong') expect(page).to have_content('Merge failed: Something went wrong')
end end
end 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