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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/ci/runners_controller.rb')
-rw-r--r--app/controllers/ci/runners_controller.rb71
1 files changed, 71 insertions, 0 deletions
diff --git a/app/controllers/ci/runners_controller.rb b/app/controllers/ci/runners_controller.rb
new file mode 100644
index 00000000000..01eebf7e6a7
--- /dev/null
+++ b/app/controllers/ci/runners_controller.rb
@@ -0,0 +1,71 @@
+module Ci
+ class RunnersController < Ci::ApplicationController
+ before_filter :authenticate_user!
+ before_filter :project
+ before_filter :set_runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
+ before_filter :authorize_access_project!
+ before_filter :authorize_manage_project!
+
+ layout 'ci/project'
+
+ def index
+ @runners = @project.runners.order('id DESC')
+ @specific_runners = current_user.authorized_runners.
+ where.not(id: @runners).order('runners.id DESC').page(params[:page]).per(20)
+ @shared_runners = Ci::Runner.shared.active
+ @shared_runners_count = @shared_runners.count(:all)
+ end
+
+ def edit
+ end
+
+ def update
+ if @runner.update_attributes(runner_params)
+ redirect_to edit_ci_project_runner_path(@project, @runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to edit_ci_project_runner_path(@project, @runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def destroy
+ if @runner.only_for?(@project)
+ @runner.destroy
+ end
+
+ redirect_to ci_project_runners_path(@project)
+ end
+
+ def resume
+ if @runner.update_attributes(active: true)
+ redirect_to ci_project_runners_path(@project, @runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to ci_project_runners_path(@project, @runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def pause
+ if @runner.update_attributes(active: false)
+ redirect_to ci_project_runners_path(@project, @runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to ci_project_runners_path(@project, @runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def show
+ end
+
+ protected
+
+ def project
+ @project = Ci::Project.find(params[:project_id])
+ end
+
+ def set_runner
+ @runner ||= @project.runners.find(params[:id])
+ end
+
+ def runner_params
+ params.require(:runner).permit(:description, :tag_list, :contacted_at, :active)
+ end
+ end
+end