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
06be418a
Commit
06be418a
authored
Feb 17, 2020
by
GitLab Bot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add latest changes from gitlab-org/gitlab@master
parent
eb1f5a3e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
94 additions
and
61 deletions
+94
-61
app/assets/javascripts/diffs/components/diff_file_row.vue
app/assets/javascripts/diffs/components/diff_file_row.vue
+5
-2
app/assets/javascripts/diffs/components/tree_list.vue
app/assets/javascripts/diffs/components/tree_list.vue
+0
-2
app/assets/javascripts/self_monitor/components/self_monitor_form.vue
...javascripts/self_monitor/components/self_monitor_form.vue
+1
-1
app/assets/javascripts/user_popovers.js
app/assets/javascripts/user_popovers.js
+39
-37
app/assets/javascripts/vue_shared/components/file_row.vue
app/assets/javascripts/vue_shared/components/file_row.vue
+1
-9
changelogs/unreleased/118442-step2-restyle-changes-header-and-file-tree.yml
...sed/118442-step2-restyle-changes-header-and-file-tree.yml
+5
-0
spec/frontend/diffs/components/diff_file_row_spec.js
spec/frontend/diffs/components/diff_file_row_spec.js
+16
-0
spec/frontend/fixtures/merge_requests.rb
spec/frontend/fixtures/merge_requests.rb
+19
-6
spec/javascripts/user_popovers_spec.js
spec/javascripts/user_popovers_spec.js
+8
-4
No files found.
app/assets/javascripts/diffs/components/diff_file_row.vue
View file @
06be418a
...
...
@@ -5,12 +5,14 @@
*/
import
FileRow
from
'
~/vue_shared/components/file_row.vue
'
;
import
FileRowStats
from
'
./file_row_stats.vue
'
;
import
ChangedFileIcon
from
'
~/vue_shared/components/changed_file_icon.vue
'
;
export
default
{
name
:
'
DiffFileRow
'
,
components
:
{
FileRow
,
FileRowStats
,
ChangedFileIcon
,
},
props
:
{
file
:
{
...
...
@@ -31,7 +33,8 @@ export default {
</
script
>
<
template
>
<file-row
:file=
"file"
:hide-file-stats=
"hideFileStats"
v-bind=
"$attrs"
v-on=
"$listeners"
>
<file-row-stats
v-if=
"showFileRowStats"
:file=
"file"
/>
<file-row
:file=
"file"
v-bind=
"$attrs"
v-on=
"$listeners"
>
<file-row-stats
v-if=
"showFileRowStats"
:file=
"file"
class=
"mr-1"
/>
<changed-file-icon
:file=
"file"
:size=
"16"
/>
</file-row>
</
template
>
app/assets/javascripts/diffs/components/tree_list.vue
View file @
06be418a
...
...
@@ -95,8 +95,6 @@ export default {
:file=
"file"
:level=
"0"
:hide-file-stats=
"hideFileStats"
:hide-extra-on-tree=
"true"
:show-changed-icon=
"true"
:file-row-component=
"$options.DiffFileRow"
@
toggleTreeOpen=
"toggleTreeOpen"
@
clickFile=
"scrollToFile"
...
...
app/assets/javascripts/self_monitor/components/self_monitor_form.vue
View file @
06be418a
...
...
@@ -106,7 +106,7 @@ export default {
saveChangesSelfMonitorProject
()
{
if
(
this
.
projectCreated
&&
!
this
.
projectEnabled
)
{
this
.
showSelfMonitorModal
();
}
else
{
}
else
if
(
!
this
.
projectCreated
&&
!
this
.
loading
)
{
this
.
createProject
();
}
},
...
...
app/assets/javascripts/user_popovers.js
View file @
06be418a
...
...
@@ -60,43 +60,45 @@ export default (elements = document.querySelectorAll('.js-user-link')) => {
const
userLinks
=
Array
.
from
(
elements
);
const
UserPopoverComponent
=
Vue
.
extend
(
UserPopover
);
return
userLinks
.
map
(
el
=>
{
if
(
initializedPopovers
.
has
(
el
))
{
return
initializedPopovers
.
get
(
el
);
}
const
user
=
{
location
:
null
,
bio
:
null
,
organization
:
null
,
status
:
null
,
loaded
:
false
,
};
const
renderedPopover
=
new
UserPopoverComponent
({
propsData
:
{
target
:
el
,
user
,
},
});
initializedPopovers
.
set
(
el
,
renderedPopover
);
renderedPopover
.
$mount
();
el
.
addEventListener
(
'
mouseenter
'
,
({
target
})
=>
{
removeTitle
(
target
);
const
preloadedUserInfo
=
getPreloadedUserInfo
(
target
.
dataset
);
Object
.
assign
(
user
,
preloadedUserInfo
);
if
(
preloadedUserInfo
.
userId
)
{
populateUserInfo
(
user
);
return
userLinks
.
filter
(({
dataset
})
=>
dataset
.
user
||
dataset
.
userId
)
.
map
(
el
=>
{
if
(
initializedPopovers
.
has
(
el
))
{
return
initializedPopovers
.
get
(
el
);
}
});
el
.
addEventListener
(
'
mouseleave
'
,
({
target
})
=>
{
target
.
removeAttribute
(
'
aria-describedby
'
);
});
return
renderedPopover
;
});
const
user
=
{
location
:
null
,
bio
:
null
,
organization
:
null
,
status
:
null
,
loaded
:
false
,
};
const
renderedPopover
=
new
UserPopoverComponent
({
propsData
:
{
target
:
el
,
user
,
},
});
initializedPopovers
.
set
(
el
,
renderedPopover
);
renderedPopover
.
$mount
();
el
.
addEventListener
(
'
mouseenter
'
,
({
target
})
=>
{
removeTitle
(
target
);
const
preloadedUserInfo
=
getPreloadedUserInfo
(
target
.
dataset
);
Object
.
assign
(
user
,
preloadedUserInfo
);
if
(
preloadedUserInfo
.
userId
)
{
populateUserInfo
(
user
);
}
});
el
.
addEventListener
(
'
mouseleave
'
,
({
target
})
=>
{
target
.
removeAttribute
(
'
aria-describedby
'
);
});
return
renderedPopover
;
});
};
app/assets/javascripts/vue_shared/components/file_row.vue
View file @
06be418a
<
script
>
import
FileHeader
from
'
~/vue_shared/components/file_row_header.vue
'
;
import
FileIcon
from
'
~/vue_shared/components/file_icon.vue
'
;
import
ChangedFileIcon
from
'
~/vue_shared/components/changed_file_icon.vue
'
;
export
default
{
name
:
'
FileRow
'
,
components
:
{
FileHeader
,
FileIcon
,
ChangedFileIcon
,
},
props
:
{
file
:
{
...
...
@@ -19,11 +17,6 @@ export default {
type
:
Number
,
required
:
true
,
},
showChangedIcon
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
},
computed
:
{
isTree
()
{
...
...
@@ -121,15 +114,14 @@ export default {
<div
class=
"file-row-name-container"
>
<span
ref=
"textOutput"
:style=
"levelIndentation"
class=
"file-row-name str-truncated"
>
<file-icon
v-if=
"!showChangedIcon || file.type === 'tree'"
class=
"file-row-icon"
:class=
"
{ 'text-secondary': file.type === 'tree' }"
:file-name="file.name"
:loading="file.loading"
:folder="isTree"
:opened="file.opened"
:size="16"
/>
<changed-file-icon
v-else
:file=
"file"
:size=
"16"
class=
"append-right-5"
/>
{{
file
.
name
}}
</span>
<slot></slot>
...
...
changelogs/unreleased/118442-step2-restyle-changes-header-and-file-tree.yml
0 → 100644
View file @
06be418a
---
title
:
Restyle Merge Request diffs file tree
merge_request
:
24342
author
:
type
:
changed
spec/frontend/diffs/components/diff_file_row_spec.js
View file @
06be418a
...
...
@@ -2,6 +2,7 @@ import { shallowMount } from '@vue/test-utils';
import
DiffFileRow
from
'
~/diffs/components/diff_file_row.vue
'
;
import
FileRow
from
'
~/vue_shared/components/file_row.vue
'
;
import
FileRowStats
from
'
~/diffs/components/file_row_stats.vue
'
;
import
ChangedFileIcon
from
'
~/vue_shared/components/changed_file_icon.vue
'
;
describe
(
'
Diff File Row component
'
,
()
=>
{
let
wrapper
;
...
...
@@ -38,6 +39,21 @@ describe('Diff File Row component', () => {
);
});
it
(
'
renders ChangedFileIcon component
'
,
()
=>
{
createComponent
({
level
:
4
,
file
:
{},
hideFileStats
:
false
,
});
expect
(
wrapper
.
find
(
ChangedFileIcon
).
props
()).
toEqual
(
expect
.
objectContaining
({
file
:
{},
size
:
16
,
}),
);
});
describe
(
'
FileRowStats components
'
,
()
=>
{
it
.
each
`
type | hideFileStats | value | desc
...
...
spec/frontend/fixtures/merge_requests.rb
View file @
06be418a
...
...
@@ -10,20 +10,24 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
let
(
:project
)
{
create
(
:project
,
:repository
,
namespace:
namespace
,
path:
'merge-requests-project'
)
}
# rubocop: disable Layout/TrailingWhitespace
let
(
:description
)
do
<<~
MARKDOWN
.
strip_heredoc
- [ ] Task List Item
- [ ]
- [ ] Task List Item 2
MARKDOWN
end
# rubocop: enable Layout/TrailingWhitespace
let
(
:merge_request
)
do
create
(
:merge_request
,
:with_diffs
,
source_project:
project
,
target_project:
project
,
description:
<<~
MARKDOWN
.
strip_heredoc
- [ ] Task List Item
- [ ]
- [ ] Task List Item 2
MARKDOWN
description:
description
)
end
# rubocop: enable Layout/TrailingWhitespace
let
(
:merged_merge_request
)
{
create
(
:merge_request
,
:merged
,
source_project:
project
,
target_project:
project
)
}
let
(
:pipeline
)
do
...
...
@@ -122,6 +126,15 @@ describe Projects::MergeRequestsController, '(JavaScript fixtures)', type: :cont
end
end
context
'with mentions'
do
let
(
:group
)
{
create
(
:group
)
}
let
(
:description
)
{
"@
#{
group
.
full_path
}
@all @
#{
admin
.
username
}
"
}
it
'merge_requests/merge_request_with_mentions.html'
do
render_merge_request
(
merge_request
)
end
end
private
def
render_discussions_json
(
merge_request
)
...
...
spec/javascripts/user_popovers_spec.js
View file @
06be418a
...
...
@@ -2,10 +2,10 @@ import initUserPopovers from '~/user_popovers';
import
UsersCache
from
'
~/lib/utils/users_cache
'
;
describe
(
'
User Popovers
'
,
()
=>
{
const
fixtureTemplate
=
'
merge_requests/
diff_comment
.html
'
;
const
fixtureTemplate
=
'
merge_requests/
merge_request_with_mentions
.html
'
;
preloadFixtures
(
fixtureTemplate
);
const
selector
=
'
.js-user-link
'
;
const
selector
=
'
.js-user-link
, .gfm-project_member
'
;
const
dummyUser
=
{
name
:
'
root
'
};
const
dummyUserStatus
=
{
message
:
'
active
'
};
...
...
@@ -34,8 +34,12 @@ describe('User Popovers', () => {
popovers
=
initUserPopovers
(
document
.
querySelectorAll
(
selector
));
});
it
(
'
initializes a popover for each js-user-link element found in the document
'
,
()
=>
{
expect
(
document
.
querySelectorAll
(
selector
).
length
).
toBe
(
popovers
.
length
);
it
(
'
initializes a popover for each user link with a user id
'
,
()
=>
{
const
linksWithUsers
=
Array
.
from
(
document
.
querySelectorAll
(
selector
)).
filter
(
({
dataset
})
=>
dataset
.
user
||
dataset
.
userId
,
);
expect
(
linksWithUsers
.
length
).
toBe
(
popovers
.
length
);
});
it
(
'
does not initialize the user popovers twice for the same element
'
,
()
=>
{
...
...
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