Welcome to mirror list, hosted at ThFree Co, Russian Federation.

runner_projects_controller.rb « admin « controllers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d25619d94e0be2f9be72124d2d31d1c183ffbc65 (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
32
33
34
35
class Admin::RunnerProjectsController < Admin::ApplicationController
  before_action :project, only: [:create]

  def index
    @runner_projects = project.runner_projects.all
    @runner_project = project.runner_projects.new
  end

  def create
    @runner = Ci::Runner.find(params[:runner_project][:runner_id])

    if @runner.assign_to(@project, current_user)
      redirect_to admin_runner_path(@runner)
    else
      redirect_to admin_runner_path(@runner), alert: 'Failed adding runner to project'
    end
  end

  def destroy
    rp = Ci::RunnerProject.find(params[:id])
    runner = rp.runner
    rp.destroy

    redirect_to admin_runner_path(runner)
  end

  private

  def project
    @project = Project.find_with_namespace(
      [params[:namespace_id], '/', params[:project_id]].join('')
    )
    @project || render_404
  end
end