diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:33:24 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:38:43 +0200 |
commit | db9c03bf4426346c631a6cd366a84626ead8d6e3 (patch) | |
tree | 720941b15333030c7654043c96ae81f8e322d3d2 | |
parent | 40528a1326208a04f95f18d6dcc7547cdb8ae0c3 (diff) | |
download | gitlab-ce-db9c03bf4426346c631a6cd366a84626ead8d6e3.tar.gz |
Add environment stop action [ci skip]
-rw-r--r-- | app/controllers/projects/environments_controller.rb | 6 | ||||
-rw-r--r-- | app/controllers/projects/merge_requests_controller.rb | 1 | ||||
-rw-r--r-- | app/models/ci/build.rb | 10 | ||||
-rw-r--r-- | config/routes/project.rb | 6 |
4 files changed, 11 insertions, 12 deletions
diff --git a/app/controllers/projects/environments_controller.rb b/app/controllers/projects/environments_controller.rb index 4fe8c3a1889..2ec316a1ebd 100644 --- a/app/controllers/projects/environments_controller.rb +++ b/app/controllers/projects/environments_controller.rb @@ -2,7 +2,7 @@ class Projects::EnvironmentsController < Projects::ApplicationController layout 'project' before_action :authorize_read_environment! before_action :authorize_create_environment!, only: [:new, :create] - before_action :authorize_update_environment!, only: [:edit, :update, :destroy] + before_action :authorize_update_environment!, only: [:edit, :update, :stop, :destroy] before_action :environment, only: [:show, :edit, :update, :destroy] def index @@ -44,6 +44,10 @@ class Projects::EnvironmentsController < Projects::ApplicationController end end + def stop + + end + def destroy if @environment.destroy flash[:notice] = 'Environment was successfully removed.' diff --git a/app/controllers/projects/merge_requests_controller.rb b/app/controllers/projects/merge_requests_controller.rb index 9207c954335..1c1938f957b 100644 --- a/app/controllers/projects/merge_requests_controller.rb +++ b/app/controllers/projects/merge_requests_controller.rb @@ -416,6 +416,7 @@ class Projects::MergeRequestsController < Projects::ApplicationController id: environment.id, name: environment.name, url: namespace_project_environment_path(project.namespace, project, environment), + stop_url: (stop_namespace_project_environment_path(project.namespace, project, environment) if environment.closeable?), external_url: environment.external_url, external_url_formatted: environment.formatted_external_url, deployed_at: deployment.try(:created_at), diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb index fd762b8c5ce..6f3e83976e7 100644 --- a/app/models/ci/build.rb +++ b/app/models/ci/build.rb @@ -125,16 +125,6 @@ module Ci end end - def play_type - return nil unless playable? - - if close_environment? - :close - else - :play - end - end - def retryable? project.builds_enabled? && commands.present? && complete? end diff --git a/config/routes/project.rb b/config/routes/project.rb index 2cd8c60794a..d73f76cd091 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -318,7 +318,11 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: end end - resources :environments + resources :environments do + member do + post :stop + end + end resource :cycle_analytics, only: [:show] |