Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
db16d149
Commit
db16d149
authored
Apr 23, 2020
by
Tristan Read
Committed by
Lin Jen-Shin
Apr 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move alert management behind a feature flag
parent
d43df1b7
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
21 deletions
+101
-21
app/controllers/projects/alert_management_controller.rb
app/controllers/projects/alert_management_controller.rb
+8
-3
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+7
-5
changelogs/unreleased/tr-alert-management-feature-flag.yml
changelogs/unreleased/tr-alert-management-feature-flag.yml
+5
-0
spec/controllers/projects/alert_management_controller_spec.rb
.../controllers/projects/alert_management_controller_spec.rb
+40
-0
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
+41
-13
No files found.
app/controllers/projects/alert_management_controller.rb
View file @
db16d149
# frozen_string_literal: true
# frozen_string_literal: true
class
Projects::AlertManagementController
<
Projects
::
ApplicationController
class
Projects::AlertManagementController
<
Projects
::
ApplicationController
before_action
:ensure_feature_enabled
def
index
def
index
respond_to
do
|
format
|
format
.
html
end
end
private
def
ensure_feature_enabled
render_404
unless
Feature
.
enabled?
(
:alert_management_minimal
,
project
)
end
end
end
end
app/views/layouts/nav/sidebar/_project.html.haml
View file @
db16d149
...
@@ -222,12 +222,14 @@
...
@@ -222,12 +222,14 @@
%span
%span
=
_
(
'Metrics'
)
=
_
(
'Metrics'
)
-
if
Feature
.
enabled?
(
:alert_management_minimal
,
@project
)
-
if
project_nav_tab?
(
:alert_management
)
-
if
project_nav_tab?
(
:alert_management
)
=
nav_link
(
controller: :alert_management
)
do
=
nav_link
(
controller: :alert_management
)
do
=
link_to
project_alert_management_index_path
(
@project
),
title:
_
(
'Alerts'
),
class:
'shortcuts-tracking qa-operations-tracking-link'
do
=
link_to
project_alert_management_index_path
(
@project
),
title:
_
(
'Alerts'
),
class:
'shortcuts-tracking qa-operations-tracking-link'
do
%span
%span
=
_
(
'Alerts'
)
=
_
(
'Alerts'
)
-
if
project_nav_tab?
:environments
=
render_if_exists
"layouts/nav/sidebar/tracing_link"
=
render_if_exists
"layouts/nav/sidebar/tracing_link"
=
nav_link
(
controller: :environments
,
action:
[
:index
,
:folder
,
:show
,
:new
,
:edit
,
:create
,
:update
,
:stop
,
:terminal
])
do
=
nav_link
(
controller: :environments
,
action:
[
:index
,
:folder
,
:show
,
:new
,
:edit
,
:create
,
:update
,
:stop
,
:terminal
])
do
...
...
changelogs/unreleased/tr-alert-management-feature-flag.yml
0 → 100644
View file @
db16d149
---
title
:
Move alert management behind a feature flag
merge_request
:
30133
author
:
type
:
fixed
spec/controllers/projects/alert_management_controller_spec.rb
0 → 100644
View file @
db16d149
# frozen_string_literal: true
require
'spec_helper'
describe
Projects
::
AlertManagementController
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:role
)
{
:reporter
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
project
.
add_role
(
user
,
role
)
sign_in
(
user
)
end
describe
'GET #index'
do
context
'when alert_management_minimal is enabled'
do
before
do
stub_feature_flags
(
alert_management_minimal:
true
)
end
it
'shows the page'
do
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
:ok
)
end
end
context
'when alert_management_minimal is disabled'
do
before
do
stub_feature_flags
(
alert_management_minimal:
false
)
end
it
'shows 404'
do
get
:index
,
params:
{
namespace_id:
project
.
namespace
,
project_id:
project
}
expect
(
response
).
to
have_gitlab_http_status
(
:not_found
)
end
end
end
end
spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb
View file @
db16d149
...
@@ -136,6 +136,7 @@ describe 'layouts/nav/sidebar/_project' do
...
@@ -136,6 +136,7 @@ describe 'layouts/nav/sidebar/_project' do
end
end
describe
'operations settings tab'
do
describe
'operations settings tab'
do
describe
'archive projects'
do
before
do
before
do
project
.
update!
(
archived:
project_archived
)
project
.
update!
(
archived:
project_archived
)
end
end
...
@@ -161,6 +162,33 @@ describe 'layouts/nav/sidebar/_project' do
...
@@ -161,6 +162,33 @@ describe 'layouts/nav/sidebar/_project' do
end
end
end
end
describe
'Alert Management'
do
context
'when alert_management_minimal is enabled'
do
before
do
stub_feature_flags
(
alert_management_minimal:
true
)
end
it
'shows the Alerts sidebar entry'
do
render
expect
(
rendered
).
to
have_css
(
'a[title="Alerts"]'
)
end
end
context
'when alert_management_minimal is disabled'
do
before
do
stub_feature_flags
(
alert_management_minimal:
false
)
end
it
'does not show the Alerts sidebar entry'
do
render
expect
(
rendered
).
to
have_no_css
(
'a[title="Alerts"]'
)
end
end
end
end
describe
'value stream analytics entry'
do
describe
'value stream analytics entry'
do
let
(
:read_cycle_analytics
)
{
true
}
let
(
:read_cycle_analytics
)
{
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment