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
08bfdf81
Commit
08bfdf81
authored
Mar 31, 2022
by
Jacques
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Load diff stats for async diffs
Ensures diff stats are alsos loaded for async diffs
parent
21c8b38c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
24 deletions
+29
-24
app/assets/javascripts/pages/projects/commit/show/index.js
app/assets/javascripts/pages/projects/commit/show/index.js
+29
-24
No files found.
app/assets/javascripts/pages/projects/commit/show/index.js
View file @
08bfdf81
...
...
@@ -27,8 +27,34 @@ initCommitBoxInfo();
initDeprecatedNotes
();
const
loadDiffStats
=
()
=>
{
const
diffStatsElements
=
document
.
querySelectorAll
(
'
#js-diff-stats
'
);
if
(
diffStatsElements
.
length
)
{
diffStatsElements
.
forEach
((
diffStatsEl
)
=>
{
const
{
addedLines
,
removedLines
,
oldSize
,
newSize
,
viewerName
}
=
diffStatsEl
.
dataset
;
new
Vue
({
el
:
diffStatsEl
,
render
(
createElement
)
{
return
createElement
(
DiffStats
,
{
props
:
{
diffFile
:
{
old_size
:
oldSize
,
new_size
:
newSize
,
viewer
:
{
name
:
viewerName
},
},
addedLines
:
Number
(
addedLines
),
removedLines
:
Number
(
removedLines
),
},
});
},
});
});
}
};
const
filesContainer
=
$
(
'
.js-diffs-batch
'
);
const
diffStatsElements
=
document
.
querySelectorAll
(
'
#js-diff-stats
'
);
if
(
filesContainer
.
length
)
{
const
batchPath
=
filesContainer
.
data
(
'
diffFilesPath
'
);
...
...
@@ -40,35 +66,14 @@ if (filesContainer.length) {
syntaxHighlight
(
filesContainer
);
handleLocationHash
();
new
Diff
();
loadDiffStats
();
})
.
catch
(()
=>
{
createFlash
({
message
:
__
(
'
An error occurred while retrieving diff files
'
)
});
});
}
else
{
new
Diff
();
}
if
(
diffStatsElements
.
length
)
{
diffStatsElements
.
forEach
((
diffStatsEl
)
=>
{
const
{
addedLines
,
removedLines
,
oldSize
,
newSize
,
viewerName
}
=
diffStatsEl
.
dataset
;
new
Vue
({
el
:
diffStatsEl
,
render
(
createElement
)
{
return
createElement
(
DiffStats
,
{
props
:
{
diffFile
:
{
old_size
:
oldSize
,
new_size
:
newSize
,
viewer
:
{
name
:
viewerName
},
},
addedLines
:
Number
(
addedLines
),
removedLines
:
Number
(
removedLines
),
},
});
},
});
});
loadDiffStats
();
}
loadAwardsHandler
();
...
...
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