diff options
author | Thong Kuah <tkuah@gitlab.com> | 2018-12-11 18:13:29 +1300 |
---|---|---|
committer | Thong Kuah <tkuah@gitlab.com> | 2018-12-17 09:51:53 +1300 |
commit | f82c9dbe44d5d003dbeb084f07615ba26c2294b6 (patch) | |
tree | 4b4a803a08c29b969797937af47a30ac0ef0b1a8 /app/controllers | |
parent | 2ad5f999e95ed0627e2c8aea9da670b7da559bab (diff) | |
download | gitlab-ce-f82c9dbe44d5d003dbeb084f07615ba26c2294b6.tar.gz |
Use finder to decide to show note to user
Given the note is about how to interpret ancestor clusters, use the
finder which actually knows if there are any ancestor clusters to find
out if the note should be shown, rather than passing the same info via a
view to a helper
Added note about Kaminari.paginate_array
Link to followup issue too
Diffstat (limited to 'app/controllers')
-rw-r--r-- | app/controllers/clusters/clusters_controller.rb | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/app/controllers/clusters/clusters_controller.rb b/app/controllers/clusters/clusters_controller.rb index 7a4ed840e3a..b9717b97640 100644 --- a/app/controllers/clusters/clusters_controller.rb +++ b/app/controllers/clusters/clusters_controller.rb @@ -18,8 +18,20 @@ class Clusters::ClustersController < Clusters::BaseController STATUS_POLLING_INTERVAL = 10_000 def index - clusters = ClusterAncestorsFinder.new(clusterable.subject, current_user).execute + finder = ClusterAncestorsFinder.new(clusterable.subject, current_user) + clusters = finder.execute + + # Note: We are paginating through an array here but this should OK as: + # + # In CE, we can have a maximum group nesting depth of 21, so including + # project cluster, we can have max 22 clusters for a group hierachy. + # In EE (Premium) we can have any number, as multiple clusters are + # supported, but the number of clusters are fairly low currently. + # + # See https://gitlab.com/gitlab-org/gitlab-ce/issues/55260 also. @clusters = Kaminari.paginate_array(clusters).page(params[:page]).per(20) + + @has_ancestor_clusters = finder.has_ancestor_clusters? end def new |