2018-10-30 06:33:43 -04: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 16:38:15 -05:00
|
|
|
def can_add_cluster?
|
|
|
|
can?(current_user, :add_cluster, clusterable)
|
|
|
|
end
|
|
|
|
|
2018-10-30 06:33:43 -04:00
|
|
|
def can_create_cluster?
|
|
|
|
can?(current_user, :create_cluster, clusterable)
|
|
|
|
end
|
|
|
|
|
|
|
|
def index_path
|
2018-11-01 17:41:53 -04:00
|
|
|
polymorphic_path([clusterable, :clusters])
|
2018-10-30 06:33:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def new_path
|
2018-11-01 17:41:53 -04:00
|
|
|
new_polymorphic_path([clusterable, :cluster])
|
2018-10-30 06:33:43 -04:00
|
|
|
end
|
2018-11-01 16:48:38 -04:00
|
|
|
|
|
|
|
def create_user_clusters_path
|
2018-11-01 17:41:53 -04:00
|
|
|
polymorphic_path([clusterable, :clusters], action: :create_user)
|
2018-11-01 16:48:38 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def create_gcp_clusters_path
|
2018-11-01 17:41:53 -04:00
|
|
|
polymorphic_path([clusterable, :clusters], action: :create_gcp)
|
2018-11-01 16:48:38 -04: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 05:08:53 -05:00
|
|
|
def update_applications_cluster_path(cluster, application)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2018-11-01 16:48:38 -04:00
|
|
|
def cluster_path(cluster, params = {})
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2018-11-06 15:26:30 -05:00
|
|
|
|
2019-05-06 12:24:14 -04:00
|
|
|
def clusters_path(params = {})
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2018-11-06 20:06:33 -05:00
|
|
|
def empty_state_help_text
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2018-11-07 03:07:28 -05:00
|
|
|
def sidebar_text
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2018-11-06 20:06:33 -05:00
|
|
|
def learn_more_link
|
2018-11-06 15:26:30 -05:00
|
|
|
raise NotImplementedError
|
|
|
|
end
|
2018-10-30 06:33:43 -04:00
|
|
|
end
|