From d26e15da56739ccc3b240c9be4b52842959804bc Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Wed, 28 Jun 2017 22:40:00 +0900 Subject: Rename route --- app/controllers/projects/variables_controller.rb | 50 ------------------------ app/views/projects/settings/ci_cd/show.html.haml | 2 +- app/views/projects/variables/_content.html.haml | 9 ----- app/views/projects/variables/_form.html.haml | 19 --------- app/views/projects/variables/_index.html.haml | 16 -------- app/views/projects/variables/_table.html.haml | 28 ------------- app/views/projects/variables/show.html.haml | 9 ----- config/routes/project.rb | 2 +- 8 files changed, 2 insertions(+), 133 deletions(-) delete mode 100644 app/controllers/projects/variables_controller.rb delete mode 100644 app/views/projects/variables/_content.html.haml delete mode 100644 app/views/projects/variables/_form.html.haml delete mode 100644 app/views/projects/variables/_index.html.haml delete mode 100644 app/views/projects/variables/_table.html.haml delete mode 100644 app/views/projects/variables/show.html.haml diff --git a/app/controllers/projects/variables_controller.rb b/app/controllers/projects/variables_controller.rb deleted file mode 100644 index c83d03f6e55..00000000000 --- a/app/controllers/projects/variables_controller.rb +++ /dev/null @@ -1,50 +0,0 @@ -class Projects::VariablesController < Projects::ApplicationController - before_action :authorize_admin_build! - - layout 'project_settings' - - def index - redirect_to namespace_project_settings_ci_cd_path(@project.namespace, @project) - end - - def show - @variable = @project.variables.find(params[:id]) - end - - def update - @variable = @project.variables.find(params[:id]) - - if @variable.update_attributes(project_params) - redirect_to namespace_project_variables_path(project.namespace, project), notice: 'Variable was successfully updated.' - else - render action: "show" - end - end - - def create - @variable = Ci::ProjectVariable.new(project_params) - - if @variable.valid? && @project.variables << @variable - flash[:notice] = 'Variables were successfully updated.' - redirect_to namespace_project_settings_ci_cd_path(project.namespace, project) - else - render "show" - end - end - - def destroy - @key = @project.variables.find(params[:id]) - @key.destroy - - redirect_to namespace_project_settings_ci_cd_path(project.namespace, project), - status: 302, - notice: 'Variable was successfully removed.' - end - - private - - def project_params - params.require(:variable) - .permit([:id, :key, :value, :protected, :_destroy]) - end -end diff --git a/app/views/projects/settings/ci_cd/show.html.haml b/app/views/projects/settings/ci_cd/show.html.haml index 00ccc3ec41e..3d49775e4b0 100644 --- a/app/views/projects/settings/ci_cd/show.html.haml +++ b/app/views/projects/settings/ci_cd/show.html.haml @@ -3,6 +3,6 @@ = render "projects/settings/head" = render 'projects/runners/index' -= render 'projects/variables/index' += render 'projects/project_variables/index' = render 'projects/triggers/index' = render 'projects/pipelines_settings/show' diff --git a/app/views/projects/variables/_content.html.haml b/app/views/projects/variables/_content.html.haml deleted file mode 100644 index 98f618ca3b8..00000000000 --- a/app/views/projects/variables/_content.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -%h4.prepend-top-0 - Secret variables - = link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'secret-variables'), target: '_blank' -%p - These variables will be set to environment by the runner, and could be protected by exposing only to protected branches or tags. -%p - So you can use them for passwords, secret keys or whatever you want. -%p - The value of the variable can be visible in job log if explicitly asked to do so. diff --git a/app/views/projects/variables/_form.html.haml b/app/views/projects/variables/_form.html.haml deleted file mode 100644 index 3264d0c81d7..00000000000 --- a/app/views/projects/variables/_form.html.haml +++ /dev/null @@ -1,19 +0,0 @@ -= form_for [@project.namespace.becomes(Namespace), @project, @variable.becomes(Ci::Variable)] do |f| - = form_errors(@variable) - - .form-group - = f.label :key, "Key", class: "label-light" - = f.text_field :key, class: "form-control", placeholder: "PROJECT_VARIABLE", required: true - .form-group - = f.label :value, "Value", class: "label-light" - = f.text_area :value, class: "form-control", placeholder: "PROJECT_VARIABLE" - .form-group - .checkbox - = f.label :protected do - = f.check_box :protected - %strong Protected - .help-block - This variable will be passed only to pipelines running on protected branches and tags - = link_to icon('question-circle'), help_page_path('ci/variables/README', anchor: 'protected-secret-variables'), target: '_blank' - - = f.submit btn_text, class: "btn btn-save" diff --git a/app/views/projects/variables/_index.html.haml b/app/views/projects/variables/_index.html.haml deleted file mode 100644 index 5e6786f6698..00000000000 --- a/app/views/projects/variables/_index.html.haml +++ /dev/null @@ -1,16 +0,0 @@ -.row.prepend-top-default.append-bottom-default - .col-lg-4 - = render "projects/variables/content" - .col-lg-8 - %h5.prepend-top-0 - Add a variable - = render "projects/variables/form", btn_text: "Add new variable" - %hr - %h5.prepend-top-0 - Your variables (#{@project.variables.size}) - - if @project.variables.empty? - %p.settings-message.text-center.append-bottom-0 - No variables found, add one with the form above. - - else - = render "projects/variables/table" - %button.btn.btn-info.js-btn-toggle-reveal-values{ "data-status" => 'hidden' } Reveal Values diff --git a/app/views/projects/variables/_table.html.haml b/app/views/projects/variables/_table.html.haml deleted file mode 100644 index 59cd3c4b592..00000000000 --- a/app/views/projects/variables/_table.html.haml +++ /dev/null @@ -1,28 +0,0 @@ -.table-responsive.variables-table - %table.table - %colgroup - %col - %col - %col - %col{ width: 100 } - %thead - %th Key - %th Value - %th Protected - %th - %tbody - - @project.variables.order_key_asc.each do |variable| - - if variable.id? - %tr - %td.variable-key= variable.key - %td.variable-value{ "data-value" => variable.value }****** - %td.variable-protected= Gitlab::Utils.boolean_to_yes_no(variable.protected) - %td.variable-menu - = link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent btn-variable-edit" do - %span.sr-only - Update - = icon("pencil") - = link_to namespace_project_variable_path(@project.namespace, @project, variable), class: "btn btn-transparent btn-variable-delete", method: :delete, data: { confirm: "Are you sure?" } do - %span.sr-only - Remove - = icon("trash") diff --git a/app/views/projects/variables/show.html.haml b/app/views/projects/variables/show.html.haml deleted file mode 100644 index 297a53ca98c..00000000000 --- a/app/views/projects/variables/show.html.haml +++ /dev/null @@ -1,9 +0,0 @@ -- page_title "Variables" - -.row.prepend-top-default.append-bottom-default - .col-lg-3 - = render "content" - .col-lg-9 - %h5.prepend-top-0 - Update variable - = render "form", btn_text: "Save variable" diff --git a/config/routes/project.rb b/config/routes/project.rb index 19e18c733b1..23f0b211e33 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -123,7 +123,7 @@ constraints(ProjectUrlConstrainer.new) do end end - resources :variables, only: [:index, :show, :update, :create, :destroy] + resources :project_variables, only: [:index, :show, :update, :create, :destroy] resources :triggers, only: [:index, :create, :edit, :update, :destroy] do member do post :take_ownership -- cgit v1.2.1