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
057e84d6
Commit
057e84d6
authored
Sep 01, 2017
by
Jose Ivan Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed some components
parent
0357726d
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
43 deletions
+24
-43
app/assets/javascripts/monitoring/components/graph.vue
app/assets/javascripts/monitoring/components/graph.vue
+4
-4
app/assets/javascripts/monitoring/components/graph_path.vue
app/assets/javascripts/monitoring/components/graph_path.vue
+0
-0
app/assets/javascripts/monitoring/utils/multiple_time_series.js
...sets/javascripts/monitoring/utils/multiple_time_series.js
+5
-26
changelogs/unreleased/additional-time-series-charts.yml
changelogs/unreleased/additional-time-series-charts.yml
+1
-1
spec/javascripts/monitoring/graph_path_spec.js
spec/javascripts/monitoring/graph_path_spec.js
+7
-6
spec/javascripts/monitoring/utils/multiple_time_series_spec.js
...javascripts/monitoring/utils/multiple_time_series_spec.js
+7
-6
No files found.
app/assets/javascripts/monitoring/components/graph.vue
View file @
057e84d6
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
import
GraphLegend
from
'
./graph/legend.vue
'
;
import
GraphLegend
from
'
./graph/legend.vue
'
;
import
GraphFlag
from
'
./graph/flag.vue
'
;
import
GraphFlag
from
'
./graph/flag.vue
'
;
import
GraphDeployment
from
'
./graph/deployment.vue
'
;
import
GraphDeployment
from
'
./graph/deployment.vue
'
;
import
monitoringPaths
from
'
./monitoring_paths
.vue
'
;
import
GraphPath
from
'
./graph_path
.vue
'
;
import
MonitoringMixin
from
'
../mixins/monitoring_mixins
'
;
import
MonitoringMixin
from
'
../mixins/monitoring_mixins
'
;
import
eventHub
from
'
../event_hub
'
;
import
eventHub
from
'
../event_hub
'
;
import
measurements
from
'
../utils/measurements
'
;
import
measurements
from
'
../utils/measurements
'
;
...
@@ -63,7 +63,7 @@
...
@@ -63,7 +63,7 @@
GraphLegend
,
GraphLegend
,
GraphFlag
,
GraphFlag
,
GraphDeployment
,
GraphDeployment
,
monitoringPaths
,
GraphPath
,
},
},
computed
:
{
computed
:
{
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
class=
"graph-data"
class=
"graph-data"
:viewBox=
"innerViewBox"
:viewBox=
"innerViewBox"
ref=
"graphData"
>
ref=
"graphData"
>
<
monitoring-paths
<
graph-path
v-for=
"(path, index) in timeSeries"
v-for=
"(path, index) in timeSeries"
:key=
"index"
:key=
"index"
:generated-line-path=
"path.linePath"
:generated-line-path=
"path.linePath"
...
@@ -246,7 +246,7 @@
...
@@ -246,7 +246,7 @@
:line-color=
"path.lineColor"
:line-color=
"path.lineColor"
:area-color=
"path.areaColor"
:area-color=
"path.areaColor"
/>
/>
<
monitoring
-deployment
<
graph
-deployment
:show-deploy-info=
"showDeployInfo"
:show-deploy-info=
"showDeployInfo"
:deployment-data=
"reducedDeploymentData"
:deployment-data=
"reducedDeploymentData"
:graph-height=
"graphHeight"
:graph-height=
"graphHeight"
...
...
app/assets/javascripts/monitoring/components/
monitoring_paths
.vue
→
app/assets/javascripts/monitoring/components/
graph_path
.vue
View file @
057e84d6
File moved
app/assets/javascripts/monitoring/utils/multiple_time_series.js
View file @
057e84d6
...
@@ -15,6 +15,9 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
...
@@ -15,6 +15,9 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
let
timeSeriesNumber
=
1
;
let
timeSeriesNumber
=
1
;
let
lineColor
=
'
#1f78d1
'
;
let
lineColor
=
'
#1f78d1
'
;
let
areaColor
=
'
#8fbce8
'
;
let
areaColor
=
'
#8fbce8
'
;
const
lineColors
=
[
'
#1f78d1
'
,
'
#fc9403
'
,
'
#db3b21
'
,
'
#1aaa55
'
,
'
#6666c4
'
];
const
areaColors
=
[
'
#8fbce8
'
,
'
#feca81
'
,
'
#ed9d90
'
,
'
#8dd5aa
'
,
'
#d1d1f0
'
];
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
]);
...
@@ -35,32 +38,8 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
...
@@ -35,32 +38,8 @@ export default function createTimeSeries(seriesData, graphWidth, graphHeight, gr
.
y1
(
d
=>
timeSeriesScaleY
(
d
.
value
))
.
y1
(
d
=>
timeSeriesScaleY
(
d
.
value
))
.
interpolate
(
'
linear
'
);
.
interpolate
(
'
linear
'
);
switch
(
timeSeriesNumber
)
{
lineColor
=
lineColors
[
timeSeriesNumber
-
1
];
case
1
:
areaColor
=
areaColors
[
timeSeriesNumber
-
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
)
{
if
(
timeSeriesNumber
<=
5
)
{
timeSeriesNumber
=
timeSeriesNumber
+=
1
;
timeSeriesNumber
=
timeSeriesNumber
+=
1
;
...
...
changelogs/unreleased/additional-time-series-charts.yml
View file @
057e84d6
---
---
title
:
Added support
the multiple time series for prometheus monitoring
title
:
Added support
for multiple time series
merge_request
:
!36893
merge_request
:
!36893
author
:
author
:
type
:
changed
type
:
changed
spec/javascripts/monitoring/
monitoring_paths
_spec.js
→
spec/javascripts/monitoring/
graph_path
_spec.js
View file @
057e84d6
import
Vue
from
'
vue
'
;
import
Vue
from
'
vue
'
;
import
MonitoringPaths
from
'
~/monitoring/components/monitoring_paths
.vue
'
;
import
GraphPath
from
'
~/monitoring/components/graph_path
.vue
'
;
import
createTimeSeries
from
'
~/monitoring/utils/multiple_time_series
'
;
import
createTimeSeries
from
'
~/monitoring/utils/multiple_time_series
'
;
import
{
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
}
from
'
./mock_data
'
;
import
{
singleRowMetricsMultipleSeries
,
convertDatesMultipleSeries
}
from
'
./mock_data
'
;
const
createComponent
=
(
propsData
)
=>
{
const
createComponent
=
(
propsData
)
=>
{
const
Component
=
Vue
.
extend
(
MonitoringPaths
);
const
Component
=
Vue
.
extend
(
GraphPath
);
return
new
Component
({
return
new
Component
({
propsData
,
propsData
,
...
@@ -14,12 +14,13 @@ const createComponent = (propsData) => {
...
@@ -14,12 +14,13 @@ const createComponent = (propsData) => {
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
const
timeSeries
=
createTimeSeries
(
convertedMetrics
[
0
].
queries
[
0
].
result
,
428
,
272
,
120
);
const
timeSeries
=
createTimeSeries
(
convertedMetrics
[
0
].
queries
[
0
].
result
,
428
,
272
,
120
);
const
firstTimeSeries
=
timeSeries
[
0
];
describe
(
'
Monitoring Paths
'
,
()
=>
{
describe
(
'
Monitoring Paths
'
,
()
=>
{
it
(
'
renders two paths to represent a line and the area underneath it
'
,
()
=>
{
it
(
'
renders two paths to represent a line and the area underneath it
'
,
()
=>
{
const
component
=
createComponent
({
const
component
=
createComponent
({
generatedLinePath
:
timeSeries
[
0
]
.
linePath
,
generatedLinePath
:
firstTimeSeries
.
linePath
,
generatedAreaPath
:
timeSeries
[
0
]
.
areaPath
,
generatedAreaPath
:
firstTimeSeries
.
areaPath
,
lineColor
:
'
#ccc
'
,
lineColor
:
'
#ccc
'
,
areaColor
:
'
#fff
'
,
areaColor
:
'
#fff
'
,
});
});
...
@@ -27,8 +28,8 @@ describe('Monitoring Paths', () => {
...
@@ -27,8 +28,8 @@ describe('Monitoring Paths', () => {
const
metricLine
=
component
.
$el
.
querySelector
(
'
.metric-line
'
);
const
metricLine
=
component
.
$el
.
querySelector
(
'
.metric-line
'
);
expect
(
metricArea
.
getAttribute
(
'
fill
'
)).
toBe
(
'
#fff
'
);
expect
(
metricArea
.
getAttribute
(
'
fill
'
)).
toBe
(
'
#fff
'
);
expect
(
metricArea
.
getAttribute
(
'
d
'
)).
toBe
(
timeSeries
[
0
]
.
areaPath
);
expect
(
metricArea
.
getAttribute
(
'
d
'
)).
toBe
(
firstTimeSeries
.
areaPath
);
expect
(
metricLine
.
getAttribute
(
'
stroke
'
)).
toBe
(
'
#ccc
'
);
expect
(
metricLine
.
getAttribute
(
'
stroke
'
)).
toBe
(
'
#ccc
'
);
expect
(
metricLine
.
getAttribute
(
'
d
'
)).
toBe
(
timeSeries
[
0
]
.
linePath
);
expect
(
metricLine
.
getAttribute
(
'
d
'
)).
toBe
(
firstTimeSeries
.
linePath
);
});
});
});
});
spec/javascripts/monitoring/utils/multiple_time_series_spec.js
View file @
057e84d6
...
@@ -3,15 +3,16 @@ import { convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from '../m
...
@@ -3,15 +3,16 @@ import { convertDatesMultipleSeries, singleRowMetricsMultipleSeries } from '../m
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
const
convertedMetrics
=
convertDatesMultipleSeries
(
singleRowMetricsMultipleSeries
);
const
timeSeries
=
createTimeSeries
(
convertedMetrics
[
0
].
queries
[
0
].
result
,
428
,
272
,
120
);
const
timeSeries
=
createTimeSeries
(
convertedMetrics
[
0
].
queries
[
0
].
result
,
428
,
272
,
120
);
const
firstTimeSeries
=
timeSeries
[
0
];
describe
(
'
Multiple time series
'
,
()
=>
{
describe
(
'
Multiple time series
'
,
()
=>
{
it
(
'
createTimeSeries returned array contains an object for each element
'
,
()
=>
{
it
(
'
createTimeSeries returned array contains an object for each element
'
,
()
=>
{
expect
(
typeof
timeSeries
[
0
]
.
linePath
).
toEqual
(
'
string
'
);
expect
(
typeof
firstTimeSeries
.
linePath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
]
.
areaPath
).
toEqual
(
'
string
'
);
expect
(
typeof
firstTimeSeries
.
areaPath
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
]
.
timeSeriesScaleX
).
toEqual
(
'
function
'
);
expect
(
typeof
firstTimeSeries
.
timeSeriesScaleX
).
toEqual
(
'
function
'
);
expect
(
typeof
timeSeries
[
0
]
.
areaColor
).
toEqual
(
'
string
'
);
expect
(
typeof
firstTimeSeries
.
areaColor
).
toEqual
(
'
string
'
);
expect
(
typeof
timeSeries
[
0
]
.
lineColor
).
toEqual
(
'
string
'
);
expect
(
typeof
firstTimeSeries
.
lineColor
).
toEqual
(
'
string
'
);
expect
(
timeSeries
[
0
]
.
values
instanceof
Array
).
toEqual
(
true
);
expect
(
firstTimeSeries
.
values
instanceof
Array
).
toEqual
(
true
);
});
});
it
(
'
createTimeSeries returns an array
'
,
()
=>
{
it
(
'
createTimeSeries returns an array
'
,
()
=>
{
...
...
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