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
Boxiang Sun
gitlab-ce
Commits
33cd912b
Commit
33cd912b
authored
Jan 23, 2019
by
Adriel Santiago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use ECharts for metrics dashboard
Update metrics dashboard to support GitLab UI area chart changes
parent
d7a3f875
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
26 deletions
+17
-26
app/assets/javascripts/monitoring/components/charts/area.vue
app/assets/javascripts/monitoring/components/charts/area.vue
+11
-10
app/assets/javascripts/monitoring/stores/monitoring_store.js
app/assets/javascripts/monitoring/stores/monitoring_store.js
+5
-5
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+1
-11
No files found.
app/assets/javascripts/monitoring/components/charts/area.vue
View file @
33cd912b
...
...
@@ -35,13 +35,7 @@ export default {
computed
:
{
chartData
()
{
return
this
.
graphData
.
queries
.
reduce
((
accumulator
,
query
)
=>
{
const
xLabel
=
`
${
query
.
unit
}
`
;
accumulator
[
xLabel
]
=
{};
query
.
result
.
forEach
(
res
=>
res
.
values
.
forEach
(
v
=>
{
accumulator
[
xLabel
][
v
.
time
.
toISOString
()]
=
v
.
value
;
}),
);
accumulator
[
query
.
unit
]
=
query
.
result
.
reduce
((
acc
,
res
)
=>
acc
.
concat
(
res
.
values
),
[]);
return
accumulator
;
},
{});
},
...
...
@@ -51,14 +45,17 @@ export default {
name
:
'
Time
'
,
type
:
'
time
'
,
axisLabel
:
{
formatter
:
date
=>
dateFormat
(
date
,
'
h:MMtt
'
),
formatter
:
date
=>
dateFormat
(
date
,
'
h:MM TT
'
),
},
axisPointer
:
{
snap
:
true
,
},
nameTextStyle
:
{
padding
:
[
18
,
0
,
0
,
0
],
},
},
yAxis
:
{
name
:
this
.
graphData
.
y_l
abel
,
name
:
this
.
yAxisL
abel
,
axisLabel
:
{
formatter
:
value
=>
value
.
toFixed
(
3
),
},
...
...
@@ -74,6 +71,10 @@ export default {
xAxisLabel
()
{
return
this
.
graphData
.
queries
.
map
(
query
=>
query
.
label
).
join
(
'
,
'
);
},
yAxisLabel
()
{
const
[
query
]
=
this
.
graphData
.
queries
;
return
`
${
this
.
graphData
.
y_label
}
(
${
query
.
unit
}
)`
;
},
},
methods
:
{
formatTooltipText
(
params
)
{
...
...
@@ -85,7 +86,7 @@ export default {
</
script
>
<
template
>
<div
class=
"prometheus-graph"
>
<div
class=
"prometheus-graph
col-12 col-lg-6
"
>
<div
class=
"prometheus-graph-header"
>
<h5
class=
"prometheus-graph-title"
>
{{
graphData
.
title
}}
</h5>
<div
class=
"prometheus-graph-widgets"
><slot></slot></div>
...
...
app/assets/javascripts/monitoring/stores/monitoring_store.js
View file @
33cd912b
...
...
@@ -13,7 +13,7 @@ function checkQueryEmptyData(query) {
result
:
query
.
result
.
filter
(
timeSeries
=>
{
const
newTimeSeries
=
timeSeries
;
const
hasValue
=
series
=>
!
Number
.
isNaN
(
series
.
value
)
&&
(
series
.
value
!==
null
||
series
.
value
!==
undefined
);
!
Number
.
isNaN
(
series
[
1
])
&&
(
series
[
1
]
!==
null
||
series
[
1
]
!==
undefined
);
const
hasNonNullValue
=
timeSeries
.
values
.
find
(
hasValue
);
newTimeSeries
.
values
=
hasNonNullValue
?
newTimeSeries
.
values
:
[];
...
...
@@ -33,10 +33,10 @@ function normalizeMetrics(metrics) {
...
query
,
result
:
query
.
result
.
map
(
result
=>
({
...
result
,
values
:
result
.
values
.
map
(([
timestamp
,
value
])
=>
({
time
:
new
Date
(
timestamp
*
1000
),
value
:
Number
(
value
),
})
),
values
:
result
.
values
.
map
(([
timestamp
,
value
])
=>
[
new
Date
(
timestamp
*
1000
).
toISOString
(
),
Number
(
value
),
]
),
})),
}));
...
...
app/assets/stylesheets/pages/environments.scss
View file @
33cd912b
...
...
@@ -240,18 +240,7 @@
}
.prometheus-graph
{
flex
:
1
0
auto
;
min-width
:
450px
;
max-width
:
100%
;
padding
:
$gl-padding
/
2
;
h5
{
font-size
:
16px
;
}
@include
media-breakpoint-down
(
sm
)
{
min-width
:
100%
;
}
}
.prometheus-graph-header
{
...
...
@@ -261,6 +250,7 @@
margin-bottom
:
$gl-padding-8
;
h5
{
font-size
:
$gl-font-size-large
;
margin
:
0
;
}
}
...
...
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