summaryrefslogtreecommitdiff
path: root/app/controllers/admin/integrations_controller.rb
blob: db9835e65ecaa71a87ccb806aa6d3ddef424fb00 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

class Admin::IntegrationsController < Admin::ApplicationController
  include ::Integrations::Actions

  before_action :not_found, unless: -> { instance_level_integrations? }

  before_action do
    push_frontend_feature_flag(:integration_form_sections, default_enabled: :yaml)
  end

  feature_category :integrations

  def overrides
    respond_to do |format|
      format.json do
        projects = Project.with_active_integration(integration.class).merge(::Integration.with_custom_settings)
        serializer = ::Integrations::ProjectSerializer.new.with_pagination(request, response)

        render json: serializer.represent(projects)
      end
      format.html { render 'shared/integrations/overrides' }
    end
  end

  private

  def find_or_initialize_non_project_specific_integration(name)
    Integration.find_or_initialize_non_project_specific_integration(name, instance: true)
  end
end