diff options
Diffstat (limited to 'app/presenters/clusters/cluster_presenter.rb')
-rw-r--r-- | app/presenters/clusters/cluster_presenter.rb | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/app/presenters/clusters/cluster_presenter.rb b/app/presenters/clusters/cluster_presenter.rb index eb4bd8532af..ce060476cfd 100644 --- a/app/presenters/clusters/cluster_presenter.rb +++ b/app/presenters/clusters/cluster_presenter.rb @@ -3,21 +3,10 @@ module Clusters class ClusterPresenter < Gitlab::View::Presenter::Delegated include ::Gitlab::Utils::StrongMemoize - include ActionView::Helpers::SanitizeHelper - include ActionView::Helpers::UrlHelper - include IconsHelper - presents :cluster + delegator_override_with ::Gitlab::Utils::StrongMemoize # TODO: Remove `::Gitlab::Utils::StrongMemoize` inclusion as it's duplicate - # We do not want to show the group path for clusters belonging to the - # clusterable, only for the ancestor clusters. - def item_link(clusterable_presenter, *html_options) - if cluster.group_type? && clusterable != clusterable_presenter.subject - contracted_group_name(cluster.group) + ' / ' + link_to_cluster - else - link_to_cluster(*html_options) - end - end + presents ::Clusters::Cluster, as: :cluster def provider_label if aws? @@ -39,16 +28,6 @@ module Clusters can?(current_user, :read_cluster, cluster) end - def cluster_type_description - if cluster.project_type? - s_("ClusterIntegration|Project cluster") - elsif cluster.group_type? - s_("ClusterIntegration|Group cluster") - elsif cluster.instance_type? - s_("ClusterIntegration|Instance cluster") - end - end - def show_path(params: {}) if cluster.project_type? project_cluster_path(project, cluster, params) @@ -107,7 +86,7 @@ module Clusters private def image_path(path) - ActionController::Base.helpers.image_path(path) + ApplicationController.helpers.image_path(path) end # currently log explorer is only available in the scope of the project @@ -127,20 +106,6 @@ module Clusters cluster.project end end - - def contracted_group_name(group) - sanitize(group.full_name) - .sub(%r{\/.*\/}, "/ #{contracted_icon} /") - .html_safe - end - - def contracted_icon - sprite_icon('ellipsis_h', size: 12, css_class: 'vertical-align-middle') - end - - def link_to_cluster(html_options: {}) - link_to_if(can_read_cluster?, cluster.name, show_path, html_options) - end end end |