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
2e54e4ea
Commit
2e54e4ea
authored
Mar 05, 2020
by
Justin Boyson
Committed by
Paul Slaughter
Mar 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change toggle file to hide instead of remove
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/26181
parent
3f66ce3b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
14 deletions
+23
-14
app/assets/javascripts/diffs/components/diff_file.vue
app/assets/javascripts/diffs/components/diff_file.vue
+13
-12
changelogs/unreleased/jdb-hide-dont-remove-collapsed-files.yml
...elogs/unreleased/jdb-hide-dont-remove-collapsed-files.yml
+5
-0
spec/javascripts/diffs/components/diff_file_spec.js
spec/javascripts/diffs/components/diff_file_spec.js
+5
-2
No files found.
app/assets/javascripts/diffs/components/diff_file.vue
View file @
2e54e4ea
...
@@ -179,18 +179,19 @@ export default {
...
@@ -179,18 +179,19 @@ export default {
<div
v-if=
"errorMessage"
class=
"diff-viewer"
>
<div
v-if=
"errorMessage"
class=
"diff-viewer"
>
<div
class=
"nothing-here-block"
v-html=
"errorMessage"
></div>
<div
class=
"nothing-here-block"
v-html=
"errorMessage"
></div>
</div>
</div>
<div
v-else-if=
"isCollapsed"
class=
"nothing-here-block diff-collapsed"
>
<template
v-else
>
{{
__
(
'
This diff is collapsed.
'
)
}}
<div
v-show=
"isCollapsed"
class=
"nothing-here-block diff-collapsed"
>
<a
class=
"click-to-expand js-click-to-expand"
href=
"#"
@
click.prevent=
"handleToggle"
>
{{
{{
__
(
'
This diff is collapsed.
'
)
}}
__
(
'
Click to expand it.
'
)
<a
class=
"click-to-expand js-click-to-expand"
href=
"#"
@
click.prevent=
"handleToggle"
>
{{
}}
</a>
__
(
'
Click to expand it.
'
)
</div>
}}
</a>
<diff-content
</div>
v-else
<diff-content
:class=
"
{ hidden: isCollapsed || isFileTooLarge }"
v-show=
"!isCollapsed && !isFileTooLarge"
:diff-file="file"
:diff-file=
"file"
:help-page-path="helpPagePath"
:help-page-path=
"helpPagePath"
/>
/>
</
template
>
</div>
</div>
</template>
</template>
</div>
</div>
...
...
changelogs/unreleased/jdb-hide-dont-remove-collapsed-files.yml
0 → 100644
View file @
2e54e4ea
---
title
:
Improved MR toggle file performance by hiding instead of removing
merge_request
:
26181
author
:
type
:
performance
spec/javascripts/diffs/components/diff_file_spec.js
View file @
2e54e4ea
...
@@ -23,6 +23,9 @@ describe('DiffFile', () => {
...
@@ -23,6 +23,9 @@ describe('DiffFile', () => {
vm
.
$destroy
();
vm
.
$destroy
();
});
});
const
findDiffContent
=
()
=>
vm
.
$el
.
querySelector
(
'
.diff-content
'
);
const
isVisible
=
el
=>
el
.
style
.
display
!==
'
none
'
;
describe
(
'
template
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
it
(
'
should render component with file header, file content components
'
,
done
=>
{
it
(
'
should render component with file header, file content components
'
,
done
=>
{
const
el
=
vm
.
$el
;
const
el
=
vm
.
$el
;
...
@@ -69,13 +72,13 @@ describe('DiffFile', () => {
...
@@ -69,13 +72,13 @@ describe('DiffFile', () => {
describe
(
'
collapsed
'
,
()
=>
{
describe
(
'
collapsed
'
,
()
=>
{
it
(
'
should not have file content
'
,
done
=>
{
it
(
'
should not have file content
'
,
done
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.diff-content
'
).
length
).
toEqual
(
1
);
expect
(
isVisible
(
findDiffContent
())).
toBe
(
true
);
expect
(
vm
.
isCollapsed
).
toEqual
(
false
);
expect
(
vm
.
isCollapsed
).
toEqual
(
false
);
vm
.
isCollapsed
=
true
;
vm
.
isCollapsed
=
true
;
vm
.
file
.
renderIt
=
true
;
vm
.
file
.
renderIt
=
true
;
vm
.
$nextTick
(()
=>
{
vm
.
$nextTick
(()
=>
{
expect
(
vm
.
$el
.
querySelectorAll
(
'
.diff-content
'
).
length
).
toEqual
(
0
);
expect
(
isVisible
(
findDiffContent
())).
toBe
(
false
);
done
();
done
();
});
});
...
...
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