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
c312d2b9
Commit
c312d2b9
authored
Feb 15, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated pipelines charts to use dynamic webpack bundle
#41341
parent
15b63e15
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
57 additions
and
39 deletions
+57
-39
app/assets/javascripts/pages/projects/pipelines/charts/index.js
...sets/javascripts/pages/projects/pipelines/charts/index.js
+56
-0
app/assets/javascripts/pipelines/pipelines_times.js
app/assets/javascripts/pipelines/pipelines_times.js
+0
-27
app/views/projects/pipelines/charts.html.haml
app/views/projects/pipelines/charts.html.haml
+0
-3
app/views/projects/pipelines/charts/_pipeline_times.haml
app/views/projects/pipelines/charts/_pipeline_times.haml
+0
-3
app/views/projects/pipelines/charts/_pipelines.haml
app/views/projects/pipelines/charts/_pipelines.haml
+0
-3
config/webpack.config.js
config/webpack.config.js
+1
-3
No files found.
app/assets/javascripts/pages/projects/pipelines/charts/index.js
0 → 100644
View file @
c312d2b9
import
Chart
from
'
vendor/Chart
'
;
const
options
=
{
scaleOverlay
:
true
,
responsive
:
true
,
maintainAspectRatio
:
false
,
};
const
buildChart
=
(
chartScope
)
=>
{
const
data
=
{
labels
:
chartScope
.
labels
,
datasets
:
[{
fillColor
:
'
#707070
'
,
strokeColor
:
'
#707070
'
,
pointColor
:
'
#707070
'
,
pointStrokeColor
:
'
#EEE
'
,
data
:
chartScope
.
totalValues
,
},
{
fillColor
:
'
#1aaa55
'
,
strokeColor
:
'
#1aaa55
'
,
pointColor
:
'
#1aaa55
'
,
pointStrokeColor
:
'
#fff
'
,
data
:
chartScope
.
successValues
,
},
],
};
const
ctx
=
$
(
`#
${
chartScope
.
scope
}
Chart`
).
get
(
0
).
getContext
(
'
2d
'
);
new
Chart
(
ctx
).
Line
(
data
,
options
);
};
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
chartTimesData
=
JSON
.
parse
(
document
.
getElementById
(
'
pipelinesTimesChartsData
'
).
innerHTML
);
const
chartsData
=
JSON
.
parse
(
document
.
getElementById
(
'
pipelinesChartsData
'
).
innerHTML
);
const
data
=
{
labels
:
chartTimesData
.
labels
,
datasets
:
[{
fillColor
:
'
rgba(220,220,220,0.5)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
barStrokeWidth
:
1
,
barValueSpacing
:
1
,
barDatasetSpacing
:
1
,
data
:
chartTimesData
.
values
,
}],
};
if
(
window
.
innerWidth
<
768
)
{
// Scale fonts if window width lower than 768px (iPad portrait)
options
.
scaleFontSize
=
8
;
}
new
Chart
(
$
(
'
#build_timesChart
'
).
get
(
0
).
getContext
(
'
2d
'
)).
Bar
(
data
,
options
);
chartsData
.
forEach
(
scope
=>
buildChart
(
scope
));
});
app/assets/javascripts/pipelines/pipelines_times.js
deleted
100644 → 0
View file @
15b63e15
import
Chart
from
'
vendor/Chart
'
;
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
const
chartData
=
JSON
.
parse
(
document
.
getElementById
(
'
pipelinesTimesChartsData
'
).
innerHTML
);
const
data
=
{
labels
:
chartData
.
labels
,
datasets
:
[{
fillColor
:
'
rgba(220,220,220,0.5)
'
,
strokeColor
:
'
rgba(220,220,220,1)
'
,
barStrokeWidth
:
1
,
barValueSpacing
:
1
,
barDatasetSpacing
:
1
,
data
:
chartData
.
values
,
}],
};
const
ctx
=
$
(
'
#build_timesChart
'
).
get
(
0
).
getContext
(
'
2d
'
);
const
options
=
{
scaleOverlay
:
true
,
responsive
:
true
,
maintainAspectRatio
:
false
,
};
if
(
window
.
innerWidth
<
768
)
{
// Scale fonts if window width lower than 768px (iPad portrait)
options
.
scaleFontSize
=
8
;
}
new
Chart
(
ctx
).
Bar
(
data
,
options
);
});
app/views/projects/pipelines/charts.html.haml
View file @
c312d2b9
-
@no_container
=
true
-
@no_container
=
true
-
breadcrumb_title
"CI / CD Charts"
-
breadcrumb_title
"CI / CD Charts"
-
page_title
_
(
"Charts"
),
_
(
"Pipelines"
)
-
page_title
_
(
"Charts"
),
_
(
"Pipelines"
)
-
content_for
:page_specific_javascripts
do
=
page_specific_javascript_bundle_tag
(
'common_d3'
)
=
page_specific_javascript_bundle_tag
(
'graphs'
)
%div
{
class:
container_class
}
%div
{
class:
container_class
}
.sub-header-block
.sub-header-block
...
...
app/views/projects/pipelines/charts/_pipeline_times.haml
View file @
c312d2b9
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'pipelines_times'
)
%div
%div
%p
.light
%p
.light
=
_
(
"Commit duration in minutes for last 30 commits"
)
=
_
(
"Commit duration in minutes for last 30 commits"
)
...
...
app/views/projects/pipelines/charts/_pipelines.haml
View file @
c312d2b9
-
content_for
:page_specific_javascripts
do
=
webpack_bundle_tag
(
'pipelines_charts'
)
%h4
=
_
(
"Pipelines charts"
)
%h4
=
_
(
"Pipelines charts"
)
%p
%p
...
...
config/webpack.config.js
View file @
c312d2b9
...
@@ -79,9 +79,7 @@ var config = {
...
@@ -79,9 +79,7 @@ var config = {
notes
:
'
./notes/index.js
'
,
notes
:
'
./notes/index.js
'
,
pdf_viewer
:
'
./blob/pdf_viewer.js
'
,
pdf_viewer
:
'
./blob/pdf_viewer.js
'
,
pipelines
:
'
./pipelines/pipelines_bundle.js
'
,
pipelines
:
'
./pipelines/pipelines_bundle.js
'
,
pipelines_charts
:
'
./pipelines/pipelines_charts.js
'
,
pipelines_details
:
'
./pipelines/pipeline_details_bundle.js
'
,
pipelines_details
:
'
./pipelines/pipeline_details_bundle.js
'
,
pipelines_times
:
'
./pipelines/pipelines_times.js
'
,
profile
:
'
./profile/profile_bundle.js
'
,
profile
:
'
./profile/profile_bundle.js
'
,
project_import_gl
:
'
./projects/project_import_gitlab_project.js
'
,
project_import_gl
:
'
./projects/project_import_gitlab_project.js
'
,
prometheus_metrics
:
'
./prometheus_metrics
'
,
prometheus_metrics
:
'
./prometheus_metrics
'
,
...
...
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