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
Jérome Perrin
gitlab-ce
Commits
34742710
Commit
34742710
authored
Mar 03, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor BranchGraph class
parent
545397c6
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
388 additions
and
392 deletions
+388
-392
app/assets/javascripts/network/branch_graph.js
app/assets/javascripts/network/branch_graph.js
+312
-390
app/assets/javascripts/network/network.js
app/assets/javascripts/network/network.js
+2
-1
app/assets/javascripts/network/network_bundle.js
app/assets/javascripts/network/network_bundle.js
+0
-1
app/assets/javascripts/network/raphael.js
app/assets/javascripts/network/raphael.js
+74
-0
No files found.
app/assets/javascripts/network/branch_graph.js
View file @
34742710
This diff is collapsed.
Click to expand it.
app/assets/javascripts/network/network.js
View file @
34742710
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, quotes, quote-props, prefer-template, comma-dangle, max-len */
/* global BranchGraph */
import
BranchGraph
from
'
./branch_graph
'
;
(
function
()
{
this
.
Network
=
(
function
()
{
...
...
app/assets/javascripts/network/network_bundle.js
View file @
34742710
...
...
@@ -2,7 +2,6 @@
/* global Network */
/* global ShortcutsNetwork */
require
(
'
./branch_graph
'
);
require
(
'
./network
'
);
(
function
()
{
...
...
app/assets/javascripts/network/raphael.js
0 → 100644
View file @
34742710
import
Raphael
from
'
raphael/raphael
'
;
Raphael
.
prototype
.
commitTooltip
=
function
commitTooltip
(
x
,
y
,
commit
)
{
const
boxWidth
=
300
;
const
icon
=
this
.
image
(
gon
.
relative_url_root
+
commit
.
author
.
icon
,
x
,
y
,
20
,
20
);
const
nameText
=
this
.
text
(
x
+
25
,
y
+
10
,
commit
.
author
.
name
);
const
idText
=
this
.
text
(
x
,
y
+
35
,
commit
.
id
);
const
messageText
=
this
.
text
(
x
,
y
+
50
,
commit
.
message
.
replace
(
/
\r?\n
/g
,
'
\n
'
));
const
textSet
=
this
.
set
(
icon
,
nameText
,
idText
,
messageText
).
attr
({
'
text-anchor
'
:
'
start
'
,
font
:
'
12px Monaco, monospace
'
,
});
nameText
.
attr
({
font
:
'
14px Arial
'
,
'
font-weight
'
:
'
bold
'
,
});
idText
.
attr
({
fill
:
'
#AAA
'
,
});
messageText
.
node
.
style
[
'
white-space
'
]
=
'
pre
'
;
this
.
textWrap
(
messageText
,
boxWidth
-
50
);
const
rect
=
this
.
rect
(
x
-
10
,
y
-
10
,
boxWidth
,
100
,
4
).
attr
({
fill
:
'
#FFF
'
,
stroke
:
'
#000
'
,
'
stroke-linecap
'
:
'
round
'
,
'
stroke-width
'
:
2
,
});
const
tooltip
=
this
.
set
(
rect
,
textSet
);
rect
.
attr
({
height
:
tooltip
.
getBBox
().
height
+
10
,
width
:
tooltip
.
getBBox
().
width
+
10
,
});
tooltip
.
transform
([
'
t
'
,
20
,
20
]);
return
tooltip
;
};
Raphael
.
prototype
.
textWrap
=
function
testWrap
(
t
,
width
)
{
const
content
=
t
.
attr
(
'
text
'
);
const
abc
=
'
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
'
;
t
.
attr
({
text
:
abc
,
});
const
letterWidth
=
t
.
getBBox
().
width
/
abc
.
length
;
t
.
attr
({
text
:
content
,
});
const
words
=
content
.
split
(
'
'
);
let
x
=
0
;
const
s
=
[];
for
(
let
j
=
0
,
len
=
words
.
length
;
j
<
len
;
j
+=
1
)
{
const
word
=
words
[
j
];
if
(
x
+
(
word
.
length
*
letterWidth
)
>
width
)
{
s
.
push
(
'
\n
'
);
x
=
0
;
}
if
(
word
===
'
\n
'
)
{
s
.
push
(
'
\n
'
);
x
=
0
;
}
else
{
s
.
push
(
`
${
word
}
`
);
x
+=
word
.
length
*
letterWidth
;
}
}
t
.
attr
({
text
:
s
.
join
(
''
).
trim
(),
});
const
b
=
t
.
getBBox
();
const
h
=
Math
.
abs
(
b
.
y2
)
+
1
;
return
t
.
attr
({
y
:
h
,
});
};
export
default
Raphael
;
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