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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ebf22493
Commit
ebf22493
authored
Nov 29, 2017
by
Kushal Pandya
Committed by
Phil Hughes
Nov 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix item name and namespace text overflow in Projects dropdown
parent
a2fea928
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
3 deletions
+40
-3
app/assets/javascripts/projects_dropdown/components/projects_list_item.vue
...ripts/projects_dropdown/components/projects_list_item.vue
+22
-3
app/assets/stylesheets/framework/dropdowns.scss
app/assets/stylesheets/framework/dropdowns.scss
+1
-0
changelogs/unreleased/39827-fix-projects-dropdown-overflow.yml
...elogs/unreleased/39827-fix-projects-dropdown-overflow.yml
+5
-0
spec/javascripts/projects_dropdown/components/projects_list_item_spec.js
...s/projects_dropdown/components/projects_list_item_spec.js
+12
-0
No files found.
app/assets/javascripts/projects_dropdown/components/projects_list_item.vue
View file @
ebf22493
...
...
@@ -48,6 +48,27 @@ export default {
}
return
this
.
projectName
;
},
/**
* Smartly truncates project namespace by doing two things;
* 1. Only include Group names in path by removing project name
* 2. Only include first and last group names in the path
* when namespace has more than 2 groups present
*
* First part (removal of project name from namespace) can be
* done from backend but doing so involves migration of
* existing project namespaces which is not wise thing to do.
*/
truncatedNamespace
()
{
const
namespaceArr
=
this
.
namespace
.
split
(
'
/
'
);
namespaceArr
.
splice
(
-
1
,
1
);
let
namespace
=
namespaceArr
.
join
(
'
/
'
);
if
(
namespaceArr
.
length
>
2
)
{
namespace
=
`
${
namespaceArr
[
0
]}
/ ... /
${
namespaceArr
.
pop
()}
`
;
}
return
namespace
;
},
},
};
</
script
>
...
...
@@ -87,9 +108,7 @@ export default {
<div
class=
"project-namespace"
:title=
"namespace"
>
{{
namespace
}}
</div>
>
{{
truncatedNamespace
}}
</div>
</div>
</a>
</li>
...
...
app/assets/stylesheets/framework/dropdowns.scss
View file @
ebf22493
...
...
@@ -1002,6 +1002,7 @@ header.header-content .dropdown-menu.projects-dropdown-menu {
max-width
:
250px
;
overflow
:
hidden
;
text-overflow
:
ellipsis
;
white-space
:
nowrap
;
}
&
:hover
{
...
...
changelogs/unreleased/39827-fix-projects-dropdown-overflow.yml
0 → 100644
View file @
ebf22493
---
title
:
Fix item name and namespace text overflow in Projects dropdown
merge_request
:
15451
author
:
type
:
fixed
spec/javascripts/projects_dropdown/components/projects_list_item_spec.js
View file @
ebf22493
...
...
@@ -50,6 +50,18 @@ describe('ProjectsListItemComponent', () => {
expect
(
vm
.
highlightedProjectName
).
toBe
(
mockProject
.
name
);
});
});
describe
(
'
truncatedNamespace
'
,
()
=>
{
it
(
'
should truncate project name from namespace string
'
,
()
=>
{
vm
.
namespace
=
'
platform / nokia-3310
'
;
expect
(
vm
.
truncatedNamespace
).
toBe
(
'
platform
'
);
});
it
(
'
should truncate namespace string from the middle if it includes more than two groups in path
'
,
()
=>
{
vm
.
namespace
=
'
platform / hardware / broadcom / Wifi Group / Mobile Chipset / nokia-3310
'
;
expect
(
vm
.
truncatedNamespace
).
toBe
(
'
platform / ... / Mobile Chipset
'
);
});
});
});
describe
(
'
template
'
,
()
=>
{
...
...
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