Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a7337266
Commit
a7337266
authored
Jun 02, 2021
by
pburdette
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add danger for merge trains
If pipeline failed for merge train show red danger button. Changelog: added
parent
dc030fda
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
3 deletions
+53
-3
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
...merge_request_widget/components/states/ready_to_merge.vue
+20
-3
ee/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+30
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/states/ready_to_merge.vue
View file @
a7337266
...
...
@@ -22,7 +22,13 @@ import { __ } from '~/locale';
import
SmartInterval
from
'
~/smart_interval
'
;
import
glFeatureFlagMixin
from
'
~/vue_shared/mixins/gl_feature_flags_mixin
'
;
import
MergeRequest
from
'
../../../merge_request
'
;
import
{
AUTO_MERGE_STRATEGIES
,
DANGER
,
CONFIRM
,
WARNING
}
from
'
../../constants
'
;
import
{
AUTO_MERGE_STRATEGIES
,
DANGER
,
CONFIRM
,
WARNING
,
MT_MERGE_STRATEGY
,
}
from
'
../../constants
'
;
import
eventHub
from
'
../../event_hub
'
;
import
mergeRequestQueryVariablesMixin
from
'
../../mixins/merge_request_query_variables
'
;
import
MergeRequestStore
from
'
../../stores/mr_widget_store
'
;
...
...
@@ -223,7 +229,7 @@ export default {
return
PIPELINE_SUCCESS_STATE
;
},
mergeButtonVariant
()
{
if
(
this
.
status
===
PIPELINE_FAILED_STATE
)
{
if
(
this
.
status
===
PIPELINE_FAILED_STATE
||
this
.
isPipelineFailed
)
{
return
DANGER
;
}
...
...
@@ -286,6 +292,9 @@ export default {
shaMismatchLink
()
{
return
this
.
mr
.
mergeRequestDiffsPath
;
},
showDangerMessageForMergeTrain
()
{
return
this
.
preferredAutoMergeStrategy
===
MT_MERGE_STRATEGY
&&
this
.
isPipelineFailed
;
},
},
mounted
()
{
if
(
this
.
glFeatures
.
mergeRequestWidgetGraphql
)
{
...
...
@@ -499,7 +508,7 @@ export default {
v-if=
"shouldShowMergeImmediatelyDropdown"
v-gl-tooltip.hover.focus=
"__('Select merge moment')"
:disabled=
"isMergeButtonDisabled"
variant=
"info
"
:variant=
"mergeButtonVariant
"
data-qa-selector=
"merge_moment_dropdown"
toggle-class=
"btn-icon js-merge-moment"
>
...
...
@@ -579,6 +588,14 @@ export default {
</gl-sprintf>
</span>
</div>
<div
v-if=
"showDangerMessageForMergeTrain"
class=
"gl-mt-5 gl-text-gray-500"
data-testid=
"failed-pipeline-merge-train-text"
>
{{ __('The latest pipeline for this merge request did not complete successfully.') }}
</div>
</div>
</div>
<merge-train-helper-text
...
...
ee/spec/frontend/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
a7337266
...
...
@@ -86,6 +86,8 @@ describe('ReadyToMerge', () => {
findMergeTrainHelperText
().
find
(
'
[data-testid="pipeline-link"]
'
);
const
findMergeTrainDocumentationLink
=
()
=>
findMergeTrainHelperText
().
find
(
'
[data-testid="documentation-link"]
'
);
const
findFailedPipelineMergeTrainText
=
()
=>
wrapper
.
find
(
'
[data-testid="failed-pipeline-merge-train-text"]
'
);
afterEach
(()
=>
{
if
(
wrapper
?.
destroy
)
{
...
...
@@ -423,4 +425,32 @@ describe('ReadyToMerge', () => {
expect
(
findPipelineConflictMessage
().
text
()).
toBe
(
PIPELINE_MUST_SUCCEED_CONFLICT_TEXT
);
});
});
describe
(
'
Merge button variant
'
,
()
=>
{
it
(
'
danger variant and failed text should show if pipeline failed
'
,
()
=>
{
factory
({
isPipelineFailed
:
true
,
preferredAutoMergeStrategy
:
MT_MERGE_STRATEGY
,
availableAutoMergeStrategies
:
[
MT_MERGE_STRATEGY
],
hasCI
:
true
,
onlyAllowMergeIfPipelineSucceeds
:
false
,
});
expect
(
findMergeButton
().
attributes
(
'
variant
'
)).
toBe
(
'
danger
'
);
expect
(
findFailedPipelineMergeTrainText
().
exists
()).
toBe
(
true
);
});
it
(
'
confirm variant and failed text should not show if pipeline passed
'
,
()
=>
{
factory
({
preferredAutoMergeStrategy
:
MT_MERGE_STRATEGY
,
availableAutoMergeStrategies
:
[
MT_MERGE_STRATEGY
],
hasCI
:
true
,
onlyAllowMergeIfPipelineSucceeds
:
false
,
ciStatus
:
'
success
'
,
});
expect
(
findMergeButton
().
attributes
(
'
variant
'
)).
toBe
(
'
confirm
'
);
expect
(
findFailedPipelineMergeTrainText
().
exists
()).
toBe
(
false
);
});
});
});
locale/gitlab.pot
View file @
a7337266
...
...
@@ -32610,6 +32610,9 @@ msgstr ""
msgid "The latest artifacts created by jobs in the most recent successful pipeline will be stored."
msgstr ""
msgid "The latest pipeline for this merge request did not complete successfully."
msgstr ""
msgid "The license key is invalid. Make sure it is exactly as you received it from GitLab Inc."
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment