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
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
Show 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 {
...
@@ -57,7 +57,7 @@ export default {
},
},
width
:
0
,
width
:
0
,
height
:
0
,
height
:
0
,
s
catterSymbol
:
undefined
,
s
vgs
:
{}
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -78,25 +78,25 @@ export default {
...
@@ -78,25 +78,25 @@ export default {
axisPointer
:
{
axisPointer
:
{
snap
:
true
,
snap
:
true
,
},
},
nameTextStyle
:
{
padding
:
[
18
,
0
,
0
,
0
],
},
},
},
yAxis
:
{
yAxis
:
{
name
:
this
.
yAxisLabel
,
name
:
this
.
yAxisLabel
,
axisLabel
:
{
axisLabel
:
{
formatter
:
value
=>
value
.
toFixed
(
3
),
formatter
:
value
=>
value
.
toFixed
(
3
),
},
},
nameTextStyle
:
{
padding
:
[
0
,
0
,
36
,
0
],
},
},
},
legend
:
{
legend
:
{
formatter
:
this
.
xAxisLabel
,
formatter
:
this
.
xAxisLabel
,
},
},
series
:
this
.
scatterSeries
,
series
:
this
.
scatterSeries
,
dataZoom
:
this
.
dataZoomConfig
,
};
};
},
},
dataZoomConfig
()
{
const
handleIcon
=
this
.
svgs
[
'
scroll-handle
'
];
return
handleIcon
?
{
handleIcon
}
:
{};
},
earliestDatapoint
()
{
earliestDatapoint
()
{
return
Object
.
values
(
this
.
chartData
).
reduce
((
acc
,
data
)
=>
{
return
Object
.
values
(
this
.
chartData
).
reduce
((
acc
,
data
)
=>
{
const
[[
timestamp
]]
=
data
.
sort
(([
a
],
[
b
])
=>
{
const
[[
timestamp
]]
=
data
.
sort
(([
a
],
[
b
])
=>
{
...
@@ -131,7 +131,7 @@ export default {
...
@@ -131,7 +131,7 @@ export default {
return
{
return
{
type
:
'
scatter
'
,
type
:
'
scatter
'
,
data
:
this
.
recentDeployments
.
map
(
deployment
=>
[
deployment
.
createdAt
,
0
]),
data
:
this
.
recentDeployments
.
map
(
deployment
=>
[
deployment
.
createdAt
,
0
]),
symbol
:
this
.
s
catterSymbol
,
symbol
:
this
.
s
vgs
.
rocket
,
symbolSize
:
14
,
symbolSize
:
14
,
};
};
},
},
...
@@ -151,7 +151,8 @@ export default {
...
@@ -151,7 +151,8 @@ export default {
created
()
{
created
()
{
debouncedResize
=
debounceByAnimationFrame
(
this
.
onResize
);
debouncedResize
=
debounceByAnimationFrame
(
this
.
onResize
);
window
.
addEventListener
(
'
resize
'
,
debouncedResize
);
window
.
addEventListener
(
'
resize
'
,
debouncedResize
);
this
.
getScatterSymbol
();
this
.
setSvg
(
'
rocket
'
);
this
.
setSvg
(
'
scroll-handle
'
);
},
},
methods
:
{
methods
:
{
formatTooltipText
(
params
)
{
formatTooltipText
(
params
)
{
...
@@ -167,11 +168,11 @@ export default {
...
@@ -167,11 +168,11 @@ export default {
this
.
tooltip
.
content
=
`
${
this
.
yAxisLabel
}
${
seriesData
.
value
[
1
].
toFixed
(
3
)}
`
;
this
.
tooltip
.
content
=
`
${
this
.
yAxisLabel
}
${
seriesData
.
value
[
1
].
toFixed
(
3
)}
`
;
}
}
},
},
getScatterSymbol
(
)
{
setSvg
(
name
)
{
getSvgIconPathContent
(
'
rocket
'
)
getSvgIconPathContent
(
name
)
.
then
(
path
=>
{
.
then
(
path
=>
{
if
(
path
)
{
if
(
path
)
{
this
.
scatterSymbol
=
`path://
${
path
}
`
;
this
.
$set
(
this
.
svgs
,
name
,
`path://
${
path
}
`
)
;
}
}
})
})
.
catch
(()
=>
{});
.
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';
...
@@ -7,6 +7,7 @@ import MonitoringMock, { deploymentData } from '../mock_data';
describe
(
'
Area component
'
,
()
=>
{
describe
(
'
Area component
'
,
()
=>
{
const
mockWidgets
=
'
mockWidgets
'
;
const
mockWidgets
=
'
mockWidgets
'
;
const
mockSvgPathContent
=
'
mockSvgPathContent
'
;
let
mockGraphData
;
let
mockGraphData
;
let
areaChart
;
let
areaChart
;
let
spriteSpy
;
let
spriteSpy
;
...
@@ -30,7 +31,7 @@ describe('Area component', () => {
...
@@ -30,7 +31,7 @@ describe('Area component', () => {
});
});
spriteSpy
=
spyOnDependency
(
Area
,
'
getSvgIconPathContent
'
).
and
.
callFake
(
spriteSpy
=
spyOnDependency
(
Area
,
'
getSvgIconPathContent
'
).
and
.
callFake
(
()
=>
new
Promise
(
resolve
=>
resolve
()),
()
=>
new
Promise
(
resolve
=>
resolve
(
mockSvgPathContent
)),
);
);
});
});
...
@@ -146,13 +147,22 @@ describe('Area component', () => {
...
@@ -146,13 +147,22 @@ describe('Area component', () => {
});
});
});
});
describe
(
'
getScatterSymbol
'
,
()
=>
{
describe
(
'
setSvg
'
,
()
=>
{
const
mockSvgName
=
'
mockSvgName
'
;
beforeEach
(()
=>
{
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
'
,
()
=>
{
it
(
'
sets svg path content
'
,
done
=>
{
expect
(
spriteSpy
).
toHaveBeenCalledWith
(
'
rocket
'
);
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