Class: ClusterablePresenter

Inherits:
Gitlab::View::Presenter::Delegated show all
Defined in:
app/presenters/clusterable_presenter.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gitlab::View::Presenter::Delegated

#initialize

Methods included from Gitlab::Utils::DelegatorOverride

#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!

Methods included from Gitlab::View::Presenter::Base

#__subject__, #can?, #declarative_policy_delegate, #is_a?, #present, #url_builder, #web_path, #web_url

Methods included from Gitlab::Allowable

#can?

Methods included from Gitlab::Routing

add_helpers, includes_helpers, redirect_legacy_paths, url_helpers

Constructor Details

This class inherits a constructor from Gitlab::View::Presenter::Delegated

Class Method Details

.fabricate(clusterable, **attributes) ⇒ Object


6
7
8
9
10
11
12
13
# File 'app/presenters/clusterable_presenter.rb', line 6

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

Instance Method Details

#can_add_cluster?Boolean

Returns:

  • (Boolean)

15
16
17
# File 'app/presenters/clusterable_presenter.rb', line 15

def can_add_cluster?
  can?(current_user, :add_cluster, clusterable)
end

#can_admin_cluster?Boolean

Returns:

  • (Boolean)

19
20
21
# File 'app/presenters/clusterable_presenter.rb', line 19

def can_admin_cluster?
  can?(current_user, :admin_cluster, clusterable)
end

#can_create_cluster?Boolean

Returns:

  • (Boolean)

23
24
25
# File 'app/presenters/clusterable_presenter.rb', line 23

def can_create_cluster?
  can?(current_user, :create_cluster, clusterable)
end

#clear_cluster_cache_path(cluster) ⇒ Object

Raises:

  • (NotImplementedError)

47
48
49
# File 'app/presenters/clusterable_presenter.rb', line 47

def clear_cluster_cache_path(cluster)
  raise NotImplementedError
end

#cluster_path(cluster, params = {}) ⇒ Object

Raises:

  • (NotImplementedError)

51
52
53
# File 'app/presenters/clusterable_presenter.rb', line 51

def cluster_path(cluster, params = {})
  raise NotImplementedError
end

#cluster_status_cluster_path(cluster, params = {}) ⇒ Object

Raises:

  • (NotImplementedError)

43
44
45
# File 'app/presenters/clusterable_presenter.rb', line 43

def cluster_status_cluster_path(cluster, params = {})
  raise NotImplementedError
end

#connect_pathObject


31
32
33
# File 'app/presenters/clusterable_presenter.rb', line 31

def connect_path
  polymorphic_path([clusterable, :clusters], action: :connect)
end

#create_user_clusters_pathObject


39
40
41
# File 'app/presenters/clusterable_presenter.rb', line 39

def create_user_clusters_path
  polymorphic_path([clusterable, :clusters], action: :create_user)
end

#empty_state_help_textObject


64
65
66
# File 'app/presenters/clusterable_presenter.rb', line 64

def empty_state_help_text
  nil
end

#environments_cluster_path(cluster) ⇒ Object

Will be overridden in EE


60
61
62
# File 'app/presenters/clusterable_presenter.rb', line 60

def environments_cluster_path(cluster)
  nil
end

#index_path(options = {}) ⇒ Object


27
28
29
# File 'app/presenters/clusterable_presenter.rb', line 27

def index_path(options = {})
  polymorphic_path([clusterable, :clusters], options)
end

Raises:

  • (NotImplementedError)

72
73
74
# File 'app/presenters/clusterable_presenter.rb', line 72

def learn_more_link
  raise NotImplementedError
end

#metrics_dashboard_path(cluster) ⇒ Object

Raises:

  • (NotImplementedError)

55
56
57
# File 'app/presenters/clusterable_presenter.rb', line 55

def metrics_dashboard_path(cluster)
  raise NotImplementedError
end

#new_cluster_docs_pathObject


35
36
37
# File 'app/presenters/clusterable_presenter.rb', line 35

def new_cluster_docs_path
  polymorphic_path([clusterable, :clusters], action: :new_cluster_docs)
end

Raises:

  • (NotImplementedError)

68
69
70
# File 'app/presenters/clusterable_presenter.rb', line 68

def sidebar_text
  raise NotImplementedError
end