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
05a77e79
Commit
05a77e79
authored
Aug 30, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added simple support for multiple colors on the different time series
parent
dd7d691f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
18 deletions
+45
-18
app/assets/javascripts/monitoring/components/graph.vue
app/assets/javascripts/monitoring/components/graph.vue
+2
-11
app/assets/javascripts/monitoring/components/graph/legend.vue
...assets/javascripts/monitoring/components/graph/legend.vue
+1
-5
app/assets/javascripts/monitoring/components/monitoring_paths.vue
...ts/javascripts/monitoring/components/monitoring_paths.vue
+1
-1
app/assets/javascripts/monitoring/utils/multiple_time_series.js
...sets/javascripts/monitoring/utils/multiple_time_series.js
+38
-0
app/assets/stylesheets/pages/environments.scss
app/assets/stylesheets/pages/environments.scss
+1
-1
spec/javascripts/monitoring/utils/multiple_time_series_spec.js
...javascripts/monitoring/utils/multiple_time_series_spec.js
+2
-0
No files found.
app/assets/javascripts/monitoring/components/graph.vue
View file @
05a77e79
...
@@ -233,7 +233,6 @@
...
@@ -233,7 +233,6 @@
:graph-height=
"graphHeight"
:graph-height=
"graphHeight"
:margin=
"margin"
:margin=
"margin"
:measurements=
"measurements"
:measurements=
"measurements"
:area-color-rgb=
"areaColorRgb"
:legend-title=
"legendTitle"
:legend-title=
"legendTitle"
:y-axis-label=
"yAxisLabel"
:y-axis-label=
"yAxisLabel"
:time-series=
"timeSeries"
:time-series=
"timeSeries"
...
@@ -249,17 +248,9 @@
...
@@ -249,17 +248,9 @@
:key=
"index"
:key=
"index"
:generated-line-path=
"path.linePath"
:generated-line-path=
"path.linePath"
:generated-area-path=
"path.areaPath"
:generated-area-path=
"path.areaPath"
:line-color=
"
lineColorRgb
"
:line-color=
"
path.lineColor
"
:area-color=
"
areaColorRgb
"
:area-color=
"
path.areaColor
"
/>
/>
<rect
class=
"prometheus-graph-overlay"
:width=
"(graphWidth - 70)"
:height=
"(graphHeight - 100)"
transform=
"translate(-5, 20)"
ref=
"graphOverlay"
@
mousemove=
"handleMouseOverGraph($event)"
>
</rect>
<monitoring-deployment
<monitoring-deployment
:show-deploy-info=
"showDeployInfo"
:show-deploy-info=
"showDeployInfo"
:deployment-data=
"reducedDeploymentData"
:deployment-data=
"reducedDeploymentData"
...
...
app/assets/javascripts/monitoring/components/graph/legend.vue
View file @
05a77e79
...
@@ -19,10 +19,6 @@
...
@@ -19,10 +19,6 @@
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
areaColorRgb
:
{
type
:
String
,
required
:
true
,
},
legendTitle
:
{
legendTitle
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
...
@@ -156,7 +152,7 @@
...
@@ -156,7 +152,7 @@
:key=
"index"
:key=
"index"
:transform=
"translateLegendGroup(index)"
>
:transform=
"translateLegendGroup(index)"
>
<rect
<rect
:fill=
"
areaColorRgb
"
:fill=
"
series.areaColor
"
:width=
"measurements.legends.width"
:width=
"measurements.legends.width"
:height=
"measurements.legends.height"
:height=
"measurements.legends.height"
x=
"20"
x=
"20"
...
...
app/assets/javascripts/monitoring/components/monitoring_paths.vue
View file @
05a77e79
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
:d=
"generatedLinePath"
:d=
"generatedLinePath"
:stroke=
"lineColor"
:stroke=
"lineColor"
fill=
"none"
fill=
"none"
stroke-width=
"
2
"
stroke-width=
"
1
"
transform=
"translate(-5, 20)"
>
transform=
"translate(-5, 20)"
>
</path>
</path>
</g>
</g>
...
...
app/assets/javascripts/monitoring/utils/multiple_time_series.js
View file @
05a77e79
...
@@ -12,6 +12,9 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
...
@@ -12,6 +12,9 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
const
maxValueFromSeries
=
_
.
max
(
maxValues
,
val
=>
val
.
maxValue
);
const
maxValueFromSeries
=
_
.
max
(
maxValues
,
val
=>
val
.
maxValue
);
let
timeSeriesNumber
=
1
;
let
lineColor
=
'
#1f78d1
'
;
let
areaColor
=
'
#8fbce8
'
;
return
seriesData
.
map
((
timeSeries
)
=>
{
return
seriesData
.
map
((
timeSeries
)
=>
{
const
timeSeriesScaleX
=
d3
.
time
.
scale
()
const
timeSeriesScaleX
=
d3
.
time
.
scale
()
.
range
([
0
,
graphWidth
-
70
]);
.
range
([
0
,
graphWidth
-
70
]);
...
@@ -32,11 +35,46 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
...
@@ -32,11 +35,46 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
.
y1
(
d
=>
timeSeriesScaleY
(
d
.
value
))
.
y1
(
d
=>
timeSeriesScaleY
(
d
.
value
))
.
interpolate
(
'
linear
'
);
.
interpolate
(
'
linear
'
);
switch
(
timeSeriesNumber
)
{
case
1
:
lineColor
=
'
#1f78d1
'
;
areaColor
=
'
#8fbce8
'
;
break
;
case
2
:
lineColor
=
'
#fc9403
'
;
areaColor
=
'
#feca81
'
;
break
;
case
3
:
lineColor
=
'
#db3b21
'
;
areaColor
=
'
#ed9d90
'
;
break
;
case
4
:
lineColor
=
'
#1aaa55
'
;
areaColor
=
'
#8dd5aa
'
;
break
;
case
5
:
lineColor
=
'
#6666c4
'
;
areaColor
=
'
#d1d1f0
'
;
break
;
default
:
lineColor
=
'
#1f78d1
'
;
areaColor
=
'
#8fbce8
'
;
break
;
}
if
(
timeSeriesNumber
<=
5
)
{
timeSeriesNumber
=
timeSeriesNumber
+=
1
;
}
else
{
timeSeriesNumber
=
1
;
}
return
{
return
{
linePath
:
lineFunction
(
timeSeries
.
values
),
linePath
:
lineFunction
(
timeSeries
.
values
),
areaPath
:
areaFunction
(
timeSeries
.
values
),
areaPath
:
areaFunction
(
timeSeries
.
values
),
timeSeriesScaleX
,
timeSeriesScaleX
,
values
:
timeSeries
.
values
,
values
:
timeSeries
.
values
,
lineColor
,
areaColor
,
};
};
});
});
}
}
app/assets/stylesheets/pages/environments.scss
View file @
05a77e79
...
@@ -167,7 +167,7 @@
...
@@ -167,7 +167,7 @@
}
}
.metric-area
{
.metric-area
{
opacity
:
0
.
8
;
opacity
:
0
.
1
;
}
}
.prometheus-graph-overlay
{
.prometheus-graph-overlay
{
...
...
spec/javascripts/monitoring/utils/multiple_time_series_spec.js
View file @
05a77e79
...
@@ -9,6 +9,8 @@ describe('Multiple time series', () => {
...
@@ -9,6 +9,8 @@ describe('Multiple time series', () => {
expect
(
typeof
timeSeries
[
0
].
linePath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
].
linePath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
].
areaPath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
].
areaPath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
].
timeSeriesScaleX
).
toEqual
(
'
function
'
);
expect
(
typeof
timeSeries
[
0
].
timeSeriesScaleX
).
toEqual
(
'
function
'
);
expect
(
typeof
timeSeries
[
0
].
areaColor
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
].
lineColor
).
toEqual
(
'
string
'
);
expect
(
timeSeries
[
0
].
values
instanceof
Array
).
toEqual
(
true
);
expect
(
timeSeries
[
0
].
values
instanceof
Array
).
toEqual
(
true
);
});
});
...
...
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