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
6021dda8
Commit
6021dda8
authored
Jul 05, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
bdef48bb
de6c2f70
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
+52
-3
app/assets/javascripts/monitoring/stores/utils.js
app/assets/javascripts/monitoring/stores/utils.js
+14
-3
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
+1
-0
spec/javascripts/monitoring/store/utils_spec.js
spec/javascripts/monitoring/store/utils_spec.js
+37
-0
No files found.
app/assets/javascripts/monitoring/stores/utils.js
View file @
6021dda8
...
...
@@ -36,15 +36,26 @@ function removeTimeSeriesNoData(queries) {
// { metricId: 2, ...query2Attrs }] },
// { title: 'new title', y_label: 'MB', queries: [{ metricId: 3, ...query3Attrs }]}
// ]
function
groupQueriesByChartInfo
(
metrics
)
{
export
function
groupQueriesByChartInfo
(
metrics
)
{
const
metricsByChart
=
metrics
.
reduce
((
accumulator
,
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
,
...
queryAttrs
}));
queries
.
forEach
(
queryAttrs
=>
{
let
metricId
;
if
(
chart
.
id
)
{
metricId
=
chart
.
id
.
toString
();
}
else
if
(
queryAttrs
.
metric_id
)
{
metricId
=
queryAttrs
.
metric_id
.
toString
();
}
else
{
metricId
=
null
;
}
accumulator
[
chartKey
].
queries
.
push
({
metricId
,
...
queryAttrs
});
});
return
accumulator
;
},
{});
...
...
lib/gitlab/ci/templates/Security/SAST.gitlab-ci.yml
View file @
6021dda8
...
...
@@ -54,6 +54,7 @@ sast:
MAVEN_PATH \
MAVEN_REPO_PATH \
SBT_PATH \
FAIL_NEVER \
) \
--volume "$PWD:/code" \
--volume /var/run/docker.sock:/var/run/docker.sock \
...
...
spec/javascripts/monitoring/store/utils_spec.js
0 → 100644
View file @
6021dda8
import
{
groupQueriesByChartInfo
}
from
'
~/monitoring/stores/utils
'
;
describe
(
'
groupQueriesByChartInfo
'
,
()
=>
{
let
input
;
let
output
;
it
(
'
groups metrics with the same chart title and y_axis label
'
,
()
=>
{
input
=
[
{
title
:
'
title
'
,
y_label
:
'
MB
'
,
queries
:
[{}]
},
{
title
:
'
title
'
,
y_label
:
'
MB
'
,
queries
:
[{}]
},
{
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{}]
},
];
output
=
[
{
title
:
'
title
'
,
y_label
:
'
MB
'
,
queries
:
[{
metricId
:
null
},
{
metricId
:
null
}]
},
{
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{
metricId
:
null
}]
},
];
expect
(
groupQueriesByChartInfo
(
input
)).
toEqual
(
output
);
});
// Functionality associated with the /additional_metrics endpoint
it
(
"
associates a chart's stringified metric_id with the metric
"
,
()
=>
{
input
=
[{
id
:
3
,
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{}]
}];
output
=
[{
id
:
3
,
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{
metricId
:
'
3
'
}]
}];
expect
(
groupQueriesByChartInfo
(
input
)).
toEqual
(
output
);
});
// Functionality associated with the /metrics_dashboard endpoint
it
(
'
aliases a stringified metrics_id on the metric to the metricId key
'
,
()
=>
{
input
=
[{
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{
metric_id
:
3
}]
}];
output
=
[{
title
:
'
new title
'
,
y_label
:
'
MB
'
,
queries
:
[{
metricId
:
'
3
'
,
metric_id
:
3
}]
}];
expect
(
groupQueriesByChartInfo
(
input
)).
toEqual
(
output
);
});
});
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