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
4dd5bd4c
Commit
4dd5bd4c
authored
Aug 07, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '33095-mr-widget-ui-ee' into 'master'
33095 mr widget ui ee See merge request !2389
parents
9567a1ee
a5331438
Changes
62
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
62 changed files
with
1000 additions
and
1014 deletions
+1000
-1014
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_author.js
...s/vue_merge_request_widget/components/mr_widget_author.js
+2
-2
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
...e_merge_request_widget/components/mr_widget_deployment.js
+48
-52
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js
...s/vue_merge_request_widget/components/mr_widget_header.js
+3
-3
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
...merge_request_widget/components/mr_widget_memory_usage.js
+3
-4
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.js
...e_merge_request_widget/components/mr_widget_merge_help.js
+1
-1
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js
...vue_merge_request_widget/components/mr_widget_pipeline.js
+49
-52
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_related_links.js
...erge_request_widget/components/mr_widget_related_links.js
+11
-14
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
..._merge_request_widget/components/mr_widget_status_icon.js
+36
-0
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_archived.js
...ge_request_widget/components/states/mr_widget_archived.js
+20
-10
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js
...t_widget/components/states/mr_widget_auto_merge_failed.js
+12
-13
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_checking.js
...ge_request_widget/components/states/mr_widget_checking.js
+12
-13
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js
...erge_request_widget/components/states/mr_widget_closed.js
+21
-16
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
...e_request_widget/components/states/mr_widget_conflicts.js
+14
-16
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_failed_to_merge.js
...est_widget/components/states/mr_widget_failed_to_merge.js
+33
-31
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_locked.js
...erge_request_widget/components/states/mr_widget_locked.js
+20
-15
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merge_when_pipeline_succeeds.js
...mponents/states/mr_widget_merge_when_pipeline_succeeds.js
+48
-47
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.js
...erge_request_widget/components/states/mr_widget_merged.js
+69
-69
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js
...uest_widget/components/states/mr_widget_missing_branch.js
+18
-15
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_not_allowed.js
...request_widget/components/states/mr_widget_not_allowed.js
+13
-11
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_nothing_to_merge.js
...st_widget/components/states/mr_widget_nothing_to_merge.js
+9
-7
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.js
...st_widget/components/states/mr_widget_pipeline_blocked.js
+12
-10
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_failed.js
...est_widget/components/states/mr_widget_pipeline_failed.js
+12
-10
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
...uest_widget/components/states/mr_widget_ready_to_merge.js
+100
-89
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_sha_mismatch.js
...equest_widget/components/states/mr_widget_sha_mismatch.js
+12
-10
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions.js
...get/components/states/mr_widget_unresolved_discussions.js
+18
-18
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_wip.js
...e_merge_request_widget/components/states/mr_widget_wip.js
+15
-14
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+19
-9
app/assets/stylesheets/framework.scss
app/assets/stylesheets/framework.scss
+2
-1
app/assets/stylesheets/framework/media_object.scss
app/assets/stylesheets/framework/media_object.scss
+8
-0
app/assets/stylesheets/pages/merge_requests.scss
app/assets/stylesheets/pages/merge_requests.scss
+128
-238
app/assets/stylesheets/pages/pipelines.scss
app/assets/stylesheets/pages/pipelines.scss
+5
-1
changelogs/unreleased-ee/33095-mr-widget-ui-ee.yml
changelogs/unreleased-ee/33095-mr-widget-ui-ee.yml
+4
-0
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_body.js
...rge_request_widget/components/approvals/approvals_body.js
+1
-1
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_footer.js
...e_request_widget/components/approvals/approvals_footer.js
+2
-3
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/mr_widget_approvals.js
...equest_widget/components/approvals/mr_widget_approvals.js
+21
-6
ee/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality.vue
...erge_request_widget/components/mr_widget_code_quality.vue
+61
-55
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.js
...erge_request_widget/components/states/mr_widget_rebase.js
+25
-21
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_secondary_geo_node.js
..._widget/components/states/mr_widget_secondary_geo_node.js
+22
-15
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
...javascripts/vue_merge_request_widget/mr_widget_options.js
+12
-8
spec/features/merge_requests/closes_issues_spec.rb
spec/features/merge_requests/closes_issues_spec.rb
+9
-15
spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb
...tures/merge_requests/merge_when_pipeline_succeeds_spec.rb
+5
-5
spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb
...merge_requests/only_allow_merge_if_build_succeeds_spec.rb
+4
-4
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_spec.js
...s/vue_mr_widget/components/mr_widget_code_quality_spec.js
+12
-13
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
...pts/vue_mr_widget/components/mr_widget_deployment_spec.js
+0
-10
spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js
...s/vue_mr_widget/components/mr_widget_memory_usage_spec.js
+3
-3
spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
...ripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
+1
-3
spec/javascripts/vue_mr_widget/components/mr_widget_related_links_spec.js
.../vue_mr_widget/components/mr_widget_related_links_spec.js
+12
-30
spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js
...ue_mr_widget/components/states/mr_widget_archived_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js
...get/components/states/mr_widget_auto_merge_failed_spec.js
+2
-2
spec/javascripts/vue_mr_widget/components/states/mr_widget_checking_spec.js
...ue_mr_widget/components/states/mr_widget_checking_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
...e_mr_widget/components/states/mr_widget_conflicts_spec.js
+7
-6
spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
...idget/components/states/mr_widget_failed_to_merge_spec.js
+2
-2
spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
...nts/states/mr_widget_merge_when_pipeline_succeeds_spec.js
+4
-4
spec/javascripts/vue_mr_widget/components/states/mr_widget_merged_spec.js
.../vue_mr_widget/components/states/mr_widget_merged_spec.js
+8
-8
spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
...widget/components/states/mr_widget_missing_branch_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_not_allowed_spec.js
...mr_widget/components/states/mr_widget_not_allowed_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
...dget/components/states/mr_widget_pipeline_blocked_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js
...idget/components/states/mr_widget_pipeline_failed_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
...widget/components/states/mr_widget_ready_to_merge_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
...r_widget/components/states/mr_widget_sha_mismatch_spec.js
+1
-1
spec/javascripts/vue_mr_widget/components/states/mr_widget_wip_spec.js
...pts/vue_mr_widget/components/states/mr_widget_wip_spec.js
+1
-1
spec/javascripts/vue_mr_widget/mock_data.js
spec/javascripts/vue_mr_widget/mock_data.js
+1
-0
No files found.
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_author.js
View file @
4dd5bd4c
...
@@ -8,8 +8,8 @@ export default {
...
@@ -8,8 +8,8 @@ export default {
template
:
`
template
:
`
<a
<a
:href="author.webUrl || author.web_url"
:href="author.webUrl || author.web_url"
class="author-link"
class="author-link
inline
"
:
class="{ 'has-tooltip': showAuthorTooltip }
"
:
v-tooltip="showAuthorTooltip
"
:title="author.name">
:title="author.name">
<img
<img
:src="author.avatarUrl || author.avatar_url"
:src="author.avatarUrl || author.avatar_url"
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_deployment.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
'
~/lib/utils/datetime_utility
'
;
import
'
~/lib/utils/datetime_utility
'
;
import
{
statusIconEntityMap
}
from
'
../../vue_shared/ci_status_icons
'
;
import
MemoryUsage
from
'
./mr_widget_memory_usage
'
;
import
MemoryUsage
from
'
./mr_widget_memory_usage
'
;
import
StatusIcon
from
'
./mr_widget_status_icon
'
;
import
MRWidgetService
from
'
../services/mr_widget_service
'
;
import
MRWidgetService
from
'
../services/mr_widget_service
'
;
export
default
{
export
default
{
...
@@ -13,11 +13,7 @@ export default {
...
@@ -13,11 +13,7 @@ export default {
},
},
components
:
{
components
:
{
'
mr-widget-memory-usage
'
:
MemoryUsage
,
'
mr-widget-memory-usage
'
:
MemoryUsage
,
},
'
status-icon
'
:
StatusIcon
,
computed
:
{
svg
()
{
return
statusIconEntityMap
.
icon_status_success
;
},
},
},
methods
:
{
methods
:
{
formatDate
(
date
)
{
formatDate
(
date
)
{
...
@@ -51,51 +47,51 @@ export default {
...
@@ -51,51 +47,51 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-heading">
<div class="mr-widget-heading
deploy-heading
">
<div v-for="deployment in mr.deployments">
<div v-for="deployment in mr.deployments">
<div class="ci-widget">
<div class="ci-widget
media
">
<div class="ci-status-icon ci-status-icon-success">
<div class="ci-status-icon ci-status-icon-success">
<span class="js-icon-link icon-link">
<span class="js-icon-link icon-link">
<span class="ci-status-icon"
<status-icon status="success" />
v-html="svg"
aria-hidden="true"></span>
</span>
</span>
</div>
</div>
<span>
<div class="media-body space-children">
<span
<span>
v-if="hasDeploymentMeta(deployment)">
<span
Deployed to
v-if="hasDeploymentMeta(deployment)">
</span>
Deployed to
<a
</span>
v-if="hasDeploymentMeta(deployment)"
<a
:href="deployment.url"
v-if="hasDeploymentMeta(deployment)"
target="_blank"
:href="deployment.url"
rel="noopener noreferrer nofollow"
target="_blank"
class="js-deploy-meta">
rel="noopener noreferrer nofollow"
{{deployment.name}}
class="js-deploy-meta inline">
</a>
{{deployment.name}}
<span
</a>
v-if="hasExternalUrls(deployment)">
<span
on
v-if="hasExternalUrls(deployment)">
</span>
on
<a
</span>
v-if="hasExternalUrls(deployment)"
<a
:href="deployment.external_url"
v-if="hasExternalUrls(deployment)"
target="_blank"
:href="deployment.external_url"
rel="noopener noreferrer nofollow"
target="_blank"
class="js-deploy-url">
rel="noopener noreferrer nofollow"
<i
class="js-deploy-url inline">
class="fa fa-external-link"
<i
aria-hidden="true" />
class="fa fa-external-link"
{{deployment.external_url_formatted}}
aria-hidden="true" />
</a>
{{deployment.external_url_formatted}}
<span
</a>
v-if="hasDeploymentTime(deployment)"
<span
:data-title="deployment.deployed_at_formatted"
v-if="hasDeploymentTime(deployment)"
class="js-deploy-time"
:data-title="deployment.deployed_at_formatted"
data-toggle="tooltip"
class="js-deploy-time"
data-placement="top">
data-toggle="tooltip"
{{formatDate(deployment.deployed_at)}}
data-placement="top">
{{formatDate(deployment.deployed_at)}}
</span>
</span>
</span>
<button
<button
type="button"
type="button"
...
@@ -104,13 +100,13 @@ export default {
...
@@ -104,13 +100,13 @@ export default {
class="btn btn-default btn-xs">
class="btn btn-default btn-xs">
Stop environment
Stop environment
</button>
</button>
</span>
<mr-widget-memory-usage
v-if="deployment.metrics_url"
:metrics-url="deployment.metrics_url"
:metrics-monitoring-url="deployment.metrics_monitoring_url"
/>
</div>
</div>
</div>
<mr-widget-memory-usage
v-if="deployment.metrics_url"
:metrics-url="deployment.metrics_url"
:metrics-monitoring-url="deployment.metrics_monitoring_url"
/>
</div>
</div>
</div>
</div>
`
,
`
,
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_header.js
View file @
4dd5bd4c
...
@@ -35,12 +35,12 @@ export default {
...
@@ -35,12 +35,12 @@ export default {
<a
<a
href="#modal_merge_info"
href="#modal_merge_info"
data-toggle="modal"
data-toggle="modal"
class="btn inline btn-grouped
btn-sm
">
class="btn inline btn-grouped">
Check out branch
Check out branch
</a>
</a>
<span class="dropdown inline prepend-left-
5
">
<span class="dropdown inline prepend-left-
10
">
<a
<a
class="btn
btn-sm
dropdown-toggle"
class="btn dropdown-toggle"
data-toggle="dropdown"
data-toggle="dropdown"
aria-label="Download as"
aria-label="Download as"
role="button">
role="button">
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_memory_usage.js
View file @
4dd5bd4c
...
@@ -120,13 +120,12 @@ export default {
...
@@ -120,13 +120,12 @@ export default {
},
},
template
:
`
template
:
`
<div class="mr-info-list clearfix mr-memory-usage js-mr-memory-usage">
<div class="mr-info-list clearfix mr-memory-usage js-mr-memory-usage">
<div class="legend"></div>
<p
<p
v-if="shouldShowLoading"
v-if="shouldShowLoading"
class="usage-info js-usage-info usage-info-loading">
class="usage-info js-usage-info usage-info-loading">
<i
<i
class="fa fa-spinner fa-spin usage-info-load-spinner"
class="fa fa-spinner fa-spin usage-info-load-spinner"
aria-hidden="true" />Loading deployment statistics
.
aria-hidden="true" />Loading deployment statistics
</p>
</p>
<p
<p
v-if="shouldShowMemoryGraph"
v-if="shouldShowMemoryGraph"
...
@@ -136,12 +135,12 @@ export default {
...
@@ -136,12 +135,12 @@ export default {
<p
<p
v-if="shouldShowLoadFailure"
v-if="shouldShowLoadFailure"
class="usage-info js-usage-info usage-info-failed">
class="usage-info js-usage-info usage-info-failed">
Failed to load deployment statistics
.
Failed to load deployment statistics
</p>
</p>
<p
<p
v-if="shouldShowMetricsUnavailable"
v-if="shouldShowMetricsUnavailable"
class="usage-info js-usage-info usage-info-unavailable">
class="usage-info js-usage-info usage-info-unavailable">
Deployment statistics are not available currently
.
Deployment statistics are not available currently
</p>
</p>
<mr-memory-graph
<mr-memory-graph
v-if="shouldShowMemoryGraph"
v-if="shouldShowMemoryGraph"
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_merge_help.js
View file @
4dd5bd4c
...
@@ -16,7 +16,7 @@ export default {
...
@@ -16,7 +16,7 @@ export default {
<a
<a
data-toggle="modal"
data-toggle="modal"
href="#modal_merge_info">
href="#modal_merge_info">
command line
.
command line
</a>
</a>
</section>
</section>
`
,
`
,
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_pipeline.js
View file @
4dd5bd4c
...
@@ -44,71 +44,68 @@ export default {
...
@@ -44,71 +44,68 @@ export default {
},
},
template
:
`
template
:
`
<div class="mr-widget-heading">
<div class="mr-widget-heading">
<div class="ci-widget">
<div class="ci-widget
media
">
<template v-if="hasCIError">
<template v-if="hasCIError">
<div class="ci-status-icon ci-status-icon-failed ci-error js-ci-error">
<div class="ci-status-icon ci-status-icon-failed ci-error js-ci-error append-right-10">
<span class="js-icon-link icon-link">
<span
<span
v-html="svg"
v-html="svg"
aria-hidden="true"></span>
aria-hidden="true"></span>
</div>
</span>
<div class="media-body">
Could not connect to the CI server. Please check your settings and try again
</div>
</div>
<span>Could not connect to the CI server. Please check your settings and try again.</span>
</template>
</template>
<template v-else>
<template v-else>
<div>
<div
class="ci-status-icon append-right-10"
>
<a
<a
class="icon-link"
class="icon-link"
:href="this.status.details_path">
:href="this.status.details_path">
<ci-icon :status="status" />
<ci-icon :status="status" />
</a>
</a>
</div>
</div>
<span>
<div class="media-body">
Pipeline
<span>
<a
Pipeline
:href="mr.pipeline.path"
<a
class="pipeline-id">#{{mr.pipeline.id}}</a>
:href="mr.pipeline.path"
{{mr.pipeline.details.status.label}}
class="pipeline-id">#{{mr.pipeline.id}}</a>
</span>
</span>
<span
<span class="mr-widget-pipeline-graph">
v-if="mr.pipeline.details.stages.length > 0">
<span class="stage-cell">
with {{stageText}}
<linked-pipelines-mini-list
</span>
v-if="triggeredBy.length"
<div class="mr-widget-pipeline-graph">
:triggered-by="triggeredBy"
<div class="stage-cell">
/>
<linked-pipelines-mini-list
v-if="triggeredBy.length"
:triggered-by="triggeredBy"
/>
<div
<div
v-if="mr.pipeline.details.stages.length > 0"
v-if="mr.pipeline.details.stages.length > 0"
v-for="(stage, index) in mr.pipeline.details.stages"
v-for="(stage, index) in mr.pipeline.details.stages"
class="stage-container dropdown js-mini-pipeline-graph"
class="stage-container dropdown js-mini-pipeline-graph"
:class="{
:class="{
'has-downstream': index === mr.pipeline.details.stages.length - 1 && triggered.length
'has-downstream': index === mr.pipeline.details.stages.length - 1 && triggered.length
}">
}">
<pipeline-stage :stage="stage" />
<pipeline-stage :stage="stage" />
</div>
</div>
<linked-pipelines-mini-list
<linked-pipelines-mini-list
v-if="triggered.length"
v-if="triggered.length"
:triggered="triggered"
:triggered="triggered"
/>
/>
</div>
</span>
</span>
<span>
{{mr.pipeline.details.status.label}} for
<a
:href="mr.pipeline.commit.commit_path"
class="commit-sha js-commit-link">
{{mr.pipeline.commit.short_id}}</a>.
</span>
<span
v-if="mr.pipeline.coverage"
class="js-mr-coverage">
Coverage {{mr.pipeline.coverage}}%
</span>
</div>
</div>
<span>
for
<a
:href="mr.pipeline.commit.commit_path"
class="commit-sha js-commit-link">
{{mr.pipeline.commit.short_id}}</a>.
</span>
<span
v-if="mr.pipeline.coverage"
class="js-mr-coverage">
Coverage {{mr.pipeline.coverage}}%.
</span>
</template>
</template>
</div>
</div>
</div>
</div>
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_related_links.js
View file @
4dd5bd4c
...
@@ -2,6 +2,7 @@ export default {
...
@@ -2,6 +2,7 @@ export default {
name
:
'
MRWidgetRelatedLinks
'
,
name
:
'
MRWidgetRelatedLinks
'
,
props
:
{
props
:
{
relatedLinks
:
{
type
:
Object
,
required
:
true
},
relatedLinks
:
{
type
:
Object
,
required
:
true
},
state
:
{
type
:
String
},
},
},
computed
:
{
computed
:
{
hasLinks
()
{
hasLinks
()
{
...
@@ -10,29 +11,25 @@ export default {
...
@@ -10,29 +11,25 @@ export default {
},
},
},
},
methods
:
{
methods
:
{
hasMultipleIssues
(
text
)
{
closesText
(
state
)
{
return
!
text
?
false
:
text
.
match
(
/<
\/
a> and <a/
);
if
(
state
===
'
merged
'
)
{
},
return
'
Closed
'
;
issueLabel
(
field
)
{
}
return
this
.
hasMultipleIssues
(
this
.
relatedLinks
[
field
])
?
'
issues
'
:
'
issue
'
;
if
(
state
===
'
closed
'
)
{
},
return
'
Did not close
'
;
verbLabel
(
field
)
{
}
return
this
.
hasMultipleIssues
(
this
.
relatedLinks
[
field
])
?
'
are
'
:
'
i
s
'
;
return
'
Close
s
'
;
},
},
},
},
template
:
`
template
:
`
<section
<section
v-if="hasLinks"
v-if="hasLinks"
class="mr-info-list mr-links">
class="mr-info-list mr-links">
<div class="legend"></div>
<p v-if="relatedLinks.closing">
<p v-if="relatedLinks.closing">
Closes {{issueLabel('closing')}}
{{closesText(state)}} <span v-html="relatedLinks.closing"></span>
<span v-html="relatedLinks.closing"></span>.
</p>
</p>
<p v-if="relatedLinks.mentioned">
<p v-if="relatedLinks.mentioned">
<span class="capitalize">{{issueLabel('mentioned')}}</span>
Mentions <span v-html="relatedLinks.mentioned"></span>
<span v-html="relatedLinks.mentioned"></span>
{{verbLabel('mentioned')}} mentioned but will not be closed.
</p>
</p>
<p v-if="relatedLinks.assignToMe">
<p v-if="relatedLinks.assignToMe">
<span v-html="relatedLinks.assignToMe"></span>
<span v-html="relatedLinks.assignToMe"></span>
...
...
app/assets/javascripts/vue_merge_request_widget/components/mr_widget_status_icon.js
0 → 100644
View file @
4dd5bd4c
import
ciIcon
from
'
../../vue_shared/components/ci_icon.vue
'
;
import
loadingIcon
from
'
../../vue_shared/components/loading_icon.vue
'
;
export
default
{
props
:
{
status
:
{
type
:
String
,
required
:
true
},
showDisabledButton
:
{
type
:
Boolean
,
required
:
false
},
},
components
:
{
ciIcon
,
loadingIcon
,
},
computed
:
{
statusObj
()
{
return
{
group
:
this
.
status
,
icon
:
`icon_status_
${
this
.
status
}
`
,
};
},
},
template
:
`
<div class="space-children flex-container-block append-right-10">
<div v-if="status === 'loading'" class="mr-widget-icon">
<loading-icon />
</div>
<ci-icon v-else :status="statusObj" />
<button
v-if="showDisabledButton"
type="button"
class="btn btn-success btn-small"
disabled="true">
Merge
</button>
</div>
`
,
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_archived.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetArchived
'
,
name
:
'
MRWidgetArchived
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<div class="space-children">
type="button"
<status-icon status="failed" />
class="btn btn-success btn-small"
<button
disabled="true">
type="button"
Merge
class="btn btn-success btn-small"
</button>
disabled="true">
<span class="bold">
Merge
This project is archived, write access has been disabled.
</button>
</span>
</div>
<div class="media-body">
<span class="bold">
This project is archived, write access has been disabled
</span>
</div>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_auto_merge_failed.js
View file @
4dd5bd4c
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetAutoMergeFailed
'
,
name
:
'
MRWidgetAutoMergeFailed
'
,
...
@@ -10,6 +11,9 @@ export default {
...
@@ -10,6 +11,9 @@ export default {
isRefreshing
:
false
,
isRefreshing
:
false
,
};
};
},
},
components
:
{
statusIcon
,
},
methods
:
{
methods
:
{
refreshWidget
()
{
refreshWidget
()
{
this
.
isRefreshing
=
true
;
this
.
isRefreshing
=
true
;
...
@@ -19,18 +23,16 @@ export default {
...
@@ -19,18 +23,16 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" />
class="btn btn-success btn-small"
<div class="media-body space-children">
disabled="true"
<span class="bold">
type="button">
<template v-if="mr.mergeError">{{mr.mergeError}}.</template>
Merge
This merge request failed to be merged automatically
</button>
</span>
<span class="bold danger">
This merge request failed to be merged automatically.
<button
<button
@click="refreshWidget"
@click="refreshWidget"
:
class="{ disabled: isRefreshing }
"
:
disabled="isRefreshing
"
type="button"
type="button"
class="btn btn-xs btn-default">
class="btn btn-xs btn-default">
<i
<i
...
@@ -39,9 +41,6 @@ export default {
...
@@ -39,9 +41,6 @@ export default {
aria-hidden="true" />
aria-hidden="true" />
Refresh
Refresh
</button>
</button>
</span>
<div class="merge-error-text danger bold">
{{mr.mergeError}}
</div>
</div>
</div>
</div>
`
,
`
,
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_checking.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetChecking
'
,
name
:
'
MRWidgetChecking
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="loading" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
Checking ability to merge automatically
Merge
</span>
</button>
</div>
<span class="bold">
Checking ability to merge automatically.
<i
class="fa fa-spinner fa-spin"
aria-hidden="true" />
</span>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_closed.js
View file @
4dd5bd4c
import
mrWidgetAuthorTime
from
'
../../components/mr_widget_author_time
'
;
import
mrWidgetAuthorTime
from
'
../../components/mr_widget_author_time
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetClosed
'
,
name
:
'
MRWidgetClosed
'
,
...
@@ -7,24 +8,28 @@ export default {
...
@@ -7,24 +8,28 @@ export default {
},
},
components
:
{
components
:
{
'
mr-widget-author-and-time
'
:
mrWidgetAuthorTime
,
'
mr-widget-author-and-time
'
:
mrWidgetAuthorTime
,
statusIcon
,
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<mr-widget-author-and-time
<status-icon status="failed" />
actionText="Closed by"
<div class="media-body">
:author="mr.closedBy"
<mr-widget-author-and-time
:dateTitle="mr.updatedAt"
actionText="Closed by"
:dateReadable="mr.closedAt"
:author="mr.closedBy"
/>
:dateTitle="mr.updatedAt"
<section>
:dateReadable="mr.closedAt"
<p>
/>
The changes were not merged into
<section class="mr-info-list">
<a
<p>
:href="mr.targetBranchPath"
The changes were not merged into
class="label-branch">
<a
{{mr.targetBranch}}</a>.
:href="mr.targetBranchPath"
</p>
class="label-branch">
</section>
{{mr.targetBranch}}</a>
</p>
</section>
</div>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_conflicts.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetConflicts
'
,
name
:
'
MRWidgetConflicts
'
,
props
:
{
props
:
{
mr
:
{
type
:
Object
,
required
:
true
},
mr
:
{
type
:
Object
,
required
:
true
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
There are merge conflicts<span v-if="!mr.canMerge">.</span>
Merge
<span v-if="!mr.canMerge">
</button>
Resolve these conflicts or ask someone with write access to this repository to merge it locally.
<span class="bold">
</span>
There are merge conflicts.
<span v-if="!mr.canMerge">
Resolve these conflicts or ask someone with write access to this repository to merge it locally.
</span>
</span>
</span>
<div
v-if="mr.canMerge"
class="btn-group">
<a
<a
v-if="mr.conflictResolutionPath"
v-if="mr.c
anMerge && mr.c
onflictResolutionPath"
:href="mr.conflictResolutionPath"
:href="mr.conflictResolutionPath"
class="btn btn-default btn-xs js-resolve-conflicts-button">
class="btn btn-default btn-xs js-resolve-conflicts-button">
Resolve conflicts
Resolve conflicts
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_failed_to_merge.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
export
default
{
export
default
{
...
@@ -38,39 +39,40 @@ export default {
...
@@ -38,39 +39,40 @@ export default {
}
}
},
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<template v-if="isRefreshing">
class="btn btn-success btn-small"
<status-icon status="loading" />
disabled="true"
<span class="media-body bold js-refresh-label">
type="button">
Refreshing now
Merge
</button>
<span
v-if="!isRefreshing"
class="bold danger">
<span
class="has-error-message"
v-if="mr.mergeError">
{{mr.mergeError}}
</span>
<span v-else>Merge failed.</span>
<span
:class="{ 'has-custom-error': mr.mergeError }">
Refreshing in {{timerText}} to show the updated status...
</span>
</span>
<button
</template>
@click="refresh"
<template v-else>
class="btn btn-default btn-xs js-refresh-button"
<status-icon status="failed" showDisabledButton />
type="button">
<div class="media-body space-children">
Refresh now
<span class="bold">
</button>
<span
</span>
class="has-error-message"
<span
v-if="mr.mergeError">
v-if="isRefreshing"
{{mr.mergeError}}.
class="bold js-refresh-label">
</span>
Refreshing now...
<span v-else>Merge failed.</span>
</span>
<span
:class="{ 'has-custom-error': mr.mergeError }">
Refreshing in {{timerText}} to show the updated status...
</span>
</span>
<button
@click="refresh"
class="btn btn-default btn-xs js-refresh-button"
type="button">
Refresh now
</button>
</div>
</template>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_locked.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetLocked
'
,
name
:
'
MRWidgetLocked
'
,
props
:
{
props
:
{
mr
:
{
type
:
Object
,
required
:
true
},
mr
:
{
type
:
Object
,
required
:
true
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body mr-state-locked">
<div class="mr-widget-body mr-state-locked
media
">
<s
pan class="state-label">Locked</span
>
<s
tatus-icon status="loading" /
>
This merge request is in the process of being merged, during which time it is locked and cannot be closed.
<div class="media-body">
<i
<h4>
class="fa fa-spinner fa-spin"
This merge request is in the process of being merged, during which time it is locked and cannot be closed
aria-hidden="true" /
>
</h4
>
<section class="mr-info-list mr-links
">
<section class="mr-info-list
">
<div class="legend"></div
>
<p
>
<p>
The changes will be merged into
The changes will be merged into
<span class="label-branch">
<span class="label-branch"
>
<a :href="mr.targetBranchPath">{{mr.targetBranch}}</a
>
<
a :href="mr.targetBranchPath">{{mr.targetBranch}}</a
>
<
/span
>
</
span>.
</
p>
</
p
>
</
section
>
</
section
>
</
div
>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merge_when_pipeline_succeeds.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
MRWidgetAuthor
from
'
../../components/mr_widget_author
'
;
import
MRWidgetAuthor
from
'
../../components/mr_widget_author
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
...
@@ -11,6 +11,7 @@ export default {
...
@@ -11,6 +11,7 @@ export default {
},
},
components
:
{
components
:
{
'
mr-widget-author
'
:
MRWidgetAuthor
,
'
mr-widget-author
'
:
MRWidgetAuthor
,
statusIcon
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -61,56 +62,56 @@ export default {
...
@@ -61,56 +62,56 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<h4>
<status-icon status="success" />
Set by
<div class="media-body">
<mr-widget-author :author="mr.setToMWPSBy" />
<h4>
to be merged automatically when the pipeline succeeds.
Set by
<a
<mr-widget-author :author="mr.setToMWPSBy" />
v-if="mr.canCancelAutomaticMerge"
to be merged automatically when the pipeline succeeds
@click.prevent="cancelAutomaticMerge"
:disabled="isCancellingAutoMerge"
role="button"
href="#"
class="btn btn-xs btn-default js-cancel-auto-merge">
<i
v-if="isCancellingAutoMerge"
class="fa fa-spinner fa-spin"
aria-hidden="true" />
Cancel automatic merge
</a>
</h4>
<section class="mr-info-list">
<div class="legend"></div>
<p>The changes will be merged into
<a
:href="mr.targetBranchPath"
class="label-branch">
{{mr.targetBranch}}
</a>.
</p>
<p v-if="mr.shouldRemoveSourceBranch">
The source branch will be removed.
</p>
<p
v-else
class="with-button">
The source branch will not be removed.
<a
<a
v-if="
canRemoveSourceBranch
"
v-if="
mr.canCancelAutomaticMerge
"
:disabled="isRemovingSourceBranch
"
@click.prevent="cancelAutomaticMerge
"
@click.prevent="removeSourceBranch
"
:disabled="isCancellingAutoMerge
"
role="button"
role="button"
class="btn btn-xs btn-default js-remove-source-branch
"
href="#
"
href="#
">
class="btn btn-xs btn-default js-cancel-auto-merge
">
<i
<i
v-if="isRemovingSourceBranch
"
v-if="isCancellingAutoMerge
"
class="fa fa-spinner fa-spin"
class="fa fa-spinner fa-spin"
aria-hidden="true" />
aria-hidden="true" />
Remove source branch
Cancel automatic merge
</a>
</a>
</p>
</h4>
</section>
<section class="mr-info-list">
<p>The changes will be merged into
<a
:href="mr.targetBranchPath"
class="label-branch">
{{mr.targetBranch}}
</a>
</p>
<p v-if="mr.shouldRemoveSourceBranch">
The source branch will be removed
</p>
<p v-else>
The source branch will not be removed
<a
v-if="canRemoveSourceBranch"
:disabled="isRemovingSourceBranch"
@click.prevent="removeSourceBranch"
role="button"
class="btn btn-xs btn-default js-remove-source-branch"
href="#">
<i
v-if="isRemovingSourceBranch"
class="fa fa-spinner fa-spin"
aria-hidden="true" />
Remove source branch
</a>
</p>
</section>
</div>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_merged.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
mrWidgetAuthorTime
from
'
../../components/mr_widget_author_time
'
;
import
mrWidgetAuthorTime
from
'
../../components/mr_widget_author_time
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
export
default
{
export
default
{
...
@@ -11,6 +12,7 @@ export default {
...
@@ -11,6 +12,7 @@ export default {
},
},
components
:
{
components
:
{
'
mr-widget-author-and-time
'
:
mrWidgetAuthorTime
,
'
mr-widget-author-and-time
'
:
mrWidgetAuthorTime
,
statusIcon
,
},
},
data
()
{
data
()
{
return
{
return
{
...
@@ -55,75 +57,73 @@ export default {
...
@@ -55,75 +57,73 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<mr-widget-author-and-time
<status-icon status="success" />
actionText="Merged by"
<div class="media-body">
:author="mr.mergedBy"
<div class="space-children">
:dateTitle="mr.updatedAt"
<mr-widget-author-and-time
:dateReadable="mr.mergedAt" />
actionText="Merged by"
<section class="mr-info-list">
:author="mr.mergedBy"
<div class="legend"></div>
:dateTitle="mr.updatedAt"
<p>
:dateReadable="mr.mergedAt" />
The changes were merged into
<a
<span class="label-branch">
v-if="mr.canRevertInCurrentMR"
<a :href="mr.targetBranchPath">{{mr.targetBranch}}</a>
class="btn btn-close btn-xs has-tooltip"
</span>
href="#modal-revert-commit"
</p>
data-toggle="modal"
<p v-if="mr.sourceBranchRemoved">The source branch has been removed.</p>
data-container="body"
<p v-if="shouldShowRemoveSourceBranch">
title="Revert this merge request in a new merge request">
You can remove source branch now.
Revert
<button
</a>
@click="removeSourceBranch"
<a
:class="{ disabled: isMakingRequest }"
v-else-if="mr.revertInForkPath"
type="button"
class="btn btn-close btn-xs has-tooltip"
class="btn btn-xs btn-default js-remove-branch-button">
data-method="post"
Remove Source Branch
:href="mr.revertInForkPath"
</button>
title="Revert this merge request in a new merge request">
</p>
Revert
<p v-if="shouldShowSourceBranchRemoving">
</a>
<i
<a
class="fa fa-spinner fa-spin"
v-if="mr.canCherryPickInCurrentMR"
aria-hidden="true" />
class="btn btn-default btn-xs has-tooltip"
The source branch is being removed.
href="#modal-cherry-pick-commit"
</p>
data-toggle="modal"
</section>
data-container="body"
<div
title="Cherry-pick this merge request in a new merge request">
v-if="shouldShowMergedButtons"
Cherry-pick
class="merged-buttons clearfix">
</a>
<a
<a
v-if="mr.canRevertInCurrentMR"
v-else-if="mr.cherryPickInForkPath"
class="btn btn-close btn-sm has-tooltip"
class="btn btn-default btn-xs has-tooltip"
href="#modal-revert-commit"
data-method="post"
data-toggle="modal"
:href="mr.cherryPickInForkPath"
data-container="body"
title="Cherry-pick this merge request in a new merge request">
title="Revert this merge request in a new merge request">
Cherry-pick
Revert
</a>
</a>
</div>
<a
<section class="mr-info-list">
v-else-if="mr.revertInForkPath"
<p>
class="btn btn-close btn-sm has-tooltip"
The changes were merged into
data-method="post"
<span class="label-branch">
:href="mr.revertInForkPath"
<a :href="mr.targetBranchPath">{{mr.targetBranch}}</a>
title="Revert this merge request in a new merge request">
</span>
Revert
</p>
</a>
<p v-if="mr.sourceBranchRemoved">The source branch has been removed</p>
<a
<p v-if="shouldShowRemoveSourceBranch" class="space-children">
v-if="mr.canCherryPickInCurrentMR"
<span>You can remove source branch now</span>
class="btn btn-default btn-sm has-tooltip"
<button
href="#modal-cherry-pick-commit"
@click="removeSourceBranch"
data-toggle="modal"
:class="{ disabled: isMakingRequest }"
data-container="body"
type="button"
title="Cherry-pick this merge request in a new merge request">
class="btn btn-xs btn-default js-remove-branch-button">
Cherry-pick
Remove Source Branch
</a>
</button>
<a
</p>
v-else-if="mr.cherryPickInForkPath"
<p v-if="shouldShowSourceBranchRemoving">
class="btn btn-default btn-sm has-tooltip"
<status-icon status="loading" />
data-method="post"
<span>The source branch is being removed</span>
:href="mr.cherryPickInForkPath"
</p>
title="Cherry-pick this merge request in a new merge request">
</section>
Cherry-pick
</a>
</div>
</div>
</div>
</div>
`
,
`
,
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_missing_branch.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
mrWidgetMergeHelp
from
'
../../components/mr_widget_merge_help
'
;
import
mrWidgetMergeHelp
from
'
../../components/mr_widget_merge_help
'
;
export
default
{
export
default
{
...
@@ -7,28 +8,30 @@ export default {
...
@@ -7,28 +8,30 @@ export default {
},
},
components
:
{
components
:
{
'
mr-widget-merge-help
'
:
mrWidgetMergeHelp
,
'
mr-widget-merge-help
'
:
mrWidgetMergeHelp
,
statusIcon
,
},
},
computed
:
{
computed
:
{
missingBranchName
()
{
missingBranchName
()
{
return
this
.
mr
.
sourceBranchRemoved
?
'
source
'
:
'
target
'
;
return
this
.
mr
.
sourceBranchRemoved
?
'
source
'
:
'
target
'
;
},
},
message
()
{
return
`If the
${
this
.
missingBranchName
}
branch exists in your local repository, you can merge this merge request manually using the command line`
;
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold js-branch-text">
disabled="true">
<span class="capitalize">
Merge
{{missingBranchName}}
</button>
</span> branch does not exist.
<span class="bold js-branch-text">
Please restore it or use a different {{missingBranchName}} branch
<span class="capitalize">
<i
{{missingBranchName}}
class="fa fa-question-circle has-tooltip"
</span> branch does not exist.
:title="message" />
Please restore the {{missingBranchName}} branch or use a different {{missingBranchName}} branch.
</span>
</span>
</div>
<mr-widget-merge-help
:missing-branch="missingBranchName" />
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_not_allowed.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetNotAllowed
'
,
name
:
'
MRWidgetNotAllowed
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="success" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
Ready to be merged automatically.
Merge
Ask someone with write access to this repository to merge this request
</button>
</span>
<span class="bold">
</div>
Ready to be merged automatically.
Ask someone with write access to this repository to merge this request.
</span>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_nothing_to_merge.js
View file @
4dd5bd4c
...
@@ -12,7 +12,7 @@ export default {
...
@@ -12,7 +12,7 @@ export default {
return
{
emptyStateSVG
};
return
{
emptyStateSVG
};
},
},
template
:
`
template
:
`
<div class="mr-widget-body empty-state">
<div class="mr-widget-body
mr-widget-
empty-state">
<div class="row">
<div class="row">
<div class="artwork col-sm-5 col-sm-push-7 col-xs-12 text-center">
<div class="artwork col-sm-5 col-sm-push-7 col-xs-12 text-center">
<span v-html="emptyStateSVG"></span>
<span v-html="emptyStateSVG"></span>
...
@@ -29,12 +29,14 @@ export default {
...
@@ -29,12 +29,14 @@ export default {
Currently there are no changes in this merge request's source branch.
Currently there are no changes in this merge request's source branch.
Please push new commits or use a different branch.
Please push new commits or use a different branch.
</p>
</p>
<a
<div>
v-if="mr.newBlobPath"
<a
:href="mr.newBlobPath"
v-if="mr.newBlobPath"
class="btn btn-inverted btn-save">
:href="mr.newBlobPath"
Create file
class="btn btn-inverted btn-save">
</a>
Create file
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
...
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_blocked.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetPipelineBlocked
'
,
name
:
'
MRWidgetPipelineBlocked
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
Pipeline blocked. The pipeline for this merge request requires a manual action to proceed
Merge
</span>
</button>
</div>
<span class="bold">
Pipeline blocked. The pipeline for this merge request requires a manual action to proceed.
</span>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_pipeline_failed.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetPipelineBlocked
'
,
name
:
'
MRWidgetPipelineBlocked
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
class="btn btn-success btn-small"
<div class="media-body space-children">
disabled="true"
<span class="bold">
type="button">
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure
Merge
</span>
</button>
</div>
<span class="bold">
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure.
</span>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_ready_to_merge.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
successSvg
from
'
icons/_icon_status_success.svg
'
;
import
successSvg
from
'
icons/_icon_status_success.svg
'
;
import
warningSvg
from
'
icons/_icon_status_warning.svg
'
;
import
warningSvg
from
'
icons/_icon_status_warning.svg
'
;
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
export
default
{
export
default
{
...
@@ -25,6 +25,9 @@ export default {
...
@@ -25,6 +25,9 @@ export default {
warningSvg
,
warningSvg
,
};
};
},
},
components
:
{
statusIcon
,
},
computed
:
{
computed
:
{
commitMessageLinkTitle
()
{
commitMessageLinkTitle
()
{
const
withDesc
=
'
Include description in commit message
'
;
const
withDesc
=
'
Include description in commit message
'
;
...
@@ -200,90 +203,103 @@ export default {
...
@@ -200,90 +203,103 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<span class="btn-group">
<status-icon status="success" />
<button
<div class="media-body">
@click="handleMergeButtonClick()"
<div class="media space-children">
:disabled="isMergeButtonDisabled"
<span class="btn-group">
:class="mergeButtonClass"
<button
type="button">
@click="handleMergeButtonClick()"
<i
:disabled="isMergeButtonDisabled"
v-if="isMakingRequest"
:class="mergeButtonClass"
class="fa fa-spinner fa-spin"
type="button">
aria-hidden="true" />
<i
{{mergeButtonText}}
v-if="isMakingRequest"
</button>
class="fa fa-spinner fa-spin"
<button
aria-hidden="true" />
v-if="shouldShowMergeOptionsDropdown"
{{mergeButtonText}}
:disabled="isMergeButtonDisabled"
</button>
type="button"
<button
class="btn btn-small btn-info dropdown-toggle"
v-if="shouldShowMergeOptionsDropdown"
data-toggle="dropdown">
:disabled="isMergeButtonDisabled"
<i
type="button"
class="fa fa-caret-down"
class="btn btn-small btn-info dropdown-toggle js-merge-moment"
aria-hidden="true" />
data-toggle="dropdown"
<span class="sr-only">
aria-label="Select merge moment">
Select merge moment
<i
class="fa fa-chevron-down"
aria-hidden="true" />
</button>
<ul
v-if="shouldShowMergeOptionsDropdown"
class="dropdown-menu dropdown-menu-right"
role="menu">
<li>
<a
@click.prevent="handleMergeButtonClick(true)"
class="merge_when_pipeline_succeeds"
href="#">
<span class="media">
<span
v-html="successSvg"
class="merge-opt-icon"
aria-hidden="true"></span>
<span class="media-body merge-opt-title">Merge when pipeline succeeds</span>
</span>
</a>
</li>
<li>
<a
@click.prevent="handleMergeButtonClick(false, true)"
class="accept-merge-request"
href="#">
<span class="media">
<span
v-html="warningSvg"
class="merge-opt-icon"
aria-hidden="true"></span>
<span class="media-body merge-opt-title">Merge immediately</span>
</span>
</a>
</li>
</ul>
</span>
</span>
</button>
<div class="media-body space-children">
<ul
<template v-if="isMergeAllowed()">
v-if="shouldShowMergeOptionsDropdown"
<label>
class="dropdown-menu dropdown-menu-right"
<input
role="menu">
id="remove-source-branch-input"
<li>
v-model="removeSourceBranch"
<a
:disabled="isRemoveSourceBranchButtonDisabled"
@click.prevent="handleMergeButtonClick(true)"
type="checkbox"/> Remove source branch
class="merge_when_pipeline_succeeds"
</label>
href="#">
<span
v-html="successSvg"
class="merge-opt-icon"
aria-hidden="true"></span>
<span class="merge-opt-title">Merge when pipeline succeeds</span>
</a>
</li>
<li>
<a
@click.prevent="handleMergeButtonClick(false, true)"
class="accept-merge-request"
href="#">
<span
v-html="warningSvg"
class="merge-opt-icon"
aria-hidden="true"></span>
<span class="merge-opt-title">Merge immediately</span>
</a>
</li>
</ul>
</span>
<template v-if="isMergeAllowed()">
<label class="spacing">
<input
id="remove-source-branch-input"
v-model="removeSourceBranch"
:disabled="isRemoveSourceBranchButtonDisabled"
type="checkbox"/> Remove source branch
</label>
<!-- Placeholder for EE extension of this component -->
<!-- Placeholder for EE extension of this component -->
<squash-before-merge
<squash-before-merge
v-if="shouldShowSquashBeforeMerge"
v-if="shouldShowSquashBeforeMerge"
:mr="mr"
:mr="mr"
:is-merge-button-disabled="isMergeButtonDisabled" />
:is-merge-button-disabled="isMergeButtonDisabled" />
<span v-if="mr.ffOnlyEnabled">
Fast-forward merge without a merge commit
</span>
<span v-else>
<button
@click="toggleCommitMessageEditor"
:disabled="isMergeButtonDisabled"
class="btn btn-default btn-xs"
type="button">
Modify commit message
</button>
</span>
<span v-if="mr.ffOnlyEnabled">
Fast-forward merge without a merge commit
</span>
<span v-else>
<button
@click="toggleCommitMessageEditor"
:disabled="isMergeButtonDisabled"
class="btn btn-default btn-xs"
type="button">
Modify commit message
</button>
</span>
</template>
<template v-else>
<span class="bold">
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure
</span>
</template>
</div>
</div>
<div
<div
v-if="showCommitMessageEditor"
v-if="showCommitMessageEditor"
class="prepend-top-default commit-message-editor">
class="prepend-top-default commit-message-editor">
...
@@ -303,7 +319,7 @@ export default {
...
@@ -303,7 +319,7 @@ export default {
rows="14"
rows="14"
name="Commit message"></textarea>
name="Commit message"></textarea>
</div>
</div>
<p class="hint">Try to keep the first line under 52 characters and the others under 72
.
</p>
<p class="hint">Try to keep the first line under 52 characters and the others under 72</p>
<div class="hint">
<div class="hint">
<a
<a
@click.prevent="updateCommitMessage"
@click.prevent="updateCommitMessage"
...
@@ -312,12 +328,7 @@ export default {
...
@@ -312,12 +328,7 @@ export default {
</div>
</div>
</div>
</div>
</div>
</div>
</template>
</div>
<template v-else>
<span class="bold">
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure.
</span>
</template>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_sha_mismatch.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetSHAMismatch
'
,
name
:
'
MRWidgetSHAMismatch
'
,
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
The source branch HEAD has recently changed. Please reload the page and review the changes before merging
Merge
</span>
</button>
</div>
<span class="bold">
The source branch HEAD has recently changed. Please reload the page and review the changes before merging.
</span>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_unresolved_discussions.js
View file @
4dd5bd4c
import
statusIcon
from
'
../mr_widget_status_icon
'
;
export
default
{
export
default
{
name
:
'
MRWidgetUnresolvedDiscussions
'
,
name
:
'
MRWidgetUnresolvedDiscussions
'
,
props
:
{
props
:
{
mr
:
{
type
:
Object
,
required
:
true
},
mr
:
{
type
:
Object
,
required
:
true
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" showDisabledButton />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
There are unresolved discussions. Please resolve these discussions
Merge
</span>
</button>
<a
<span class="bold">
v-if="mr.createIssueToResolveDiscussionsPath"
There are unresolved discussions. Please resolve these discussions
:href="mr.createIssueToResolveDiscussionsPath"
<span v-if="mr.canCreateIssue">or</span>
class="btn btn-default btn-xs js-create-issue">
<span v-else>.</span>
Create an issue to resolve them later
</span>
</a>
<a
</div>
v-if="mr.createIssueToResolveDiscussionsPath"
:href="mr.createIssueToResolveDiscussionsPath"
class="btn btn-default btn-xs js-create-issue">
Create an issue to resolve them later
</a>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_wip.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
statusIcon
from
'
../mr_widget_status_icon
'
;
import
eventHub
from
'
../../event_hub
'
;
import
eventHub
from
'
../../event_hub
'
;
export
default
{
export
default
{
...
@@ -28,21 +29,21 @@ export default {
...
@@ -28,21 +29,21 @@ export default {
});
});
},
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<button
<status-icon status="failed" :showDisabledButton="Boolean(mr.removeWIPPath)" />
type="button"
<div class="media-body space-children">
class="btn btn-success btn-small"
<span class="bold">
disabled="true">
This is a Work in Progress
Merge</button>
<i
<span class="bold">
class="fa fa-question-circle has-tooltip"
This merge request is currently Work In Progress and therefore unable to merge
title="When this merge request is ready, remove the WIP: prefix from the title to allow it to be merged." />
</span>
</span>
<template v-if="mr.removeWIPPath">
<i
class="fa fa-question-circle has-tooltip"
title="When this merge request is ready, remove the WIP: prefix from the title to allow it to be merged." />
<button
<button
v-if="mr.removeWIPPath"
@click="removeWIP"
@click="removeWIP"
:disabled="isMakingRequest"
:disabled="isMakingRequest"
type="button"
type="button"
...
@@ -53,7 +54,7 @@ export default {
...
@@ -53,7 +54,7 @@ export default {
aria-hidden="true" />
aria-hidden="true" />
Resolve WIP status
Resolve WIP status
</button>
</button>
</
template
>
</
div
>
</div>
</div>
`
,
`
,
};
};
app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
4dd5bd4c
...
@@ -35,8 +35,13 @@ import {
...
@@ -35,8 +35,13 @@ import {
export
default
{
export
default
{
el
:
'
#js-vue-mr-widget
'
,
el
:
'
#js-vue-mr-widget
'
,
name
:
'
MRWidget
'
,
name
:
'
MRWidget
'
,
props
:
{
mrData
:
{
type
:
Object
,
},
},
data
()
{
data
()
{
const
store
=
new
MRWidgetStore
(
gl
.
mrWidgetData
);
const
store
=
new
MRWidgetStore
(
this
.
mrData
||
window
.
gl
.
mrWidgetData
);
const
service
=
this
.
createService
(
store
);
const
service
=
this
.
createService
(
store
);
return
{
return
{
mr
:
store
,
mr
:
store
,
...
@@ -232,14 +237,19 @@ export default {
...
@@ -232,14 +237,19 @@ export default {
v-if="shouldRenderDeployments"
v-if="shouldRenderDeployments"
:mr="mr"
:mr="mr"
:service="service" />
:service="service" />
<component
<div class="mr-widget-section">
:is="componentName"
<component
:mr="mr"
:is="componentName"
:service="service" />
:mr="mr"
<mr-widget-related-links
:service="service" />
v-if="shouldRenderRelatedLinks"
<mr-widget-related-links
:related-links="mr.relatedLinks" />
v-if="shouldRenderRelatedLinks"
<mr-widget-merge-help v-if="shouldRenderMergeHelp" />
:state="mr.state"
:related-links="mr.relatedLinks" />
</div>
<div class="mr-widget-footer" v-if="shouldRenderMergeHelp">
<mr-widget-merge-help />
</div>
</div>
</div>
`
,
`
,
};
};
app/assets/stylesheets/framework.scss
View file @
4dd5bd4c
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
@import
'framework/tw_bootstrap_variables'
;
@import
'framework/tw_bootstrap_variables'
;
@import
'framework/tw_bootstrap'
;
@import
'framework/tw_bootstrap'
;
@import
"framework/layout"
;
@import
"framework/layout"
;
@import
"framework/animations"
;
@import
"framework/animations"
;
@import
"framework/avatar"
;
@import
"framework/avatar"
;
@import
"framework/asciidoctor"
;
@import
"framework/asciidoctor"
;
...
@@ -26,8 +25,10 @@
...
@@ -26,8 +25,10 @@
@import
"framework/lists"
;
@import
"framework/lists"
;
@import
"framework/logo"
;
@import
"framework/logo"
;
@import
"framework/markdown_area"
;
@import
"framework/markdown_area"
;
@import
"framework/media_object"
;
@import
"framework/mobile"
;
@import
"framework/mobile"
;
@import
"framework/modal"
;
@import
"framework/modal"
;
@import
"framework/media_object"
;
@import
"framework/nav"
;
@import
"framework/nav"
;
@import
"framework/pagination"
;
@import
"framework/pagination"
;
@import
"framework/panels"
;
@import
"framework/panels"
;
...
...
app/assets/stylesheets/framework/media_object.scss
0 → 100644
View file @
4dd5bd4c
.media
{
display
:
flex
;
align-items
:
flex-start
;
}
.media-body
{
flex
:
1
;
}
app/assets/stylesheets/pages/merge_requests.scss
View file @
4dd5bd4c
This diff is collapsed.
Click to expand it.
app/assets/stylesheets/pages/pipelines.scss
View file @
4dd5bd4c
...
@@ -247,7 +247,11 @@
...
@@ -247,7 +247,11 @@
position
:
relative
;
position
:
relative
;
vertical-align
:
middle
;
vertical-align
:
middle
;
height
:
22px
;
height
:
22px
;
margin
:
3px
6px
3px
0
;
margin
:
3px
0
;
+
.stage-container
{
margin-left
:
6px
;
}
// Hack to show a button tooltip inline
// Hack to show a button tooltip inline
button
.has-tooltip
+
.tooltip
{
button
.has-tooltip
+
.tooltip
{
...
...
changelogs/unreleased-ee/33095-mr-widget-ui-ee.yml
0 → 100644
View file @
4dd5bd4c
---
title
:
clean up merge request widget UI
merge_request
:
author
:
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_body.js
View file @
4dd5bd4c
...
@@ -70,7 +70,7 @@ export default {
...
@@ -70,7 +70,7 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="approvals-body">
<div class="approvals-body
space-children
">
<span v-if="showApproveButton" class="approvals-approve-button-wrap">
<span v-if="showApproveButton" class="approvals-approve-button-wrap">
<button
<button
:disabled="approving"
:disabled="approving"
...
...
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/approvals_footer.js
View file @
4dd5bd4c
...
@@ -65,8 +65,7 @@ export default {
...
@@ -65,8 +65,7 @@ export default {
},
},
template
:
`
template
:
`
<div v-if="approvedBy.length" class="approved-by-users approvals-footer clearfix mr-info-list">
<div v-if="approvedBy.length" class="approved-by-users approvals-footer clearfix mr-info-list">
<div class="legend"></div>
<div class="approvers-prefix space-children">
<div class="approvers-prefix">
<p>Approved by</p>
<p>Approved by</p>
<div class="approvers-list">
<div class="approvers-list">
<span v-for="approver in approvedBy">
<span v-for="approver in approvedBy">
...
@@ -89,7 +88,7 @@ export default {
...
@@ -89,7 +88,7 @@ export default {
<button
<button
:disabled="unapproving"
:disabled="unapproving"
@click="unapproveMergeRequest"
@click="unapproveMergeRequest"
class="btn btn-
sm
">
class="btn btn-
xs
">
<i
<i
v-if="unapproving"
v-if="unapproving"
class="fa fa-spinner fa-spin"
class="fa fa-spinner fa-spin"
...
...
ee/app/assets/javascripts/vue_merge_request_widget/components/approvals/mr_widget_approvals.js
View file @
4dd5bd4c
/* global Flash */
/* global Flash */
import
statusIcon
from
'
~/vue_merge_request_widget/components/mr_widget_status_icon
'
;
import
ApprovalsBody
from
'
./approvals_body
'
;
import
ApprovalsBody
from
'
./approvals_body
'
;
import
ApprovalsFooter
from
'
./approvals_footer
'
;
import
ApprovalsFooter
from
'
./approvals_footer
'
;
...
@@ -23,6 +24,15 @@ export default {
...
@@ -23,6 +24,15 @@ export default {
components
:
{
components
:
{
'
approvals-body
'
:
ApprovalsBody
,
'
approvals-body
'
:
ApprovalsBody
,
'
approvals-footer
'
:
ApprovalsFooter
,
'
approvals-footer
'
:
ApprovalsFooter
,
statusIcon
,
},
computed
:
{
status
()
{
if
(
this
.
mr
.
approvals
.
approvals_left
>
0
)
{
return
'
failed
'
;
}
return
'
success
'
;
},
},
},
created
()
{
created
()
{
const
flashErrorMessage
=
'
An error occured while retrieving approval data for this merge request.
'
;
const
flashErrorMessage
=
'
An error occured while retrieving approval data for this merge request.
'
;
...
@@ -37,18 +47,23 @@ export default {
...
@@ -37,18 +47,23 @@ export default {
template
:
`
template
:
`
<div
<div
v-if="mr.approvalsRequired"
v-if="mr.approvalsRequired"
class="mr-widget-approvals-container mr-widget-body">
class="mr-widget-approvals-container mr-widget-body mr-widget-section media">
<div
v-if="fetchingApprovals"
class="mr-widget-icon">
<i class="fa fa-spinner fa-spin" />
</div>
<status-icon v-else :status="status" />
<div
<div
v-show="fetchingApprovals"
v-show="fetchingApprovals"
class="mr-approvals-loading-state">
class="mr-approvals-loading-state
media-body
">
<span class="approvals-loading-text
bold
">
<span class="approvals-loading-text">
Checking approval status
for this merge request.
Checking approval status
</span>
</span>
<i class="fa fa-spinner fa-spin" />
</div>
</div>
<div
<div
v-if="!fetchingApprovals"
v-if="!fetchingApprovals"
class="approvals-components">
class="approvals-components
media-body
">
<approvals-body
<approvals-body
:mr="mr"
:mr="mr"
:service="service"
:service="service"
...
...
ee/app/assets/javascripts/vue_merge_request_widget/components/mr_widget_code_quality.vue
View file @
4dd5bd4c
<
script
>
<
script
>
import
successIcon
from
'
icons/_icon_status_success.svg
'
;
import
statusIcon
from
'
~/vue_merge_request_widget/components/mr_widget_status_icon
'
;
import
errorIcon
from
'
icons/_icon_status_failed.svg
'
;
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
loadingIcon
from
'
~/vue_shared/components/loading_icon.vue
'
;
import
'
~/lib/utils/text_utility
'
;
import
'
~/lib/utils/text_utility
'
;
import
issuesBlock
from
'
./mr_widget_code_quality_issues.vue
'
;
import
issuesBlock
from
'
./mr_widget_code_quality_issues.vue
'
;
...
@@ -22,6 +21,7 @@ export default {
...
@@ -22,6 +21,7 @@ export default {
components
:
{
components
:
{
issuesBlock
,
issuesBlock
,
loadingIcon
,
loadingIcon
,
statusIcon
,
},
},
data
()
{
data
()
{
...
@@ -34,8 +34,11 @@ export default {
...
@@ -34,8 +34,11 @@ export default {
},
},
computed
:
{
computed
:
{
stateIcon
()
{
status
()
{
return
this
.
mr
.
codeclimateMetrics
.
newIssues
.
length
?
errorIcon
:
successIcon
;
if
(
this
.
loadingFailed
||
this
.
mr
.
codeclimateMetrics
.
newIssues
.
length
)
{
return
'
failed
'
;
}
return
'
success
'
;
},
},
hasNoneIssues
()
{
hasNoneIssues
()
{
...
@@ -55,7 +58,7 @@ export default {
...
@@ -55,7 +58,7 @@ export default {
let
text
=
[];
let
text
=
[];
if
(
this
.
hasNoneIssues
)
{
if
(
this
.
hasNoneIssues
)
{
text
.
push
(
'
No changes to code quality
.
'
);
text
.
push
(
'
No changes to code quality
'
);
}
else
if
(
this
.
hasIssues
)
{
}
else
if
(
this
.
hasIssues
)
{
if
(
newIssues
.
length
)
{
if
(
newIssues
.
length
)
{
newIssuesText
=
` degraded on
${
newIssues
.
length
}
${
this
.
pointsText
(
newIssues
)}
`
;
newIssuesText
=
` degraded on
${
newIssues
.
length
}
${
this
.
pointsText
(
newIssues
)}
`
;
...
@@ -79,8 +82,6 @@ export default {
...
@@ -79,8 +82,6 @@ export default {
if
(
newIssuesText
)
{
if
(
newIssuesText
)
{
text
.
push
(
newIssuesText
);
text
.
push
(
newIssuesText
);
}
}
text
.
push
(
'
.
'
);
}
}
return
text
.
join
(
''
);
return
text
.
join
(
''
);
...
@@ -128,61 +129,66 @@ export default {
...
@@ -128,61 +129,66 @@ export default {
};
};
</
script
>
</
script
>
<
template
>
<
template
>
<section
class=
"mr-widget-code-quality"
>
<section
class=
"mr-widget-code-quality mr-widget-section"
>
<div
<div
v-if=
"isLoading"
v-if=
"isLoading"
class=
"padding-left"
>
class=
"media"
>
<i
<div
class=
"mr-widget-icon"
>
class=
"fa fa-spinner fa-spin"
<i
aria-hidden=
"true"
>
class=
"fa fa-spinner fa-spin"
</i>
aria-hidden=
"true"
>
Loading codeclimate report.
</i>
</div>
<div
class=
"media-body"
>
Loading codeclimate report
</div>
</div>
</div>
<div
v-else-if=
"!isLoading && !loadingFailed"
>
<div
<span
v-else-if=
"!isLoading && !loadingFailed"
class=
"padding-left ci-status-icon"
class=
"media"
>
:class=
"
{
<status-icon
:status=
"status"
/>
'ci-status-icon-failed': mr.codeclimateMetrics.newIssues.length,
<div
class=
"media-body space-children"
>
'ci-status-icon-passed': mr.codeclimateMetrics.newIssues.length === 0
<span
class=
"js-code-text"
>
}"
{{
codeText
}}
v-html="stateIcon">
</span>
</span>
<span>
<button
{{
codeText
}}
type=
"button"
</span>
class=
"btn-link btn-blank"
v-if=
"hasIssues"
<button
@
click=
"toggleCollapsed"
>
type=
"button"
{{
collapseText
}}
class=
"btn-link btn-blank"
</button>
v-if=
"hasIssues"
@
click=
"toggleCollapsed"
>
{{
collapseText
}}
</button>
<div
class=
"code-quality-container"
v-if=
"hasIssues"
v-show=
"!isCollapsed"
>
<issues-block
class=
"js-mr-code-resolved-issues"
v-if=
"mr.codeclimateMetrics.resolvedIssues.length"
type=
"success"
:issues=
"mr.codeclimateMetrics.resolvedIssues"
/>
<issues-block
class=
"js-mr-code-new-issues"
v-if=
"mr.codeclimateMetrics.newIssues.length"
type=
"failed"
:issues=
"mr.codeclimateMetrics.newIssues"
/>
</div>
</div>
</div>
</div>
<div
class=
"code-quality-container"
v-if=
"hasIssues"
v-show=
"!isCollapsed"
>
<issues-block
class=
"js-mr-code-resolved-issues"
v-if=
"mr.codeclimateMetrics.resolvedIssues.length"
type=
"success"
:issues=
"mr.codeclimateMetrics.resolvedIssues"
/>
<issues-block
class=
"js-mr-code-new-issues"
v-if=
"mr.codeclimateMetrics.newIssues.length"
type=
"failed"
:issues=
"mr.codeclimateMetrics.newIssues"
/>
</div>
<div
<div
v-else-if=
"loadingFailed"
v-else-if=
"loadingFailed"
class=
"padding-left"
>
class=
"media"
>
Failed to load codeclimate report.
<status-icon
status=
"failed"
/>
<div
class=
"media-body"
>
Failed to load codeclimate report
</div>
</div>
</div>
</section>
</section>
</
template
>
</
template
>
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_rebase.js
View file @
4dd5bd4c
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
simplePoll
from
'
~/lib/utils/simple_poll
'
;
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
eventHub
from
'
~/vue_merge_request_widget/event_hub
'
;
import
statusIcon
from
'
~/vue_merge_request_widget/components/mr_widget_status_icon
'
;
export
default
{
export
default
{
props
:
{
props
:
{
...
@@ -14,11 +15,28 @@ export default {
...
@@ -14,11 +15,28 @@ export default {
required
:
true
,
required
:
true
,
},
},
},
},
components
:
{
statusIcon
,
},
data
()
{
data
()
{
return
{
return
{
isMakingRequest
:
false
,
isMakingRequest
:
false
,
};
};
},
},
computed
:
{
status
()
{
if
(
this
.
mr
.
rebaseInProgress
||
this
.
isMakingRequest
)
{
return
'
loading
'
;
}
if
(
!
this
.
mr
.
canPushToSourceBranch
&&
!
this
.
mr
.
rebaseInProgress
)
{
return
'
failed
'
;
}
return
'
success
'
;
},
showDisabledButton
()
{
return
[
'
failed
'
,
'
loading
'
].
includes
(
this
.
status
);
},
},
methods
:
{
methods
:
{
rebase
()
{
rebase
()
{
this
.
isMakingRequest
=
true
;
this
.
isMakingRequest
=
true
;
...
@@ -48,38 +66,24 @@ export default {
...
@@ -48,38 +66,24 @@ export default {
},
},
},
},
template
:
`
template
:
`
<div class="mr-widget-body">
<div class="mr-widget-body media">
<div class="rebase-state-find-class-convention">
<status-icon :status="status" :showDisabledButton="showDisabledButton" />
<div class="rebase-state-find-class-convention media media-body space-children">
<template v-if="mr.rebaseInProgress || isMakingRequest">
<template v-if="mr.rebaseInProgress || isMakingRequest">
<button
type="button"
class="btn btn-success btn-small"
disabled="true">
Merge
</button>
<span class="bold">
<span class="bold">
<i
Rebase in progress
class="fa fa-spinner fa-spin"
aria-hidden="true" />
Rebase in progress. This merge request is in the process of being rebased.
</span>
</span>
</template>
</template>
<template v-if="!mr.rebaseInProgress && !mr.canPushToSourceBranch">
<template v-if="!mr.rebaseInProgress && !mr.canPushToSourceBranch">
<button
type="button"
class="btn btn-success btn-small"
disabled="true">
Merge
</button>
<span class="bold">
<span class="bold">
Fast-forward merge is not possible.
Fast-forward merge is not possible.
Rebase the source branch onto
Rebase the source branch onto
<span class="label-branch">{{mr.targetBranch}}</span>
<span class="label-branch">{{mr.targetBranch}}</span>
to allow this merge request to be merged
.
to allow this merge request to be merged
</span>
</span>
</template>
</template>
<template v-if="!mr.rebaseInProgress && mr.canPushToSourceBranch && !isMakingRequest">
<template v-if="!mr.rebaseInProgress && mr.canPushToSourceBranch && !isMakingRequest">
<div class="accept-merge-holder clearfix js-toggle-container accept-action">
<div class="accept-merge-holder clearfix js-toggle-container accept-action
media space-children
">
<button
<button
class="btn btn-small btn-reopen btn-success"
class="btn btn-small btn-reopen btn-success"
:disabled="isMakingRequest"
:disabled="isMakingRequest"
...
@@ -93,7 +97,7 @@ export default {
...
@@ -93,7 +97,7 @@ export default {
<span class="bold">
<span class="bold">
Fast-forward merge is not possible.
Fast-forward merge is not possible.
Rebase the source branch onto the target branch or merge target
Rebase the source branch onto the target branch or merge target
branch into source branch to allow this merge request to be merged
.
branch into source branch to allow this merge request to be merged
</span>
</span>
</div>
</div>
</template>
</template>
...
...
ee/app/assets/javascripts/vue_merge_request_widget/components/states/mr_widget_secondary_geo_node.js
View file @
4dd5bd4c
import
statusIcon
from
'
~/vue_merge_request_widget/components/mr_widget_status_icon
'
;
export
default
{
export
default
{
props
:
{
props
:
{
mr
:
{
mr
:
{
...
@@ -5,22 +7,27 @@ export default {
...
@@ -5,22 +7,27 @@ export default {
required
:
true
,
required
:
true
,
},
},
},
},
components
:
{
statusIcon
,
},
template
:
`
template
:
`
<div>
<div class="media">
<button type="button" class="btn btn-success btn-small" disabled="true">Merge</button>
<status-icon status="failed" showDisabledButton />
<span class="bold">
<div class="media-body">
Merge requests are read-only in a secondary Geo node.
<span class="bold">
</span>
Merge requests are read-only in a secondary Geo node
<a
</span>
:href="mr.geoSecondaryHelpPath"
<a
data-title="About this feature"
:href="mr.geoSecondaryHelpPath"
data-toggle="tooltip"
data-title="About this feature"
data-placement="bottom"
data-toggle="tooltip"
target="_blank"
data-placement="bottom"
rel="noopener noreferrer nofollow"
target="_blank"
data-container="body">
rel="noopener noreferrer nofollow"
<i class="fa fa-question-circle"></i>
data-container="body">
</a>
<i class="fa fa-question-circle"></i>
</a>
</div>
</div>
</div>
`
,
`
,
};
};
ee/app/assets/javascripts/vue_merge_request_widget/mr_widget_options.js
View file @
4dd5bd4c
...
@@ -40,14 +40,18 @@ export default {
...
@@ -40,14 +40,18 @@ export default {
:mr="mr"
:mr="mr"
:service="service"
:service="service"
/>
/>
<component
<div class="mr-widget-section">
:is="componentName"
<component
:mr="mr"
:is="componentName"
:service="service" />
:mr="mr"
<mr-widget-related-links
:service="service" />
v-if="shouldRenderRelatedLinks"
<mr-widget-related-links
:related-links="mr.relatedLinks" />
v-if="shouldRenderRelatedLinks"
<mr-widget-merge-help v-if="shouldRenderMergeHelp" />
:related-links="mr.relatedLinks" />
</div>
<div class="mr-widget-footer" v-if="shouldRenderMergeHelp">
<mr-widget-merge-help />
</div>
</div>
</div>
`
,
`
,
};
};
spec/features/merge_requests/closes_issues_spec.rb
View file @
4dd5bd4c
...
@@ -26,17 +26,11 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -26,17 +26,11 @@ feature 'Merge Request closing issues message', js: true do
wait_for_requests
wait_for_requests
end
end
context
'not closing or mentioning any issue'
do
it
'does not display closing issue message'
do
expect
(
page
).
not_to
have_css
(
'.mr-widget-footer'
)
end
end
context
'closing issues but not mentioning any other issue'
do
context
'closing issues but not mentioning any other issue'
do
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_description
)
{
"Description
\n\n
closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
issues
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -44,7 +38,7 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -44,7 +38,7 @@ feature 'Merge Request closing issues message', js: true do
let
(
:merge_request_description
)
{
"Description
\n\n
Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_description
)
{
"Description
\n\n
Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"
Issues
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
are mentioned but will not be closed.
"
)
expect
(
page
).
to
have_content
(
"
Mentions
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -52,8 +46,8 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -52,8 +46,8 @@ feature 'Merge Request closing issues message', js: true do
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
issue
#{
issue_1
.
to_reference
}
.
"
)
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"
Issue
#{
issue_2
.
to_reference
}
is mentioned but will not be closed.
"
)
expect
(
page
).
to
have_content
(
"
Mentions
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -61,7 +55,7 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -61,7 +55,7 @@ feature 'Merge Request closing issues message', js: true do
let
(
:merge_request_title
)
{
"closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"closing
#{
issue_1
.
to_reference
}
,
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
issues
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -69,7 +63,7 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -69,7 +63,7 @@ feature 'Merge Request closing issues message', js: true do
let
(
:merge_request_title
)
{
"Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"Refers to
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"
Issues
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
are mentioned but will not be closed.
"
)
expect
(
page
).
to
have_content
(
"
Mentions
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -77,8 +71,8 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -77,8 +71,8 @@ feature 'Merge Request closing issues message', js: true do
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
let
(
:merge_request_title
)
{
"closes
#{
issue_1
.
to_reference
}
\n\n
refers to
#{
issue_2
.
to_reference
}
"
}
it
'does not display closing issue message'
do
it
'does not display closing issue message'
do
expect
(
page
).
to
have_content
(
"Closes
issue
#{
issue_1
.
to_reference
}
. Issue
#{
issue_2
.
to_reference
}
is mentioned but will not be closed.
"
)
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
"
)
expect
(
page
).
to
have_content
(
"
Issue
#{
issue_2
.
to_reference
}
is mentioned but will not be closed.
"
)
expect
(
page
).
to
have_content
(
"
Mentions
#{
issue_2
.
to_reference
}
"
)
end
end
end
end
...
@@ -92,7 +86,7 @@ feature 'Merge Request closing issues message', js: true do
...
@@ -92,7 +86,7 @@ feature 'Merge Request closing issues message', js: true do
it
'displays closing issue message exactly one time'
do
it
'displays closing issue message exactly one time'
do
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_content
(
"Closes
issues
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
,
count:
1
)
expect
(
page
).
to
have_content
(
"Closes
#{
issue_1
.
to_reference
}
and
#{
issue_2
.
to_reference
}
"
,
count:
1
)
end
end
end
end
end
end
spec/features/merge_requests/merge_when_pipeline_succeeds_spec.rb
View file @
4dd5bd4c
...
@@ -41,8 +41,8 @@ feature 'Merge When Pipeline Succeeds', :js do
...
@@ -41,8 +41,8 @@ feature 'Merge When Pipeline Succeeds', :js do
it
'activates the Merge when pipeline succeeds feature'
do
it
'activates the Merge when pipeline succeeds feature'
do
click_button
"Merge when pipeline succeeds"
click_button
"Merge when pipeline succeeds"
expect
(
page
).
to
have_content
"Set by
#{
user
.
name
}
to be merged automatically when the pipeline succeeds
.
"
expect
(
page
).
to
have_content
"Set by
#{
user
.
name
}
to be merged automatically when the pipeline succeeds"
expect
(
page
).
to
have_content
"The source branch will not be removed
.
"
expect
(
page
).
to
have_content
"The source branch will not be removed"
expect
(
page
).
to
have_selector
".js-cancel-auto-merge"
expect
(
page
).
to
have_selector
".js-cancel-auto-merge"
visit_merge_request
(
merge_request
)
# Needed to refresh the page
visit_merge_request
(
merge_request
)
# Needed to refresh the page
expect
(
page
).
to
have_content
/enabled an automatic merge when the pipeline for \h{8} succeeds/i
expect
(
page
).
to
have_content
/enabled an automatic merge when the pipeline for \h{8} succeeds/i
...
@@ -97,11 +97,11 @@ feature 'Merge When Pipeline Succeeds', :js do
...
@@ -97,11 +97,11 @@ feature 'Merge When Pipeline Succeeds', :js do
describe
'enabling Merge when pipeline succeeds via dropdown'
do
describe
'enabling Merge when pipeline succeeds via dropdown'
do
it
'activates the Merge when pipeline succeeds feature'
do
it
'activates the Merge when pipeline succeeds feature'
do
click_button
'Select merge moment'
find
(
'.js-merge-moment'
).
click
click_link
'Merge when pipeline succeeds'
click_link
'Merge when pipeline succeeds'
expect
(
page
).
to
have_content
"Set by
#{
user
.
name
}
to be merged automatically when the pipeline succeeds
.
"
expect
(
page
).
to
have_content
"Set by
#{
user
.
name
}
to be merged automatically when the pipeline succeeds"
expect
(
page
).
to
have_content
"The source branch will not be removed
.
"
expect
(
page
).
to
have_content
"The source branch will not be removed"
expect
(
page
).
to
have_link
"Cancel automatic merge"
expect
(
page
).
to
have_link
"Cancel automatic merge"
end
end
end
end
...
...
spec/features/merge_requests/only_allow_merge_if_build_succeeds_spec.rb
View file @
4dd5bd4c
...
@@ -43,7 +43,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
...
@@ -43,7 +43,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_button
'Merge when pipeline succeeds'
expect
(
page
).
to
have_button
'Merge when pipeline succeeds'
expect
(
page
).
not_to
have_button
'
Select merge
moment'
expect
(
page
).
not_to
have_button
'
.js-merge-
moment'
end
end
end
end
...
@@ -56,7 +56,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
...
@@ -56,7 +56,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
wait_for_requests
wait_for_requests
expect
(
page
).
to
have_css
(
'button[disabled="disabled"]'
,
text:
'Merge'
)
expect
(
page
).
to
have_css
(
'button[disabled="disabled"]'
,
text:
'Merge'
)
expect
(
page
).
to
have_content
(
'Please retry the job or push a new commit to fix the failure
.
'
)
expect
(
page
).
to
have_content
(
'Please retry the job or push a new commit to fix the failure'
)
end
end
end
end
...
@@ -69,7 +69,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
...
@@ -69,7 +69,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
wait_for_requests
wait_for_requests
expect
(
page
).
not_to
have_button
'Merge'
expect
(
page
).
not_to
have_button
'Merge'
expect
(
page
).
to
have_content
(
'Please retry the job or push a new commit to fix the failure
.
'
)
expect
(
page
).
to
have_content
(
'Please retry the job or push a new commit to fix the failure'
)
end
end
end
end
...
@@ -113,7 +113,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
...
@@ -113,7 +113,7 @@ feature 'Only allow merge requests to be merged if the pipeline succeeds', js: t
expect
(
page
).
to
have_button
'Merge when pipeline succeeds'
expect
(
page
).
to
have_button
'Merge when pipeline succeeds'
click_button
'Select merge moment'
page
.
find
(
'.js-merge-moment'
).
click
expect
(
page
).
to
have_content
'Merge immediately'
expect
(
page
).
to
have_content
'Merge immediately'
end
end
end
end
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_code_quality_spec.js
View file @
4dd5bd4c
...
@@ -31,11 +31,11 @@ describe('Merge Request Code Quality', () => {
...
@@ -31,11 +31,11 @@ describe('Merge Request Code Quality', () => {
});
});
it
(
'
should render loading indicator
'
,
()
=>
{
it
(
'
should render loading indicator
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Loading codeclimate report
.
'
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Loading codeclimate report
'
);
});
});
});
});
describe
(
'
with successful
l
request
'
,
()
=>
{
describe
(
'
with successful request
'
,
()
=>
{
const
interceptor
=
(
request
,
next
)
=>
{
const
interceptor
=
(
request
,
next
)
=>
{
if
(
request
.
url
===
'
head.json
'
)
{
if
(
request
.
url
===
'
head.json
'
)
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
headIssues
),
{
next
(
request
.
respondWith
(
JSON
.
stringify
(
headIssues
),
{
...
@@ -66,8 +66,8 @@ describe('Merge Request Code Quality', () => {
...
@@ -66,8 +66,8 @@ describe('Merge Request Code Quality', () => {
it
(
'
should render provided data
'
,
(
done
)
=>
{
it
(
'
should render provided data
'
,
(
done
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
textContent
.
trim
(),
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
(),
).
toEqual
(
'
Code quality improved on 1 point and degraded on 1 point
.
'
);
).
toEqual
(
'
Code quality improved on 1 point and degraded on 1 point
'
);
done
();
done
();
},
0
);
},
0
);
});
});
...
@@ -79,8 +79,8 @@ describe('Merge Request Code Quality', () => {
...
@@ -79,8 +79,8 @@ describe('Merge Request Code Quality', () => {
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
textContent
.
trim
(),
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
(),
).
toEqual
(
'
Code quality improved on 1 point
.
'
);
).
toEqual
(
'
Code quality improved on 1 point
'
);
done
();
done
();
});
});
},
0
);
},
0
);
...
@@ -89,11 +89,10 @@ describe('Merge Request Code Quality', () => {
...
@@ -89,11 +89,10 @@ describe('Merge Request Code Quality', () => {
it
(
'
should only render information about added issues
'
,
(
done
)
=>
{
it
(
'
should only render information about added issues
'
,
(
done
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
vm
.
mr
.
codeclimateMetrics
.
resolvedIssues
=
[];
vm
.
mr
.
codeclimateMetrics
.
resolvedIssues
=
[];
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
textContent
.
trim
(),
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
(),
).
toEqual
(
'
Code quality degraded on 1 point
.
'
);
).
toEqual
(
'
Code quality degraded on 1 point
'
);
done
();
done
();
});
});
},
0
);
},
0
);
...
@@ -130,7 +129,7 @@ describe('Merge Request Code Quality', () => {
...
@@ -130,7 +129,7 @@ describe('Merge Request Code Quality', () => {
});
});
});
});
describe
(
'
with empty successful
l
request
'
,
()
=>
{
describe
(
'
with empty successful request
'
,
()
=>
{
const
emptyInterceptor
=
(
request
,
next
)
=>
{
const
emptyInterceptor
=
(
request
,
next
)
=>
{
if
(
request
.
url
===
'
head.json
'
)
{
if
(
request
.
url
===
'
head.json
'
)
{
next
(
request
.
respondWith
(
JSON
.
stringify
([]),
{
next
(
request
.
respondWith
(
JSON
.
stringify
([]),
{
...
@@ -161,8 +160,8 @@ describe('Merge Request Code Quality', () => {
...
@@ -161,8 +160,8 @@ describe('Merge Request Code Quality', () => {
it
(
'
should render provided data
'
,
(
done
)
=>
{
it
(
'
should render provided data
'
,
(
done
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
expect
(
vm
.
$el
.
querySelector
(
'
span:nth-child(2)
'
).
textContent
.
trim
(),
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
(),
).
toEqual
(
'
No changes to code quality
.
'
);
).
toEqual
(
'
No changes to code quality
'
);
done
();
done
();
},
0
);
},
0
);
});
});
...
@@ -198,7 +197,7 @@ describe('Merge Request Code Quality', () => {
...
@@ -198,7 +197,7 @@ describe('Merge Request Code Quality', () => {
it
(
'
should render error indicator
'
,
(
done
)
=>
{
it
(
'
should render error indicator
'
,
(
done
)
=>
{
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Failed to load codeclimate report
.
'
);
expect
(
vm
.
$el
.
textContent
.
trim
()).
toEqual
(
'
Failed to load codeclimate report
'
);
done
();
done
();
},
0
);
},
0
);
});
});
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_deployment_spec.js
View file @
4dd5bd4c
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/mr_widget_deployment
'
;
import
deploymentComponent
from
'
~/vue_merge_request_widget/components/mr_widget_deployment
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
MRWidgetService
from
'
~/vue_merge_request_widget/services/mr_widget_service
'
;
import
{
statusIconEntityMap
}
from
'
~/vue_shared/ci_status_icons
'
;
const
deploymentMockData
=
[
const
deploymentMockData
=
[
{
{
...
@@ -43,15 +42,6 @@ describe('MRWidgetDeployment', () => {
...
@@ -43,15 +42,6 @@ describe('MRWidgetDeployment', () => {
});
});
});
});
describe
(
'
computed
'
,
()
=>
{
describe
(
'
svg
'
,
()
=>
{
it
(
'
should have the proper SVG icon
'
,
()
=>
{
const
vm
=
createComponent
(
deploymentMockData
);
expect
(
vm
.
svg
).
toEqual
(
statusIconEntityMap
.
icon_status_success
);
});
});
});
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
let
vm
=
createComponent
();
let
vm
=
createComponent
();
const
deployment
=
deploymentMockData
[
0
];
const
deployment
=
deploymentMockData
[
0
];
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_memory_usage_spec.js
View file @
4dd5bd4c
...
@@ -52,10 +52,10 @@ const createComponent = () => {
...
@@ -52,10 +52,10 @@ const createComponent = () => {
};
};
const
messages
=
{
const
messages
=
{
loadingMetrics
:
'
Loading deployment statistics
.
'
,
loadingMetrics
:
'
Loading deployment statistics
'
,
hasMetrics
:
'
Memory usage unchanged from 0MB to 0MB
'
,
hasMetrics
:
'
Memory usage unchanged from 0MB to 0MB
'
,
loadFailed
:
'
Failed to load deployment statistics
.
'
,
loadFailed
:
'
Failed to load deployment statistics
'
,
metricsUnavailable
:
'
Deployment statistics are not available currently
.
'
,
metricsUnavailable
:
'
Deployment statistics are not available currently
'
,
};
};
describe
(
'
MemoryUsage
'
,
()
=>
{
describe
(
'
MemoryUsage
'
,
()
=>
{
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_pipeline_spec.js
View file @
4dd5bd4c
...
@@ -83,13 +83,12 @@ describe('MRWidgetPipeline', () => {
...
@@ -83,13 +83,12 @@ describe('MRWidgetPipeline', () => {
expect
(
el
.
querySelectorAll
(
'
.ci-status-icon.ci-status-icon-success
'
).
length
).
toEqual
(
1
);
expect
(
el
.
querySelectorAll
(
'
.ci-status-icon.ci-status-icon-success
'
).
length
).
toEqual
(
1
);
expect
(
el
.
querySelector
(
'
.pipeline-id
'
).
textContent
).
toContain
(
`#
${
pipeline
.
id
}
`
);
expect
(
el
.
querySelector
(
'
.pipeline-id
'
).
textContent
).
toContain
(
`#
${
pipeline
.
id
}
`
);
expect
(
el
.
innerText
).
toContain
(
'
passed
'
);
expect
(
el
.
innerText
).
toContain
(
'
passed
'
);
expect
(
el
.
innerText
).
toContain
(
'
with stages
'
);
expect
(
el
.
querySelector
(
'
.pipeline-id
'
).
getAttribute
(
'
href
'
)).
toEqual
(
pipeline
.
path
);
expect
(
el
.
querySelector
(
'
.pipeline-id
'
).
getAttribute
(
'
href
'
)).
toEqual
(
pipeline
.
path
);
expect
(
el
.
querySelectorAll
(
'
.stage-container
'
).
length
).
toEqual
(
2
);
expect
(
el
.
querySelectorAll
(
'
.stage-container
'
).
length
).
toEqual
(
2
);
expect
(
el
.
querySelector
(
'
.js-ci-error
'
)).
toEqual
(
null
);
expect
(
el
.
querySelector
(
'
.js-ci-error
'
)).
toEqual
(
null
);
expect
(
el
.
querySelector
(
'
.js-commit-link
'
).
getAttribute
(
'
href
'
)).
toEqual
(
pipeline
.
commit
.
commit_path
);
expect
(
el
.
querySelector
(
'
.js-commit-link
'
).
getAttribute
(
'
href
'
)).
toEqual
(
pipeline
.
commit
.
commit_path
);
expect
(
el
.
querySelector
(
'
.js-commit-link
'
).
textContent
).
toContain
(
pipeline
.
commit
.
short_id
);
expect
(
el
.
querySelector
(
'
.js-commit-link
'
).
textContent
).
toContain
(
pipeline
.
commit
.
short_id
);
expect
(
el
.
querySelector
(
'
.js-mr-coverage
'
).
textContent
).
toContain
(
`Coverage
${
pipeline
.
coverage
}
%
.
`
);
expect
(
el
.
querySelector
(
'
.js-mr-coverage
'
).
textContent
).
toContain
(
`Coverage
${
pipeline
.
coverage
}
%`
);
});
});
it
(
'
should list single stage
'
,
(
done
)
=>
{
it
(
'
should list single stage
'
,
(
done
)
=>
{
...
@@ -97,7 +96,6 @@ describe('MRWidgetPipeline', () => {
...
@@ -97,7 +96,6 @@ describe('MRWidgetPipeline', () => {
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
el
.
querySelectorAll
(
'
.stage-container button
'
).
length
).
toEqual
(
1
);
expect
(
el
.
querySelectorAll
(
'
.stage-container button
'
).
length
).
toEqual
(
1
);
expect
(
el
.
innerText
).
toContain
(
'
with stage
'
);
done
();
done
();
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/mr_widget_related_links_spec.js
View file @
4dd5bd4c
...
@@ -55,33 +55,17 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -55,33 +55,17 @@ describe('MRWidgetRelatedLinks', () => {
};
};
const
vm
=
createComponent
(
data
);
const
vm
=
createComponent
(
data
);
describe
(
'
hasMultipleIssues
'
,
()
=>
{
describe
(
'
closesText
'
,
()
=>
{
it
(
'
should return true if the given text has multiple issues
'
,
()
=>
{
it
(
'
returns correct text for open merge request
'
,
()
=>
{
expect
(
vm
.
hasMultipleIssues
(
data
.
relatedLinks
.
closing
)).
toBeTruthy
(
);
expect
(
vm
.
closesText
(
'
open
'
)).
toEqual
(
'
Closes
'
);
});
});
it
(
'
should return false if the given text has one issue
'
,
()
=>
{
it
(
'
returns correct text for closed merge request
'
,
()
=>
{
expect
(
vm
.
hasMultipleIssues
(
data
.
relatedLinks
.
mentioned
)).
toBeFalsy
();
expect
(
vm
.
closesText
(
'
closed
'
)).
toEqual
(
'
Did not close
'
);
});
});
describe
(
'
issueLabel
'
,
()
=>
{
it
(
'
should return true if the given text has multiple issues
'
,
()
=>
{
expect
(
vm
.
issueLabel
(
'
closing
'
)).
toEqual
(
'
issues
'
);
});
it
(
'
should return false if the given text has one issue
'
,
()
=>
{
expect
(
vm
.
issueLabel
(
'
mentioned
'
)).
toEqual
(
'
issue
'
);
});
});
describe
(
'
verbLabel
'
,
()
=>
{
it
(
'
should return true if the given text has multiple issues
'
,
()
=>
{
expect
(
vm
.
verbLabel
(
'
closing
'
)).
toEqual
(
'
are
'
);
});
});
it
(
'
should return false if the given text has one issue
'
,
()
=>
{
it
(
'
returns correct tense for merged request
'
,
()
=>
{
expect
(
vm
.
verbLabel
(
'
mentioned
'
)).
toEqual
(
'
is
'
);
expect
(
vm
.
closesText
(
'
merged
'
)).
toEqual
(
'
Closed
'
);
});
});
});
});
});
});
...
@@ -95,8 +79,8 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -95,8 +79,8 @@ describe('MRWidgetRelatedLinks', () => {
});
});
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
expect
(
content
).
toContain
(
'
Closes
issues
#23 and #42
'
);
expect
(
content
).
toContain
(
'
Closes #23 and #42
'
);
expect
(
content
).
not
.
toContain
(
'
mentioned
'
);
expect
(
content
).
not
.
toContain
(
'
Mentions
'
);
});
});
it
(
'
should have only have mentioned issues text
'
,
()
=>
{
it
(
'
should have only have mentioned issues text
'
,
()
=>
{
...
@@ -106,8 +90,7 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -106,8 +90,7 @@ describe('MRWidgetRelatedLinks', () => {
},
},
});
});
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
issue #7
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Mentions #7
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
is mentioned but will not be closed.
'
);
expect
(
vm
.
$el
.
innerText
).
not
.
toContain
(
'
Closes
'
);
expect
(
vm
.
$el
.
innerText
).
not
.
toContain
(
'
Closes
'
);
});
});
...
@@ -120,9 +103,8 @@ describe('MRWidgetRelatedLinks', () => {
...
@@ -120,9 +103,8 @@ describe('MRWidgetRelatedLinks', () => {
});
});
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
const
content
=
vm
.
$el
.
textContent
.
replace
(
/
\n(\s)
+/g
,
'
'
).
trim
();
expect
(
content
).
toContain
(
'
Closes issue #7.
'
);
expect
(
content
).
toContain
(
'
Closes #7
'
);
expect
(
content
).
toContain
(
'
issues #23 and #42
'
);
expect
(
content
).
toContain
(
'
Mentions #23 and #42
'
);
expect
(
content
).
toContain
(
'
are mentioned but will not be closed.
'
);
});
});
it
(
'
should have assing issues link
'
,
()
=>
{
it
(
'
should have assing issues link
'
,
()
=>
{
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_archived_spec.js
View file @
4dd5bd4c
...
@@ -12,7 +12,7 @@ describe('MRWidgetArchived', () => {
...
@@ -12,7 +12,7 @@ describe('MRWidgetArchived', () => {
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
classList
.
contains
(
'
btn-success
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
classList
.
contains
(
'
btn-success
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
innerText
).
toContain
(
'
This project is archived, write access has been disabled
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
This project is archived, write access has been disabled
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_auto_merge_failed_spec.js
View file @
4dd5bd4c
...
@@ -24,8 +24,8 @@ describe('MRWidgetAutoMergeFailed', () => {
...
@@ -24,8 +24,8 @@ describe('MRWidgetAutoMergeFailed', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBe
Truth
y
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBe
Fals
y
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This merge request failed to be merged automatically
.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
This merge request failed to be merged automatically
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
mergeError
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
mergeError
);
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_checking_spec.js
View file @
4dd5bd4c
...
@@ -12,7 +12,7 @@ describe('MRWidgetChecking', () => {
...
@@ -12,7 +12,7 @@ describe('MRWidgetChecking', () => {
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
classList
.
contains
(
'
btn-success
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
classList
.
contains
(
'
btn-success
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
innerText
).
toContain
(
'
Checking ability to merge automatically
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
Checking ability to merge automatically
'
);
expect
(
el
.
querySelector
(
'
i
'
)).
toBeDefined
();
expect
(
el
.
querySelector
(
'
i
'
)).
toBeDefined
();
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_conflicts_spec.js
View file @
4dd5bd4c
...
@@ -29,15 +29,16 @@ describe('MRWidgetConflicts', () => {
...
@@ -29,15 +29,16 @@ describe('MRWidgetConflicts', () => {
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
const
el
=
createComponent
().
$el
;
const
el
=
createComponent
().
$el
;
const
resolveButton
=
el
.
querySelectorAll
(
'
.btn-group .btn
'
)[
0
];
const
resolveButton
=
el
.
querySelector
(
'
.js-resolve-conflicts-button
'
);
const
mergeLocallyButton
=
el
.
querySelectorAll
(
'
.btn-group .btn
'
)[
1
];
const
mergeButton
=
el
.
querySelector
(
'
.mr-widget-body .btn
'
);
const
mergeLocallyButton
=
el
.
querySelector
(
'
.js-merge-locally-button
'
);
expect
(
el
.
textContent
).
toContain
(
'
There are merge conflicts
.
'
);
expect
(
el
.
textContent
).
toContain
(
'
There are merge conflicts
'
);
expect
(
el
.
textContent
).
not
.
toContain
(
'
ask someone with write access
'
);
expect
(
el
.
textContent
).
not
.
toContain
(
'
ask someone with write access
'
);
expect
(
el
.
querySelector
(
'
.btn-success
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
.btn-success
'
).
disabled
).
toBeTruthy
();
expect
(
el
.
querySelectorAll
(
'
.btn-group .btn
'
).
length
).
toBe
(
2
);
expect
(
resolveButton
.
textContent
).
toContain
(
'
Resolve conflicts
'
);
expect
(
resolveButton
.
textContent
).
toContain
(
'
Resolve conflicts
'
);
expect
(
resolveButton
.
getAttribute
(
'
href
'
)).
toEqual
(
path
);
expect
(
resolveButton
.
getAttribute
(
'
href
'
)).
toEqual
(
path
);
expect
(
mergeButton
.
textContent
).
toContain
(
'
Merge
'
);
expect
(
mergeLocallyButton
.
textContent
).
toContain
(
'
Merge locally
'
);
expect
(
mergeLocallyButton
.
textContent
).
toContain
(
'
Merge locally
'
);
});
});
...
@@ -59,8 +60,8 @@ describe('MRWidgetConflicts', () => {
...
@@ -59,8 +60,8 @@ describe('MRWidgetConflicts', () => {
it
(
'
should not have action buttons
'
,
(
done
)
=>
{
it
(
'
should not have action buttons
'
,
(
done
)
=>
{
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.btn
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelectorAll
(
'
.btn
'
).
length
).
toBe
(
1
);
expect
(
vm
.
$el
.
querySelector
(
'
a
.js-resolve-conflicts-button
'
)).
toEqual
(
null
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-resolve-conflicts-button
'
)).
toEqual
(
null
);
expect
(
vm
.
$el
.
querySelector
(
'
a
.js-merge-locally-button
'
)).
toEqual
(
null
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-merge-locally-button
'
)).
toEqual
(
null
);
done
();
done
();
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_failed_to_merge_spec.js
View file @
4dd5bd4c
...
@@ -94,7 +94,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -94,7 +94,7 @@ describe('MRWidgetFailedToMerge', () => {
expect
(
el
.
querySelector
(
'
button
'
).
innerText
).
toContain
(
'
Merge
'
);
expect
(
el
.
querySelector
(
'
button
'
).
innerText
).
toContain
(
'
Merge
'
);
expect
(
el
.
querySelector
(
'
.js-refresh-button
'
).
innerText
).
toContain
(
'
Refresh now
'
);
expect
(
el
.
querySelector
(
'
.js-refresh-button
'
).
innerText
).
toContain
(
'
Refresh now
'
);
expect
(
el
.
querySelector
(
'
.js-refresh-label
'
)).
toEqual
(
null
);
expect
(
el
.
querySelector
(
'
.js-refresh-label
'
)).
toEqual
(
null
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
Refreshing now
...
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
Refreshing now
'
);
setTimeout
(()
=>
{
setTimeout
(()
=>
{
expect
(
el
.
innerText
).
toContain
(
'
Refreshing in 9 seconds
'
);
expect
(
el
.
innerText
).
toContain
(
'
Refreshing in 9 seconds
'
);
done
();
done
();
...
@@ -115,7 +115,7 @@ describe('MRWidgetFailedToMerge', () => {
...
@@ -115,7 +115,7 @@ describe('MRWidgetFailedToMerge', () => {
vm
.
refresh
();
vm
.
refresh
();
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
el
.
innerText
).
not
.
toContain
(
'
Merge failed. Refreshing
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
Merge failed. Refreshing
'
);
expect
(
el
.
innerText
).
toContain
(
'
Refreshing now
...
'
);
expect
(
el
.
innerText
).
toContain
(
'
Refreshing now
'
);
});
});
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_merge_when_pipeline_succeeds_spec.js
View file @
4dd5bd4c
...
@@ -162,10 +162,10 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
...
@@ -162,10 +162,10 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
innerText
).
toContain
(
'
to be merged automatically when the pipeline succeeds
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
to be merged automatically when the pipeline succeeds
'
);
expect
(
el
.
innerText
).
toContain
(
'
The changes will be merged into
'
);
expect
(
el
.
innerText
).
toContain
(
'
The changes will be merged into
'
);
expect
(
el
.
innerText
).
toContain
(
targetBranch
);
expect
(
el
.
innerText
).
toContain
(
targetBranch
);
expect
(
el
.
innerText
).
toContain
(
'
The source branch will not be removed
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
The source branch will not be removed
'
);
expect
(
el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
innerText
).
toContain
(
'
Cancel automatic merge
'
);
expect
(
el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
innerText
).
toContain
(
'
Cancel automatic merge
'
);
expect
(
el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
getAttribute
(
'
disabled
'
)).
toBeFalsy
();
expect
(
el
.
querySelector
(
'
.js-cancel-auto-merge
'
).
getAttribute
(
'
disabled
'
)).
toBeFalsy
();
expect
(
el
.
querySelector
(
'
.js-remove-source-branch
'
).
innerText
).
toContain
(
'
Remove source branch
'
);
expect
(
el
.
querySelector
(
'
.js-remove-source-branch
'
).
innerText
).
toContain
(
'
Remove source branch
'
);
...
@@ -186,8 +186,8 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
...
@@ -186,8 +186,8 @@ describe('MRWidgetMergeWhenPipelineSucceeds', () => {
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
const
normalizedText
=
el
.
innerText
.
replace
(
/
\s
+/g
,
'
'
);
const
normalizedText
=
el
.
innerText
.
replace
(
/
\s
+/g
,
'
'
);
expect
(
normalizedText
).
toContain
(
'
The source branch will be removed
.
'
);
expect
(
normalizedText
).
toContain
(
'
The source branch will be removed
'
);
expect
(
normalizedText
).
not
.
toContain
(
'
The source branch will not be removed
.
'
);
expect
(
normalizedText
).
not
.
toContain
(
'
The source branch will not be removed
'
);
done
();
done
();
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_merged_spec.js
View file @
4dd5bd4c
...
@@ -142,19 +142,19 @@ describe('MRWidgetMerged', () => {
...
@@ -142,19 +142,19 @@ describe('MRWidgetMerged', () => {
expect
(
el
.
querySelector
(
'
.js-mr-widget-author
'
)).
toBeDefined
();
expect
(
el
.
querySelector
(
'
.js-mr-widget-author
'
)).
toBeDefined
();
expect
(
el
.
innerText
).
toContain
(
'
The changes were merged into
'
);
expect
(
el
.
innerText
).
toContain
(
'
The changes were merged into
'
);
expect
(
el
.
innerText
).
toContain
(
targetBranch
);
expect
(
el
.
innerText
).
toContain
(
targetBranch
);
expect
(
el
.
innerText
).
toContain
(
'
The source branch has been removed
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
The source branch has been removed
'
);
expect
(
el
.
innerText
).
toContain
(
'
Revert
'
);
expect
(
el
.
innerText
).
toContain
(
'
Revert
'
);
expect
(
el
.
innerText
).
toContain
(
'
Cherry-pick
'
);
expect
(
el
.
innerText
).
toContain
(
'
Cherry-pick
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
You can remove source branch now
.
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
You can remove source branch now
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch is being removed
.
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch is being removed
'
);
});
});
it
(
'
should not show source branch removed text
'
,
(
done
)
=>
{
it
(
'
should not show source branch removed text
'
,
(
done
)
=>
{
vm
.
mr
.
sourceBranchRemoved
=
false
;
vm
.
mr
.
sourceBranchRemoved
=
false
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
el
.
innerText
).
toContain
(
'
You can remove source branch now
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
You can remove source branch now
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch has been removed
.
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch has been removed
'
);
done
();
done
();
});
});
});
});
...
@@ -164,9 +164,9 @@ describe('MRWidgetMerged', () => {
...
@@ -164,9 +164,9 @@ describe('MRWidgetMerged', () => {
vm
.
mr
.
sourceBranchRemoved
=
false
;
vm
.
mr
.
sourceBranchRemoved
=
false
;
Vue
.
nextTick
(()
=>
{
Vue
.
nextTick
(()
=>
{
expect
(
el
.
innerText
).
toContain
(
'
The source branch is being removed
.
'
);
expect
(
el
.
innerText
).
toContain
(
'
The source branch is being removed
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
You can remove source branch now
.
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
You can remove source branch now
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch has been removed
.
'
);
expect
(
el
.
innerText
).
not
.
toContain
(
'
The source branch has been removed
'
);
done
();
done
();
});
});
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_missing_branch_spec.js
View file @
4dd5bd4c
...
@@ -49,7 +49,7 @@ describe('MRWidgetMissingBranch', () => {
...
@@ -49,7 +49,7 @@ describe('MRWidgetMissingBranch', () => {
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
content
).
toContain
(
'
source branch does not exist.
'
);
expect
(
content
).
toContain
(
'
source branch does not exist.
'
);
expect
(
content
).
toContain
(
'
Please restore
the source branch or use a different source branch.
'
);
expect
(
content
).
toContain
(
'
Please restore
it or use a different source branch
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_not_allowed_spec.js
View file @
4dd5bd4c
...
@@ -11,7 +11,7 @@ describe('MRWidgetNotAllowed', () => {
...
@@ -11,7 +11,7 @@ describe('MRWidgetNotAllowed', () => {
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Ready to be merged automatically.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Ready to be merged automatically.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Ask someone with write access to this repository to merge this request
.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Ask someone with write access to this repository to merge this request
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_blocked_spec.js
View file @
4dd5bd4c
...
@@ -10,7 +10,7 @@ describe('MRWidgetPipelineBlocked', () => {
...
@@ -10,7 +10,7 @@ describe('MRWidgetPipelineBlocked', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Pipeline blocked. The pipeline for this merge request requires a manual action to proceed
.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
Pipeline blocked. The pipeline for this merge request requires a manual action to proceed
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_pipeline_failed_spec.js
View file @
4dd5bd4c
...
@@ -10,7 +10,7 @@ describe('MRWidgetPipelineFailed', () => {
...
@@ -10,7 +10,7 @@ describe('MRWidgetPipelineFailed', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure
.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
The pipeline for this merge request failed. Please retry the job or push a new commit to fix the failure
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_ready_to_merge_spec.js
View file @
4dd5bd4c
...
@@ -72,7 +72,7 @@ describe('MRWidgetReadyToMerge', () => {
...
@@ -72,7 +72,7 @@ describe('MRWidgetReadyToMerge', () => {
const
withDesc
=
'
Include description in commit message
'
;
const
withDesc
=
'
Include description in commit message
'
;
const
withoutDesc
=
"
Don't include description in commit message
"
;
const
withoutDesc
=
"
Don't include description in commit message
"
;
it
(
'
should return message wit description
'
,
()
=>
{
it
(
'
should return message wit
h
description
'
,
()
=>
{
expect
(
vm
.
commitMessageLinkTitle
).
toEqual
(
withDesc
);
expect
(
vm
.
commitMessageLinkTitle
).
toEqual
(
withDesc
);
});
});
...
...
spec/javascripts/vue_mr_widget/components/states/mr_widget_sha_mismatch_spec.js
View file @
4dd5bd4c
...
@@ -10,7 +10,7 @@ describe('MRWidgetSHAMismatch', () => {
...
@@ -10,7 +10,7 @@ describe('MRWidgetSHAMismatch', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
The source branch HEAD has recently changed. Please reload the page and review the changes before merging
.
'
);
expect
(
vm
.
$el
.
innerText
).
toContain
(
'
The source branch HEAD has recently changed. Please reload the page and review the changes before merging
'
);
});
});
});
});
});
});
spec/javascripts/vue_mr_widget/components/states/mr_widget_wip_spec.js
View file @
4dd5bd4c
...
@@ -78,7 +78,7 @@ describe('MRWidgetWIP', () => {
...
@@ -78,7 +78,7 @@ describe('MRWidgetWIP', () => {
it
(
'
should have correct elements
'
,
()
=>
{
it
(
'
should have correct elements
'
,
()
=>
{
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
classList
.
contains
(
'
mr-widget-body
'
)).
toBeTruthy
();
expect
(
el
.
innerText
).
toContain
(
'
This
merge request is currently Work In Progress and therefore unable to merge
'
);
expect
(
el
.
innerText
).
toContain
(
'
This
is a Work in Progress
'
);
expect
(
el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
getAttribute
(
'
disabled
'
)).
toBeTruthy
();
expect
(
el
.
querySelector
(
'
button
'
).
innerText
).
toContain
(
'
Merge
'
);
expect
(
el
.
querySelector
(
'
button
'
).
innerText
).
toContain
(
'
Merge
'
);
expect
(
el
.
querySelector
(
'
.js-remove-wip
'
).
innerText
).
toContain
(
'
Resolve WIP status
'
);
expect
(
el
.
querySelector
(
'
.js-remove-wip
'
).
innerText
).
toContain
(
'
Resolve WIP status
'
);
...
...
spec/javascripts/vue_mr_widget/mock_data.js
View file @
4dd5bd4c
...
@@ -30,6 +30,7 @@ export default {
...
@@ -30,6 +30,7 @@ export default {
"
merge_user_id
"
:
null
,
"
merge_user_id
"
:
null
,
"
merge_when_pipeline_succeeds
"
:
false
,
"
merge_when_pipeline_succeeds
"
:
false
,
"
source_branch
"
:
"
daaaa
"
,
"
source_branch
"
:
"
daaaa
"
,
"
source_branch_link
"
:
"
daaaa
"
,
"
source_project_id
"
:
19
,
"
source_project_id
"
:
19
,
"
target_branch
"
:
"
master
"
,
"
target_branch
"
:
"
master
"
,
"
target_project_id
"
:
19
,
"
target_project_id
"
:
19
,
...
...
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