Class: Clusters::ClusterPresenter
Instance Method Summary
collapse
#initialize
#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!
#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url
#can?, #can_all?, #can_any?
includes_helpers, redirect_legacy_paths, url_helpers
Instance Method Details
#agent_migration_for_display ⇒ Object
47
48
49
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 47
def agent_migration_for_display
cluster.agent_migration || Clusters::AgentMigration.new(cluster: cluster)
end
|
#can_read_cluster? ⇒ Boolean
27
28
29
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 27
def can_read_cluster?
can?(current_user, :read_cluster, cluster)
end
|
#provider_label ⇒ Object
11
12
13
14
15
16
17
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 11
def provider_label
if aws?
s_('ClusterIntegration|Elastic Kubernetes Service')
elsif gcp?
s_('ClusterIntegration|Google Kubernetes Engine')
end
end
|
#provider_management_url ⇒ Object
19
20
21
22
23
24
25
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 19
def provider_management_url
if aws?
"https://console.aws.amazon.com/eks/home?region=#{provider.region}\#/clusters/#{name}"
elsif gcp?
"https://console.cloud.google.com/kubernetes/clusters/details/#{provider.zone}/#{name}"
end
end
|
43
44
45
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 43
def read_only_kubernetes_platform_fields?
!cluster.provided_by_user?
end
|
#show_path(params: {}) ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
|
# File 'app/presenters/clusters/cluster_presenter.rb', line 31
def show_path(params: {})
if cluster.project_type?
project_cluster_path(project, cluster, params)
elsif cluster.group_type?
group_cluster_path(group, cluster, params)
elsif cluster.instance_type?
admin_cluster_path(cluster, params)
else
raise NotImplementedError
end
end
|