Commit ca15ef1c authored by Filipa Lacerda's avatar Filipa Lacerda

Adds feature flag for env dashboard

Adds specs

Adds dashboard title
parent 6309b1c3
...@@ -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
...@@ -14,6 +16,10 @@ class OperationsController < ApplicationController ...@@ -14,6 +16,10 @@ class OperationsController < ApplicationController
render :index render :index
end 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)
%li.dropdown %li.dropdown
%button.btn-link{ type: 'button', data: { toggle: 'dropdown' } } %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 .dropdown-menu{ 'aria-labelledby': "js-dashboards-menu" }
= link_to operations_path, class: 'dropdown-item', title: _('Environments'), aria: { label: _('Environments') } do .dropdown-bold-header
= _('Environments') = _('Dashboards')
- if can?(current_user, :read_operations_dashboard) - if Feature.enabled?('environments_dashboard')
= link_to operations_path, class: 'dropdown-item', title: _('Operations'), aria: { label: _('Operations') } do = link_to operations_environments_path, class: 'dropdown-item', title: _('Environments'), aria: { label: _('Environments') } do
= _('Operations') = _('Environments')
= link_to operations_path, class: 'dropdown-item', title: _('Operations'), aria: { label: _('Operations') } do
= _('Operations')
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
...@@ -3275,6 +3275,9 @@ msgstr "" ...@@ -3275,6 +3275,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