gitlab-org--gitlab-foss/app/presenters/clusters/cluster_presenter.rb
Thong Kuah 1163b23539 Move view and path concerns to presenters
- Move show path for cluster to ClusterPresenter

- Create ClusterablePresenter to encapsulate logic. Consolidates
scattered methods from BaseController and ClustersHelper into an object.
2018-11-01 19:37:32 +13:00

23 lines
536 B
Ruby

# frozen_string_literal: true
module Clusters
class ClusterPresenter < Gitlab::View::Presenter::Delegated
presents :cluster
def gke_cluster_url
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}" if gcp?
end
def can_toggle_cluster?
can?(current_user, :update_cluster, cluster) && created?
end
def show_path
if cluster.project_type?
project_cluster_path(project, cluster)
else
raise NotImplementedError
end
end
end
end