diff options
author | Tiago Botelho <tiagonbotelho@hotmail.com> | 2018-06-26 10:36:16 +0100 |
---|---|---|
committer | Jose <jvargas@gitlab.com> | 2018-06-26 23:06:25 -0500 |
commit | 91463e52467d4b93d95693ac4eba1d5630ecdc98 (patch) | |
tree | dabe37b1c6a169d59e1611d17e0157cf0516e33b /app | |
parent | c4df74d1e1ba53996c0d64a8f8ef91712bbecf75 (diff) | |
download | gitlab-ce-91463e52467d4b93d95693ac4eba1d5630ecdc98.tar.gz |
Specify environment actions to distinguish between metrics and every other environment related actions
Diffstat (limited to 'app')
4 files changed, 9 insertions, 8 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 47b2028860d..decef19a0a2 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -31,10 +31,6 @@ class Projects::EnvironmentsController < Projects::ApplicationController end end - def empty - render :empty - end - def folder folder_environments = project.environments.where(environment_type: params[:id]) @environments = folder_environments.with_state(params[:scope] || :available) @@ -124,6 +120,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController end end + def empty + render :empty + end + def metrics # Currently, this acts as a hint to load the metrics details into the cache # if they aren't there already diff --git a/app/controllers/projects/git_http_client_controller.rb b/app/controllers/projects/git_http_client_controller.rb index 07249fe3182..199a8a4c4c5 100644 --- a/app/controllers/projects/git_http_client_controller.rb +++ b/app/controllers/projects/git_http_client_controller.rb @@ -15,6 +15,7 @@ class Projects::GitHttpClientController < Projects::ApplicationController # Git clients will not know what authenticity token to send along skip_before_action :verify_authenticity_token skip_before_action :repository + skip_before_action :available_environment before_action :authenticate_user private diff --git a/app/controllers/projects/uploads_controller.rb b/app/controllers/projects/uploads_controller.rb index f5cf089ad98..14e84f6a65f 100644 --- a/app/controllers/projects/uploads_controller.rb +++ b/app/controllers/projects/uploads_controller.rb @@ -2,7 +2,7 @@ class Projects::UploadsController < Projects::ApplicationController include UploadsActions # These will kick you out if you don't have access. - skip_before_action :project, :repository, + skip_before_action :project, :repository, :available_environment, if: -> { action_name == 'show' && image_or_video? } before_action :authorize_upload_file!, only: [:create] diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index 4096a0f4c31..a1a14aec5c6 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -204,18 +204,18 @@ %ul.sidebar-sub-level-items = nav_link(controller: [:environments, :clusters, :user, :gcp], html_options: { class: "fly-out-top-item" } ) do - = link_to project_environments_path(@project) do + = link_to operations_metrics_path(@project, @available_environment) do %strong.fly-out-top-item-name = _('Operations') %li.divider.fly-out-top-item - if project_nav_tab? :environments - = nav_link(controller: [:environments, :metrics]) do + = nav_link(controller: :environments, action: [:metrics, :empty]) do = link_to operations_metrics_path(@project, @available_environment), title: 'Metrics', class: 'shortcuts-environments' do %span = _('Metrics') - = nav_link(controller: :environments) do + = nav_link(controller: :environments, action: [:index, :folder, :show, :new, :edit, :create, :update, :stop, :terminal]) do = link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do %span = _('Environments') |