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
d753db3f
Commit
d753db3f
authored
Apr 18, 2019
by
Adriel Santiago
Committed by
Clement Ho
Apr 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve cluster metrics regression
Fixes a regression causing cluster metrics not to display
parent
e9bf3672
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
4 deletions
+27
-4
app/assets/javascripts/monitoring/stores/monitoring_store.js
app/assets/javascripts/monitoring/stores/monitoring_store.js
+3
-4
spec/javascripts/monitoring/monitoring_store_spec.js
spec/javascripts/monitoring/monitoring_store_spec.js
+24
-0
No files found.
app/assets/javascripts/monitoring/stores/monitoring_store.js
View file @
d753db3f
...
...
@@ -45,14 +45,13 @@ function removeTimeSeriesNoData(queries) {
// ]
function
groupQueriesByChartInfo
(
metrics
)
{
const
metricsByChart
=
metrics
.
reduce
((
accumulator
,
metric
)
=>
{
const
{
id
,
queries
,
...
chart
}
=
metric
;
const
{
queries
,
...
chart
}
=
metric
;
const
metricId
=
chart
.
id
?
chart
.
id
.
toString
()
:
null
;
const
chartKey
=
`
${
chart
.
title
}
|
${
chart
.
y_label
}
`
;
accumulator
[
chartKey
]
=
accumulator
[
chartKey
]
||
{
...
chart
,
queries
:
[]
};
queries
.
forEach
(
queryAttrs
=>
accumulator
[
chartKey
].
queries
.
push
({
metricId
:
id
.
toString
(),
...
queryAttrs
}),
);
queries
.
forEach
(
queryAttrs
=>
accumulator
[
chartKey
].
queries
.
push
({
metricId
,
...
queryAttrs
}));
return
accumulator
;
},
{});
...
...
spec/javascripts/monitoring/monitoring_store_spec.js
View file @
d753db3f
...
...
@@ -32,4 +32,28 @@ describe('MonitoringStore', () => {
it
(
'
removes the data if all the values from a query are not defined
'
,
()
=>
{
expect
(
store
.
groups
[
1
].
metrics
[
0
].
queries
[
0
].
result
.
length
).
toEqual
(
0
);
});
it
(
'
assigns queries a metric id
'
,
()
=>
{
expect
(
store
.
groups
[
1
].
metrics
[
0
].
queries
[
0
].
metricId
).
toEqual
(
'
100
'
);
});
it
(
'
assigns metric id of null if metric has no id
'
,
()
=>
{
const
noId
=
MonitoringMock
.
data
.
map
(
group
=>
({
...
group
,
...{
metrics
:
group
.
metrics
.
map
(
metric
=>
{
const
{
id
,
...
metricWithoutId
}
=
metric
;
return
metricWithoutId
;
}),
},
}));
store
.
storeMetrics
(
noId
);
store
.
groups
.
forEach
(
group
=>
{
group
.
metrics
.
forEach
(
metric
=>
{
expect
(
metric
.
queries
.
every
(
query
=>
query
.
metricId
===
null
)).
toBe
(
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