Skip to content
代码片段 群组 项目
提交 4feda5ae 编辑于 作者: Pavel Shutsin's avatar Pavel Shutsin
浏览文件

Merge branch '365922-add-link-to-change-failure-rate-from-tile' into 'master'

Add link to change failure rate chart from tile

See merge request gitlab-org/gitlab!92529
No related branches found
No related tags found
无相关合并请求
...@@ -131,7 +131,7 @@ To retrieve metrics for change failure rate, use the [GraphQL](../../api/graphql ...@@ -131,7 +131,7 @@ To retrieve metrics for change failure rate, use the [GraphQL](../../api/graphql
| `lead_time_for_changes` | Project | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 13.11 and later | Unit in seconds. Aggregation method is median. | | `lead_time_for_changes` | Project | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 13.11 and later | Unit in seconds. Aggregation method is median. |
| `lead_time_for_changes` | Group | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 14.0 and later | Unit in seconds. Aggregation method is median. | | `lead_time_for_changes` | Group | [GitLab 13.10 and later](../../api/dora/metrics.md) | GitLab 14.0 and later | Unit in seconds. Aggregation method is median. |
| `time_to_restore_service` | Project and group | [GitLab 14.9 and later](../../api/dora/metrics.md) | GitLab 15.1 and later | Unit in days. Aggregation method is median. | | `time_to_restore_service` | Project and group | [GitLab 14.9 and later](../../api/dora/metrics.md) | GitLab 15.1 and later | Unit in days. Aggregation method is median. |
| `change_failure_rate` | Project and group | [GitLab 14.10 and later](../../api/dora/metrics.md) | Not supported | | | `change_failure_rate` | Project and group | [GitLab 14.10 and later](../../api/dora/metrics.md) | GitLab 15.2 and later | Percentage of deployments. | |
## Definitions ## Definitions
......
...@@ -27,11 +27,26 @@ def value ...@@ -27,11 +27,26 @@ def value
def links def links
helpers = Gitlab::Routing.url_helpers helpers = Gitlab::Routing.url_helpers
dashboard_link =
if @stage.parent.is_a?(::Group)
helpers.group_analytics_ci_cd_analytics_path(@stage.parent, tab: 'change-failure-rate')
else
helpers.charts_project_pipelines_path(@stage.parent, chart: 'change-failure-rate')
end
[ [
{ "name" => _('Change Failure Rate'), {
"name" => _('Change Failure Rate'),
"url" => dashboard_link,
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Change Failure Rate'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'change-failure-rate'), "url" => helpers.help_page_path('user/analytics/index', anchor: 'change-failure-rate'),
"docs_link" => true, "docs_link" => true,
"label" => s_('ValueStreamAnalytics|Go to docs') } "label" => s_('ValueStreamAnalytics|Go to docs')
}
] ]
end end
......
...@@ -48,17 +48,48 @@ ...@@ -48,17 +48,48 @@
describe '#links' do describe '#links' do
subject { described_class.new(stage: stage, current_user: user, options: options).links } subject { described_class.new(stage: stage, current_user: user, options: options).links }
it 'displays documentation link' do it 'displays documentation link and group dashboard link' do
helpers = Gitlab::Routing.url_helpers helpers = Gitlab::Routing.url_helpers
expect(subject).to match_array( expect(subject).to match_array(
[ [
{ "name" => _('Change Failure Rate'), {
"name" => _('Change Failure Rate'),
"url" => helpers.group_analytics_ci_cd_analytics_path(stage.parent, tab: 'change-failure-rate'),
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Change Failure Rate'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'change-failure-rate'), "url" => helpers.help_page_path('user/analytics/index', anchor: 'change-failure-rate'),
"docs_link" => true, "docs_link" => true,
"label" => s_('ValueStreamAnalytics|Go to docs') } "label" => s_('ValueStreamAnalytics|Go to docs')
}
] ]
) )
end end
context 'when the stage parent is a project' do
let(:stage) { build(:cycle_analytics_project_stage) }
it 'displays documentation link and group dashboard link' do
helpers = Gitlab::Routing.url_helpers
expect(subject).to match_array(
[
{
"name" => _('Change Failure Rate'),
"url" => helpers.charts_project_pipelines_path(stage.parent, chart: 'change-failure-rate'),
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Change Failure Rate'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'change-failure-rate'),
"docs_link" => true,
"label" => s_('ValueStreamAnalytics|Go to docs')
}
]
)
end
end
end end
end end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册