Class: Projects::ServicesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/projects/services_controller.rb

Constant Summary collapse

ALLOWED_PARAMS =
[:title, :token, :type, :active, :api_key, :api_url, :api_version, :subdomain,
:room, :recipients, :project_url, :webhook,
:user_key, :device, :priority, :sound, :bamboo_url, :username, :password,
:build_key, :server, :teamcity_url, :drone_url, :build_type,
:description, :issues_url, :new_issue_url, :restrict_to_branch, :channel,
:colorize_messages, :channels,
:push_events, :issues_events, :merge_requests_events, :tag_push_events,
:note_events, :build_events, :wiki_page_events,
:notify_only_broken_builds, :add_pusher,
:send_from_committer_email, :disable_diffs, :external_wiki_url,
:notify, :color,
:server_host, :server_port, :default_irc_uri, :enable_ssl_verification,
:jira_issue_transition_id]
FILTER_BLANK_PARAMS =

Parameters to ignore if no value is specified

[:password]

Instance Method Summary collapse

Methods inherited from ApplicationController

#redirect_back_or_default

Methods included from PageLayoutHelper

#blank_container, #container_class, #fluid_layout, #header_title, #nav, #page_card_attributes, #page_card_meta_tags, #page_description, #page_image, #page_title, #sidebar

Methods included from GitlabRoutingHelper

#activity_project_path, #edit_project_path, #edit_project_url, #issue_path, #issue_url, #merge_request_path, #merge_request_url, #milestone_path, #project_builds_path, #project_commits_path, #project_files_path, #project_path, #project_pipelines_path, #project_snippet_url, #project_url, #runner_path, #runners_path, #toggle_subscription_path

Methods included from Gitlab::GonHelper

#add_gon_variables

Methods included from Gitlab::CurrentSettings

#current_application_settings, #fake_application_settings

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Projects::ApplicationController

Instance Method Details

#editObject


32
33
# File 'app/controllers/projects/services_controller.rb', line 32

def edit
end

#indexObject


27
28
29
30
# File 'app/controllers/projects/services_controller.rb', line 27

def index
  @project.build_missing_services
  @services = @project.services.visible.reload
end

#testObject


47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/projects/services_controller.rb', line 47

def test
  data = Gitlab::PushDataBuilder.build_sample(project, current_user)
  outcome = @service.test(data)
  if outcome[:success]
    message = { notice: 'We sent a request to the provided URL' }
  else
    error_message = "We tried to send a request to the provided URL but an error occurred"
    error_message << ": #{outcome[:result]}" if outcome[:result].present?
    message = { alert: error_message }
  end

  redirect_back_or_default(options: message)
end

#updateObject


35
36
37
38
39
40
41
42
43
44
45
# File 'app/controllers/projects/services_controller.rb', line 35

def update
  if @service.update_attributes(service_params)
    redirect_to(
      edit_namespace_project_service_path(@project.namespace, @project,
                                          @service.to_param, notice:
                                          'Successfully updated.')
    )
  else
    render 'edit'
  end
end