2018-07-24 06:00:56 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-23 04:36:35 -04:00
|
|
|
module Clusters
|
2017-10-05 13:45:15 -04:00
|
|
|
class ClusterPresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
presents :cluster
|
|
|
|
|
|
|
|
def gke_cluster_url
|
2017-10-23 04:36:35 -04:00
|
|
|
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}" if gcp?
|
2017-10-05 13:45:15 -04:00
|
|
|
end
|
2017-12-05 11:09:04 -05:00
|
|
|
|
|
|
|
def can_toggle_cluster?
|
|
|
|
can?(current_user, :update_cluster, cluster) && created?
|
|
|
|
end
|
2018-10-30 06:33:43 -04:00
|
|
|
|
|
|
|
def show_path
|
|
|
|
if cluster.project_type?
|
|
|
|
project_cluster_path(project, cluster)
|
|
|
|
else
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
end
|
2017-10-05 13:45:15 -04:00
|
|
|
end
|
|
|
|
end
|