summaryrefslogtreecommitdiff
path: root/app/finders
diff options
context:
space:
mode:
authorThong Kuah <tkuah@gitlab.com>2018-11-07 01:13:33 +1300
committerThong Kuah <tkuah@gitlab.com>2018-12-17 09:50:52 +1300
commit7e4f76ea8978bfff42124013cd38ed5ad38873b5 (patch)
treefdcb69f5bf201507befe953085067bc47a27c839 /app/finders
parent8b4602041cf2c4a8738a4796d78720017249249f (diff)
downloadgitlab-ce-7e4f76ea8978bfff42124013cd38ed5ad38873b5.tar.gz
Show clusters of ancestors in cluster list page
Show both the cluster(s) of the clusterable, and the cluster(s) of ancestor groups.
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/cluster_ancestors_finder.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/app/finders/cluster_ancestors_finder.rb b/app/finders/cluster_ancestors_finder.rb
new file mode 100644
index 00000000000..9f85e6e5c31
--- /dev/null
+++ b/app/finders/cluster_ancestors_finder.rb
@@ -0,0 +1,20 @@
+# frozen_string_literal: true
+
+class ClusterAncestorsFinder
+ def initialize(clusterable, user)
+ @clusterable = clusterable
+ @user = user
+ end
+
+ def execute
+ clusterable.clusters + ancestor_clusters
+ end
+
+ private
+
+ attr_reader :clusterable, :user
+
+ def ancestor_clusters
+ Clusters::Cluster.ancestor_clusters_for_clusterable(clusterable)
+ end
+end