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
12790c45
Commit
12790c45
authored
Jul 15, 2021
by
Sarah GP
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update anscestor deduplication in pipeline graph
Changelog: performance
parent
1f5e40d4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
app/assets/javascripts/pipelines/components/parsing_utils.js
app/assets/javascripts/pipelines/components/parsing_utils.js
+15
-2
No files found.
app/assets/javascripts/pipelines/components/parsing_utils.js
View file @
12790c45
import
{
isEqual
,
memoize
,
uniqWith
}
from
'
lodash
'
;
import
{
memoize
}
from
'
lodash
'
;
import
{
createSankey
}
from
'
./dag/drawing_utils
'
;
/*
...
...
@@ -113,11 +113,24 @@ export const filterByAncestors = (links, nodeDict) =>
return
!
allAncestors
.
includes
(
source
);
});
/*
A peformant alternative to lodash's isEqual. Because findIndex always finds
the first instance of a match, if the found index is not the first, we know
it is in fact a duplicate.
*/
const
deduplicate
=
(
item
,
itemIndex
,
arr
)
=>
{
const
foundIdx
=
arr
.
findIndex
((
test
)
=>
{
return
test
.
source
===
item
.
source
&&
test
.
target
===
item
.
target
;
});
return
foundIdx
===
itemIndex
;
};
export
const
parseData
=
(
nodes
)
=>
{
const
nodeDict
=
createNodeDict
(
nodes
);
const
allLinks
=
makeLinksFromNodes
(
nodes
,
nodeDict
);
const
filteredLinks
=
filterByAncestors
(
allLinks
,
nodeDict
);
const
links
=
uniqWith
(
filteredLinks
,
isEqual
);
const
links
=
filteredLinks
.
filter
(
deduplicate
);
return
{
nodes
,
links
};
};
...
...
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