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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
8cb105cf
Commit
8cb105cf
authored
Feb 07, 2018
by
Pawel Chojnacki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix order of checks in editable? method.
+ address small nitpicks
parent
277f7fef
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
app/models/project_services/prometheus_service.rb
app/models/project_services/prometheus_service.rb
+4
-3
spec/factories/projects.rb
spec/factories/projects.rb
+1
-1
spec/factories/services.rb
spec/factories/services.rb
+2
-2
No files found.
app/models/project_services/prometheus_service.rb
View file @
8cb105cf
...
@@ -28,7 +28,7 @@ class PrometheusService < MonitoringService
...
@@ -28,7 +28,7 @@ class PrometheusService < MonitoringService
end
end
def
editable?
def
editable?
!
prometheus_installed?
||
manual_configuration
?
manual_configuration?
||
!
prometheus_installed
?
end
end
def
title
def
title
...
@@ -126,7 +126,8 @@ class PrometheusService < MonitoringService
...
@@ -126,7 +126,8 @@ class PrometheusService < MonitoringService
end
end
def
prometheus_installed?
def
prometheus_installed?
return
false
if
template?
||
!
project
return
false
if
template?
return
false
unless
project
project
.
clusters
.
enabled
.
any?
{
|
cluster
|
cluster
.
application_prometheus
&
.
installed?
}
project
.
clusters
.
enabled
.
any?
{
|
cluster
|
cluster
.
application_prometheus
&
.
installed?
}
end
end
...
@@ -157,7 +158,7 @@ class PrometheusService < MonitoringService
...
@@ -157,7 +158,7 @@ class PrometheusService < MonitoringService
end
end
def
synchronize_service_state!
def
synchronize_service_state!
self
.
active
=
prometheus_installed?
||
self
.
manual_configuration?
self
.
active
=
prometheus_installed?
||
manual_configuration?
true
true
end
end
...
...
spec/factories/projects.rb
View file @
8cb105cf
...
@@ -249,7 +249,7 @@ FactoryBot.define do
...
@@ -249,7 +249,7 @@ FactoryBot.define do
project
.
create_prometheus_service
(
project
.
create_prometheus_service
(
active:
true
,
active:
true
,
properties:
{
properties:
{
api_url:
'https://prometheus.example.com'
,
api_url:
'https://prometheus.example.com
/
'
,
manual_configuration:
true
manual_configuration:
true
}
}
)
)
...
...
spec/factories/services.rb
View file @
8cb105cf
...
@@ -30,8 +30,8 @@ FactoryBot.define do
...
@@ -30,8 +30,8 @@ FactoryBot.define do
project
project
active
true
active
true
properties
({
properties
({
manual_configuration:
true
,
api_url:
'https://prometheus.example.com/'
,
api_url:
'https://prometheus.example.com/'
manual_configuration:
true
})
})
end
end
...
...
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