Skip to content
代码片段 群组 项目
提交 81a7abe4 编辑于 作者: Etienne Baqué's avatar Etienne Baqué
浏览文件

Merge branch 'fix-time-to-restore-service-link' into 'master'

Add link to Time to restore service chart

See merge request gitlab-org/gitlab!90847
No related branches found
No related tags found
无相关合并请求
...@@ -11,11 +11,27 @@ def title ...@@ -11,11 +11,27 @@ def title
def links def links
helpers = Gitlab::Routing.url_helpers helpers = Gitlab::Routing.url_helpers
parent = @stage.parent
dashboard_link =
if parent.is_a?(::Group)
helpers.group_analytics_ci_cd_analytics_path(parent, tab: 'time-to-restore-service')
else
helpers.charts_project_pipelines_path(parent, chart: 'time-to-restore-service')
end
[ [
{ "name" => _('Time to Restore Service'), {
"name" => _('Time to Restore Service'),
"url" => dashboard_link,
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Time to Restore Service'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'time-to-restore-service'), "url" => helpers.help_page_path('user/analytics/index', anchor: 'time-to-restore-service'),
"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" => _('Time to Restore Service'), {
"name" => _('Time to Restore Service'),
"url" => helpers.group_analytics_ci_cd_analytics_path(stage.parent, tab: 'time-to-restore-service'),
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Time to Restore Service'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'time-to-restore-service'), "url" => helpers.help_page_path('user/analytics/index', anchor: 'time-to-restore-service'),
"docs_link" => true, "docs_link" => true,
"label" => s_('ValueStreamAnalytics|Go to docs') } "label" => s_('ValueStreamAnalytics|Go to docs')
}
] ]
) )
end end
context 'for project stage' do
let(:stage) { build(:cycle_analytics_project_stage) }
it 'displays documentation link and project dashboard link' do
helpers = Gitlab::Routing.url_helpers
expect(subject).to match_array(
[
{
"name" => _('Time to Restore Service'),
"url" => helpers.charts_project_pipelines_path(stage.parent, chart: 'time-to-restore-service'),
"label" => s_('ValueStreamAnalytics|Dashboard')
},
{
"name" => _('Time to Restore Service'),
"url" => helpers.help_page_path('user/analytics/index', anchor: 'time-to-restore-service'),
"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.
先完成此消息的编辑!
想要评论请 注册