Commit 6b0b2adc authored by allison.browne's avatar allison.browne

Code review feedback

Use predicate method and boolean rather than string
parent b2e86043
......@@ -363,7 +363,7 @@ module ProjectsHelper
end
def grafana_integration_enabled
@project.grafana_integration&.enabled
@project.grafana_integration&.enabled?
end
private
......
......@@ -17,8 +17,8 @@ class GrafanaIntegration < ApplicationRecord
validates :enabled, inclusion: { in: [true, false] }
def client
if enabled?
@client ||= ::Grafana::Client.new(api_url: grafana_url.chomp('/'), token: token)
end
return unless enabled?
@client ||= ::Grafana::Client.new(api_url: grafana_url.chomp('/'), token: token)
end
end
---
title: Add flag to enable and disable grafana integration
title: Migrate enabled flag on grafana_integrations table
merge_request: 19234
author:
type: changed
......@@ -5,6 +5,6 @@ FactoryBot.define do
project
grafana_url { 'https://grafana.example.com' }
token { SecureRandom.hex(10) }
enabled { 'true' }
enabled { true }
end
end
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