summaryrefslogtreecommitdiff
path: root/app/controllers/projects/environments_controller.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-04-29 15:14:38 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-06-10 22:38:40 +0200
commitcf7da039bedcad5163ce9deedccc94206d4c485a (patch)
treefe865b6b7f017a964f01f2909fbf1842bc6e3992 /app/controllers/projects/environments_controller.rb
parentff345f8ba11658c679b423e06bbc42b90af158eb (diff)
downloadgitlab-ce-cf7da039bedcad5163ce9deedccc94206d4c485a.tar.gz
commit status
Diffstat (limited to 'app/controllers/projects/environments_controller.rb')
-rw-r--r--app/controllers/projects/environments_controller.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb
new file mode 100644
index 00000000000..f5af24ed217
--- /dev/null
+++ b/app/controllers/projects/environments_controller.rb
@@ -0,0 +1,17 @@
+class Projects::EnvironmentsController < Projects::ApplicationController
+ layout 'project'
+
+ def index
+ @environments = project.builds.where.not(environment: nil).pluck(:environment).uniq
+ @environments = @environments.map { |env| build_for_env(env) }.compact
+ end
+
+ def show
+ @environment = params[:id].to_s
+ @builds = project.builds.where.not(status: ["manual"]).where(environment: params[:id].to_s).order(id: :desc).page(params[:page]).per(30)
+ end
+
+ def build_for_env(environment)
+ project.builds.success.order(id: :desc).find_by(environment: environment)
+ end
+end