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
1e1f3084
Commit
1e1f3084
authored
Jun 10, 2020
by
Adam Hegyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify VSA stage presenter I18n approach
parent
b68e9d36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
37 deletions
+41
-37
ee/app/presenters/analytics/cycle_analytics/stage_presenter.rb
...p/presenters/analytics/cycle_analytics/stage_presenter.rb
+34
-32
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
...eatures/analytics/cycle_analytics/cycle_analytics_spec.rb
+7
-5
No files found.
ee/app/presenters/analytics/cycle_analytics/stage_presenter.rb
View file @
1e1f3084
...
...
@@ -3,37 +3,6 @@
module
Analytics
module
CycleAnalytics
class
StagePresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
DEFAULT_STAGE_ATTRIBUTES
=
{
issue:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Issue'
)
},
description:
->
{
_
(
'Time before an issue gets scheduled'
)
}
}.
freeze
,
plan:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Plan'
)
},
description:
->
{
_
(
'Time before an issue starts implementation'
)
}
}.
freeze
,
code:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Code'
)
},
description:
->
{
_
(
'Time until first merge request'
)
}
}.
freeze
,
test:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Test'
)
},
description:
->
{
_
(
'Total test time for all commits/merges'
)
}
}.
freeze
,
review:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Review'
)
},
description:
->
{
_
(
'Time between merge request creation and merge/close'
)
}
}.
freeze
,
staging:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Staging'
)
},
description:
->
{
_
(
'From merge request merge until deploy to production'
)
}
}.
freeze
,
production:
{
title:
->
{
s_
(
'CycleAnalyticsStage|Total'
)
},
description:
->
{
_
(
'From issue creation until deploy to production'
)
}
}.
freeze
}.
freeze
def
title
extract_default_stage_attribute
(
:title
)
||
name
end
...
...
@@ -49,7 +18,40 @@ module Analytics
private
def
extract_default_stage_attribute
(
attribute
)
DEFAULT_STAGE_ATTRIBUTES
.
dig
(
name
.
to_sym
,
attribute
.
to_sym
)
&
.
call
default_stage_attributes
.
dig
(
name
.
to_sym
,
attribute
.
to_sym
)
end
def
default_stage_attributes
@default_stage_attributes
||=
{
issue:
{
title:
s_
(
'CycleAnalyticsStage|Issue'
),
description:
_
(
'Time before an issue gets scheduled'
)
},
plan:
{
title:
s_
(
'CycleAnalyticsStage|Plan'
),
description:
_
(
'Time before an issue starts implementation'
)
},
code:
{
title:
s_
(
'CycleAnalyticsStage|Code'
),
description:
_
(
'Time until first merge request'
)
},
test:
{
title:
s_
(
'CycleAnalyticsStage|Test'
),
description:
_
(
'Total test time for all commits/merges'
)
},
review:
{
title:
s_
(
'CycleAnalyticsStage|Review'
),
description:
_
(
'Time between merge request creation and merge/close'
)
},
staging:
{
title:
s_
(
'CycleAnalyticsStage|Staging'
),
description:
_
(
'From merge request merge until deploy to production'
)
},
production:
{
title:
s_
(
'CycleAnalyticsStage|Total'
),
description:
_
(
'From issue creation until deploy to production'
)
}
}.
freeze
end
end
end
...
...
ee/spec/features/analytics/cycle_analytics/cycle_analytics_spec.rb
View file @
1e1f3084
...
...
@@ -964,10 +964,12 @@ RSpec.describe 'Group Value Stream Analytics', :js do
context
'Duration chart'
do
let
(
:duration_chart_dropdown
)
{
page
.
find
(
'.js-dropdown-stages'
)
}
default_stages
=
Analytics
::
CycleAnalytics
::
StagePresenter
::
DEFAULT_STAGE_ATTRIBUTES
.
each_value
.
map
{
|
value
|
value
[
:title
].
call
}
.
freeze
let_it_be
(
:translated_default_stage_names
)
do
Gitlab
::
Analytics
::
CycleAnalytics
::
DefaultStages
.
names
.
map
do
|
name
|
stage
=
Analytics
::
CycleAnalytics
::
GroupStage
.
new
(
name:
name
)
Analytics
::
CycleAnalytics
::
StagePresenter
.
new
(
stage
).
title
end
.
freeze
end
def
duration_chart_stages
duration_chart_dropdown
.
all
(
'.dropdown-item'
).
collect
(
&
:text
)
...
...
@@ -984,7 +986,7 @@ RSpec.describe 'Group Value Stream Analytics', :js do
it
'has all the default stages'
do
toggle_duration_chart_dropdown
expect
(
duration_chart_stages
).
to
eq
(
default_stag
es
)
expect
(
duration_chart_stages
).
to
eq
(
translated_default_stage_nam
es
)
end
context
'hidden stage'
do
...
...
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