Commit ae8dd183 authored by allison.browne's avatar allison.browne

Clean up grafana scopes

parent e9310d3e
...@@ -62,11 +62,8 @@ class Issue < ApplicationRecord ...@@ -62,11 +62,8 @@ class Issue < ApplicationRecord
scope :order_relative_position_asc, -> { reorder(::Gitlab::Database.nulls_last_order('relative_position', 'ASC')) } scope :order_relative_position_asc, -> { reorder(::Gitlab::Database.nulls_last_order('relative_position', 'ASC')) }
scope :preload_associated_models, -> { preload(:labels, project: :namespace) } scope :preload_associated_models, -> { preload(:labels, project: :namespace) }
scope :with_project_grafana_integration, -> { joins(project: :grafana_integration).where(projects: { grafana_integrations: { enabled: true } } ) }
scope :with_api_entity_associations, -> { preload(:timelogs, :assignees, :author, :notes, :labels, project: [:route, { namespace: :route }] ) } scope :with_api_entity_associations, -> { preload(:timelogs, :assignees, :author, :notes, :labels, project: [:route, { namespace: :route }] ) }
scope :grafana_embedded_aprox, -> { where('"issues"."description" ILIKE \'%\' || "grafana_integrations"."grafana_url" || \'%\'') }
scope :public_only, -> { where(confidential: false) } scope :public_only, -> { where(confidential: false) }
scope :confidential_only, -> { where(confidential: true) } scope :confidential_only, -> { where(confidential: true) }
......
...@@ -435,6 +435,7 @@ class Project < ApplicationRecord ...@@ -435,6 +435,7 @@ class Project < ApplicationRecord
scope :with_merge_requests_available_for_user, ->(current_user) { with_feature_available_for_user(:merge_requests, current_user) } scope :with_merge_requests_available_for_user, ->(current_user) { with_feature_available_for_user(:merge_requests, current_user) }
scope :with_merge_requests_enabled, -> { with_feature_enabled(:merge_requests) } scope :with_merge_requests_enabled, -> { with_feature_enabled(:merge_requests) }
scope :with_remote_mirrors, -> { joins(:remote_mirrors).where(remote_mirrors: { enabled: true }).distinct } scope :with_remote_mirrors, -> { joins(:remote_mirrors).where(remote_mirrors: { enabled: true }).distinct }
scope :with_grafana_integration_enabled, -> { joins(:grafana_integration).where(grafana_integrations: { enabled: true }) }
scope :with_group_runners_enabled, -> do scope :with_group_runners_enabled, -> do
joins(:ci_cd_settings) joins(:ci_cd_settings)
......
...@@ -13,7 +13,6 @@ module Banzai ...@@ -13,7 +13,6 @@ module Banzai
doc.document.create_element( doc.document.create_element(
'div', 'div',
class: 'js-render-metrics', class: 'js-render-metrics',
# Grafana usage ping depends on this implementation
'data-dashboard-url': metrics_dashboard_url(params) 'data-dashboard-url': metrics_dashboard_url(params)
) )
end end
......
...@@ -154,7 +154,7 @@ describe Gitlab::UsageData do ...@@ -154,7 +154,7 @@ describe Gitlab::UsageData do
issues issues
issues_with_associated_zoom_link issues_with_associated_zoom_link
issues_using_zoom_quick_actions issues_using_zoom_quick_actions
issues_with_embeded_grafana_charts_aprox issues_with_embedded_grafana_charts_approx
keys keys
label_lists label_lists
labels labels
...@@ -214,7 +214,7 @@ describe Gitlab::UsageData do ...@@ -214,7 +214,7 @@ describe Gitlab::UsageData do
expect(count_data[:projects_with_error_tracking_enabled]).to eq(1) expect(count_data[:projects_with_error_tracking_enabled]).to eq(1)
expect(count_data[:issues_with_associated_zoom_link]).to eq(2) expect(count_data[:issues_with_associated_zoom_link]).to eq(2)
expect(count_data[:issues_using_zoom_quick_actions]).to eq(3) expect(count_data[:issues_using_zoom_quick_actions]).to eq(3)
expect(count_data[:issues_with_embeded_grafana_charts_aprox]).to eq(2) expect(count_data[:issues_with_embedded_grafana_charts_approx]).to eq(2)
expect(count_data[:clusters_enabled]).to eq(4) expect(count_data[:clusters_enabled]).to eq(4)
expect(count_data[:project_clusters_enabled]).to eq(3) expect(count_data[:project_clusters_enabled]).to eq(3)
......
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