2018-10-30 10:33:43 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ClusterablePresenter < Gitlab::View::Presenter::Delegated
|
|
|
|
presents :clusterable
|
|
|
|
|
|
|
|
def self.fabricate(clusterable, **attributes)
|
|
|
|
presenter_class = "#{clusterable.class.name}ClusterablePresenter".constantize
|
|
|
|
attributes_with_presenter_class = attributes.merge(presenter_class: presenter_class)
|
|
|
|
|
|
|
|
Gitlab::View::Presenter::Factory
|
|
|
|
.new(clusterable, attributes_with_presenter_class)
|
|
|
|
.fabricate!
|
|
|
|
end
|
|
|
|
|
2018-12-04 21:38:15 +00:00
|
|
|
def can_add_cluster?
|
|
|
|
can?(current_user, :add_cluster, clusterable)
|
|
|
|
end
|
|
|
|
|
2018-10-30 10:33:43 +00:00
|
|
|
def can_create_cluster?
|
|
|
|
can?(current_user, :create_cluster, clusterable)
|
|
|
|
end
|
|
|
|
|
|
|
|
def index_path
|
2018-11-01 21:41:53 +00:00
|
|
|
polymorphic_path([clusterable, :clusters])
|
2018-10-30 10:33:43 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def new_path
|
2018-11-01 21:41:53 +00:00
|
|
|
new_polymorphic_path([clusterable, :cluster])
|
2018-10-30 10:33:43 +00:00
|
|
|
end
|
2018-11-01 20:48:38 +00:00
|
|
|
|
|
|
|
def create_user_clusters_path
|
2018-11-01 21:41:53 +00:00
|
|
|
polymorphic_path([clusterable, :clusters], action: :create_user)
|
2018-11-01 20:48:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def create_gcp_clusters_path
|
2018-11-01 21:41:53 +00:00
|
|
|
polymorphic_path([clusterable, :clusters], action: :create_gcp)
|
2018-11-01 20:48:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def cluster_status_cluster_path(cluster, params = {})
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def install_applications_cluster_path(cluster, application)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2019-03-04 10:08:53 +00:00
|
|
|
def update_applications_cluster_path(cluster, application)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2018-11-01 20:48:38 +00:00
|
|
|
def cluster_path(cluster, params = {})
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2018-11-06 20:26:30 +00:00
|
|
|
|
2018-11-07 01:06:33 +00:00
|
|
|
def empty_state_help_text
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2018-11-07 08:07:28 +00:00
|
|
|
def sidebar_text
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2018-11-07 01:06:33 +00:00
|
|
|
def learn_more_link
|
2018-11-06 20:26:30 +00:00
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2018-10-30 10:33:43 +00:00
|
|
|
end
|