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
6585c88d
Commit
6585c88d
authored
Nov 23, 2021
by
Heinrich Lee Yu
Committed by
Natalia Tepluhina
Nov 23, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Request title from backend in MR popovers
parent
09fb3abe
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
10 deletions
+21
-10
app/assets/javascripts/mr_popover/components/mr_popover.vue
app/assets/javascripts/mr_popover/components/mr_popover.vue
+5
-2
app/assets/javascripts/mr_popover/queries/merge_request.query.graphql
...avascripts/mr_popover/queries/merge_request.query.graphql
+1
-0
spec/frontend/mr_popover/__snapshots__/mr_popover_spec.js.snap
...frontend/mr_popover/__snapshots__/mr_popover_spec.js.snap
+2
-6
spec/frontend/mr_popover/mr_popover_spec.js
spec/frontend/mr_popover/mr_popover_spec.js
+13
-2
No files found.
app/assets/javascripts/mr_popover/components/mr_popover.vue
View file @
6585c88d
...
@@ -65,6 +65,9 @@ export default {
...
@@ -65,6 +65,9 @@ export default {
return
humanMRStates
.
open
;
return
humanMRStates
.
open
;
}
}
},
},
title
()
{
return
this
.
mergeRequest
?.
title
||
this
.
mergeRequestTitle
;
},
showDetails
()
{
showDetails
()
{
return
Object
.
keys
(
this
.
mergeRequest
).
length
>
0
;
return
Object
.
keys
(
this
.
mergeRequest
).
length
>
0
;
},
},
...
@@ -89,7 +92,7 @@ export default {
...
@@ -89,7 +92,7 @@ export default {
<
template
>
<
template
>
<gl-popover
:target=
"target"
boundary=
"viewport"
placement=
"top"
show
>
<gl-popover
:target=
"target"
boundary=
"viewport"
placement=
"top"
show
>
<div
class=
"mr-popover"
>
<div
class=
"mr-popover"
>
<div
v-if=
"$apollo.loading"
>
<div
v-if=
"$apollo.
queries.mergeRequest.
loading"
>
<gl-skeleton-loading
:lines=
"1"
class=
"animation-container-small mt-1"
/>
<gl-skeleton-loading
:lines=
"1"
class=
"animation-container-small mt-1"
/>
</div>
</div>
<div
v-else-if=
"showDetails"
class=
"d-flex align-items-center justify-content-between"
>
<div
v-else-if=
"showDetails"
class=
"d-flex align-items-center justify-content-between"
>
...
@@ -101,7 +104,7 @@ export default {
...
@@ -101,7 +104,7 @@ export default {
</div>
</div>
<ci-icon
v-if=
"detailedStatus"
:status=
"detailedStatus"
/>
<ci-icon
v-if=
"detailedStatus"
:status=
"detailedStatus"
/>
</div>
</div>
<h5
class=
"my-2"
>
{{
mergeRequestT
itle
}}
</h5>
<h5
v-if=
"!$apollo.queries.mergeRequest.loading"
class=
"my-2"
>
{{
t
itle
}}
</h5>
<!-- eslint-disable @gitlab/vue-require-i18n-strings -->
<!-- eslint-disable @gitlab/vue-require-i18n-strings -->
<div
class=
"text-secondary"
>
<div
class=
"text-secondary"
>
{{
`${projectPath
}
!${mergeRequestIID
}
`
}}
{{
`${projectPath
}
!${mergeRequestIID
}
`
}}
...
...
app/assets/javascripts/mr_popover/queries/merge_request.query.graphql
View file @
6585c88d
query
mergeRequest
(
$projectPath
:
ID
!,
$mergeRequestIID
:
String
!)
{
query
mergeRequest
(
$projectPath
:
ID
!,
$mergeRequestIID
:
String
!)
{
project
(
fullPath
:
$projectPath
)
{
project
(
fullPath
:
$projectPath
)
{
mergeRequest
(
iid
:
$mergeRequestIID
)
{
mergeRequest
(
iid
:
$mergeRequestIID
)
{
title
createdAt
createdAt
state
state
headPipeline
{
headPipeline
{
...
...
spec/frontend/mr_popover/__snapshots__/mr_popover_spec.js.snap
View file @
6585c88d
...
@@ -45,7 +45,7 @@ exports[`MR Popover loaded state matches the snapshot 1`] = `
...
@@ -45,7 +45,7 @@ exports[`MR Popover loaded state matches the snapshot 1`] = `
<h5
<h5
class="my-2"
class="my-2"
>
>
MR
Title
Updated
Title
</h5>
</h5>
<div
<div
...
@@ -77,11 +77,7 @@ exports[`MR Popover shows skeleton-loader while apollo is loading 1`] = `
...
@@ -77,11 +77,7 @@ exports[`MR Popover shows skeleton-loader while apollo is loading 1`] = `
/>
/>
</div>
</div>
<h5
<!---->
class="my-2"
>
MR Title
</h5>
<div
<div
class="text-secondary"
class="text-secondary"
...
...
spec/frontend/mr_popover/mr_popover_spec.js
View file @
6585c88d
...
@@ -15,14 +15,18 @@ describe('MR Popover', () => {
...
@@ -15,14 +15,18 @@ describe('MR Popover', () => {
},
},
mocks
:
{
mocks
:
{
$apollo
:
{
$apollo
:
{
queries
:
{
mergeRequest
:
{
loading
:
false
,
loading
:
false
,
},
},
},
},
},
},
});
});
});
});
it
(
'
shows skeleton-loader while apollo is loading
'
,
()
=>
{
it
(
'
shows skeleton-loader while apollo is loading
'
,
()
=>
{
wrapper
.
vm
.
$apollo
.
loading
=
true
;
wrapper
.
vm
.
$apollo
.
queries
.
mergeRequest
.
loading
=
true
;
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
element
).
toMatchSnapshot
();
expect
(
wrapper
.
element
).
toMatchSnapshot
();
...
@@ -33,6 +37,7 @@ describe('MR Popover', () => {
...
@@ -33,6 +37,7 @@ describe('MR Popover', () => {
it
(
'
matches the snapshot
'
,
()
=>
{
it
(
'
matches the snapshot
'
,
()
=>
{
wrapper
.
setData
({
wrapper
.
setData
({
mergeRequest
:
{
mergeRequest
:
{
title
:
'
Updated Title
'
,
state
:
'
opened
'
,
state
:
'
opened
'
,
createdAt
:
new
Date
(),
createdAt
:
new
Date
(),
headPipeline
:
{
headPipeline
:
{
...
@@ -64,5 +69,11 @@ describe('MR Popover', () => {
...
@@ -64,5 +69,11 @@ describe('MR Popover', () => {
expect
(
wrapper
.
find
(
CiIcon
).
exists
()).
toBe
(
false
);
expect
(
wrapper
.
find
(
CiIcon
).
exists
()).
toBe
(
false
);
});
});
});
});
it
(
'
falls back to cached MR title when request fails
'
,
()
=>
{
return
wrapper
.
vm
.
$nextTick
().
then
(()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
MR Title
'
);
});
});
});
});
});
});
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