debian-mirror-gitlab/app/controllers/admin/runner_projects_controller.rb

35 lines
811 B
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2015-12-23 02:04:40 +05:30
class Admin::RunnerProjectsController < Admin::ApplicationController
before_action :project, only: [:create]
2021-01-03 14:25:43 +05:30
feature_category :continuous_integration
2015-12-23 02:04:40 +05:30
def create
@runner = Ci::Runner.find(params[:runner_project][:runner_id])
2018-11-08 19:23:39 +05:30
if @runner.assign_to(@project, current_user)
2015-12-23 02:04:40 +05:30
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-11-18 11:00:15 +05:30
redirect_to admin_runner_path(runner), status: :found
2015-12-23 02:04:40 +05:30
end
private
def project
2017-08-17 22:00:37 +05:30
@project = Project.find_by_full_path(
2015-12-23 02:04:40 +05:30
[params[:namespace_id], '/', params[:project_id]].join('')
)
@project || render_404
end
end