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
Léo-Paul Géneau
gitlab-ce
Commits
e70d06df
Commit
e70d06df
authored
Aug 07, 2018
by
Tim Zallmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Incremental Rendering of the MR
parent
f68f405c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
7 deletions
+51
-7
app/assets/javascripts/diffs/components/app.vue
app/assets/javascripts/diffs/components/app.vue
+9
-4
app/assets/javascripts/diffs/components/diff_file.vue
app/assets/javascripts/diffs/components/diff_file.vue
+2
-2
app/assets/javascripts/diffs/store/actions.js
app/assets/javascripts/diffs/store/actions.js
+20
-0
app/assets/javascripts/diffs/store/mutation_types.js
app/assets/javascripts/diffs/store/mutation_types.js
+1
-0
app/assets/javascripts/diffs/store/mutations.js
app/assets/javascripts/diffs/store/mutations.js
+19
-1
No files found.
app/assets/javascripts/diffs/components/app.vue
View file @
e70d06df
...
...
@@ -114,11 +114,16 @@ export default {
this
.
adjustView
();
},
methods
:
{
...
mapActions
(
'
diffs
'
,
[
'
setBaseConfig
'
,
'
fetchDiffFiles
'
]),
...
mapActions
(
'
diffs
'
,
[
'
setBaseConfig
'
,
'
fetchDiffFiles
'
,
'
startRenderDiffsQueue
'
]),
fetchData
()
{
this
.
fetchDiffFiles
().
catch
(()
=>
{
createFlash
(
__
(
'
Something went wrong on our end. Please try again!
'
));
});
this
.
fetchDiffFiles
()
.
then
(()
=>
{
console
.
log
(
'
Done
'
);
requestIdleCallback
(
this
.
startRenderDiffsQueue
,
{
timeout
:
1000
});
})
.
catch
(()
=>
{
createFlash
(
__
(
'
Something went wrong on our end. Please try again!
'
));
});
if
(
!
this
.
isNotesFetched
)
{
eventHub
.
$emit
(
'
fetchNotesData
'
);
...
...
app/assets/javascripts/diffs/components/diff_file.vue
View file @
e70d06df
...
...
@@ -121,12 +121,12 @@ export default {
</div>
<diff-content
v-if=
"!isCollapsed"
v-if=
"!isCollapsed
&& file.renderIt
"
:class=
"
{ hidden: isCollapsed || file.tooLarge }"
:diff-file="file"
/>
<loading-icon
v-if=
"isLoadingCollapsedDiff"
v-if=
"isLoadingCollapsedDiff
|| !file.renderIt
"
class=
"diff-content loading"
/>
<div
...
...
app/assets/javascripts/diffs/store/actions.js
View file @
e70d06df
...
...
@@ -29,6 +29,26 @@ export const fetchDiffFiles = ({ state, commit }) => {
.
then
(
handleLocationHash
);
};
export
const
startRenderDiffsQueue
=
({
state
,
commit
})
=>
{
const
checkItem
=
()
=>
{
const
nextFile
=
state
.
diffFiles
.
find
(
file
=>
!
file
.
renderIt
&&
!
file
.
collapsed
);
if
(
nextFile
)
{
requestAnimationFrame
(()
=>
{
commit
(
types
.
RENDER_FILE
,
nextFile
);
});
requestIdleCallback
(
()
=>
{
console
.
log
(
'
CALL NEXT
'
);
checkItem
();
},
{
timeout
:
1000
},
);
}
};
checkItem
();
};
export
const
setInlineDiffViewType
=
({
commit
})
=>
{
commit
(
types
.
SET_DIFF_VIEW_TYPE
,
INLINE_DIFF_VIEW_TYPE
);
...
...
app/assets/javascripts/diffs/store/mutation_types.js
View file @
e70d06df
...
...
@@ -8,3 +8,4 @@ export const REMOVE_COMMENT_FORM_LINE = 'REMOVE_COMMENT_FORM_LINE';
export
const
ADD_CONTEXT_LINES
=
'
ADD_CONTEXT_LINES
'
;
export
const
ADD_COLLAPSED_DIFFS
=
'
ADD_COLLAPSED_DIFFS
'
;
export
const
EXPAND_ALL_FILES
=
'
EXPAND_ALL_FILES
'
;
export
const
RENDER_FILE
=
'
RENDER_FILE
'
;
app/assets/javascripts/diffs/store/mutations.js
View file @
e70d06df
...
...
@@ -15,8 +15,26 @@ export default {
},
[
types
.
SET_DIFF_DATA
](
state
,
data
)
{
const
diffData
=
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
});
let
showingLines
=
0
;
diffData
.
diffFiles
.
map
(
file
=>
{
if
(
file
.
highlightedDiffLines
)
{
showingLines
+=
file
.
parallelDiffLines
.
length
;
Object
.
assign
(
file
,
{
renderIt
:
showingLines
<
200
,
collapsed
:
showingLines
>
2000
,
});
}
});
Object
.
assign
(
state
,
{
...
convertObjectPropsToCamelCase
(
data
,
{
deep
:
true
}),
...
diffData
,
});
},
[
types
.
RENDER_FILE
](
state
,
file
)
{
Object
.
assign
(
file
,
{
renderIt
:
true
,
});
},
...
...
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