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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-07-20 15:33:13 +0300
committerKamil Trzcinski <ayufan@ayufan.eu>2016-07-20 15:39:06 +0300
commit52d5d7daf13291416050de23c8635dd59373f3b7 (patch)
tree070364c000eafcd4221dcb789920d89342c98dc4 /app/controllers
parent7e8ef1b853b2d95ba99ac597992724b51163fde6 (diff)
Create PipelinesSettingsController for showing settings page
Diffstat (limited to 'app/controllers')
-rw-r--r--app/controllers/projects/pipelines_controller.rb27
-rw-r--r--app/controllers/projects/pipelines_settings_controller.rb33
-rw-r--r--app/controllers/projects/refs_controller.rb2
3 files changed, 35 insertions, 27 deletions
diff --git a/app/controllers/projects/pipelines_controller.rb b/app/controllers/projects/pipelines_controller.rb
index 55b68b89d0d..487963fdcd7 100644
--- a/app/controllers/projects/pipelines_controller.rb
+++ b/app/controllers/projects/pipelines_controller.rb
@@ -1,10 +1,9 @@
class Projects::PipelinesController < Projects::ApplicationController
- before_action :pipeline, except: [:index, :new, :create, :settings, :update_settings]
+ before_action :pipeline, except: [:index, :new, :create]
before_action :commit, only: [:show]
before_action :authorize_read_pipeline!
before_action :authorize_create_pipeline!, only: [:new, :create]
before_action :authorize_update_pipeline!, only: [:retry, :cancel]
- before_action :authorize_admin_pipeline!, only: [:settings, :update_settings]
def index
@scope = params[:scope]
@@ -44,36 +43,12 @@ class Projects::PipelinesController < Projects::ApplicationController
redirect_back_or_default default: namespace_project_pipelines_path(project.namespace, project)
end
- def settings
- @ref = params[:ref] || @project.default_branch || 'master'
- @build_badge = Gitlab::Badge::Build.new(@project, @ref)
- end
-
- def update_settings
- if @project.update_attributes(pipelines_settings_params)
- flash[:notice] = "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
- redirect_to(
- settings_namespace_project_pipelines_path(@project.namespace, @project),
- notice: "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
- )
- else
- render 'settings'
- end
- end
-
private
def create_params
params.require(:pipeline).permit(:ref)
end
- def pipelines_settings_params
- params.require(:project).permit(
- :runners_token, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
- :public_builds
- )
- end
-
def pipeline
@pipeline ||= project.pipelines.find_by!(id: params[:id])
end
diff --git a/app/controllers/projects/pipelines_settings_controller.rb b/app/controllers/projects/pipelines_settings_controller.rb
new file mode 100644
index 00000000000..e7b96887c9c
--- /dev/null
+++ b/app/controllers/projects/pipelines_settings_controller.rb
@@ -0,0 +1,33 @@
+class Projects::PipelinesSettingsController < Projects::ApplicationController
+ before_action :authorize_admin_pipeline!
+
+ def show
+ @ref = params[:ref] || @project.default_branch || 'master'
+ @build_badge = Gitlab::Badge::Build.new(@project, @ref)
+ end
+
+ def update
+ if @project.update_attributes(update_params)
+ flash[:notice] = "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
+ redirect_to(
+ namespace_project_pipelines_settings_path(@project.namespace, @project),
+ notice: "CI/CD Pipelines settings for '#{@project.name}' was successfully updated."
+ )
+ else
+ render 'index'
+ end
+ end
+
+ private
+
+ def create_params
+ params.require(:pipeline).permit(:ref)
+ end
+
+ def update_params
+ params.require(:project).permit(
+ :runners_token, :builds_enabled, :build_allow_git_fetch, :build_timeout_in_minutes, :build_coverage_regex,
+ :public_builds
+ )
+ end
+end
diff --git a/app/controllers/projects/refs_controller.rb b/app/controllers/projects/refs_controller.rb
index 08d74634315..3602b3d5e58 100644
--- a/app/controllers/projects/refs_controller.rb
+++ b/app/controllers/projects/refs_controller.rb
@@ -25,7 +25,7 @@ class Projects::RefsController < Projects::ApplicationController
when "graphs_commits"
commits_namespace_project_graph_path(@project.namespace, @project, @id)
when "badges"
- settings_namespace_project_pipelines_path(@project.namespace, @project, ref: @id)
+ namespace_project_pipelines_settings_path(@project.namespace, @project, ref: @id)
else
namespace_project_commits_path(@project.namespace, @project, @id)
end