Rename Operations menu item to Monitor

In this commit we're renaming the menu item `Operations`,
placed in the project sidebar, to `Monitor`.
parent c6a85564
- @content_class = 'limit-container-width' unless fluid_layout
- page_title _('Operations Settings')
- breadcrumb_title _('Operations Settings')
- title = Feature.enabled?(:sidebar_refactor, current_user, default_enabled: :yaml) ? _('Monitor Settings') : _('Operations Settings')
- page_title title
- breadcrumb_title title
= render 'projects/settings/operations/alert_management'
= render 'projects/settings/operations/incidents'
......
......@@ -4,7 +4,7 @@ module EE
module Sidebars
module Projects
module Menus
module OperationsMenu
module MonitorMenu
extend ::Gitlab::Utils::Override
override :configure_menu_items
......
......@@ -107,7 +107,7 @@ RSpec.describe 'Project navbar' do
end
context 'when sidebar refactor feature flag is enabled' do
let(:operations_menu_items) do
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
......@@ -119,6 +119,13 @@ RSpec.describe 'Project navbar' do
]
end
let(:monitor_nav_item) do
{
nav_item: _('Monitor'),
nav_sub_items: monitor_menu_items
}
end
let(:project_information_nav_item) do
{
nav_item: _('Project information'),
......@@ -129,9 +136,21 @@ RSpec.describe 'Project navbar' do
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
end
before do
stub_feature_flags(sidebar_refactor: true)
insert_package_nav(_('Operations'))
insert_package_nav(_('Monitor'))
insert_infrastructure_registry_nav
insert_after_nav_item(
......@@ -147,7 +166,7 @@ RSpec.describe 'Project navbar' do
)
insert_after_nav_item(
_('Operations'),
_('Monitor'),
new_nav_item: {
nav_item: _('Infrastructure'),
nav_sub_items: [
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::OperationsMenu do
RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
let(:project) { build(:project) }
let(:user) { project.owner }
let(:context) { Sidebars::Projects::Context.new(current_user: user, container: project, show_cluster_hint: true) }
......
......@@ -149,8 +149,8 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Operations main link' do
let(:user) { create(:user) }
describe 'Monitor main link' do
let_it_be(:user) { create(:user) }
before do
project.project_feature.update!(builds_access_level: feature)
......@@ -165,7 +165,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'links to feature flags page' do
render
expect(rendered).to have_link('Operations', href: project_feature_flags_path(project))
expect(rendered).to have_link('Monitor', href: project_feature_flags_path(project))
end
end
......@@ -175,7 +175,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'links to metrics page' do
render
expect(rendered).to have_link('Operations', href: metrics_project_environments_path(project))
expect(rendered).to have_link('Monitor', href: metrics_project_environments_path(project))
end
end
end
......@@ -404,11 +404,11 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
allow(view).to receive(:current_user).and_return(user)
end
describe 'Operations' do
describe 'Monitor' do
it 'links to settings page' do
render
expect(rendered).to have_link('Operations', href: project_settings_operations_path(project))
expect(rendered).to have_link('Monitor', href: project_settings_operations_path(project))
end
context 'when user is not authorized' do
......@@ -417,7 +417,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'does not display the link' do
render
expect(rendered).not_to have_link('Operations', href: project_settings_operations_path(project))
expect(rendered).not_to have_link('Monitor', href: project_settings_operations_path(project))
end
end
end
......
......@@ -3,7 +3,7 @@
module Sidebars
module Projects
module Menus
class OperationsMenu < ::Sidebars::Menu
class MonitorMenu < ::Sidebars::Menu
override :configure_menu_items
def configure_menu_items
return false unless context.project.feature_available?(:operations, context.current_user)
......@@ -36,18 +36,18 @@ module Sidebars
override :extra_container_html_options
def extra_container_html_options
{
class: 'shortcuts-operations'
class: Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? 'shortcuts-monitor' : 'shortcuts-operations'
}
end
override :title
def title
_('Operations')
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations')
end
override :sprite_icon
def sprite_icon
Feature.enabled?(:sidebar_refactor, context.current_user) ? 'monitor' : 'cloud-gear'
Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? 'monitor' : 'cloud-gear'
end
override :active_routes
......@@ -243,4 +243,4 @@ module Sidebars
end
end
Sidebars::Projects::Menus::OperationsMenu.prepend_mod_with('Sidebars::Projects::Menus::OperationsMenu')
Sidebars::Projects::Menus::MonitorMenu.prepend_mod_with('Sidebars::Projects::Menus::MonitorMenu')
......@@ -14,7 +14,7 @@ module Sidebars
add_item(access_tokens_menu_item)
add_item(repository_menu_item)
add_item(ci_cd_menu_item)
add_item(operations_menu_item)
add_item(monitor_menu_item)
add_item(pages_menu_item)
add_item(packages_and_registries_menu_item)
......@@ -107,16 +107,17 @@ module Sidebars
)
end
def operations_menu_item
def monitor_menu_item
if context.project.archived? || !can?(context.current_user, :admin_operations, context.project)
return ::Sidebars::NilMenuItem.new(item_id: :operations)
return ::Sidebars::NilMenuItem.new(item_id: :monitor)
end
title = Feature.enabled?(:sidebar_refactor, context.current_user, default_enabled: :yaml) ? _('Monitor') : _('Operations')
::Sidebars::MenuItem.new(
title: _('Operations'),
title: title,
link: project_settings_operations_path(context.project),
active_routes: { path: 'operations#show' },
item_id: :operations
item_id: :monitor
)
end
......
......@@ -28,7 +28,7 @@ module Sidebars
add_menu(Sidebars::Projects::Menus::CiCdMenu.new(context))
add_menu(Sidebars::Projects::Menus::SecurityComplianceMenu.new(context))
add_menu(Sidebars::Projects::Menus::DeploymentsMenu.new(context))
add_menu(Sidebars::Projects::Menus::OperationsMenu.new(context))
add_menu(Sidebars::Projects::Menus::MonitorMenu.new(context))
add_menu(Sidebars::Projects::Menus::InfrastructureMenu.new(context))
add_menu(Sidebars::Projects::Menus::PackagesRegistriesMenu.new(context))
add_menu(Sidebars::Projects::Menus::AnalyticsMenu.new(context))
......
......@@ -21406,6 +21406,12 @@ msgstr ""
msgid "Monday"
msgstr ""
msgid "Monitor"
msgstr ""
msgid "Monitor Settings"
msgstr ""
msgid "Monitor your errors by integrating with Sentry."
msgstr ""
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
RSpec.describe 'Monitor dropdown sidebar', :aggregate_failures do
let_it_be_with_reload(:project) { create(:project, :internal, :repository) }
let(:user) { create(:user) }
......@@ -17,27 +17,27 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
visit project_issues_path(project)
end
shared_examples 'shows Operations menu based on the access level' do
shared_examples 'shows Monitor menu based on the access level' do
context 'when operations project feature is PRIVATE' do
let(:access_level) { ProjectFeature::PRIVATE }
it 'shows the `Operations` menu' do
expect(page).to have_selector('a.shortcuts-operations', text: 'Operations')
it 'shows the `Monitor` menu' do
expect(page).to have_selector('a.shortcuts-monitor', text: 'Monitor')
end
end
context 'when operations project feature is DISABLED' do
let(:access_level) { ProjectFeature::DISABLED }
it 'does not show the `Operations` menu' do
expect(page).not_to have_selector('a.shortcuts-operations')
it 'does not show the `Monitor` menu' do
expect(page).not_to have_selector('a.shortcuts-monitor')
end
end
end
context 'user is not a member' do
it 'has the correct `Operations` menu items', :aggregate_failures do
expect(page).to have_selector('a.shortcuts-operations', text: 'Operations')
it 'has the correct `Monitor` menu items', :aggregate_failures do
expect(page).to have_selector('a.shortcuts-monitor', text: 'Monitor')
expect(page).to have_link('Incidents', href: project_incidents_path(project))
expect(page).to have_link('Environments', href: project_environments_path(project))
......@@ -53,8 +53,8 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
context 'when operations project feature is PRIVATE' do
let(:access_level) { ProjectFeature::PRIVATE }
it 'does not show the `Operations` menu' do
expect(page).not_to have_selector('a.shortcuts-operations')
it 'does not show the `Monitor` menu' do
expect(page).not_to have_selector('a.shortcuts-monitor')
end
end
......@@ -62,7 +62,7 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
let(:access_level) { ProjectFeature::DISABLED }
it 'does not show the `Operations` menu' do
expect(page).not_to have_selector('a.shortcuts-operations')
expect(page).not_to have_selector('a.shortcuts-monitor')
end
end
end
......@@ -70,8 +70,8 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
context 'user has guest role' do
let(:role) { :guest }
it 'has the correct `Operations` menu items' do
expect(page).to have_selector('a.shortcuts-operations', text: 'Operations')
it 'has the correct `Monitor` menu items' do
expect(page).to have_selector('a.shortcuts-monitor', text: 'Monitor')
expect(page).to have_link('Incidents', href: project_incidents_path(project))
expect(page).to have_link('Environments', href: project_environments_path(project))
......@@ -84,13 +84,13 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
expect(page).not_to have_link('Kubernetes', href: project_clusters_path(project))
end
it_behaves_like 'shows Operations menu based on the access level'
it_behaves_like 'shows Monitor menu based on the access level'
end
context 'user has reporter role' do
let(:role) { :reporter }
it 'has the correct `Operations` menu items' do
it 'has the correct `Monitor` menu items' do
expect(page).to have_link('Metrics', href: project_metrics_dashboard_path(project))
expect(page).to have_link('Incidents', href: project_incidents_path(project))
expect(page).to have_link('Environments', href: project_environments_path(project))
......@@ -103,13 +103,13 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
expect(page).not_to have_link('Kubernetes', href: project_clusters_path(project))
end
it_behaves_like 'shows Operations menu based on the access level'
it_behaves_like 'shows Monitor menu based on the access level'
end
context 'user has developer role' do
let(:role) { :developer }
it 'has the correct `Operations` menu items' do
it 'has the correct `Monitor` menu items' do
expect(page).to have_link('Metrics', href: project_metrics_dashboard_path(project))
expect(page).to have_link('Alerts', href: project_alert_management_index_path(project))
expect(page).to have_link('Incidents', href: project_incidents_path(project))
......@@ -122,13 +122,13 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
expect(page).not_to have_link('Kubernetes', href: project_clusters_path(project))
end
it_behaves_like 'shows Operations menu based on the access level'
it_behaves_like 'shows Monitor menu based on the access level'
end
context 'user has maintainer role' do
let(:role) { :maintainer }
it 'has the correct `Operations` menu items' do
it 'has the correct `Monitor` menu items' do
expect(page).to have_link('Metrics', href: project_metrics_dashboard_path(project))
expect(page).to have_link('Alerts', href: project_alert_management_index_path(project))
expect(page).to have_link('Incidents', href: project_incidents_path(project))
......@@ -140,6 +140,6 @@ RSpec.describe 'Operations dropdown sidebar', :aggregate_failures do
expect(page).to have_link('Kubernetes', href: project_clusters_path(project))
end
it_behaves_like 'shows Operations menu based on the access level'
it_behaves_like 'shows Monitor menu based on the access level'
end
end
......@@ -83,7 +83,14 @@ RSpec.describe 'Project navbar' do
end
context 'when sidebar refactor feature flag is enabled' do
let(:operations_menu_items) do
let(:monitor_nav_item) do
{
nav_item: _('Monitor'),
nav_sub_items: monitor_menu_items
}
end
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
......@@ -105,21 +112,33 @@ RSpec.describe 'Project navbar' do
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Monitor')
]
end
before do
stub_feature_flags(sidebar_refactor: true)
stub_config(registry: { enabled: true })
insert_package_nav(_('Operations'))
insert_package_nav(_('Monitor'))
insert_infrastructure_registry_nav
insert_container_nav
insert_after_sub_nav_item(
_('Operations'),
_('Monitor'),
within: _('Settings'),
new_sub_nav_item_name: _('Packages & Registries')
)
insert_after_nav_item(
_('Operations'),
_('Monitor'),
new_nav_item: {
nav_item: _('Infrastructure'),
nav_sub_items: [
......
......@@ -11,16 +11,27 @@ RSpec.describe 'Projects > Settings > For a forked project', :js do
sign_in(user)
end
describe 'Sidebar > Operations' do
describe 'Sidebar > Monitor' do
it 'renders the menu in the sidebar' do
visit project_path(project)
wait_for_requests
expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Operations"]', text: 'Operations', visible: false)
expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Monitor"]', text: 'Monitor', visible: false)
end
context 'when feature flag sidebar_refactor is disabled' do
it 'renders the menu "Operations" in the sidebar' do
stub_feature_flags(sidebar_refactor: false)
visit project_path(project)
wait_for_requests
expect(page).to have_selector('.sidebar-sub-level-items a[aria-label="Operations"]', text: 'Operations', visible: false)
end
end
end
describe 'Settings > Operations' do
describe 'Settings > Monitor' do
describe 'Incidents' do
let(:create_issue) { 'Create an incident. Incidents are created for each alert triggered.' }
let(:send_email) { 'Send a single email notification to Owners and Maintainers for new alerts.' }
......
......@@ -198,7 +198,7 @@ RSpec.describe 'Projects > User sees sidebar' do
expect(page).to have_content 'Project'
expect(page).to have_content 'Issues'
expect(page).to have_content 'Wiki'
expect(page).to have_content 'Operations'
expect(page).to have_content 'Monitor'
expect(page).not_to have_content 'Repository'
expect(page).not_to have_content 'CI/CD'
......
......@@ -188,12 +188,12 @@ RSpec.describe 'User uses shortcuts', :js do
end
end
context 'when navigating to the Operations pages' do
context 'when navigating to the Monitor pages' do
it 'redirects to the Metrics page' do
find('body').native.send_key('g')
find('body').native.send_key('l')
expect(page).to have_active_navigation('Operations')
expect(page).to have_active_navigation('Monitor')
expect(page).to have_active_sub_navigation('Metrics')
end
......@@ -202,6 +202,14 @@ RSpec.describe 'User uses shortcuts', :js do
stub_feature_flags(sidebar_refactor: false)
end
it 'redirects to the Operations page' do
find('body').native.send_key('g')
find('body').native.send_key('l')
expect(page).to have_active_navigation('Operations')
expect(page).to have_active_sub_navigation('Metrics')
end
it 'redirects to the Kubernetes page with active Operations' do
find('body').native.send_key('g')
find('body').native.send_key('k')
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe Sidebars::Projects::Menus::OperationsMenu do
RSpec.describe Sidebars::Projects::Menus::MonitorMenu do
let_it_be_with_refind(:project) { create(:project) }
let(:user) { project.owner }
......@@ -37,6 +37,34 @@ RSpec.describe Sidebars::Projects::Menus::OperationsMenu do
end
end
describe '#title' do
it 'returns "Monitor"' do
expect(subject.title).to eq 'Monitor'
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'returns "Operations"' do
stub_feature_flags(sidebar_refactor: false)
expect(subject.title).to eq 'Operations'
end
end
end
describe '#extra_container_html_options' do
it 'returns "shortcuts-monitor"' do
expect(subject.extra_container_html_options).to eq(class: 'shortcuts-monitor')
end
context 'when feature flag :sidebar_refactor is disabled' do
it 'returns "shortcuts-operations"' do
stub_feature_flags(sidebar_refactor: false)
expect(subject.extra_container_html_options).to eq(class: 'shortcuts-operations')
end
end
end
describe '#link' do
context 'when metrics dashboard is visible' do
it 'returns link to the metrics dashboard page' do
......
......@@ -18,7 +18,7 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
end
describe 'Menu items' do
subject { described_class.new(context).renderable_items.index { |e| e.item_id == item_id } }
subject { described_class.new(context).renderable_items.find { |e| e.item_id == item_id } }
shared_examples 'access rights checks' do
specify { is_expected.not_to be_nil }
......@@ -82,8 +82,8 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
end
end
describe 'Operations' do
let(:item_id) { :operations }
describe 'Monitor' do
let(:item_id) { :monitor }
describe 'when project is archived' do
before do
......@@ -96,6 +96,16 @@ RSpec.describe Sidebars::Projects::Menus::SettingsMenu do
describe 'when project is not archived' do
specify { is_expected.not_to be_nil }
specify { expect(subject.title).to eq 'Monitor' }
context 'when feature flag :sidebar_refactor is disabled' do
before do
stub_feature_flags(sidebar_refactor: false)
end
specify { expect(subject.title).to eq 'Operations' }
end
describe 'when the user does not have access' do
let(:user) { nil }
......
......@@ -24,7 +24,14 @@ RSpec.shared_context 'project navbar structure' do
}
end
let(:operations_menu_items) do
let(:monitor_nav_item) do
{
nav_item: _('Operations'),
nav_sub_items: monitor_menu_items
}
end
let(:monitor_menu_items) do
[
_('Metrics'),
_('Logs'),
......@@ -52,6 +59,18 @@ RSpec.shared_context 'project navbar structure' do
}
end
let(:settings_menu_items) do
[
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Operations')
]
end
let(:structure) do
[
project_information_nav_item,
......@@ -93,10 +112,7 @@ RSpec.shared_context 'project navbar structure' do
]
},
security_and_compliance_nav_item,
{
nav_item: _('Operations'),
nav_sub_items: operations_menu_items
},
monitor_nav_item,
analytics_nav_item,
{
nav_item: _('Wiki'),
......@@ -112,15 +128,7 @@ RSpec.shared_context 'project navbar structure' do
},
{
nav_item: _('Settings'),
nav_sub_items: [
_('General'),
_('Integrations'),
_('Webhooks'),
_('Access Tokens'),
_('Repository'),
_('CI/CD'),
_('Operations')
].compact
nav_sub_items: settings_menu_items
}
].compact
end
......
......@@ -507,11 +507,11 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Operations' do
describe 'Monitor' do
it 'top level navigation link is visible for user with permissions' do
render
expect(rendered).to have_link('Operations')
expect(rendered).to have_link('Monitor')
end
describe 'Metrics Dashboard' do
......@@ -705,7 +705,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'does not have a link to the environments page' do
render
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Environments"]')).to be_empty
expect(page.at_css('.shortcuts-monitor').parent.css('[aria-label="Environments"]')).to be_empty
end
context 'when feature flag :sidebar_refactor is disabled' do
......@@ -738,7 +738,7 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
it 'does not have a link to the feature flags page' do
render
expect(page.at_css('.shortcuts-operations').parent.css('[aria-label="Feature Flags"]')).to be_empty
expect(page.at_css('.shortcuts-monitor').parent.css('[aria-label="Feature Flags"]')).to be_empty
end
context 'when feature flag :sidebar_refactor is disabled' do
......@@ -1173,24 +1173,24 @@ RSpec.describe 'layouts/nav/sidebar/_project' do
end
end
describe 'Operations' do
describe 'Monitor' do
context 'when project is archived' do
before do
project.update!(archived: true)
end
it 'does not have a link to the Operations settings' do
it 'does not have a link to the Monitor settings' do
render
expect(rendered).not_to have_link('Operations', href: project_settings_operations_path(project))
expect(rendered).not_to have_link('Monitor', href: project_settings_operations_path(project))
end
end
context 'when project is not archived active' do
it 'has a link to the Operations settings' do
it 'has a link to the Monitor settings' do
render
expect(rendered).to have_link('Operations', href: project_settings_operations_path(project))
expect(rendered).to have_link('Monitor', href: project_settings_operations_path(project))
end
end
end
......
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