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
d22b6b0f
Commit
d22b6b0f
authored
Apr 10, 2020
by
Dhiraj Bodicherla
Committed by
Kushal Pandya
Apr 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Monitoring chart tooltip improvement
This MR improves monitoring dashboard charts tooltip display logic
parent
befd7a23
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
39 deletions
+86
-39
app/assets/javascripts/monitoring/components/charts/annotations.js
...s/javascripts/monitoring/components/charts/annotations.js
+11
-1
app/assets/javascripts/monitoring/components/charts/time_series.vue
.../javascripts/monitoring/components/charts/time_series.vue
+5
-7
spec/frontend/monitoring/components/charts/time_series_spec.js
...frontend/monitoring/components/charts/time_series_spec.js
+70
-31
No files found.
app/assets/javascripts/monitoring/components/charts/annotations.js
View file @
d22b6b0f
...
@@ -87,11 +87,17 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
...
@@ -87,11 +87,17 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
return
{
return
{
name
:
'
deployments
'
,
name
:
'
deployments
'
,
value
:
[
deployment
.
createdAt
,
annotationsYAxisCoords
.
pos
],
value
:
[
deployment
.
createdAt
,
annotationsYAxisCoords
.
pos
],
// style options
symbol
:
deployment
.
icon
,
symbol
:
deployment
.
icon
,
symbolSize
:
symbolSizes
.
default
,
symbolSize
:
symbolSizes
.
default
,
itemStyle
:
{
itemStyle
:
{
color
:
deployment
.
color
,
color
:
deployment
.
color
,
},
},
// metadata that are accessible in `formatTooltipText` method
tooltipData
:
{
sha
:
deployment
.
sha
.
substring
(
0
,
8
),
commitUrl
:
deployment
.
commitUrl
,
},
};
};
});
});
...
@@ -100,8 +106,12 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
...
@@ -100,8 +106,12 @@ export const generateAnnotationsSeries = ({ deployments = [], annotations = [] }
return
{
return
{
name
:
'
annotations
'
,
name
:
'
annotations
'
,
value
:
[
annotation
.
from
,
annotationsYAxisCoords
.
pos
],
value
:
[
annotation
.
from
,
annotationsYAxisCoords
.
pos
],
// style options
symbol
:
'
none
'
,
symbol
:
'
none
'
,
description
:
annotation
.
description
,
// metadata that are accessible in `formatTooltipText` method
tooltipData
:
{
description
:
annotation
.
description
,
},
};
};
});
});
...
...
app/assets/javascripts/monitoring/components/charts/time_series.vue
View file @
d22b6b0f
...
@@ -262,19 +262,17 @@ export default {
...
@@ -262,19 +262,17 @@ export default {
params
.
seriesData
.
forEach
(
dataPoint
=>
{
params
.
seriesData
.
forEach
(
dataPoint
=>
{
if
(
dataPoint
.
value
)
{
if
(
dataPoint
.
value
)
{
const
[
xVal
,
yVal
]
=
dataPoint
.
value
;
const
[,
yVal
]
=
dataPoint
.
value
;
this
.
tooltip
.
type
=
dataPoint
.
name
;
this
.
tooltip
.
type
=
dataPoint
.
name
;
if
(
this
.
isTooltipOfType
(
this
.
tooltip
.
type
,
this
.
$options
.
tooltipTypes
.
deployments
))
{
if
(
this
.
isTooltipOfType
(
this
.
tooltip
.
type
,
this
.
$options
.
tooltipTypes
.
deployments
))
{
const
[
deploy
]
=
this
.
recentDeployments
.
filter
(
const
{
data
=
{}
}
=
dataPoint
;
deployment
=>
deployment
.
createdAt
===
xVal
,
this
.
tooltip
.
sha
=
data
?.
tooltipData
?.
sha
;
);
this
.
tooltip
.
commitUrl
=
data
?.
tooltipData
?.
commitUrl
;
this
.
tooltip
.
sha
=
deploy
.
sha
.
substring
(
0
,
8
);
this
.
tooltip
.
commitUrl
=
deploy
.
commitUrl
;
}
else
if
(
}
else
if
(
this
.
isTooltipOfType
(
this
.
tooltip
.
type
,
this
.
$options
.
tooltipTypes
.
annotations
)
this
.
isTooltipOfType
(
this
.
tooltip
.
type
,
this
.
$options
.
tooltipTypes
.
annotations
)
)
{
)
{
const
{
data
}
=
dataPoint
;
const
{
data
}
=
dataPoint
;
this
.
tooltip
.
content
.
push
(
data
?.
description
);
this
.
tooltip
.
content
.
push
(
data
?.
tooltipData
?.
description
);
}
else
{
}
else
{
const
{
seriesName
,
color
,
dataIndex
}
=
dataPoint
;
const
{
seriesName
,
color
,
dataIndex
}
=
dataPoint
;
...
...
spec/frontend/monitoring/components/charts/time_series_spec.js
View file @
d22b6b0f
...
@@ -155,43 +155,56 @@ describe('Time series component', () => {
...
@@ -155,43 +155,56 @@ describe('Time series component', () => {
describe
(
'
methods
'
,
()
=>
{
describe
(
'
methods
'
,
()
=>
{
describe
(
'
formatTooltipText
'
,
()
=>
{
describe
(
'
formatTooltipText
'
,
()
=>
{
let
mockDate
;
const
mockCommitUrl
=
deploymentData
[
0
].
commitUrl
;
let
mockCommitUrl
;
const
mockDate
=
deploymentData
[
0
].
created_at
;
let
generateSeriesData
;
const
mockSha
=
'
f5bcd1d9
'
;
const
mockLineSeriesData
=
()
=>
({
beforeEach
(()
=>
{
seriesData
:
[
mockDate
=
deploymentData
[
0
].
created_at
;
{
mockCommitUrl
=
deploymentData
[
0
].
commitUrl
;
seriesName
:
timeSeriesChart
.
vm
.
chartData
[
0
].
name
,
generateSeriesData
=
type
=>
({
componentSubType
:
'
line
'
,
seriesData
:
[
value
:
[
mockDate
,
5.55555
],
{
dataIndex
:
0
,
seriesName
:
timeSeriesChart
.
vm
.
chartData
[
0
].
name
,
},
componentSubType
:
type
,
],
value
:
[
mockDate
,
5.55555
],
value
:
mockDate
,
dataIndex
:
0
,
...(
type
===
'
scatter
'
&&
{
name
:
'
deployments
'
}),
},
],
value
:
mockDate
,
});
});
});
const
annotationsMetadata
=
{
tooltipData
:
{
sha
:
mockSha
,
commitUrl
:
mockCommitUrl
,
},
};
const
mockAnnotationsSeriesData
=
{
seriesData
:
[
{
componentSubType
:
'
scatter
'
,
seriesName
:
'
series01
'
,
dataIndex
:
0
,
value
:
[
mockDate
,
5.55555
],
type
:
'
scatter
'
,
name
:
'
deployments
'
,
},
],
value
:
mockDate
,
};
it
(
'
does not throw error if data point is outside the zoom range
'
,
()
=>
{
it
(
'
does not throw error if data point is outside the zoom range
'
,
()
=>
{
const
seriesDataWithoutValue
=
generateSeriesData
(
'
line
'
);
const
seriesDataWithoutValue
=
{
expect
(
...
mockLineSeriesData
(),
timeSeriesChart
.
vm
.
formatTooltipText
({
seriesData
:
mockLineSeriesData
().
seriesData
.
map
(
data
=>
({
...
seriesDataWithoutValue
,
...
data
,
seriesData
:
seriesDataWithoutValue
.
seriesData
.
map
(
data
=>
({
value
:
undefined
,
...
data
,
})),
value
:
undefined
,
};
})),
expect
(
timeSeriesChart
.
vm
.
formatTooltipText
(
seriesDataWithoutValue
)).
toBeUndefined
();
}),
).
toBeUndefined
();
});
});
describe
(
'
when series is of line type
'
,
()
=>
{
describe
(
'
when series is of line type
'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
done
=>
{
timeSeriesChart
.
vm
.
formatTooltipText
(
generateSeriesData
(
'
line
'
));
timeSeriesChart
.
vm
.
formatTooltipText
(
mockLineSeriesData
(
));
timeSeriesChart
.
vm
.
$nextTick
(
done
);
timeSeriesChart
.
vm
.
$nextTick
(
done
);
});
});
...
@@ -223,7 +236,14 @@ describe('Time series component', () => {
...
@@ -223,7 +236,14 @@ describe('Time series component', () => {
describe
(
'
when series is of scatter type, for deployments
'
,
()
=>
{
describe
(
'
when series is of scatter type, for deployments
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
timeSeriesChart
.
vm
.
formatTooltipText
(
generateSeriesData
(
'
scatter
'
));
timeSeriesChart
.
vm
.
formatTooltipText
({
...
mockAnnotationsSeriesData
,
seriesData
:
mockAnnotationsSeriesData
.
seriesData
.
map
(
data
=>
({
...
data
,
data
:
annotationsMetadata
,
})),
});
return
timeSeriesChart
.
vm
.
$nextTick
;
});
});
it
(
'
set tooltip type to deployments
'
,
()
=>
{
it
(
'
set tooltip type to deployments
'
,
()
=>
{
...
@@ -242,6 +262,25 @@ describe('Time series component', () => {
...
@@ -242,6 +262,25 @@ describe('Time series component', () => {
expect
(
timeSeriesChart
.
vm
.
tooltip
.
commitUrl
).
toBe
(
mockCommitUrl
);
expect
(
timeSeriesChart
.
vm
.
tooltip
.
commitUrl
).
toBe
(
mockCommitUrl
);
});
});
});
});
describe
(
'
when series is of scatter type and deployments data is missing
'
,
()
=>
{
beforeEach
(()
=>
{
timeSeriesChart
.
vm
.
formatTooltipText
(
mockAnnotationsSeriesData
);
return
timeSeriesChart
.
vm
.
$nextTick
;
});
it
(
'
formats tooltip title
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
tooltip
.
title
).
toBe
(
'
16 Jul 2019, 10:14AM
'
);
});
it
(
'
formats tooltip sha
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
tooltip
.
sha
).
toBeUndefined
();
});
it
(
'
formats tooltip commit url
'
,
()
=>
{
expect
(
timeSeriesChart
.
vm
.
tooltip
.
commitUrl
).
toBeUndefined
();
});
});
});
});
describe
(
'
setSvg
'
,
()
=>
{
describe
(
'
setSvg
'
,
()
=>
{
...
...
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