Commit 4974ff6b authored by Enrique Alcántara's avatar Enrique Alcántara Committed by Douglas Barbosa Alexandre

Do not render k8s feature highlight if not needed

Avoid rendering k8s feature highlight when the
operations section in the sidebar is not active
parent 9288f0ff
...@@ -29,12 +29,6 @@ ...@@ -29,12 +29,6 @@
} }
} }
.is-showing-fly-out {
.feature-highlight {
display: none;
}
}
.feature-highlight-popover-content { .feature-highlight-popover-content {
display: none; display: none;
......
...@@ -13,6 +13,7 @@ module UserCalloutsHelper ...@@ -13,6 +13,7 @@ module UserCalloutsHelper
end end
def show_gke_cluster_integration_callout?(project) def show_gke_cluster_integration_callout?(project)
active_nav_link?(controller: sidebar_operations_paths) &&
can?(current_user, :create_cluster, project) && can?(current_user, :create_cluster, project) &&
!user_dismissed?(GKE_CLUSTER_INTEGRATION) !user_dismissed?(GKE_CLUSTER_INTEGRATION)
end end
......
---
title: Increase sidebar performance by not rendering k8s highlight when not needed
merge_request: 39228
author:
type: performance
...@@ -25,9 +25,23 @@ RSpec.describe UserCalloutsHelper do ...@@ -25,9 +25,23 @@ RSpec.describe UserCalloutsHelper do
allow(helper).to receive(:user_dismissed?).and_return(false) allow(helper).to receive(:user_dismissed?).and_return(false)
end end
context 'when active_nav_link is in the operations section' do
before do
allow(helper).to receive(:active_nav_link?).and_return(true)
end
it { is_expected.to be true } it { is_expected.to be true }
end end
context 'when active_nav_link is not in the operations section' do
before do
allow(helper).to receive(:active_nav_link?).and_return(false)
end
it { is_expected.to be false }
end
end
context 'when user dismissed' do context 'when user dismissed' do
before do before do
allow(helper).to receive(:user_dismissed?).and_return(true) allow(helper).to receive(:user_dismissed?).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