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
58ae16f9
Commit
58ae16f9
authored
Jul 30, 2020
by
Ezekiel Kigbo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor prepare time metrics function
Moves the function to a separate utility and adds some specs
parent
1b486454
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
ee/app/assets/javascripts/analytics/cycle_analytics/components/time_metrics_card.vue
...nalytics/cycle_analytics/components/time_metrics_card.vue
+2
-11
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
+12
-1
No files found.
ee/app/assets/javascripts/analytics/cycle_analytics/components/time_metrics_card.vue
View file @
58ae16f9
...
...
@@ -2,9 +2,8 @@
import
Api
from
'
ee/api
'
;
import
{
__
,
s__
}
from
'
~/locale
'
;
import
createFlash
from
'
~/flash
'
;
import
{
slugify
}
from
'
~/lib/utils/text_utility
'
;
import
MetricCard
from
'
../../shared/components/metric_card.vue
'
;
import
{
removeFlash
}
from
'
../utils
'
;
import
{
removeFlash
,
prepareTimeMetricsData
}
from
'
../utils
'
;
const
I18N_TEXT
=
{
'
lead-time
'
:
s__
(
'
ValueStreamAnalytics|Median time from issue created to issue closed.
'
),
...
...
@@ -47,15 +46,7 @@ export default {
this
.
loading
=
true
;
return
Api
.
cycleAnalyticsTimeSummaryData
(
this
.
groupPath
,
this
.
additionalParams
)
.
then
(({
data
})
=>
{
this
.
data
=
data
.
map
(({
title
:
label
,
...
rest
})
=>
{
const
key
=
slugify
(
label
);
return
{
...
rest
,
label
,
key
,
tooltipText
:
I18N_TEXT
[
key
]
||
''
,
};
});
this
.
data
=
prepareTimeMetricsData
(
data
,
I18N_TEXT
);
})
.
catch
(()
=>
{
createFlash
(
...
...
ee/app/assets/javascripts/analytics/cycle_analytics/utils.js
View file @
58ae16f9
...
...
@@ -3,7 +3,7 @@ import dateFormat from 'dateformat';
import
{
s__
,
sprintf
}
from
'
~/locale
'
;
import
{
convertObjectPropsToCamelCase
}
from
'
~/lib/utils/common_utils
'
;
import
httpStatus
from
'
~/lib/utils/http_status
'
;
import
{
convertToSnakeCase
}
from
'
~/lib/utils/text_utility
'
;
import
{
convertToSnakeCase
,
slugify
}
from
'
~/lib/utils/text_utility
'
;
import
{
hideFlash
}
from
'
~/flash
'
;
import
{
newDate
,
...
...
@@ -378,3 +378,14 @@ export const transformStagesForPathNavigation = ({ stages, medians, selectedStag
stage
.
title
===
CAPITALIZED_STAGE_NAME
.
OVERVIEW
?
0
:
1
,
);
};
export
const
prepareTimeMetricsData
=
(
data
=
[],
tooltipText
=
{})
=>
data
.
map
(({
title
:
label
,
...
rest
})
=>
{
const
key
=
slugify
(
label
);
return
{
...
rest
,
label
,
key
,
tooltipText
:
tooltipText
[
key
]
||
''
,
};
});
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