Add switch statement & last_deployment method
This commit is contained in:
parent
52c06647b5
commit
73467bd163
3 changed files with 31 additions and 3 deletions
|
@ -46,6 +46,12 @@
|
|||
border: 1px solid $border-color;
|
||||
padding: 12px $gl-padding;
|
||||
border-radius: $border-radius-default;
|
||||
|
||||
svg {
|
||||
position: relative;
|
||||
top: 1px;
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,12 @@ module Ci
|
|||
!self.pipeline.statuses.latest.include?(self)
|
||||
end
|
||||
|
||||
def last_deployment
|
||||
return @last_deployment if defined?(@last_deployment)
|
||||
|
||||
@last_deployment = Deployment.where(deployable: self).order(id: :desc).last
|
||||
end
|
||||
|
||||
def depends_on_builds
|
||||
# Get builds of the same type
|
||||
latest_builds = self.pipeline.builds.latest
|
||||
|
|
|
@ -26,12 +26,28 @@
|
|||
= link_to namespace_project_runners_path(@build.project.namespace, @build.project) do
|
||||
Runners page
|
||||
|
||||
- if @build.stage == 'deploy'
|
||||
- if @build.deploy
|
||||
.prepend-top-default
|
||||
.environment-information
|
||||
= ci_icon_for_status(@build.status)
|
||||
This build is the most recent deployment to
|
||||
= link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
|
||||
|
||||
- if @build.last_deployment
|
||||
This build is the most recent deployment to
|
||||
= link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
|
||||
- else
|
||||
- case @build.status
|
||||
- when 'failed', 'canceled'
|
||||
The deployment of this build to
|
||||
= link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
|
||||
did not complete
|
||||
- when 'pending', 'running'
|
||||
This build is creating a deployment to
|
||||
= link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
|
||||
and will overwrite the latest deployment
|
||||
- when 'success'
|
||||
This build is an out-of-date deployment to
|
||||
= link_to @build.environment, namespace_project_environment_path(@project.namespace, @project, @build.environment)
|
||||
View the most recent deployment #24869
|
||||
|
||||
.prepend-top-default
|
||||
- if @build.erased?
|
||||
|
|
Loading…
Reference in a new issue