gitlab-org--gitlab-foss/app/controllers/admin/runner_projects_controller.rb

33 lines
767 B
Ruby
Raw Normal View History

# frozen_string_literal: true
2015-12-04 06:55:23 -05:00
class Admin::RunnerProjectsController < Admin::ApplicationController
before_action :project, only: [:create]
def create
@runner = Ci::Runner.find(params[:runner_project][:runner_id])
if @runner.assign_to(@project, current_user)
2015-12-04 06:55:23 -05:00
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
2018-07-02 06:43:06 -04:00
redirect_to admin_runner_path(runner), status: :found
2015-12-04 06:55:23 -05:00
end
private
def project
@project = Project.find_by_full_path(
2015-12-04 06:55:23 -05:00
[params[:namespace_id], '/', params[:project_id]].join('')
)
@project || render_404
end
end