Commit 3c49bcb6 authored by Tiago Botelho's avatar Tiago Botelho Committed by Jose

Adds metrics to Operartions tab in projects sidebar

parent 292cf668
...@@ -5,6 +5,7 @@ class Projects::ApplicationController < ApplicationController ...@@ -5,6 +5,7 @@ class Projects::ApplicationController < ApplicationController
skip_before_action :authenticate_user! skip_before_action :authenticate_user!
before_action :project before_action :project
before_action :repository before_action :repository
before_action :environment
layout 'project' layout 'project'
helper_method :repository, :can_collaborate_with_project?, :user_access helper_method :repository, :can_collaborate_with_project?, :user_access
...@@ -32,6 +33,10 @@ class Projects::ApplicationController < ApplicationController ...@@ -32,6 +33,10 @@ class Projects::ApplicationController < ApplicationController
@repository ||= project.repository @repository ||= project.repository
end end
def environment
@environment ||= project.environments.first
end
def authorize_action!(action) def authorize_action!(action)
unless can?(current_user, action, project) unless can?(current_user, action, project)
return access_denied! return access_denied!
......
...@@ -8,6 +8,7 @@ class ProjectsController < Projects::ApplicationController ...@@ -8,6 +8,7 @@ class ProjectsController < Projects::ApplicationController
before_action :redirect_git_extension, only: [:show] before_action :redirect_git_extension, only: [:show]
before_action :project, except: [:index, :new, :create] before_action :project, except: [:index, :new, :create]
before_action :repository, except: [:index, :new, :create] before_action :repository, except: [:index, :new, :create]
before_action :environment, except: [:index, :new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists? before_action :assign_ref_vars, only: [:show], if: :repo_exists?
before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?] before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
before_action :lfs_blob_ids, only: [:show], if: [:repo_exists?, :project_view_files?] before_action :lfs_blob_ids, only: [:show], if: [:repo_exists?, :project_view_files?]
......
...@@ -4,4 +4,10 @@ module EnvironmentsHelper ...@@ -4,4 +4,10 @@ module EnvironmentsHelper
endpoint: project_environments_path(@project, format: :json) endpoint: project_environments_path(@project, format: :json)
} }
end end
def metrics_path(project, environment)
metrics_project_environment_path(project, environment) if environment
project_environments_path(project)
end
end end
...@@ -210,6 +210,11 @@ ...@@ -210,6 +210,11 @@
%li.divider.fly-out-top-item %li.divider.fly-out-top-item
- if project_nav_tab? :environments - if project_nav_tab? :environments
= nav_link(controller: [:environments, :metrics]) do
= link_to metrics_path(@project, @environment), title: 'Metrics', class: 'shortcuts-environments' do
%span
= _('Metrics')
= nav_link(controller: :environments) do = nav_link(controller: :environments) do
= link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do = link_to project_environments_path(@project), title: 'Environments', class: 'shortcuts-environments' do
%span %span
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment