summaryrefslogtreecommitdiff
path: root/app/models/grafana_integration.rb
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 18:06:00 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-01 18:06:00 +0000
commit77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0 (patch)
tree0773f62090b7a896b29b8b08152565ba976716a8 /app/models/grafana_integration.rb
parentded8ee5a09a1a02209adf179ac7d6e456703726a (diff)
downloadgitlab-ce-77a73903aa803869d0ab7fe544cc2d8b1a6aa1e0.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/grafana_integration.rb')
-rw-r--r--app/models/grafana_integration.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/grafana_integration.rb b/app/models/grafana_integration.rb
index 51cc398394d..620bb4231a0 100644
--- a/app/models/grafana_integration.rb
+++ b/app/models/grafana_integration.rb
@@ -14,7 +14,11 @@ class GrafanaIntegration < ApplicationRecord
validates :token, :project, presence: true
+ validates :enabled, inclusion: { in: [true, false] }
+
def client
+ return unless enabled?
+
@client ||= ::Grafana::Client.new(api_url: grafana_url.chomp('/'), token: token)
end
end