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:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-25 19:03:41 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-09-25 19:03:41 +0300
commitb328c76c063cfe3082316e4273cfd318bbbfe69b (patch)
tree0d23ca81c9439912a2330d81b7f3f774eedcf348 /app/controllers/projects/runners_controller.rb
parent352f242d8ca491172db49d458f3eae31c70270c8 (diff)
Move runners page to project settings
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/controllers/projects/runners_controller.rb')
-rw-r--r--app/controllers/projects/runners_controller.rb69
1 files changed, 69 insertions, 0 deletions
diff --git a/app/controllers/projects/runners_controller.rb b/app/controllers/projects/runners_controller.rb
new file mode 100644
index 00000000000..d59884a1dd7
--- /dev/null
+++ b/app/controllers/projects/runners_controller.rb
@@ -0,0 +1,69 @@
+class Projects::RunnersController < Projects::ApplicationController
+ before_action :ci_project
+ before_action :set_runner, only: [:edit, :update, :destroy, :pause, :resume, :show]
+ before_action :authorize_admin_project!
+
+ layout 'project_settings'
+
+ def index
+ @runners = @ci_project.runners.order('id DESC')
+ @specific_runners =
+ Ci::Runner.specific.includes(:runner_projects).
+ where(Ci::RunnerProject.table_name => { project_id: current_user.authorized_projects } ).
+ where.not(id: @runners).order("#{Ci::Runner.table_name}.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 runner_path(@runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to runner_path(@runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def destroy
+ if @runner.only_for?(@ci_project)
+ @runner.destroy
+ end
+
+ redirect_to runners_path(@project)
+ end
+
+ def resume
+ if @runner.update_attributes(active: true)
+ redirect_to runner_path(@runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to runner_path(@runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def pause
+ if @runner.update_attributes(active: false)
+ redirect_to runner_path(@runner), notice: 'Runner was successfully updated.'
+ else
+ redirect_to runner_path(@runner), alert: 'Runner was not updated.'
+ end
+ end
+
+ def show
+ end
+
+ protected
+
+ def ci_project
+ @ci_project = @project.gitlab_ci_project
+ end
+
+ def set_runner
+ @runner ||= @ci_project.runners.find(params[:id])
+ end
+
+ def runner_params
+ params.require(:runner).permit(:description, :tag_list, :contacted_at, :active)
+ end
+end