This instance will be upgraded to Heptapod 0.31.0 (final) on 2022-05-24 at 14:00 UTC+2 (a few minutes of down time)

Commit db9c03bf authored by Kamil Trzcinski's avatar Kamil Trzcinski
Browse files

Add environment stop action [ci skip]

parent 54721506ef89
......@@ -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 @@ def update
end
end
def stop
end
def destroy
if @environment.destroy
flash[:notice] = 'Environment was successfully removed.'
......
......@@ -416,6 +416,7 @@ def ci_environments_status
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),
......
......@@ -125,16 +125,6 @@ def play(current_user = nil)
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
......
......@@ -318,7 +318,11 @@
end
end
resources :environments
resources :environments do
member do
post :stop
end
end
resource :cycle_analytics, only: [:show]
......
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