2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
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
|
2018-12-13 13:39:08 +05:30
|
|
|
|
|
|
|
def show_path
|
|
|
|
if cluster.project_type?
|
|
|
|
project_cluster_path(project, cluster)
|
2018-12-23 12:14:25 +05:30
|
|
|
elsif cluster.group_type?
|
|
|
|
group_cluster_path(group, cluster)
|
2018-12-13 13:39:08 +05:30
|
|
|
else
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
2018-03-17 18:26:18 +05:30
|
|
|
end
|
|
|
|
end
|