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>2020-01-18 00:08:29 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2020-01-18 00:08:29 +0300
commit40254b9ace2a74a3c9f1cc51a1b1d5e3e78c1ae9 (patch)
tree9b735ef933178be36d35088f3acab2d9b75dbbad /app/finders
parent22a0d312ae82e7dda3073d5d1a5a766d7641738d (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/deployments_finder.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/finders/deployments_finder.rb b/app/finders/deployments_finder.rb
index b718b55dd68..0bb8ce6b4da 100644
--- a/app/finders/deployments_finder.rb
+++ b/app/finders/deployments_finder.rb
@@ -17,6 +17,8 @@ class DeploymentsFinder
def execute
items = init_collection
items = by_updated_at(items)
+ items = by_environment(items)
+ items = by_status(items)
sort(items)
end
@@ -58,6 +60,24 @@ class DeploymentsFinder
items
end
+ def by_environment(items)
+ if params[:environment].present?
+ items.for_environment_name(params[:environment])
+ else
+ items
+ end
+ end
+
+ def by_status(items)
+ return items unless params[:status].present?
+
+ unless Deployment.statuses.key?(params[:status])
+ raise ArgumentError, "The deployment status #{params[:status]} is invalid"
+ end
+
+ items.for_status(params[:status])
+ end
+
def sort_params
order_by = ALLOWED_SORT_VALUES.include?(params[:order_by]) ? params[:order_by] : DEFAULT_SORT_VALUE
order_direction = ALLOWED_SORT_DIRECTIONS.include?(params[:sort]) ? params[:sort] : DEFAULT_SORT_DIRECTION