Class: ClusterablePresenter

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

Instance Attribute Summary

Attributes included from Gitlab::View::Presenter::Base

#subject

Class Method Summary collapse

Instance Method Summary collapse

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

#initialize

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

#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

#authorize_aws_role_pathObject


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

def authorize_aws_role_path
  polymorphic_path([clusterable, :clusters], action: :authorize_aws_role)
end

#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_create_cluster?Boolean

Returns:

  • (Boolean)

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

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

#clear_cluster_cache_path(cluster) ⇒ Object

Raises:

  • (NotImplementedError)

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

def clear_cluster_cache_path(cluster)
  raise NotImplementedError
end

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

Raises:

  • (NotImplementedError)

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

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

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

Raises:

  • (NotImplementedError)

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

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

#create_aws_clusters_pathObject


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

def create_aws_clusters_path
  polymorphic_path([clusterable, :clusters], action: :create_aws)
end

#create_gcp_clusters_pathObject


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

def create_gcp_clusters_path
  polymorphic_path([clusterable, :clusters], action: :create_gcp)
end

#create_user_clusters_pathObject


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

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

#empty_state_help_textObject


76
77
78
# File 'app/presenters/clusterable_presenter.rb', line 76

def empty_state_help_text
  nil
end

#environments_cluster_path(cluster) ⇒ Object

Will be overridden in EE


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

def environments_cluster_path(cluster)
  nil
end

#index_path(options = {}) ⇒ Object


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

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

#install_applications_cluster_path(cluster, application) ⇒ Object

Raises:

  • (NotImplementedError)

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

def install_applications_cluster_path(cluster, application)
  raise NotImplementedError
end

Raises:

  • (NotImplementedError)

84
85
86
# File 'app/presenters/clusterable_presenter.rb', line 84

def learn_more_link
  raise NotImplementedError
end

#metrics_dashboard_path(cluster) ⇒ Object

Raises:

  • (NotImplementedError)

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

def metrics_dashboard_path(cluster)
  raise NotImplementedError
end

#new_path(options = {}) ⇒ Object


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

def new_path(options = {})
  new_polymorphic_path([clusterable, :cluster], options)
end

Raises:

  • (NotImplementedError)

80
81
82
# File 'app/presenters/clusterable_presenter.rb', line 80

def sidebar_text
  raise NotImplementedError
end

#update_applications_cluster_path(cluster, application) ⇒ Object

Raises:

  • (NotImplementedError)

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

def update_applications_cluster_path(cluster, application)
  raise NotImplementedError
end