Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2023-05-17 19:05:49 +0300
commit43a25d93ebdabea52f99b05e15b06250cd8f07d7 (patch)
treedceebdc68925362117480a5d672bcff122fb625b /app/serializers/environment_status_entity.rb
parent20c84b99005abd1c82101dfeff264ac50d2df211 (diff)
Add latest changes from gitlab-org/gitlab@16-0-stable-eev16.0.0-rc42
Diffstat (limited to 'app/serializers/environment_status_entity.rb')
-rw-r--r--app/serializers/environment_status_entity.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/serializers/environment_status_entity.rb b/app/serializers/environment_status_entity.rb
index e8cf7980f5e..9318e0c1de8 100644
--- a/app/serializers/environment_status_entity.rb
+++ b/app/serializers/environment_status_entity.rb
@@ -23,6 +23,10 @@ class EnvironmentStatusEntity < Grape::Entity
stop_project_environment_path(es.project, es.environment)
end
+ expose :retry_url, if: ->(*) { can_rollback_environment? } do |es|
+ retry_project_job_path(es.project, es.deployment.deployable)
+ end
+
expose :external_url do |es|
es.environment.external_url
end
@@ -41,6 +45,10 @@ class EnvironmentStatusEntity < Grape::Entity
DeploymentEntity.represent(es.deployment, options.merge(project: es.project, only: [:playable_build]))
end
+ expose :environment_available do |es|
+ es.environment.available?
+ end
+
expose :changes
private
@@ -68,4 +76,8 @@ class EnvironmentStatusEntity < Grape::Entity
def can_stop_environment?
can?(current_user, :stop_environment, environment)
end
+
+ def can_rollback_environment?
+ object.deployable && can?(current_user, :play_job, object.deployable)
+ end
end