summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/presenters/clusterable_presenter.rb6
-rw-r--r--app/presenters/group_clusterable_presenter.rb16
-rw-r--r--app/presenters/project_clusterable_presenter.rb11
-rw-r--r--app/views/clusters/clusters/_empty_state.html.haml7
-rw-r--r--app/views/clusters/clusters/_sidebar.html.haml13
-rw-r--r--app/views/groups/clusters/_sidebar.html.haml5
-rw-r--r--app/views/projects/clusters/_sidebar.html.haml9
7 files changed, 44 insertions, 23 deletions
diff --git a/app/presenters/clusterable_presenter.rb b/app/presenters/clusterable_presenter.rb
index 6de967a58e9..08ff49a8702 100644
--- a/app/presenters/clusterable_presenter.rb
+++ b/app/presenters/clusterable_presenter.rb
@@ -44,7 +44,11 @@ class ClusterablePresenter < Gitlab::View::Presenter::Delegated
raise NotImplementedError
end
- def project?
+ def empty_state_help_text
+ nil
+ end
+
+ def learn_more_link
raise NotImplementedError
end
end
diff --git a/app/presenters/group_clusterable_presenter.rb b/app/presenters/group_clusterable_presenter.rb
index 6da4dbfeaa4..427f3ec047c 100644
--- a/app/presenters/group_clusterable_presenter.rb
+++ b/app/presenters/group_clusterable_presenter.rb
@@ -1,19 +1,31 @@
# frozen_string_literal: true
class GroupClusterablePresenter < ClusterablePresenter
+ extend ::Gitlab::Utils::Override
+ include ActionView::Helpers::UrlHelper
+
+ override :cluster_status_cluster_path
def cluster_status_cluster_path(cluster, params = {})
cluster_status_group_cluster_path(clusterable, cluster, params)
end
+ override :install_applications_cluster_path
def install_applications_cluster_path(cluster, application)
install_applications_group_cluster_path(clusterable, cluster, application)
end
+ override :cluster_path
def cluster_path(cluster, params = {})
group_cluster_path(clusterable, cluster, params)
end
- def project?
- false
+ override :empty_state_help_text
+ def empty_state_help_text
+ s_('ClusterIntegration|Adding an integration to your group will share the cluster across all your projects.')
+ end
+
+ override :learn_more_link
+ def learn_more_link
+ link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
end
diff --git a/app/presenters/project_clusterable_presenter.rb b/app/presenters/project_clusterable_presenter.rb
index 2aea31e8bbf..ede8547d210 100644
--- a/app/presenters/project_clusterable_presenter.rb
+++ b/app/presenters/project_clusterable_presenter.rb
@@ -1,19 +1,26 @@
# frozen_string_literal: true
class ProjectClusterablePresenter < ClusterablePresenter
+ extend ::Gitlab::Utils::Override
+ include ActionView::Helpers::UrlHelper
+
+ override :cluster_status_cluster_path
def cluster_status_cluster_path(cluster, params = {})
cluster_status_project_cluster_path(clusterable, cluster, params)
end
+ override :install_applications_cluster_path
def install_applications_cluster_path(cluster, application)
install_applications_project_cluster_path(clusterable, cluster, application)
end
+ override :cluster_path
def cluster_path(cluster, params = {})
project_cluster_path(clusterable, cluster, params)
end
- def project?
- true
+ override :learn_more_link
+ def learn_more_link
+ link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
end
end
diff --git a/app/views/clusters/clusters/_empty_state.html.haml b/app/views/clusters/clusters/_empty_state.html.haml
index 1cbff0a0e23..c926ec258f0 100644
--- a/app/views/clusters/clusters/_empty_state.html.haml
+++ b/app/views/clusters/clusters/_empty_state.html.haml
@@ -6,11 +6,8 @@
%h4.text-center= s_('ClusterIntegration|Integrate Kubernetes cluster automation')
%p
= s_('ClusterIntegration|Kubernetes clusters allow you to use review apps, deploy your applications, run your pipelines, and much more in an easy way.')
- - if clusterable.project?
- = link_to(s_('ClusterIntegration|Learn more about Kubernetes'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
- - else
- = s_('ClusterIntegration|Adding an integration to your group will share the cluster across all your projects.')
- = link_to(s_('ClusterIntegration|Learn more about group Kubernetes clusters'), help_page_path('user/project/clusters/index'), target: '_blank', rel: 'noopener noreferrer')
+ = clusterable.empty_state_help_text
+ = clusterable.learn_more_link
- if clusterable.can_create_cluster?
.text-center
diff --git a/app/views/clusters/clusters/_sidebar.html.haml b/app/views/clusters/clusters/_sidebar.html.haml
deleted file mode 100644
index 66cda3ee83b..00000000000
--- a/app/views/clusters/clusters/_sidebar.html.haml
+++ /dev/null
@@ -1,13 +0,0 @@
-- clusters_help_url = help_page_path('user/project/clusters/index.md')
-- help_link_start = "<a href=\"%{url}\" target=\"_blank\" rel=\"noopener noreferrer\">".html_safe
-- help_link_end = '</a>'.html_safe
-%h4.prepend-top-0
- = s_('ClusterIntegration|Add a Kubernetes cluster integration')
-- if clusterable.project?
- %p
- = s_('ClusterIntegration|With a Kubernetes cluster associated to this project, you can use review apps, deploy your applications, run your pipelines, and much more in an easy way.')
- %p
- = s_('ClusterIntegration|Learn more about %{help_link_start}Kubernetes%{help_link_end}.').html_safe % { help_link_start: help_link_start % { url: clusters_help_url }, help_link_end: help_link_end }
-- else
- %p
- = s_('ClusterIntegration|Adding a Kubernetes cluster to your group will automatically share the cluster across all your projects. Use review apps, deploy your applications, and easily run your pipelines for all projects using the same cluster.')
diff --git a/app/views/groups/clusters/_sidebar.html.haml b/app/views/groups/clusters/_sidebar.html.haml
new file mode 100644
index 00000000000..39b70de72df
--- /dev/null
+++ b/app/views/groups/clusters/_sidebar.html.haml
@@ -0,0 +1,5 @@
+%h4.prepend-top-0
+ = s_('ClusterIntegration|Add a Kubernetes cluster integration')
+%p
+ = s_('ClusterIntegration|Adding a Kubernetes cluster to your group will automatically share the cluster across all your projects.')
+ = s_('ClusterIntegration|Use review apps, deploy your applications, and easily run your pipelines for all projects using the same cluster.')
diff --git a/app/views/projects/clusters/_sidebar.html.haml b/app/views/projects/clusters/_sidebar.html.haml
new file mode 100644
index 00000000000..b44c1df51fd
--- /dev/null
+++ b/app/views/projects/clusters/_sidebar.html.haml
@@ -0,0 +1,9 @@
+- clusters_help_url = help_page_path('user/project/clusters/index.md')
+- help_link_start = "<a href=\"%{url}\" target=\"_blank\" rel=\"noopener noreferrer\">".html_safe
+- help_link_end = '</a>'.html_safe
+%h4.prepend-top-0
+ = s_('ClusterIntegration|Add a Kubernetes cluster integration')
+%p
+ = s_('ClusterIntegration|With a Kubernetes cluster associated to this project, you can use review apps, deploy your applications, run your pipelines, and much more in an easy way.')
+%p
+ = s_('ClusterIntegration|Learn more about %{help_link_start}Kubernetes%{help_link_end}.').html_safe % { help_link_start: help_link_start % { url: clusters_help_url }, help_link_end: help_link_end }