summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Botelho <tiagonbotelho@hotmail.com>2018-06-14 10:40:59 +0100
committerJose <jvargas@gitlab.com>2018-07-03 12:49:40 -0500
commit3fc8aa2c173fce2aa93a0bad6dcfaa945331cb6c (patch)
tree9b112209fb2250debac4d7e2d54301bdca2375eb
parentcd5789415b6e561564073693243e890e79596ed2 (diff)
downloadgitlab-ce-3fc8aa2c173fce2aa93a0bad6dcfaa945331cb6c.tar.gz
Add environments list instance variable to environment metrics view
-rw-r--r--app/controllers/projects/environments_controller.rb8
-rw-r--r--app/views/projects/environments/metrics.html.haml1
2 files changed, 6 insertions, 3 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
index 0821362f5df..931ebcabf29 100644
--- a/app/controllers/projects/environments_controller.rb
+++ b/app/controllers/projects/environments_controller.rb
@@ -6,13 +6,11 @@ class Projects::EnvironmentsController < Projects::ApplicationController
before_action :authorize_update_environment!, only: [:edit, :update]
before_action :authorize_admin_environment!, only: [:terminal, :terminal_websocket_authorize]
before_action :environment, only: [:show, :edit, :update, :stop, :terminal, :terminal_websocket_authorize, :metrics]
+ before_action :environments, only: [:index, :metrics]
before_action :verify_api_request!, only: :terminal_websocket_authorize
before_action :expire_etag_cache, only: [:index]
def index
- @environments = project.environments
- .with_state(params[:scope] || :available)
-
respond_to do |format|
format.html
format.json do
@@ -165,4 +163,8 @@ class Projects::EnvironmentsController < Projects::ApplicationController
def environment
@environment ||= project.environments.find(params[:id])
end
+
+ def environments
+ @environments ||= project.environments.with_state(params[:scope] || :available)
+ end
end
diff --git a/app/views/projects/environments/metrics.html.haml b/app/views/projects/environments/metrics.html.haml
index d6f0b230b58..cd822164316 100644
--- a/app/views/projects/environments/metrics.html.haml
+++ b/app/views/projects/environments/metrics.html.haml
@@ -8,6 +8,7 @@
%h3
Environment:
= link_to @environment.name, environment_path(@environment)
+ = @environments.to_a
#prometheus-graphs{ data: { "settings-path": edit_project_service_path(@project, 'prometheus'),
"clusters-path": project_clusters_path(@project),