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
f33521f0
Commit
f33521f0
authored
Mar 31, 2020
by
Jose Vargas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename max_value to maxValue
parent
685228d5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
15 deletions
+12
-15
app/assets/javascripts/monitoring/components/charts/single_stat.vue
.../javascripts/monitoring/components/charts/single_stat.vue
+5
-8
app/assets/javascripts/monitoring/stores/utils.js
app/assets/javascripts/monitoring/stores/utils.js
+1
-1
spec/frontend/monitoring/components/charts/single_stat_spec.js
...frontend/monitoring/components/charts/single_stat_spec.js
+4
-4
spec/frontend/monitoring/store/utils_spec.js
spec/frontend/monitoring/store/utils_spec.js
+2
-2
No files found.
app/assets/javascripts/monitoring/components/charts/single_stat.vue
View file @
f33521f0
...
...
@@ -27,22 +27,19 @@ export default {
/**
* This method formats the query result from a promQL expression
* allowing a user to format the data in percentile values
* by using the `max
_v
alue` inner property from the graphData prop
* by using the `max
V
alue` inner property from the graphData prop
* @returns {(String)}
*/
statValue
()
{
let
formatter
;
let
value
;
if
(
this
.
graphData
?.
max
_v
alue
)
{
if
(
this
.
graphData
?.
max
V
alue
)
{
formatter
=
getFormatter
(
SUPPORTED_FORMATS
.
percent
);
value
=
formatter
(
this
.
queryResult
/
Number
(
this
.
graphData
.
max_value
),
defaultPrecision
);
}
else
{
formatter
=
getFormatter
(
SUPPORTED_FORMATS
.
number
);
value
=
`
${
formatter
(
this
.
queryResult
,
defaultPrecision
)}${
this
.
queryInfo
.
unit
}
`
;
return
formatter
(
this
.
queryResult
/
Number
(
this
.
graphData
.
maxValue
),
defaultPrecision
);
}
return
value
;
formatter
=
getFormatter
(
SUPPORTED_FORMATS
.
number
);
return
`
${
formatter
(
this
.
queryResult
,
defaultPrecision
)}${
this
.
queryInfo
.
unit
}
`
;
},
graphTitle
()
{
return
this
.
queryInfo
.
label
;
...
...
app/assets/javascripts/monitoring/stores/utils.js
View file @
f33521f0
...
...
@@ -126,7 +126,7 @@ const mapPanelToViewModel = ({
y_label
:
yAxis
.
name
,
// Changing y_label to yLabel is pending https://gitlab.com/gitlab-org/gitlab/issues/207198
yAxis
,
xAxis
,
max_value
,
max
Value
:
max
_value
,
metrics
:
mapToMetricsViewModel
(
metrics
,
yAxis
.
name
),
};
};
...
...
spec/frontend/monitoring/components/charts/single_stat_spec.js
View file @
f33521f0
...
...
@@ -27,18 +27,18 @@ describe('Single Stat Chart component', () => {
singleStatChart
.
setProps
({
graphData
:
{
...
graphDataPrometheusQuery
,
max
_v
alue
:
120
,
max
V
alue
:
120
,
},
});
expect
(
singleStatChart
.
vm
.
statValue
).
toContain
(
'
75.83%
'
);
});
it
(
'
should display NaN for non numeric max
_v
alue values
'
,
()
=>
{
it
(
'
should display NaN for non numeric max
V
alue values
'
,
()
=>
{
singleStatChart
.
setProps
({
graphData
:
{
...
graphDataPrometheusQuery
,
max
_v
alue
:
'
not a number
'
,
max
V
alue
:
'
not a number
'
,
},
});
...
...
@@ -60,7 +60,7 @@ describe('Single Stat Chart component', () => {
],
},
],
max
_v
alue
:
120
,
max
V
alue
:
120
,
},
});
...
...
spec/frontend/monitoring/store/utils_spec.js
View file @
f33521f0
...
...
@@ -222,12 +222,12 @@ describe('mapToDashboardViewModel', () => {
});
// This property allows single_stat panels to render percentile values
it
(
'
group max
_v
alue
'
,
()
=>
{
it
(
'
group max
V
alue
'
,
()
=>
{
setupWithPanel
({
max_value
:
100
,
});
expect
(
getMappedPanel
().
max
_v
alue
).
toBe
(
100
);
expect
(
getMappedPanel
().
max
V
alue
).
toBe
(
100
);
});
});
...
...
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