Commit 3d2a6024 authored by Kamil Trzciński's avatar Kamil Trzciński

Merge branch '8400-operations-check' into 'master'

Renders feature flags link when ci/cd is disabled

Closes #8400

See merge request gitlab-org/gitlab-ee!8622
parents dfaa942f 8dd3b2b5
......@@ -393,6 +393,10 @@ module ProjectsHelper
end
end
def sidebar_operations_link_path(project = @project)
metrics_project_environments_path(project) if can?(current_user, :read_environment, project)
end
def project_last_activity(project)
if project.last_activity_at
time_ago_with_tooltip(project.last_activity_at, placement: 'bottom', html_class: 'last_activity_time_ago')
......
......@@ -196,7 +196,7 @@
- if project_nav_tab? :operations
= nav_link(controller: sidebar_operations_paths) do
= link_to metrics_project_environments_path(@project), class: 'shortcuts-operations' do
= link_to sidebar_operations_link_path, class: 'shortcuts-operations' do
.nav-icon-container
= sprite_icon('cloud-gear')
%span.nav-item-name
......@@ -204,7 +204,7 @@
%ul.sidebar-sub-level-items
= nav_link(controller: sidebar_operations_paths, html_options: { class: "fly-out-top-item" } ) do
= link_to metrics_project_environments_path(@project) do
= link_to sidebar_operations_link_path do
%strong.fly-out-top-item-name
= _('Operations')
%li.divider.fly-out-top-item
......
......@@ -88,6 +88,11 @@ module EE
end
end
override :sidebar_operations_link_path
def sidebar_operations_link_path(project = @project)
super || project_feature_flags_path(project)
end
# Given the current GitLab configuration, check whether the GitLab URL for Kerberos is going to be different than the HTTP URL
def alternative_kerberos_url?
::Gitlab.config.alternative_gitlab_kerberos_url?
......
---
title: Defaults to feature flags link for Operations entry
merge_request: 8622
author:
type: fixed
......@@ -13,6 +13,39 @@ describe 'layouts/nav/sidebar/_project' do
stub_licensed_features(tracing: true)
end
describe 'Operations main link' do
let(:user) { create(:user) }
before do
stub_licensed_features(feature_flags: true)
project.project_feature.update(builds_access_level: feature)
project.team.add_developer(user)
sign_in(user)
end
context 'when ci/cd is disabled' do
let(:feature) { ProjectFeature::DISABLED }
it 'links to feature flags page' do
render
expect(rendered).to have_link('Operations', href: project_feature_flags_path(project))
end
end
context 'when ci/cd is enabled' do
let(:feature) { ProjectFeature::ENABLED }
it 'links to metrics page' do
render
expect(rendered).to have_link('Operations', href: metrics_project_environments_path(project))
end
end
end
describe 'Operations > Tracing' do
it 'is not visible when no valid license' do
allow(view).to receive(:can?).and_return(true)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment