gitlab-org--gitlab-foss/app/controllers/admin/runner_projects_controller.rb
Lin Jen-Shin 397a69f834 Allow admins to assign locked runners:
And show information about locked status.

Help! This looks bad :o
2016-06-28 19:55:12 +08:00

32 lines
770 B
Ruby

class Admin::RunnerProjectsController < Admin::ApplicationController
before_action :project, only: [:create]
def create
@runner = Ci::Runner.find(params[:runner_project][:runner_id])
runner_project = @runner.assign_to(@project, current_user)
if runner_project.persisted?
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