Commit bb9c3769 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch '10488-add-operations-dropdown' into 'master'

Resolve "Update 'speedometer' button on Gitlab.com header to be a dropdown menu that lists dashboards"

Closes #10488

See merge request gitlab-org/gitlab-ee!10519
parents c5001c49 ca15ef1c
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
class OperationsController < ApplicationController class OperationsController < ApplicationController
before_action :authorize_read_operations_dashboard! before_action :authorize_read_operations_dashboard!
before_action :dashboard_feature_flag, only: [:environments]
respond_to :json, only: [:list] respond_to :json, only: [:list]
POLLING_INTERVAL = 120_000 POLLING_INTERVAL = 120_000
...@@ -10,6 +12,14 @@ class OperationsController < ApplicationController ...@@ -10,6 +12,14 @@ class OperationsController < ApplicationController
def index def index
end end
def environments
render :index
end
def dashboard_feature_flag
push_frontend_feature_flag(:environments_dashboard)
end
def list def list
Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL) Gitlab::PollingInterval.set_header(response, interval: POLLING_INTERVAL)
projects = load_projects(current_user) projects = load_projects(current_user)
......
- if can?(current_user, :read_operations_dashboard) - if can?(current_user, :read_operations_dashboard)
= nav_link(controller: 'operations') do %li.dropdown
= link_to operations_path, title: _('Operations'), aria: { label: _('Operations') } do %button#js-dashboards-menu.btn-link{ type: 'button', data: { toggle: 'dropdown' }, 'aria-label': _('Operations Dashboard'), 'aria-haspopup': true, 'aria-expanded': false }
= sprite_icon('dashboard', size: 18) = sprite_icon('dashboard', size: 18)
.dropdown-menu{ 'aria-labelledby': "js-dashboards-menu" }
.dropdown-bold-header
= _('Dashboards')
- if Feature.enabled?('environments_dashboard')
= link_to operations_environments_path, class: 'dropdown-item', title: _('Environments'), aria: { label: _('Environments') } do
= _('Environments')
= link_to operations_path, class: 'dropdown-item', title: _('Operations'), aria: { label: _('Operations') } do
= _('Operations')
# frozen_string_literal: true # frozen_string_literal: true
get 'operations' => 'operations#index' get 'operations' => 'operations#index'
get 'operations/environments' => 'operations#environments'
get 'operations/list' => 'operations#list' get 'operations/list' => 'operations#list'
post 'operations' => 'operations#create', as: :add_operations_project post 'operations' => 'operations#create', as: :add_operations_project
delete 'operations' => 'operations#destroy', as: :remove_operations_project delete 'operations' => 'operations#destroy', as: :remove_operations_project
require 'spec_helper'
describe 'Operations dropdown navbar EE' do
let(:user) { create(:user) }
let(:project) { create(:project) }
before do
project.add_maintainer(user)
sign_in(user)
stub_licensed_features(operations_dashboard: true)
stub_feature_flags(environments_dashboard: true)
visit project_issues_path(project)
end
it 'should have a `Operations` link' do
expect(page).to have_link('Operations', href: operations_path)
end
it 'should have a `Environments` link' do
expect(page).to have_link('Environments', href: operations_environments_path)
end
end
...@@ -3305,6 +3305,9 @@ msgstr "" ...@@ -3305,6 +3305,9 @@ msgstr ""
msgid "DashboardProjects|Personal" msgid "DashboardProjects|Personal"
msgstr "" msgstr ""
msgid "Dashboards"
msgstr ""
msgid "Data is still calculating..." msgid "Data is still calculating..."
msgstr "" msgstr ""
......
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