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
de98f4d5
Commit
de98f4d5
authored
Jan 21, 2022
by
wortschi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VSA metrics: Only render decimal places for floats
Changelog: changed
parent
55a4cc5a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
8 deletions
+17
-8
app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue
...ripts/cycle_analytics/components/value_stream_metrics.vue
+5
-1
spec/features/cycle_analytics_spec.rb
spec/features/cycle_analytics_spec.rb
+1
-1
spec/frontend/cycle_analytics/value_stream_metrics_spec.js
spec/frontend/cycle_analytics/value_stream_metrics_spec.js
+11
-6
No files found.
app/assets/javascripts/cycle_analytics/components/value_stream_metrics.vue
View file @
de98f4d5
...
@@ -86,6 +86,10 @@ export default {
...
@@ -86,6 +86,10 @@ export default {
redirectTo
(
links
[
0
].
url
);
redirectTo
(
links
[
0
].
url
);
}
}
},
},
getDecimalPlaces
(
value
)
{
const
parsedFloat
=
parseFloat
(
value
);
return
Number
.
isNaN
(
parsedFloat
)
||
Number
.
isInteger
(
parsedFloat
)
?
0
:
1
;
},
},
},
};
};
</
script
>
</
script
>
...
@@ -104,7 +108,7 @@ export default {
...
@@ -104,7 +108,7 @@ export default {
:title="metric.label"
:title="metric.label"
:unit="metric.unit || ''"
:unit="metric.unit || ''"
:should-animate="true"
:should-animate="true"
:animation-decimal-places="
1
"
:animation-decimal-places="
getDecimalPlaces(metric.value)
"
:class="{ 'gl-hover-cursor-pointer': hasLinks(metric.links) }"
:class="{ 'gl-hover-cursor-pointer': hasLinks(metric.links) }"
tabindex="0"
tabindex="0"
@click="clickHandler(metric)"
@click="clickHandler(metric)"
...
...
spec/features/cycle_analytics_spec.rb
View file @
de98f4d5
...
@@ -134,7 +134,7 @@ RSpec.describe 'Value Stream Analytics', :js do
...
@@ -134,7 +134,7 @@ RSpec.describe 'Value Stream Analytics', :js do
end
end
it
'can filter the metrics by date'
do
it
'can filter the metrics by date'
do
expect
(
metrics_values
).
to
match_array
(
[
"21.0"
,
"2.0"
,
"1.0"
,
"0.0"
])
expect
(
metrics_values
).
to
match_array
(
%w[21 2 1 0
]
)
set_daterange
(
from
,
to
)
set_daterange
(
from
,
to
)
...
...
spec/frontend/cycle_analytics/value_stream_metrics_spec.js
View file @
de98f4d5
...
@@ -88,12 +88,12 @@ describe('ValueStreamMetrics', () => {
...
@@ -88,12 +88,12 @@ describe('ValueStreamMetrics', () => {
});
});
describe
.
each
`
describe
.
each
`
index | value | title | unit | clickable
index | value | title | unit |
animationDecimalPlaces |
clickable
${
0
}
|
${
metricsData
[
0
].
value
}
|
${
metricsData
[
0
].
title
}
|
${
metricsData
[
0
].
unit
}
|
${
false
}
${
0
}
|
${
metricsData
[
0
].
value
}
|
${
metricsData
[
0
].
title
}
|
${
metricsData
[
0
].
unit
}
|
${
0
}
|
${
false
}
${
1
}
|
${
metricsData
[
1
].
value
}
|
${
metricsData
[
1
].
title
}
|
${
metricsData
[
1
].
unit
}
|
${
false
}
${
1
}
|
${
metricsData
[
1
].
value
}
|
${
metricsData
[
1
].
title
}
|
${
metricsData
[
1
].
unit
}
|
${
0
}
|
${
false
}
${
2
}
|
${
metricsData
[
2
].
value
}
|
${
metricsData
[
2
].
title
}
|
${
metricsData
[
2
].
unit
}
|
${
false
}
${
2
}
|
${
metricsData
[
2
].
value
}
|
${
metricsData
[
2
].
title
}
|
${
metricsData
[
2
].
unit
}
|
${
0
}
|
${
false
}
${
3
}
|
${
metricsData
[
3
].
value
}
|
${
metricsData
[
3
].
title
}
|
${
metricsData
[
3
].
unit
}
|
${
true
}
${
3
}
|
${
metricsData
[
3
].
value
}
|
${
metricsData
[
3
].
title
}
|
${
metricsData
[
3
].
unit
}
|
${
1
}
|
${
true
}
`
(
'
metric tiles
'
,
({
index
,
value
,
title
,
unit
,
clickable
})
=>
{
`
(
'
metric tiles
'
,
({
index
,
value
,
title
,
unit
,
animationDecimalPlaces
,
clickable
})
=>
{
it
(
`renders a single stat component for "
${
title
}
" with value and unit`
,
()
=>
{
it
(
`renders a single stat component for "
${
title
}
" with value and unit`
,
()
=>
{
const
metric
=
findMetrics
().
at
(
index
);
const
metric
=
findMetrics
().
at
(
index
);
expect
(
metric
.
props
()).
toMatchObject
({
value
,
title
,
unit
:
unit
??
''
});
expect
(
metric
.
props
()).
toMatchObject
({
value
,
title
,
unit
:
unit
??
''
});
...
@@ -111,6 +111,11 @@ describe('ValueStreamMetrics', () => {
...
@@ -111,6 +111,11 @@ describe('ValueStreamMetrics', () => {
expect
(
redirectTo
).
not
.
toHaveBeenCalled
();
expect
(
redirectTo
).
not
.
toHaveBeenCalled
();
}
}
});
});
it
(
`will render
${
animationDecimalPlaces
}
decimal places for the
${
title
}
metric with the value "
${
value
}
"`
,
()
=>
{
const
metric
=
findMetrics
().
at
(
index
);
expect
(
metric
.
props
(
'
animationDecimalPlaces
'
)).
toBe
(
animationDecimalPlaces
);
});
});
});
it
(
'
will not display a loading icon
'
,
()
=>
{
it
(
'
will not display a loading icon
'
,
()
=>
{
...
...
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