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
52426c65
Commit
52426c65
authored
Feb 23, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor stat_graph_contributors to es6 module syntax
parent
2d2e0b7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
102 deletions
+100
-102
app/assets/javascripts/graphs/graphs_bundle.js
app/assets/javascripts/graphs/graphs_bundle.js
+4
-1
app/assets/javascripts/graphs/stat_graph_contributors.js
app/assets/javascripts/graphs/stat_graph_contributors.js
+96
-101
No files found.
app/assets/javascripts/graphs/graphs_bundle.js
View file @
52426c65
require
(
'
./stat_graph_contributors
'
);
import
ContributorsStatGraph
from
'
./stat_graph_contributors
'
;
// export to global scope
window
.
ContributorsStatGraph
=
ContributorsStatGraph
;
app/assets/javascripts/graphs/stat_graph_contributors.js
View file @
52426c65
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign */
/* eslint-disable func-names, space-before-function-paren, wrap-iife, no-var, one-var, camelcase, one-var-declaration-per-line, quotes, no-param-reassign, quote-props, comma-dangle, prefer-template, max-len, no-return-assign
, no-shadow
*/
import
d3
from
'
d3
'
;
import
{
ContributorsGraph
,
ContributorsAuthorGraph
,
ContributorsMasterGraph
}
from
'
./stat_graph_contributors_graph
'
;
import
{
ContributorsGraph
,
ContributorsAuthorGraph
,
ContributorsMasterGraph
}
from
'
./stat_graph_contributors_graph
'
;
import
ContributorsStatGraphUtil
from
'
./stat_graph_contributors_util
'
;
import
ContributorsStatGraphUtil
from
'
./stat_graph_contributors_util
'
;
/* global d3 */
export
default
(
function
()
{
function
ContributorsStatGraph
()
{}
window
.
d3
=
require
(
'
d3
'
);
ContributorsStatGraph
.
prototype
.
init
=
function
(
log
)
{
var
author_commits
,
total_commits
;
this
.
parsed_log
=
ContributorsStatGraphUtil
.
parse_log
(
log
);
this
.
set_current_field
(
"
commits
"
);
total_commits
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
);
this
.
add_master_graph
(
total_commits
);
this
.
add_authors_graph
(
author_commits
);
return
this
.
change_date_header
();
};
(
function
()
{
ContributorsStatGraph
.
prototype
.
add_master_graph
=
function
(
total_data
)
{
this
.
ContributorsStatGraph
=
(
function
()
{
this
.
master_graph
=
new
ContributorsMasterGraph
(
total_data
);
function
ContributorsStatGraph
()
{}
return
this
.
master_graph
.
draw
();
};
ContributorsStatGraph
.
prototype
.
init
=
function
(
log
)
{
ContributorsStatGraph
.
prototype
.
add_authors_graph
=
function
(
author_data
)
{
var
author_commits
,
total_commits
;
var
limited_author_data
;
this
.
parsed_log
=
ContributorsStatGraphUtil
.
parse_log
(
log
);
this
.
authors
=
[];
this
.
set_current_field
(
"
commits
"
);
limited_author_data
=
author_data
.
slice
(
0
,
100
);
total_commits
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
return
_
.
each
(
limited_author_data
,
(
function
(
_this
)
{
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
);
return
function
(
d
)
{
this
.
add_master_graph
(
total_commits
);
var
author_graph
,
author_header
;
this
.
add_authors_graph
(
author_commits
);
author_header
=
_this
.
create_author_header
(
d
);
return
this
.
change_date_header
();
$
(
"
.contributors-list
"
).
append
(
author_header
);
};
_this
.
authors
[
d
.
author_name
]
=
author_graph
=
new
ContributorsAuthorGraph
(
d
.
dates
);
return
author_graph
.
draw
();
};
})(
this
));
};
ContributorsStatGraph
.
prototype
.
add_master_graph
=
function
(
total_data
)
{
ContributorsStatGraph
.
prototype
.
format_author_commit_info
=
function
(
author
)
{
this
.
master_graph
=
new
ContributorsMasterGraph
(
total_data
);
var
commits
;
return
this
.
master_graph
.
draw
();
commits
=
$
(
'
<span/>
'
,
{
};
"
class
"
:
'
graph-author-commits-count
'
});
commits
.
text
(
author
.
commits
+
"
commits
"
);
return
$
(
'
<span/>
'
).
append
(
commits
);
};
ContributorsStatGraph
.
prototype
.
add_authors_graph
=
function
(
author_data
)
{
ContributorsStatGraph
.
prototype
.
create_author_header
=
function
(
author
)
{
var
limited_author_data
;
var
author_commit_info
,
author_commit_info_span
,
author_email
,
author_name
,
list_item
;
this
.
authors
=
[];
list_item
=
$
(
'
<li/>
'
,
{
limited_author_data
=
author_data
.
slice
(
0
,
100
);
"
class
"
:
'
person
'
,
return
_
.
each
(
limited_author_data
,
(
function
(
_this
)
{
style
:
'
display: block;
'
return
function
(
d
)
{
});
var
author_graph
,
author_header
;
author_name
=
$
(
'
<h4>
'
+
author
.
author_name
+
'
</h4>
'
);
author_header
=
_this
.
create_author_header
(
d
);
author_email
=
$
(
'
<p class="graph-author-email">
'
+
author
.
author_email
+
'
</p>
'
);
$
(
"
.contributors-list
"
).
append
(
author_header
);
author_commit_info_span
=
$
(
'
<span/>
'
,
{
_this
.
authors
[
d
.
author_name
]
=
author_graph
=
new
ContributorsAuthorGraph
(
d
.
dates
);
"
class
"
:
'
commits
'
return
author_graph
.
draw
();
});
};
author_commit_info
=
this
.
format_author_commit_info
(
author
);
})(
this
));
author_commit_info_span
.
html
(
author_commit_info
);
};
list_item
.
append
(
author_name
);
list_item
.
append
(
author_email
);
list_item
.
append
(
author_commit_info_span
);
return
list_item
;
};
ContributorsStatGraph
.
prototype
.
format_author_commit_info
=
function
(
author
)
{
ContributorsStatGraph
.
prototype
.
redraw_master
=
function
()
{
var
commits
;
var
total_data
;
commits
=
$
(
'
<span/>
'
,
{
total_data
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
"
class
"
:
'
graph-author-commits-count
'
this
.
master_graph
.
set_data
(
total_data
);
});
return
this
.
master_graph
.
redraw
();
commits
.
text
(
author
.
commits
+
"
commits
"
);
};
return
$
(
'
<span/>
'
).
append
(
commits
);
};
ContributorsStatGraph
.
prototype
.
create_author_header
=
function
(
author
)
{
ContributorsStatGraph
.
prototype
.
redraw_authors
=
function
()
{
var
author_commit_info
,
author_commit_info_span
,
author_email
,
author_name
,
list_item
;
var
author_commits
,
x_domain
;
list_item
=
$
(
'
<li/>
'
,
{
$
(
"
ol
"
).
html
(
""
);
"
class
"
:
'
person
'
,
x_domain
=
ContributorsGraph
.
prototype
.
x_domain
;
style
:
'
display: block;
'
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
,
x_domain
);
});
return
_
.
each
(
author_commits
,
(
function
(
_this
)
{
author_name
=
$
(
'
<h4>
'
+
author
.
author_name
+
'
</h4>
'
);
return
function
(
d
)
{
author_email
=
$
(
'
<p class="graph-author-email">
'
+
author
.
author_email
+
'
</p>
'
);
_this
.
redraw_author_commit_info
(
d
);
author_commit_info_span
=
$
(
'
<span/>
'
,
{
$
(
_this
.
authors
[
d
.
author_name
].
list_item
).
appendTo
(
"
ol
"
);
"
class
"
:
'
commits
'
_this
.
authors
[
d
.
author_name
].
set_data
(
d
.
dates
);
});
return
_this
.
authors
[
d
.
author_name
].
redraw
();
author_commit_info
=
this
.
format_author_commit_info
(
author
);
};
author_commit_info_span
.
html
(
author_commit_info
);
})(
this
));
list_item
.
append
(
author_name
);
};
list_item
.
append
(
author_email
);
list_item
.
append
(
author_commit_info_span
);
return
list_item
;
};
ContributorsStatGraph
.
prototype
.
redraw_master
=
function
()
{
ContributorsStatGraph
.
prototype
.
set_current_field
=
function
(
field
)
{
var
total_data
;
return
this
.
field
=
field
;
total_data
=
ContributorsStatGraphUtil
.
get_total_data
(
this
.
parsed_log
,
this
.
field
);
};
this
.
master_graph
.
set_data
(
total_data
);
return
this
.
master_graph
.
redraw
();
};
ContributorsStatGraph
.
prototype
.
redraw_authors
=
function
()
{
ContributorsStatGraph
.
prototype
.
change_date_header
=
function
()
{
var
author_commits
,
x_domain
;
var
print
,
print_date_format
,
x_domain
;
$
(
"
ol
"
).
html
(
""
);
x_domain
=
ContributorsGraph
.
prototype
.
x_domain
;
x_domain
=
ContributorsGraph
.
prototype
.
x_domain
;
print_date_format
=
d3
.
time
.
format
(
"
%B %e %Y
"
);
author_commits
=
ContributorsStatGraphUtil
.
get_author_data
(
this
.
parsed_log
,
this
.
field
,
x_domain
);
print
=
print_date_format
(
x_domain
[
0
])
+
"
-
"
+
print_date_format
(
x_domain
[
1
]);
return
_
.
each
(
author_commits
,
(
function
(
_this
)
{
return
$
(
"
#date_header
"
).
text
(
print
);
return
function
(
d
)
{
};
_this
.
redraw_author_commit_info
(
d
);
$
(
_this
.
authors
[
d
.
author_name
].
list_item
).
appendTo
(
"
ol
"
);
_this
.
authors
[
d
.
author_name
].
set_data
(
d
.
dates
);
return
_this
.
authors
[
d
.
author_name
].
redraw
();
};
})(
this
));
};
ContributorsStatGraph
.
prototype
.
set_current_field
=
function
(
field
)
{
ContributorsStatGraph
.
prototype
.
redraw_author_commit_info
=
function
(
author
)
{
return
this
.
field
=
field
;
var
author_commit_info
,
author_list_item
;
};
author_list_item
=
$
(
this
.
authors
[
author
.
author_name
].
list_item
);
author_commit_info
=
this
.
format_author_commit_info
(
author
);
return
author_list_item
.
find
(
"
span
"
).
html
(
author_commit_info
);
};
ContributorsStatGraph
.
prototype
.
change_date_header
=
function
()
{
return
ContributorsStatGraph
;
var
print
,
print_date_format
,
x_domain
;
})();
x_domain
=
ContributorsGraph
.
prototype
.
x_domain
;
print_date_format
=
d3
.
time
.
format
(
"
%B %e %Y
"
);
print
=
print_date_format
(
x_domain
[
0
])
+
"
-
"
+
print_date_format
(
x_domain
[
1
]);
return
$
(
"
#date_header
"
).
text
(
print
);
};
ContributorsStatGraph
.
prototype
.
redraw_author_commit_info
=
function
(
author
)
{
var
author_commit_info
,
author_list_item
;
author_list_item
=
$
(
this
.
authors
[
author
.
author_name
].
list_item
);
author_commit_info
=
this
.
format_author_commit_info
(
author
);
return
author_list_item
.
find
(
"
span
"
).
html
(
author_commit_info
);
};
return
ContributorsStatGraph
;
})();
}).
call
(
window
);
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