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
Léo-Paul Géneau
gitlab-ce
Commits
64abbb78
Commit
64abbb78
authored
Mar 06, 2019
by
Adriel Santiago
Committed by
Clement Ho
Mar 06, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add zoom to metrics dashboard
Adds the ability to change data zoom for metrics graphs
parent
d40b55c2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
17 deletions
+33
-17
app/assets/javascripts/monitoring/components/charts/area.vue
app/assets/javascripts/monitoring/components/charts/area.vue
+13
-12
changelogs/unreleased/57085-introduce-zoom-and-scroll-functionality-on-metrics-charts.yml
...oduce-zoom-and-scroll-functionality-on-metrics-charts.yml
+5
-0
spec/javascripts/monitoring/charts/area_spec.js
spec/javascripts/monitoring/charts/area_spec.js
+15
-5
No files found.
app/assets/javascripts/monitoring/components/charts/area.vue
View file @
64abbb78
...
...
@@ -57,7 +57,7 @@ export default {
},
width
:
0
,
height
:
0
,
s
catterSymbol
:
undefined
,
s
vgs
:
{}
,
};
},
computed
:
{
...
...
@@ -78,25 +78,25 @@ export default {
axisPointer
:
{
snap
:
true
,
},
nameTextStyle
:
{
padding
:
[
18
,
0
,
0
,
0
],
},
},
yAxis
:
{
name
:
this
.
yAxisLabel
,
axisLabel
:
{
formatter
:
value
=>
value
.
toFixed
(
3
),
},
nameTextStyle
:
{
padding
:
[
0
,
0
,
36
,
0
],
},
},
legend
:
{
formatter
:
this
.
xAxisLabel
,
},
series
:
this
.
scatterSeries
,
dataZoom
:
this
.
dataZoomConfig
,
};
},
dataZoomConfig
()
{
const
handleIcon
=
this
.
svgs
[
'
scroll-handle
'
];
return
handleIcon
?
{
handleIcon
}
:
{};
},
earliestDatapoint
()
{
return
Object
.
values
(
this
.
chartData
).
reduce
((
acc
,
data
)
=>
{
const
[[
timestamp
]]
=
data
.
sort
(([
a
],
[
b
])
=>
{
...
...
@@ -131,7 +131,7 @@ export default {
return
{
type
:
'
scatter
'
,
data
:
this
.
recentDeployments
.
map
(
deployment
=>
[
deployment
.
createdAt
,
0
]),
symbol
:
this
.
s
catterSymbol
,
symbol
:
this
.
s
vgs
.
rocket
,
symbolSize
:
14
,
};
},
...
...
@@ -151,7 +151,8 @@ export default {
created
()
{
debouncedResize
=
debounceByAnimationFrame
(
this
.
onResize
);
window
.
addEventListener
(
'
resize
'
,
debouncedResize
);
this
.
getScatterSymbol
();
this
.
setSvg
(
'
rocket
'
);
this
.
setSvg
(
'
scroll-handle
'
);
},
methods
:
{
formatTooltipText
(
params
)
{
...
...
@@ -167,11 +168,11 @@ export default {
this
.
tooltip
.
content
=
`
${
this
.
yAxisLabel
}
${
seriesData
.
value
[
1
].
toFixed
(
3
)}
`
;
}
},
getScatterSymbol
(
)
{
getSvgIconPathContent
(
'
rocket
'
)
setSvg
(
name
)
{
getSvgIconPathContent
(
name
)
.
then
(
path
=>
{
if
(
path
)
{
this
.
scatterSymbol
=
`path://
${
path
}
`
;
this
.
$set
(
this
.
svgs
,
name
,
`path://
${
path
}
`
)
;
}
})
.
catch
(()
=>
{});
...
...
changelogs/unreleased/57085-introduce-zoom-and-scroll-functionality-on-metrics-charts.yml
0 → 100644
View file @
64abbb78
---
title
:
Add zoom and scroll to metrics dashboard
merge_request
:
25388
author
:
type
:
added
spec/javascripts/monitoring/charts/area_spec.js
View file @
64abbb78
...
...
@@ -7,6 +7,7 @@ import MonitoringMock, { deploymentData } from '../mock_data';
describe
(
'
Area component
'
,
()
=>
{
const
mockWidgets
=
'
mockWidgets
'
;
const
mockSvgPathContent
=
'
mockSvgPathContent
'
;
let
mockGraphData
;
let
areaChart
;
let
spriteSpy
;
...
...
@@ -30,7 +31,7 @@ describe('Area component', () => {
});
spriteSpy
=
spyOnDependency
(
Area
,
'
getSvgIconPathContent
'
).
and
.
callFake
(
()
=>
new
Promise
(
resolve
=>
resolve
()),
()
=>
new
Promise
(
resolve
=>
resolve
(
mockSvgPathContent
)),
);
});
...
...
@@ -146,13 +147,22 @@ describe('Area component', () => {
});
});
describe
(
'
getScatterSymbol
'
,
()
=>
{
describe
(
'
setSvg
'
,
()
=>
{
const
mockSvgName
=
'
mockSvgName
'
;
beforeEach
(()
=>
{
areaChart
.
vm
.
getScatterSymbol
();
areaChart
.
vm
.
setSvg
(
mockSvgName
);
});
it
(
'
gets svg path content
'
,
()
=>
{
expect
(
spriteSpy
).
toHaveBeenCalledWith
(
mockSvgName
);
});
it
(
'
gets rocket svg path content for use as deployment data symbol
'
,
()
=>
{
expect
(
spriteSpy
).
toHaveBeenCalledWith
(
'
rocket
'
);
it
(
'
sets svg path content
'
,
done
=>
{
areaChart
.
vm
.
$nextTick
(()
=>
{
expect
(
areaChart
.
vm
.
svgs
[
mockSvgName
]).
toBe
(
`path://
${
mockSvgPathContent
}
`
);
done
();
});
});
});
...
...
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