Commit 55943872 authored by Tiago Botelho's avatar Tiago Botelho Committed by Jose

Adds empty environments page

parent 3c49bcb6
......@@ -5,7 +5,7 @@ class Projects::ApplicationController < ApplicationController
skip_before_action :authenticate_user!
before_action :project
before_action :repository
before_action :environment
before_action :available_environment
layout 'project'
helper_method :repository, :can_collaborate_with_project?, :user_access
......@@ -33,8 +33,8 @@ class Projects::ApplicationController < ApplicationController
@repository ||= project.repository
end
def environment
@environment ||= project.environments.first
def available_environment
@available_environment ||= project.environments.with_state(:available).first
end
def authorize_action!(action)
......
......@@ -31,6 +31,10 @@ 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)
......
......@@ -8,7 +8,7 @@ class ProjectsController < Projects::ApplicationController
before_action :redirect_git_extension, only: [:show]
before_action :project, except: [:index, :new, :create]
before_action :repository, except: [:index, :new, :create]
before_action :environment, except: [:index, :new, :create]
before_action :available_environment, except: [:index, :new, :create]
before_action :assign_ref_vars, only: [:show], if: :repo_exists?
before_action :tree, only: [:show], if: [:repo_exists?, :project_view_files?]
before_action :lfs_blob_ids, only: [:show], if: [:repo_exists?, :project_view_files?]
......
......@@ -6,8 +6,8 @@ module EnvironmentsHelper
end
def metrics_path(project, environment)
metrics_project_environment_path(project, environment) if environment
return metrics_project_environment_path(project, environment) if environment
project_environments_path(project)
empty_project_environments_path(project)
end
end
......@@ -211,7 +211,7 @@
- if project_nav_tab? :environments
= nav_link(controller: [:environments, :metrics]) do
= link_to metrics_path(@project, @environment), title: 'Metrics', class: 'shortcuts-environments' do
= link_to metrics_path(@project, @available_environment), title: 'Metrics', class: 'shortcuts-environments' do
%span
= _('Metrics')
......
- page_title "Metrics"
%h1
No environments were found
= link_to "New Environment", new_project_environment_path(@project)
......@@ -235,6 +235,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
collection do
get :empty
get :folder, path: 'folders/*id', constraints: { format: /(html|json)/ }
end
......
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